[cpl-plugin-hawki] 04/39: Upstream version 1.8.9
Ole Streicher
olebole-guest at alioth.debian.org
Mon Sep 16 19:36:06 UTC 2013
This is an automated email from the git hooks/post-receive script.
olebole-guest pushed a commit to branch debian
in repository cpl-plugin-hawki.
commit c6e532f17e5767443bff9f6d470758f070e45d48
Author: Ole Streicher <debian at liska.ath.cx>
Date: Mon Jan 7 11:05:17 2013 +0100
Upstream version 1.8.9
---
AUTHORS | 5 +
COPYING | 340 +
COPYING.LIB | 515 +
ChangeLog | 6783 ++++++++
INSTALL | 229 +
Makefile.am | 70 +
Makefile.in | 925 ++
Makefile.purify.in | 109 +
acinclude.m4 | 166 +
aclocal.m4 | 1235 ++
admin/compile | 143 +
admin/config.guess | 1501 ++
admin/config.sub | 1705 ++
admin/depcomp | 630 +
admin/html.am | 74 +
admin/install-sh | 520 +
admin/ltmain.sh | 9636 ++++++++++++
admin/missing | 376 +
calib/cal/HI_GSSC_081103A_stdstars_cat.fits | Bin 0 -> 17280 bytes
calib/cal/distmap.fits | Bin 0 -> 25920 bytes
calib/cal/distmap_x.fits | Bin 0 -> 25920 bytes
calib/cal/distmap_y.fits | Bin 0 -> 25920 bytes
calib/cal/master_2mass_tbl.fits | Bin 0 -> 17280 bytes
calib/dic/ESO-DFS-DIC.HAWKI_QC | 948 ++
calib/dic/ESO-VLT-DIC.HAWKI_CFG | 929 ++
calib/dic/ESO-VLT-DIC.HAWKI_ICS | 1057 ++
calib/dic/ESO-VLT-DIC.HAWKI_OS | 409 +
calib/gasgano/config/HAWKI.prefs | 53 +
calib/gasgano/config/HAWKI.prefs.in | 53 +
calib/gasgano/config/hawki.oca | 375 +
calib/gasgano/config/hawki_wkf.oca | 264 +
catalogs/dist_map_chip1.txt | 82 +
catalogs/dist_map_chip2.txt | 82 +
catalogs/dist_map_chip3.txt | 82 +
catalogs/dist_map_chip4.txt | 82 +
catalogs/stdstars/HAWKI_Persson_2008-10-30.txt | 33 +
catalogs/stdstars/HAWKI_UKIRT_2008-10-30.txt | 75 +
config.h.in | 140 +
configure |16224 ++++++++++++++++++++
configure.ac | 103 +
doxygen/Doxyfile.in | 1219 ++
hawki/Makefile.am | 83 +
hawki/Makefile.in | 670 +
hawki/hawki_alloc.c | 86 +
hawki/hawki_alloc.h | 40 +
hawki/hawki_bkg.c | 371 +
hawki/hawki_bkg.h | 55 +
hawki/hawki_calib.c | 492 +
hawki/hawki_calib.h | 69 +
hawki/hawki_combine.c | 55 +
hawki/hawki_combine.h | 35 +
hawki/hawki_dfs.c | 113 +
hawki/hawki_dfs.h | 507 +
hawki/hawki_distortion.c | 1228 ++
hawki/hawki_distortion.h | 127 +
hawki/hawki_image_stats.c | 636 +
hawki/hawki_image_stats.h | 67 +
hawki/hawki_load.c | 916 ++
hawki/hawki_load.h | 57 +
hawki/hawki_mask.c | 133 +
hawki/hawki_mask.h | 43 +
hawki/hawki_match_cats.c | 107 +
hawki/hawki_match_cats.h | 43 +
hawki/hawki_obj_det.c | 122 +
hawki/hawki_obj_det.h | 40 +
hawki/hawki_pfits.c | 723 +
hawki/hawki_pfits.h | 95 +
hawki/hawki_properties_tel.c | 836 +
hawki/hawki_properties_tel.h | 48 +
hawki/hawki_saa.c | 127 +
hawki/hawki_saa.h | 52 +
hawki/hawki_save.c | 702 +
hawki/hawki_save.h | 101 +
hawki/hawki_utils.c | 1268 ++
hawki/hawki_utils.h | 149 +
hawki/hawki_variance.c | 183 +
hawki/hawki_variance.h | 55 +
html/annotated.html | 52 +
html/bc_s.png | Bin 0 -> 677 bytes
html/classes.html | 53 +
html/closed.png | Bin 0 -> 126 bytes
html/dir_61a4ab009ead72bcdcfcf8e0d997aa51.html | 86 +
html/dir_dd1f22bf73a30aa083e3126f80060e44.html | 73 +
html/dirs.html | 47 +
html/doxygen.css | 835 +
html/doxygen.png | Bin 0 -> 3942 bytes
html/files.html | 105 +
html/form_0.png | Bin 0 -> 676 bytes
html/form_1.png | Bin 0 -> 2144 bytes
html/form_2.png | Bin 0 -> 352 bytes
html/form_3.png | Bin 0 -> 197 bytes
html/form_4.png | Bin 0 -> 338 bytes
html/form_5.png | Bin 0 -> 215 bytes
html/form_6.png | Bin 0 -> 264 bytes
html/form_7.png | Bin 0 -> 271 bytes
html/form_8.png | Bin 0 -> 437 bytes
html/formula.repository | 9 +
html/group__hawki__alloc.html | 110 +
html/group__hawki__calib.html | 404 +
html/group__hawki__combine.html | 45 +
html/group__hawki__dfs.html | 82 +
html/group__hawki__distortion.html | 709 +
html/group__hawki__image__stats.html | 502 +
html/group__hawki__load.html | 929 ++
html/group__hawki__mask.html | 81 +
html/group__hawki__obj__det.html | 149 +
html/group__hawki__pfits.html | 1694 ++
html/group__hawki__properties__tel.html | 132 +
html/group__hawki__save.html | 620 +
html/group__hawki__utils.html | 1053 ++
html/group__hawki__variance.html | 189 +
html/hawki__alloc_8c_source.html | 122 +
html/hawki__alloc_8h_source.html | 94 +
html/hawki__bkg_8c_source.html | 367 +
html/hawki__bkg_8h_source.html | 109 +
html/hawki__cal__dark_8c_source.html | 892 ++
html/hawki__cal__distortion_8c_source.html | 1335 ++
html/hawki__cal__flat_8c_source.html | 1917 +++
html/hawki__cal__illum_8c_source.html | 838 +
html/hawki__cal__lingain_8c_source.html | 232 +
html/hawki__cal__zpoint_8c_source.html | 1871 +++
html/hawki__calib_8c_source.html | 451 +
html/hawki__calib_8h_source.html | 123 +
html/hawki__combine_8c_source.html | 101 +
html/hawki__combine_8h_source.html | 89 +
html/hawki__dfs_8c_source.html | 154 +
html/hawki__dfs_8h_source.html | 561 +
html/hawki__distortion_8c_source.html | 1104 ++
html/hawki__distortion_8h_source.html | 181 +
html/hawki__image__stats_8c_source.html | 621 +
html/hawki__image__stats_8h_source.html | 121 +
html/hawki__load_8c_source.html | 833 +
html/hawki__load_8h_source.html | 111 +
html/hawki__mask_8c_source.html | 176 +
html/hawki__mask_8h_source.html | 97 +
html/hawki__match__cats_8c_source.html | 134 +
html/hawki__match__cats_8h_source.html | 97 +
html/hawki__obj__det_8c_source.html | 157 +
html/hawki__obj__det_8h_source.html | 94 +
html/hawki__pfits_8c_source.html | 499 +
html/hawki__pfits_8h_source.html | 149 +
html/hawki__properties__tel_8c_source.html | 846 +
html/hawki__properties__tel_8h_source.html | 102 +
html/hawki__saa_8c_source.html | 173 +
html/hawki__saa_8h_source.html | 106 +
html/hawki__save_8c_source.html | 651 +
html/hawki__save_8h_source.html | 155 +
html/hawki__sci__jitter_8c_source.html | 2163 +++
html/hawki__step__apply__dist_8c_source.html | 524 +
html/hawki__step__basic__calib_8c_source.html | 578 +
html/hawki__step__combine_8c_source.html | 1014 ++
html/hawki__step__compute__bkg_8c_source.html | 1215 ++
html/hawki__step__detect__obj_8c_source.html | 970 ++
html/hawki__step__photom__2mass_8c_source.html | 975 ++
html/hawki__step__refine__offsets_8c_source.html | 811 +
html/hawki__step__stats_8c_source.html | 437 +
html/hawki__step__stitch_8c_source.html | 367 +
html/hawki__step__subtract__bkg_8c_source.html | 532 +
html/hawki__tec__filtchk_8c_source.html | 385 +
html/hawki__util__extinction_8c_source.html | 543 +
html/hawki__util__gendist_8c_source.html | 585 +
html/hawki__util__stdstars_8c_source.html | 319 +
html/hawki__utils_8c_source.html | 1130 ++
html/hawki__utils_8h_source.html | 203 +
html/hawki__variance_8c_source.html | 172 +
html/hawki__variance_8h_source.html | 109 +
html/index.html | 43 +
html/jquery.js | 54 +
html/modules.html | 59 +
html/nav_f.png | Bin 0 -> 159 bytes
html/nav_h.png | Bin 0 -> 97 bytes
html/open.png | Bin 0 -> 118 bytes
...__hawki__distortion__obj__function__args__.html | 59 +
html/tab_a.png | Bin 0 -> 140 bytes
html/tab_b.png | Bin 0 -> 178 bytes
html/tab_h.png | Bin 0 -> 192 bytes
html/tab_s.png | Bin 0 -> 189 bytes
html/tabs.css | 59 +
irplib/Makefile.am | 87 +
irplib/Makefile.in | 809 +
irplib/irplib_calib.c | 646 +
irplib/irplib_calib.h | 49 +
irplib/irplib_cat.c | 469 +
irplib/irplib_cat.h | 57 +
irplib/irplib_distortion.c | 1398 ++
irplib/irplib_distortion.h | 44 +
irplib/irplib_flat.c | 402 +
irplib/irplib_flat.h | 40 +
irplib/irplib_framelist.c | 1289 ++
irplib/irplib_framelist.h | 107 +
irplib/irplib_hist.c | 350 +
irplib/irplib_hist.h | 93 +
irplib/irplib_ksigma_clip.c | 258 +
irplib/irplib_ksigma_clip.h | 52 +
irplib/irplib_ksigma_clip_body.h | 107 +
irplib/irplib_match_cats.c | 211 +
irplib/irplib_match_cats.h | 46 +
irplib/irplib_mkmaster.c | 565 +
irplib/irplib_mkmaster.h | 53 +
irplib/irplib_oddeven.c | 338 +
irplib/irplib_oddeven.h | 40 +
irplib/irplib_plugin.c | 1267 ++
irplib/irplib_plugin.h | 93 +
irplib/irplib_polynomial.c | 1486 ++
irplib/irplib_polynomial.h | 70 +
irplib/irplib_ppm.c | 494 +
irplib/irplib_ppm.h | 40 +
irplib/irplib_slitpos.c | 568 +
irplib/irplib_slitpos.h | 39 +
irplib/irplib_spectrum.c | 606 +
irplib/irplib_spectrum.h | 59 +
irplib/irplib_stdstar.c | 823 +
irplib/irplib_stdstar.h | 78 +
irplib/irplib_strehl.c | 806 +
irplib/irplib_strehl.h | 75 +
irplib/irplib_utils.c | 1659 ++
irplib/irplib_utils.h | 464 +
irplib/irplib_wavecal.c | 1646 ++
irplib/irplib_wavecal.h | 184 +
irplib/irplib_wavecal_impl.h | 56 +
irplib/irplib_wcs.c | 391 +
irplib/irplib_wcs.h | 66 +
irplib/irplib_wlxcorr.c | 1261 ++
irplib/irplib_wlxcorr.h | 73 +
irplib/tests/Makefile.am | 90 +
irplib/tests/Makefile.in | 776 +
irplib/tests/irplib_cat-test.c | 98 +
irplib/tests/irplib_framelist-test.c | 98 +
irplib/tests/irplib_hist-test.c | 150 +
irplib/tests/irplib_plugin-test.c | 129 +
irplib/tests/irplib_polynomial-test.c | 582 +
irplib/tests/irplib_utils-test.c | 331 +
irplib/tests/irplib_wcs-test.c | 307 +
irplib/tests/irplib_wlxcorr-test.c | 483 +
m4macros/cpl.m4 | 1499 ++
m4macros/eso.m4 | 1065 ++
m4macros/gsl.m4 | 23 +
m4macros/libtool.m4 | 7835 ++++++++++
m4macros/ltoptions.m4 | 369 +
m4macros/ltsugar.m4 | 123 +
m4macros/ltversion.m4 | 23 +
m4macros/lt~obsolete.m4 | 98 +
m4macros/openmp.m4 | 103 +
m4macros/purify.m4 | 27 +
recipes/Makefile.am | 149 +
recipes/Makefile.in | 868 ++
recipes/hawki_cal_dark.c | 885 ++
recipes/hawki_cal_distortion.c | 1352 ++
recipes/hawki_cal_flat.c | 1952 +++
recipes/hawki_cal_zpoint.c | 1892 +++
recipes/hawki_sci_jitter.c | 2207 +++
recipes/hawki_step_apply_dist.c | 517 +
recipes/hawki_step_basic_calib.c | 579 +
recipes/hawki_step_combine.c | 1017 ++
recipes/hawki_step_compute_bkg.c | 1224 ++
recipes/hawki_step_detect_obj.c | 970 ++
recipes/hawki_step_photom_2mass.c | 973 ++
recipes/hawki_step_refine_offsets.c | 813 +
recipes/hawki_step_stats.c | 432 +
recipes/hawki_step_stitch.c | 351 +
recipes/hawki_step_subtract_bkg.c | 534 +
recipes/hawki_tec_filtchk.c | 380 +
recipes/hawki_util_extinction.c | 537 +
recipes/hawki_util_gendist.c | 602 +
recipes/hawki_util_stdstars.c | 315 +
reflex/Hawki_Calib_Science.xml.in | 3960 +++++
reflex/Makefile.am | 33 +
reflex/Makefile.in | 507 +
reflex/hawki_wkf.oca | 282 +
regtests/Makefile.am | 30 +
regtests/Makefile.in | 614 +
regtests/tests/Makefile.am | 61 +
regtests/tests/Makefile.in | 435 +
setup | 77 +
tests/Makefile.am | 48 +
tests/Makefile.in | 532 +
276 files changed, 153685 insertions(+)
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..174173d
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+This package is maintained by
+
+ César Enrique García Dabó <cgarcia at eso.org>
+
+on behalf of the European Southern Observatory.
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/COPYING.LIB b/COPYING.LIB
new file mode 100644
index 0000000..c4792dd
--- /dev/null
+++ b/COPYING.LIB
@@ -0,0 +1,515 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+^L
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+^L
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+^L
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+^L
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+^L
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+^L
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+^L
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+^L
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+ <one line to give the library's name and a brief idea of what it
+does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper
+mail.
+
+You should also get your employer (if you work as a programmer) or
+your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James
+Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..179ea24
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,6783 @@
+2008-08-20 09:30 cgarcia
+
+ * configure.ac: Updated to version 1.3.4
+
+2008-08-20 09:04 amodigli
+
+ * irplib/irplib_detmon_lg.c: added a missing check on EXPTIME/DIT
+ columns in linear_table
+
+2008-08-19 18:47 cgarcia
+
+ * recipes/hawki_img_flat.c: New selection parameter acording to
+ rms. Implemented selection parameters in a chip by chip basis.
+
+2008-08-19 17:46 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Bug in OPT fixed.
+
+2008-08-19 14:03 cgarcia
+
+ * recipes/hawki_img_flat.c: Fixed double released pointer. Fixed
+ memory leak
+
+2008-08-18 16:29 cgarcia
+
+ * recipes/hawki_img_flat.c: Fixed double pointer release
+
+2008-08-18 15:04 cgarcia
+
+ * recipes/: hawki_img_flat.c, hawki_tec_filtchk.c: Fixed problem
+ saving PAF files (DFS5782)
+
+2008-08-13 16:38 cgarcia
+
+ * hawki/hawki_bkg.c: Removed debug message
+
+2008-08-13 15:56 cgarcia
+
+ * configure.ac: Updated to version 1.3.3
+
+2008-08-13 15:48 cgarcia
+
+ * recipes/hawki_img_flat.c: Fixed the selection algorithm
+
+2008-08-13 14:52 cgarcia
+
+ * recipes/hawki_img_flat.c: Changed the selection algorithm Removed
+ parameter select_max_nframes Added parameter select_auto_max_bins
+ Changed default value of select_min_nframes to 3 (previously -1)
+
+2008-08-13 14:48 cgarcia
+
+ * recipes/: hawki_util_compute_bkg.c, hawki_util_stats.c,
+ hawki_util_subtract_bkg.c: Fixed the description of the recipe
+
+2008-08-13 14:44 cgarcia
+
+ * recipes/hawki_tec_filtchk.c: Fixed the description of the recipe
+
+2008-08-13 14:42 cgarcia
+
+ * hawki/: hawki_utils.h, hawki_utils.c: Added
+ hawki_vector_get_min_select, hawki_vector_get_max_select
+
+2008-08-11 15:02 yjung
+
+ * irplib/: irplib_spectrum.c, irplib_ppm.c, irplib_spectrum.c: [no
+ log message]
+
+2008-08-11 14:59 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2008-08-11 14:20 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2008-08-07 13:38 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Raise bar for 6-deg test
+
+2008-08-07 10:39 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_add(): Fix bug on
+ empty self + simplify. irplib_polynomial_subtract(): Modified from
+ irplib_polynomial_add()
+
+2008-08-07 10:16 llundin
+
+ * irplib/: irplib_distortion.c, irplib_polynomial.c:
+ irplib_polynomial_shift_1d(): Dim numbered from 0
+
+2008-08-07 10:13 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_estimate(): Updated
+ doxygen
+
+2008-08-06 16:59 llundin
+
+ * irplib/irplib_distortion.c:
+ irplib_distortion_fill_arc_positions(): info on line gradient at
+ center
+
+2008-08-06 16:52 llundin
+
+ * irplib/: irplib_polynomial.c, tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all(),
+ irplib_polynomial_solve_1d_nonzero(): Use cpl_polynomial_solve_1d()
+ + irplib_polynomial_divide_1d_root() to support arbitrary degrees
+ (with simple test for 5+6 degree)
+
+2008-08-06 14:13 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2008-08-06 13:47 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2008-08-06 13:28 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2008-08-06 13:22 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Enable tests
+
+2008-08-06 13:21 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3(): Give
+ preference to real/double-root solution
+
+2008-08-06 09:55 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_estimate():
+ Bug-fix, set *arcs to NULL on failure
+
+2008-08-05 23:29 llundin
+
+ * irplib/: irplib_polynomial.c, irplib_polynomial.h:
+ irplib_polynomial_shift_1d(): Added
+
+2008-08-05 15:44 llundin
+
+ * irplib/irplib_distortion.c:
+ irplib_distortion_fill_arc_positions(): Fit a 1D-poly to each arc
+
+2008-08-05 15:41 cgarcia
+
+ * hawki/hawki_image_stats.c: Removed debugging messages
+
+2008-08-05 15:32 cgarcia
+
+ * recipes/hawki_img_flat.c: Support for even/odd row/column
+ statistics products.
+
+2008-08-05 15:30 cgarcia
+
+ * hawki/: hawki_image_stats.h, hawki_image_stats.c: Support for
+ even/odd row/column statistics
+
+2008-08-05 15:29 cgarcia
+
+ * hawki/hawki_dfs.h: Support for even/odd row/column products
+
+2008-08-05 13:07 llundin
+
+ * irplib/irplib_distortion.c: irplib_polynomial_fit_2d(): True
+ fix-point for y=(ny+1)/2
+
+2008-08-05 11:50 lbilbao
+
+ * irplib/: irplib_detmon.h, irplib_detmon_lg.h: Code move from
+ irplib_detmon_lg.h -> irplib_detmon.h
+
+2008-08-04 15:13 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_estimate(): Prep
+ for fitting with center line as true fix-point
+
+2008-08-04 12:01 cgarcia
+
+ * recipes/hawki_img_dark.c: Removed support for TEC_FLAT input. Now
+ this is handle by its own recipe: hawki_tec_filtchk.
+
+2008-08-04 11:59 cgarcia
+
+ * recipes/: hawki_tec_filtchk.c, hawki_util_stats.c: Added support
+ for "statistics of the statistics"
+
+2008-08-04 10:57 yjung
+
+ * irplib/irplib_wlxcorr.c: 2 differtnt plottings for the catalog
+
+2008-08-01 16:38 llundin
+
+ * irplib/: irplib_wavecal.c, irplib_wavecal.h:
+ irplib_vector_fill_line_spectrum_model(): renamed from
+ irplib_vector_fill_line_spectrum().
+ irplib_vector_fill_line_spectrum(): Renamed from
+ irplib_vector_fill_spectrum()
+
+2008-08-01 15:54 cgarcia
+
+ * recipes/hawki_tec_filtchk.c: First version of tec_filtchk recipe,
+ intended to process data taken with different filters. The first
+ approach of this recipe is to compute statistics.
+
+2008-08-01 15:53 cgarcia
+
+ * recipes/Makefile.am: Added subtract_bkg and filtchk recipes
+
+2008-08-01 15:52 cgarcia
+
+ * recipes/hawki_util_subtract_bkg.c: Changed the dfs keyworkds.
+
+2008-08-01 15:51 cgarcia
+
+ * recipes/hawki_util_distortion.c: Changes for the modularity
+ scheme. Support for a series of images. Only background
+ subtracted images are acepted.
+
+2008-08-01 15:48 cgarcia
+
+ * recipes/hawki_util_compute_bkg.c: Exits if object masks are
+ provided, since that funcitonality is not still supported.
+
+2008-08-01 15:47 cgarcia
+
+ * recipes/hawki_util_basic_calib.c: [no log message]
+
+2008-08-01 15:46 cgarcia
+
+ * hawki/: hawki_distortion.h, hawki_distortion.c: Added support for
+ distortion correction of imagelists.
+
+2008-08-01 15:45 cgarcia
+
+ * hawki/hawki_dfs.h: Added keywords for background subtracted
+ products and filter position check products
+
+2008-08-01 15:43 cgarcia
+
+ * hawki/hawki_bkg.c: Fixed potential buffer overflow
+
+2008-08-01 15:30 llundin
+
+ * irplib/irplib_distortion.c:
+ irplib_distortion_fill_arc_positions(): Better variable names =>
+ merge two loops, avoid potentially dangerous data-layout assumption
+
+2008-08-01 14:53 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_purge_arcs(): Purge
+ arcs that do not cross center line.
+ irplib_distortion_fill_arc_positions(): replaces
+ irplib_distortion_get_arc_positions(), sample arcs along all rows
+ (not just 20 uniformly spaced rows), Fit to centroid of center row,
+ resize sample vectors
+
+2008-08-01 14:22 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_estimate(): Print
+ mse of 2D-fit
+
+2008-07-31 16:44 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2008-07-31 14:52 llundin
+
+ * irplib/irplib_distortion.c:
+ irplib_distortion_get_arc_positions(): Avoid data repacking
+
+2008-07-31 13:52 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_get_row_centroid():
+ Renamed from irplib_distortion_fine_pos(), avoid arbitrary tols
+ (1e-40), more error checking
+
+2008-07-31 11:20 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_purge_arcs():
+ Improve API, optimize relabelling, check validity of lab_im.
+ irplib_distortion_detect_arcs(): use const int
+
+2008-07-31 10:36 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_fill_border():
+ Reduce complexity
+
+2008-07-31 09:20 llundin
+
+ * irplib/irplib_distortion.c: irplib_distortion_fill_border():
+ Renamed from irplib_distortion_fill_badzones().
+ irplib_distortion_purge_arcs(): Redeclared to int, use CPL error
+ module, avoid recreation of label image
+
+2008-07-30 16:36 llundin
+
+ * irplib/irplib_distortion.c: cpl_msg_error() replaced by CPL error
+ module calls. irplib_distortion_remove_ramp():
+ cpl_vector_get_median() replaces cpl_vector_get_median_const()
+
+2008-07-30 16:03 cgarcia
+
+ * hawki/hawki_dfs.c: Added support for clasification of background
+ images
+
+2008-07-30 16:01 cgarcia
+
+ * recipes/hawki_util_subtract_bkg.c: First implementation of
+ hawki_util_subtract_bkg recipe
+
+2008-07-30 15:59 cgarcia
+
+ * hawki/hawki_load.c: Fixed memory leaks and potential buffer
+ overflow
+
+2008-07-30 15:57 cgarcia
+
+ * hawki/: hawki_calib.h, hawki_calib.c: New utility for background
+ subtraction
+
+2008-07-30 15:32 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Doxygen improved for
+ irplib_detmon_{gain, lin}().
+
+2008-07-30 13:38 lbilbao
+
+ * irplib/irplib_detmon.c: Missing initialisation of variable
+
+2008-07-30 11:46 lbilbao
+
+ * irplib/irplib_detmon.c: Optional product SYNTH (only created with
+ PREOVERSCAN method) allowed to be passed a NULL. Example recipe
+ updated accordingly.
+
+2008-07-30 09:16 llundin
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h,
+ tests/irplib_wlxcorr-test.c: irplib_wlxcorr_find_1d(): Dropped
+
+2008-07-29 17:09 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h, irplib_detmon_lg.c,
+ irplib_detmon_lg.h, tests/irplib_detmon-test.c,
+ tests/irplib_detmon_lg-test.c: API of irplib_detmon_ronbias()
+ changed to allow to pass not only PRO.CATG but also PRO.SCIENCE,
+ PRO.TYPE and PRO.TECH.
+
+2008-07-29 16:36 llundin
+
+ * irplib/irplib_wavecal.c: irplib_vector_fill_line_spectrum():
+ Verify monotony of dispersion
+
+2008-07-29 16:09 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h, irplib_detmon_lg.h,
+ tests/irplib_detmon-test.c: irplib_detmon_ronbias() extended for
+ NIR cases, when PREOVERSCAN method must not be available. New
+ example recipe detmon_darkron provided. (DFS05702)
+
+2008-07-29 15:52 llundin
+
+ * irplib/irplib_wavecal.c: irplib_vector_fill_line_spectrum():
+ Check also the derivative at xmin
+
+2008-07-29 15:38 llundin
+
+ * irplib/irplib_wavecal.c: irplib_vector_fill_line_spectrum():
+ Copied from cpl_vector_fill_line_spectrum()
+
+2008-07-29 11:09 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Default value for --niter changed to
+ 5.
+
+2008-07-29 11:07 llundin
+
+ * irplib/irplib_wavecal.c:
+ irplib_polynomial_find_1d_from_correlation(): Change messaging from
+ info to debug
+
+2008-07-29 10:43 llundin
+
+ * irplib/: Makefile.am, irplib_wavecal.c, irplib_wavecal.h: Added
+ irplib_wavecal with GSL-based wavelength calibration
+
+2008-07-24 15:56 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: Changes in the treatment of DIT and
+ EXPTIME in Gain and Linearity Tables. Now only one of them is
+ copied to the table (DIT for NIR and EXPTIME for OPT, according to
+ DFO). Some code duplication removed as well. (DFS05694)
+
+2008-07-23 18:39 cgarcia
+
+ * hawki/hawki_utils.c: Removed unused varaibles gap, nx, ny
+
+2008-07-23 18:37 cgarcia
+
+ * hawki/hawki_bkg.c: Removed debug traces
+
+2008-07-23 18:19 cgarcia
+
+ * recipes/: hawki_img_flat.c, hawki_util_basic_calib.c,
+ hawki_util_compute_bkg.c, hawki_util_stats.c: Removed unneeded
+ included files
+
+2008-07-23 18:07 cgarcia
+
+ * recipes/Makefile.am: Support for hawki_util_stats and
+ hawki_util_compute_bkg recipes
+
+2008-07-23 18:05 cgarcia
+
+ * recipes/hawki_util_compute_bkg.c: New recipe
+ hawki_util_compute_bkg.
+
+2008-07-23 18:04 cgarcia
+
+ * recipes/hawki_img_jitter.c: Use the new hawki_bkg utilities
+
+2008-07-23 18:04 cgarcia
+
+ * hawki/hawki_dfs.c: Added support for the clasification of
+ intermediate products.
+
+2008-07-23 18:03 cgarcia
+
+ * hawki/: hawki_bkg.h, hawki_bkg.c: Added new function to compute
+ the background for a set of frames.
+
+2008-07-22 10:46 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: API of irplib_detmon_{gain, lin}()
+ extended to get a tolerance value for pair extraction.
+
+2008-07-21 17:04 cgarcia
+
+ * recipes/hawki_util_stats.c: New utility to compute image
+ statistics
+
+2008-07-21 17:03 cgarcia
+
+ * hawki/: hawki_image_stats.h, hawki_image_stats.c: Added support
+ for stats from a frame. Added support for printing stats to
+ stdout.
+
+2008-07-16 17:44 cgarcia
+
+ * hawki/: hawki_bkg.c, hawki_bkg.h: New file to include background
+ estimation functionality
+
+2008-07-16 17:41 cgarcia
+
+ * configure.ac: [no log message]
+
+2008-07-16 17:35 cgarcia
+
+ * recipes/hawki_util_basic_calib.c: Support for different output
+ products (OBJ_BASIC_CALIB or SKY_BASIC_CALIB) depending on the
+ input frames.
+
+2008-07-16 17:33 cgarcia
+
+ * recipes/hawki_img_jitter.c: Removed extra_stats flag parameter
+ (that shouldn't ever be comitted)
+
+2008-07-16 17:28 cgarcia
+
+ * recipes/hawki_img_jitter.c: Added support for background stats.
+ Removed support for product BGD.
+
+2008-07-16 17:19 cgarcia
+
+ * hawki/Makefile.am: [no log message]
+
+2008-07-16 17:19 cgarcia
+
+ * hawki/hawki_dfs.h: Added support for new products: BKG_STATS
+ SKY_BASICCALIBRATED OBJ_MASK Removed support for BGD product
+
+2008-07-16 09:35 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Missing variable renaming from
+ previous change done now.
+
+2008-07-15 13:00 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_subtract(): Fix bug
+ on empty self
+
+2008-07-15 11:41 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Doxygen correction for
+ irplib_detmon_gain() (DFS05678).
+
+2008-07-09 13:42 llundin
+
+ * irplib/irplib_plugin.c: recipe_parameterlist_set(): use also
+ getenv()
+
+2008-07-08 16:27 cgarcia
+
+ * recipes/hawki_util_basic_calib.c: Fixed memory leak.
+
+2008-07-08 16:27 cgarcia
+
+ * recipes/hawki_img_jitter.c: More robust behaviour when it is not
+ possible to read all telescope data or when not all chips have
+ detected objects. Fixed double initialization of telescope data.
+
+2008-07-08 16:25 cgarcia
+
+ * recipes/hawki_img_flat.c: Moving the initialization of telescope
+ table to the main flow, like the other recipes.
+
+2008-07-08 16:23 cgarcia
+
+ * hawki/hawki_properties_tel.c: Support for FWHM values -1 for
+ START or END
+
+2008-07-07 11:40 llundin
+
+ * irplib/irplib_plot.c: irplib_vectors_plot(): Use correct error
+ code
+
+2008-07-04 15:13 cgarcia
+
+ * configure.ac: Updated to version 1.3.1
+
+2008-07-04 14:16 yjung
+
+ * irplib/irplib_detmon_lg.c: added Workaround for DFS05341 before
+ CPL 4.2
+
+2008-07-04 11:52 cgarcia
+
+ * recipes/hawki_img_zpoint.c: config structure has been splitted
+ between configuration and output data
+
+2008-07-04 11:51 cgarcia
+
+ * recipes/hawki_img_flat.c: Changed selection algorithm
+
+2008-07-04 10:04 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Missing keywords in PAF
+ (multi-extension case) added.
+
+2008-07-03 16:09 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: PRO.CATG properly named after
+ CPL_DFS_PRO_CATG
+
+2008-07-03 15:38 cgarcia
+
+ * hawki/hawki_pfits.h: Fixed double definition of function _get_dit
+
+2008-07-03 13:56 yjung
+
+ * irplib/irplib_stdstar.c: Workaround to wait for next CPL version
+ (4.2)
+
+2008-07-03 11:52 yjung
+
+ * irplib/irplib_stdstar.c: use the CPL_DFS define for the PRO CATG
+ and PRO TYPE keywords
+
+2008-07-02 18:11 cgarcia
+
+ * hawki/Makefile.am: Added hawki_image_stats to the compilation
+ list
+
+2008-07-02 18:06 cgarcia
+
+ * recipes/hawki_img_zpoint.c: Added support for raw table
+ statistics (DFS05592)
+
+2008-07-02 18:04 cgarcia
+
+ * recipes/hawki_img_jitter.c: Added support for raw table
+ statistics (DFS05595)
+
+2008-07-02 18:03 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: irplib_detmon_lg() API extended to
+ pass not only PRO.CATG but also PRO.{SCIENCE, TECH, TYPE} to the
+ recipe.
+
+2008-07-02 17:55 cgarcia
+
+ * hawki/hawki_image_stats.c: Fixed return code. Updated
+ documentation. More error checking code.
+
+2008-07-02 17:54 cgarcia
+
+ * hawki/hawki_dfs.h: Added support for ZPOINT statistics product
+
+2008-07-02 16:19 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Changed from error to warning in case
+ of failure in the linearity efficiency computation.
+
+2008-07-02 16:13 lbilbao
+
+ * irplib/irplib_detmon_lg.c: EXTNAME keyword copied to output
+ extension headers in case of multiextension reduction.
+
+2008-07-02 16:01 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c: llx,
+ lly, urx, ury parameters activated (with unit test).
+
+2008-06-27 17:34 cgarcia
+
+ * recipes/hawki_img_flat.c: Migrating to new hawki_image_stats
+ utilities
+
+2008-06-27 17:26 cgarcia
+
+ * recipes/hawki_img_detlin.c: Cosmetic hanges: index in loops have
+ more meaningful names
+
+2008-06-27 17:12 cgarcia
+
+ * recipes/hawki_img_dark.c: Updated the recipe to the use of
+ hawki_image_stats functions (common to all recipes). Comestic
+ changes: substitute chip by idet
+
+2008-06-27 17:00 cgarcia
+
+ * hawki/hawki_calib.c: Comestic change: sustitute chip by ider
+
+2008-06-27 16:59 cgarcia
+
+ * hawki/hawki_load.c: [no log message]
+
+2008-06-27 16:57 cgarcia
+
+ * hawki/: hawki_image_stats.h, hawki_image_stats.c: New file that
+ manipulates raw image statistics
+
+2008-06-27 16:56 cgarcia
+
+ * hawki/hawki_dfs.h: Changed SCIENCE_PARAMS to SCIENCE_PCS (params
+ and conditions) Merged all the stats table to the same PRO.TYPE
+
+2008-06-27 16:55 cgarcia
+
+ * hawki/hawki_calib.h: Cosmetic change: sustitute chip by idet
+
+2008-06-25 16:49 cgarcia
+
+ * recipes/hawki_img_jitter.c: Several changes: -support for
+ telescope pointing and ambiental conditions product. -initial
+ support for raw statistics -internal design changes:
+ -splitted config structure to config and outputs -input
+ parameters are read in a dedicated function
+
+2008-06-25 16:44 cgarcia
+
+ * recipes/hawki_util_basic_calib.c: Minor change: update to new
+ hawki_calib.h. Minor bugs
+
+2008-06-25 16:43 cgarcia
+
+ * recipes/: hawki_img_illum.c, hawki_img_zpoint.c: Minor change:
+ update to new hawki_calib.h
+
+2008-06-25 16:42 cgarcia
+
+ * hawki/hawki_dfs.h: Support for new statistics products: DARK,
+ SCIENCE stats and SCIENCE_PARAMS (telescope pointing and ambiental
+ conditions)
+
+2008-06-25 15:19 cgarcia
+
+ * hawki/hawki_load.c: Minor bug (bpp was trated as a cpl_type)
+
+2008-06-25 15:08 cgarcia
+
+ * hawki/: hawki_pfits.h, hawki_pfits.c: New functions to access
+ keywords related to telescope status
+
+2008-06-25 15:05 cgarcia
+
+ * hawki/hawki_properties_tel.c: New functions dealing with keywords
+ of the telescope status used by QC (TEL.ALT, TEL.AZ, TEL.AMBI.*,
+ TEL.AIRM, etc..)
+
+2008-06-25 15:04 cgarcia
+
+ * hawki/hawki_properties_tel.h: New functions dealing with keywords
+ of the telescope status used by QC
+
+2008-06-25 15:02 cgarcia
+
+ * hawki/hawki_calib.c: New file created out of calibration
+ functions found in hawki/hawki_utils.c
+
+2008-06-25 15:01 cgarcia
+
+ * hawki/hawki_calib.h: New file created out of calibration
+ functions found in hawki/hawki_utils.h
+
+2008-06-25 15:00 cgarcia
+
+ * hawki/hawki_utils.c: Calibration functions moved to hawki_calib
+
+2008-06-25 14:58 cgarcia
+
+ * hawki/hawki_utils.h: Moved the calibration functions to
+ hawki_calib
+
+2008-06-25 14:58 cgarcia
+
+ * hawki/Makefile.am: Added hawki_calib.c and hawki_properties_tel.c
+
+2008-06-19 15:46 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Wrong info message corrected.
+
+2008-06-19 15:22 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Small bug in multi-extension support
+ fixed.
+
+2008-06-17 15:05 cgarcia
+
+ * configure.ac: Go back to tag 1.3.0
+
+2008-06-17 14:47 cgarcia
+
+ * configure.ac: tag 1.3.1 was not commited here.
+
+2008-06-17 14:33 cgarcia
+
+ * recipes/hawki_util_basic_calib.c: Fix function name which gave
+ linking problem
+
+2008-06-17 14:31 cgarcia
+
+ * recipes/hawki_img_flat.c: Minor bug fix.
+
+2008-06-17 13:45 cgarcia
+
+ * configure.ac: Updated to version 1.3.0
+
+2008-06-17 13:22 cgarcia
+
+ * recipes/hawki_img_flat.c: Minor formatting Removing the RAW USED
+ keywords in the paf files due to DFS05341
+
+2008-06-17 13:20 cgarcia
+
+ * recipes/: hawki_img_jitter.c, hawki_util_basic_calib.c: Minor
+ formatting
+
+2008-06-13 17:47 cgarcia
+
+ * recipes/hawki_util_basic_calib.c: New utility to make standalano
+ basic calibrations: dark, flat and bpm.
+
+2008-06-13 17:41 cgarcia
+
+ * recipes/Makefile.am: Added compilation for basic_calib
+
+2008-06-13 17:41 cgarcia
+
+ * recipes/hawki_img_dark.c: Added support for a new data product:
+ the raw dark statistics.
+
+2008-06-13 17:40 cgarcia
+
+ * recipes/hawki_img_flat.c: Added support to save the selected
+ flats to the products. Added the mean to the statistics product.
+
+2008-06-13 17:38 cgarcia
+
+ * recipes/: hawki_img_illum.c, hawki_img_jitter.c: Minor changes
+
+2008-06-13 17:33 cgarcia
+
+ * recipes/hawki_img_zpoint.c: Minor fixes
+
+2008-06-13 17:31 cgarcia
+
+ * hawki/: hawki_utils.h, hawki_utils.c: Added calibration of dark,
+ bpm and flat at the same time.
+
+2008-06-13 17:18 cgarcia
+
+ * hawki/hawki_saa.c: Minor fix: remove dependency with cpl_tools
+
+2008-06-13 17:18 cgarcia
+
+ * hawki/: hawki_pfits.h, hawki_pfits.c: New focus to access the
+ focus
+
+2008-06-13 17:17 cgarcia
+
+ * hawki/: hawki_load.h, hawki_load.c: New function hawki_load_image
+
+2008-06-13 17:11 cgarcia
+
+ * hawki/hawki_dfs.h: New PRO.CATG products: Dark statistics, focus
+ products, basic calibration products. Added columns in flat
+ statistics.
+
+2008-06-13 10:40 llundin
+
+ * irplib/: irplib_polynomial.c, irplib_polynomial.h,
+ tests/irplib_polynomial-test.c:
+ irplib_polynomial_multiply_scalar(), irplib_polynomial_add():
+ Exported. irplib_polynomial_subtract(): Added (still needs unit
+ tests)
+
+2008-06-03 18:15 lbilbao
+
+ * irplib/tests/irplib_fft-test.c: Missing include added.
+
+2008-06-03 18:11 lbilbao
+
+ * irplib/tests/irplib_fft-test.c: Warning about FFTW dependency
+ setting removed.
+
+2008-06-03 18:07 lbilbao
+
+ * irplib/tests/irplib_fft-test.c: Bug in FFTW dependency setting.
+
+2008-06-03 17:55 lbilbao
+
+ * irplib/: Makefile.am, irplib_detmon.c, irplib_detmon_lg.c,
+ irplib_fft.c, irplib_fft.h, irplib_fft_body.h, tests/Makefile.am,
+ tests/irplib_fft-test.c: New FFTW wrappers added to IRPLIB with
+ unit tests.
+
+2008-05-09 16:01 cguirao
+
+ * Makefile.purify.in: Adding -dlclose-mode=2 on request from MZ
+
+2008-05-09 15:04 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c: Unit
+ tests added for irplib_detmon_lin().
+
+2008-05-09 11:05 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h: New lower-level
+ function for Linearity computation irplib_detmon_lin().
+
+2008-05-06 12:39 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon_body.h: Warning memory
+ leak removal in irplib_ksigma_clip().
+
+2008-04-30 10:58 lbilbao
+
+ * irplib/irplib_detmon_body.h: Change in code just for clarity.
+
+2008-04-30 10:49 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon_body.h,
+ tests/irplib_detmon-test.c, tests/irplib_detmon_lg-test.c: Bug in
+ irplib_ksigma_clip() fixed. Unit test added.
+
+2008-04-30 09:59 lbilbao
+
+ * irplib/tests/irplib_detmon_lg-test.c: Temporary deactivation of
+ irplib_detmon_gain() unit tests.
+
+2008-04-29 19:30 lbilbao
+
+ * irplib/irplib_detmon.c: Another typo fix.
+
+2008-04-29 19:21 lbilbao
+
+ * irplib/irplib_detmon.c: Typo fix.
+
+2008-04-29 16:01 lbilbao
+
+ * irplib/: Makefile.am, irplib_detmon.c, irplib_detmon.h,
+ irplib_detmon_body.h, irplib_detmon_lg.c:
+ irplib_get_clean_mean_window() converted into irplib_ksigma_clip().
+ Improvements in the algorithm.
+
+2008-04-25 10:46 lbilbao
+
+ * irplib/irplib_detmon.c: Wrong default value in
+ irplib_detmon_ronbias() corrected.
+
+2008-04-24 16:41 lbilbao
+
+ * irplib/irplib_detmon.c: Unnecessary QC parameters removed. Bug in
+ irplib_detmon_ronbias_master() fixed.
+
+2008-04-24 16:06 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: Bug in
+ irplib_imagelist_collapse_stdev_create() fixed. Unit test added.
+
+2008-04-23 18:58 llundin
+
+ * irplib/irplib_utils.c: irplib_image_split(): Fix uninit warning
+
+2008-04-23 09:46 yjung
+
+ * recipes/hawki_img_detlin.c: removed QC DETLIN LAMP key
+
+2008-04-22 14:53 yjung
+
+ * configure.ac: -> 1.2.0
+
+2008-04-22 14:44 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2008-04-22 14:36 yjung
+
+ * recipes/: hawki_img_dark.c, hawki_img_detlin.c, hawki_img_flat.c,
+ hawki_img_illum.c, hawki_img_jitter.c, hawki_img_zpoint.c: added
+ QC.DATANCOM
+
+2008-04-22 14:24 yjung
+
+ * hawki/hawki_utils.h: added INS.FILT1-2.NAME and DET.NCORRS.NAME
+
+2008-04-17 23:12 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: irplib_image_split(): 1st draft, API to
+ be simplified
+
+2008-04-17 16:34 llundin
+
+ * irplib/Makefile.am: Removed irplib_test.{c,h}. (Empty) source
+ files kept, in case new functionality is needed
+
+2008-04-17 11:27 yjung
+
+ * configure.ac: version -> 1.1.0
+
+2008-04-17 11:13 yjung
+
+ * hawki/hawki_dfs.h: [no log message]
+
+2008-04-17 11:11 yjung
+
+ * hawki/hawki_dfs.h: added new columns definitions
+
+2008-04-17 11:10 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2008-04-16 16:12 yjung
+
+ * recipes/: hawki_img_dark.c, hawki_img_flat.c: new QCs
+
+2008-04-16 15:54 yjung
+
+ * hawki/hawki_utils.h, recipes/hawki_img_dark.c,
+ recipes/hawki_img_detlin.c, recipes/hawki_img_flat.c,
+ recipes/hawki_img_illum.c, recipes/hawki_img_jitter.c,
+ recipes/hawki_img_zpoint.c, recipes/hawki_util_distortion.c,
+ recipes/hawki_util_gendist.c, recipes/hawki_util_stdstars.c,
+ recipes/hawki_util_stitch.c: rewrote the paf files saving
+
+2008-04-15 17:37 yjung
+
+ * ChangeLog, hawki/hawki_distortion.c, hawki/hawki_utils.h,
+ recipes/hawki_img_dark.c, recipes/hawki_img_detlin.c,
+ recipes/hawki_img_flat.c, recipes/hawki_img_illum.c,
+ recipes/hawki_img_jitter.c: added keywords (DET.CHIP.* DET.WIN....
+ from the RAW files to the products
+
+2008-04-15 10:04 lbilbao
+
+ * irplib/irplib_oddeven.c: Odd-even filtering improved for cases
+ where high frequencies on the X axis are also found
+
+2008-04-15 02:55 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: irplib_dfs_table_convert() takes check
+ function with non-const table
+
+2008-04-14 20:23 llundin
+
+ * irplib/irplib_utils.c: irplib_table_read_from_frameset():
+ Improved error msg
+
+2008-04-14 20:13 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: irplib_table_read_from_frameset(),
+ irplib_dfs_table_convert(): table_set_row() is of type cpl_boolean
+
+2008-04-14 19:50 llundin
+
+ * irplib/irplib_utils.c: irplib_table_read_from_frameset(),
+ irplib_dfs_table_convert(): Updated doxygen
+
+2008-04-14 19:46 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: irplib_table_read_from_frameset(): Added
+ with minimal unit-test
+
+2008-04-14 19:02 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: irplib_dfs_table_convert(): 1st working
+ version (with minimal unit-test)
+
+2008-04-14 16:16 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: irplib_dfs_table_convert(): 1st draft -
+ API incomplete
+
+2008-04-10 15:00 lbilbao
+
+ * irplib/irplib_oddeven.c: Bug in odd-even effect filtering
+ definition fixed.
+
+2008-04-08 12:56 yjung
+
+ * irplib/irplib_spectrum.c: added include irplib_plot.h
+
+2008-04-03 15:12 yjung
+
+ * irplib/: irplib_spectrum.c, irplib_spectrum.h: added
+ irplib_spectrum_detect_peaks() from CRIRES for Andrea
+
+2008-04-02 17:16 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: Unit tests added and improved in
+ irplib_detmon_lg-test and bugs found fixed.
+
+2008-04-01 17:23 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: New lower-level function
+ irplib_detmon_gain() for GAIN computation added.
+
+2008-03-26 09:46 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_CONCAT(), IRPLIB_CONCAT2X():
+ Readded (for uves)
+
+2008-03-25 14:31 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_compute(): Drop support for
+ CPL 3.X (and earlier)
+
+2008-03-25 14:08 llundin
+
+ * irplib/irplib_plugin.h: Drop IRPLIB_CONCAT(), IRPLIB_CONCAT2X().
+ Define IRPLIB_RECIPE_DEFINE as CPL_RECIPE_DEFINE. Define
+ irplib_get_license as cpl_get_license. Drop naco_get_license()
+
+2008-03-25 13:31 llundin
+
+ * irplib/: irplib_test.c, irplib_test.h: cpl_test.h replaces
+ irplib_test.h
+
+2008-03-25 12:12 llundin
+
+ * irplib/tests/: filter_median_type.c, irplib_detmon-test.c,
+ irplib_detmon_lg-test.c, irplib_filter-test.c, irplib_hist-test.c,
+ irplib_polynomial-test.c, irplib_utils-test.c,
+ irplib_wlxcorr-test.c: cpl_test.h replaces irplib_test.h
+
+2008-03-25 11:31 llundin
+
+ * irplib/irplib_math_const.h: Depend on cpl_math_const.h and issue
+ #warning with gcc
+
+2008-03-25 11:26 llundin
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon-test.c,
+ tests/irplib_detmon_lg-test.c, tests/irplib_polynomial-test.c,
+ tests/irplib_wlxcorr-test.c: Use cpl_math module instead of
+ irplib_math module
+
+2008-03-25 11:10 llundin
+
+ * irplib/: irplib_polynomial.c, irplib_stdstar.c, irplib_strehl.c,
+ tests/irplib_detmon-test.c, tests/irplib_polynomial-test.c: Use
+ cpl_math module instead of irplib_math module
+
+2008-03-25 11:09 llundin
+
+ * irplib/irplib_detmon.c: Use cpl_math module instead of
+ irplib_math module. irplib_detmon_ronbias_master(): Fix uninit
+ warning
+
+2008-03-20 16:30 llundin
+
+ * irplib/irplib_utils.h: error_if(): Fix check of CPL error code
+
+2008-03-20 10:55 llundin
+
+ * irplib/irplib_plugin.c: recipe_msg_set_level_from_env(): Drop.
+ irplib_plugin_test(): Use cpl_msg_set_level(), when CPL_MSG_LEVEL
+ is used, _dump() to /dev/null if not at debug level
+
+2008-03-17 18:33 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: DFS05135. New products added:
+ BP_MAP_HOT, BP_MAP_COLD, BP_MAP_DEV.
+
+2008-03-17 17:26 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h, irplib_detmon_lg.c:
+ New input parameter tolerance added to
+ irplib_get_clean_mean_window().
+
+2008-03-17 17:16 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h, irplib_detmon_lg.c:
+ irplib_get_clean_mean_window() function API changed, kappa int -->
+ double.
+
+2008-03-17 15:28 lbilbao
+
+ * irplib/irplib_detmon.c: Wrong use of frameset (needed for later
+ use by EsoRex) fixed in irplib_detmon_ronbias() and unnecessary
+ duplicated framesets removed. New function
+ irplib_imagelist_collapse_stdev_create() added for later use in
+ deviant pixel map creation.
+
+2008-03-17 13:41 lbilbao
+
+ * irplib/irplib_detmon.c: Bug in SYNTHETIC frame saving fixed.
+
+2008-03-14 19:13 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_get_clean_mean_window() updated to
+ do computation more precisely and faster.
+
+2008-03-14 18:26 lbilbao
+
+ * irplib/irplib_detmon.c: RON/Bias product saving simplified.
+
+2008-03-14 17:42 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon_lg.c: Bug in
+ multi-extension output saving fixed.
+
+2008-03-13 16:16 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: Action on ticket DFS05112.
+ Multi-extension files support provided. Small bug in robustness of
+ histogram computation fixed. Error checking improved overall, moved
+ to skip_if - end_skip scheme. New parameter-filling functions
+ added.
+
+2008-03-13 11:46 yjung
+
+ * hawki/hawki_distortion.c: [no log message]
+
+2008-03-12 16:40 yjung
+
+ * hawki/hawki_distortion.c: improve the shifts map creation
+
+2008-03-10 12:51 yjung
+
+ * configure.ac: version 1.0.0
+
+2008-03-10 10:04 yjung
+
+ * recipes/hawki_img_zpoint.c: added extinction in J H K
+
+2008-03-10 09:55 yjung
+
+ * recipes/hawki_img_zpoint.c: do not output ATX0 if extinction is
+ unknown
+
+2008-03-07 09:50 yjung
+
+ * recipes/hawki_img_dark.c: [no log message]
+
+2008-03-06 10:32 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2008-03-05 13:46 yjung
+
+ * Makefile.am: added catalogs in the dist target
+
+2008-02-28 18:13 amodigli
+
+ * irplib/irplib_detmon.c: fixed English typo in ron/dsnu.method
+ param description
+
+2008-02-28 18:04 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon_lg.c: Info on dark
+ parameters extended. Warnings removed.
+
+2008-02-27 19:17 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Lamp CR (Count Rate) computation
+ deactivated due to lack of template support.
+
+2008-02-22 13:56 yjung
+
+ * recipes/hawki_img_flat.c: [no log message]
+
+2008-02-22 11:25 yjung
+
+ * configure.ac: version 0.5.0
+
+2008-02-22 11:15 yjung
+
+ * hawki/hawki_utils.c, hawki/hawki_utils.h,
+ recipes/hawki_img_zpoint.c, recipes/hawki_util_stdstars.c: added
+ support for the Y filter
+
+2008-02-22 11:05 yjung
+
+ * catalogs/stdstars/: Hawki.txt, UKIRT-Fundamental.txt: added the Y
+ filter
+
+2008-02-22 11:02 yjung
+
+ * recipes/hawki_img_flat.c: implemented the auto-selection process
+
+2008-02-21 16:43 yjung
+
+ * hawki/hawki_utils.h, recipes/hawki_img_dark.c: added QC.DARK.VCi
+ MEAN MED and STDEV
+
+2008-02-21 15:03 yjung
+
+ * recipes/hawki_img_flat.c: [no log message]
+
+2008-02-21 15:02 yjung
+
+ * recipes/hawki_img_flat.c: first implementation of the frames
+ selection
+
+2008-02-21 14:49 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Disable all tests
+
+2008-02-21 11:55 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h, recipes/hawki_img_flat.c:
+ fixed dark subtraction bug
+
+2008-02-21 11:06 yjung
+
+ * catalogs/: dist_map_chip1.txt, dist_map_chip2.txt,
+ dist_map_chip3.txt, dist_map_chip4.txt, stdstars/Hawki.txt,
+ stdstars/UKIRT-Fundamental.txt: added A #comment line on top
+
+2008-02-21 09:31 llundin
+
+ * irplib/tests/irplib_polynomial-test.c: #define MAXDEGREE 3
+
+2008-02-20 15:25 llundin
+
+ * irplib/tests/Makefile.am: clean-local: Added .logfile (*.log)
+
+2008-02-20 14:41 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_2(): Use
+ minimal residual
+
+2008-02-19 16:30 llundin
+
+ * irplib/irplib_polynomial.c: Update coverage comments,
+ irplib_polynomial_solve_1d_3r(): replace assert() with round-off
+ handling
+
+2008-02-19 16:28 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Cover branch in
+ irplib_polynomial_solve_1d_3r()
+
+2008-02-18 10:04 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3(): Drop
+ doall also in subfunctions
+
+2008-02-18 09:44 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3(): Drop
+ doall
+
+2008-02-16 22:35 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Test minimal residual on
+ cubic
+
+2008-02-16 22:34 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_eval_{2,3}_max():
+ Added. irplib_polynomial_solve_1d_{2,3}(): Use minimal residual
+ method
+
+2008-02-15 18:46 llundin
+
+ * irplib/irplib_polynomial.c:
+ irplib_polynomial_solve_1d_3{1,2,r,c}(): Added.
+ irplib_polynomial_solve_1d_3(): Call new functions
+
+2008-02-15 18:44 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): More tests cubic with
+ complex roots
+
+2008-02-15 11:54 llundin
+
+ * irplib/irplib_polynomial.c: irplib_sort3(): Drop.
+ irplib_polynomial_solve_1d_3(): complex-branch: Avoid cancellation
+ on same-sign, Handle truncated imaginary part
+
+2008-02-15 11:51 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): More tests cubic with
+ complex roots
+
+2008-02-15 09:33 lbilbao
+
+ * irplib/tests/: irplib_detmon-test.c, irplib_detmon_lg-test.c:
+ Unnecessary include removed
+
+2008-02-14 23:33 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Added two tests on single
+ real root for cubic
+
+2008-02-14 23:32 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3(): Avoid
+ cancellation on single real root
+
+2008-02-14 21:31 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Added two tests
+
+2008-02-14 21:26 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3():
+ acos-branch: Drop sort, prevent cancellation.
+ irplib_polynomial_solve_1d_4(): c==0-branch: Single swap replaces
+ Bubble-sort
+
+2008-02-14 18:44 lbilbao
+
+ * irplib/tests/Makefile.am: Options for conditional compilation
+ with FFTW added.
+
+2008-02-14 10:53 yjung
+
+ * recipes/hawki_util_gendist.c: PRO TYPE
+
+2008-02-14 10:38 yjung
+
+ * configure.ac: 0.3.0 -> 0.4.0
+
+2008-02-13 16:30 llundin
+
+ * irplib/irplib_plot.c: Drop irplib_utils.h
+
+2008-02-11 13:20 llundin
+
+ * irplib/irplib_utils.h: error_if(), IRPLIB_XSTRINGIFY(),
+ IRPLIB_STRINGIFY(): Added
+
+2008-02-11 12:20 llundin
+
+ * irplib/irplib_stdstar.h: IRPLIB_STDSTAR_LIMIT: Added
+
+2008-02-11 08:54 llundin
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h:
+ irplib_stdstar_great_circle_dist(), IRPLIB_STDSTAR_MAXDIST,
+ IRPLIB_STDSTAR_NOMAG: Export. Replace tabs with spaces, __func__
+ with cpl_func
+
+2008-02-08 17:13 llundin
+
+ * irplib/irplib_stdstar.c: irplib_stdstar_get_mag(): Add warning
+ about buffer overflow
+
+2008-02-07 13:37 llundin
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h:
+ irplib_wlxcorr_find_1d() degshift is a cpl_array
+
+2008-02-07 12:28 lbilbao
+
+ * irplib/irplib_detmon.c: Downgrade to FFTW2
+
+2008-02-06 18:23 llundin
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h, tests/Makefile.am,
+ tests/irplib_wlxcorr-test.c: irplib_wlxcorr_find_1d(): Added stub
+
+2008-02-06 17:44 llundin
+
+ * irplib/irplib_plugin.c: irplib_plugin_test(): Allow
+ <recipe>_exec() to propagate a pre-exisitng error before returning
+
+2008-02-04 15:27 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: New parameters --tolerance and
+ --pafname added.
+
+2008-02-04 09:39 llundin
+
+ * irplib/irplib_plugin.h: irplib_get_license(),
+ IRPLIB_RECIPE_DEFINE(): use CPL when available
+
+2008-02-01 13:49 llundin
+
+ * irplib/irplib_polynomial.c: Improved doxygen
+
+2008-01-31 16:40 llundin
+
+ * irplib/filter_median.c: S_SWAP(): Doxygen
+
+2008-01-31 16:25 llundin
+
+ * irplib/irplib_filter.c: Move /**@{*/ down
+
+2008-01-31 16:22 llundin
+
+ * irplib/filter_median.c: fill_row(): Fix doxygen warning
+
+2008-01-31 14:26 amodigli
+
+ * irplib/irplib_detmon_lg.c: updated ID
+
+2008-01-29 11:12 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all_test(): Try to ensure double-root
+ detection on Darwin
+
+2008-01-24 19:14 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Warning removed
+
+2008-01-22 13:45 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: --bpmbin parameter added to control
+ bad pixel map creation (binary or with values powers of 2), with
+ unit test.
+
+2008-01-21 15:00 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h: Error messages
+ and man-page improved -> DFS04844.
+
+2008-01-21 13:10 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Message warning added and error made
+ zero when fitting not over-determined -> DFS04847.
+
+2008-01-21 08:58 llundin
+
+ * irplib/irplib_filter.h: enum irplib_filter_mode: Drop comma at
+ end of list
+
+2008-01-21 08:56 llundin
+
+ * irplib/: irplib_polynomial.c, tests/irplib_polynomial-test.c:
+ irplib_polynomial_solve_1d_all(): Unsupport degree = 4
+
+2008-01-19 00:53 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_test_root_all(): Verify complex roots.
+ irplib_polynomial_multiply_1d_factor(): Drop internal test.
+ irplib_polynomial_solve_1d_all_test(): Test also quartic
+
+2008-01-19 00:49 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3():
+ Return largest root on single-request from quartic.
+ irplib_polynomial_solve_1d_4(): Ensure sorting in biquadratic +
+ 0real, fix 0.5 bug + un-depress, drop unsupported
+
+2008-01-19 00:43 llundin
+
+ * irplib/irplib_test.c: irplib_test_abs_macro(): Improve message
+
+2008-01-18 19:39 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c:
+ Implementation of irplib_detmon_lg_lineff() made more robust.
+ Change in irplib_detmon_linearity, dif_avg converted into
+ |dif_avg|.
+
+2008-01-18 17:50 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_4():
+ Prototype added (not yet working)
+
+2008-01-18 17:50 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_test_root_all(): Add info on comparison
+
+2008-01-18 14:13 llundin
+
+ * irplib/tests/irplib_polynomial-test.c: irplib_polynomial_add(),
+ irplib_polynomial_multiply_scalar(): Added.
+ irplib_polynomial_multiply_1d_factor(): Support complex roots.
+ irplib_polynomial_solve_1d_all_test(): Test all cases with
+ irplib_polynomial_test_root_all() only
+
+2008-01-18 14:10 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_{2,3}():
+ Takes doubles, instead of a const double *
+
+2008-01-18 11:39 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Bug in determination of bad pixel
+ amount fixed.
+
+2008-01-18 10:48 amodigli
+
+ * irplib/irplib_detmon.c: add more verbosity to a failure message
+ in case dark recipe has no input
+
+2008-01-17 21:26 llundin
+
+ * irplib/filter_median.c: Resolve doxygen warning regarding #
+
+2008-01-17 21:23 llundin
+
+ * irplib/irplib_stdstar.c: irplib_stdstar_get_mag(),
+ irplib_stdstar_write_catalogs(): Resolve doxygen warnings
+
+2008-01-17 20:59 llundin
+
+ * irplib/irplib_polynomial.c: Drop #_cpl_error_code_
+
+2008-01-17 20:42 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_3(): Fix
+ (false) uninit warning
+
+2008-01-17 19:43 llundin
+
+ * irplib/tests/irplib_polynomial-test.c: fix warning
+
+2008-01-17 19:10 llundin
+
+ * irplib/tests/irplib_polynomial-test.c: Improve tests
+
+2008-01-17 16:39 llundin
+
+ * irplib/tests/irplib_polynomial-test.c:
+ irplib_polynomial_test_root_all(): Added
+
+2008-01-17 16:36 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_2(): Sort
+ real roots. Improve doxygen
+
+2008-01-17 11:56 llundin
+
+ * irplib/irplib_polynomial.c: irplib_polynomial_solve_1d_2():
+ Ensure positive imaginary part
+
+2008-01-17 11:47 llundin
+
+ * irplib/: Makefile.am, irplib_polynomial.c, irplib_polynomial.h,
+ tests/Makefile.am, tests/irplib_polynomial-test.c: Added
+ irplib_polynomial with irplib_polynomial_solve_1d_all()
+
+2008-01-17 11:21 llundin
+
+ * irplib/: irplib_test.c, irplib_test.h: irplib_test_error(): Added
+
+2008-01-17 10:20 lbilbao
+
+ * irplib/irplib_detmon_lg.h: Spaces after backslashes removed
+
+2008-01-17 09:57 lbilbao
+
+ * irplib/tests/irplib_detmon_lg-test.c: Test deactivated.
+
+2008-01-17 09:46 lbilbao
+
+ * irplib/tests/: irplib_detmon-test.c, irplib_detmon_lg-test.c:
+ cpl_test -> irplib_test
+
+2008-01-17 09:22 llundin
+
+ * irplib/filter_median.c: #define inline as comment when
+ unsupported
+
+2008-01-16 14:12 amodigli
+
+ * irplib/irplib_detmon_lg.c: issued proper error message in case of
+ failed poly fit
+
+2008-01-16 13:53 amodigli
+
+ * irplib/irplib_detmon_lg.c: issued proper message in case of input
+ data set
+
+2008-01-16 13:49 amodigli
+
+ * irplib/irplib_detmon_lg.h: updated man-page lin-gain
+
+2008-01-16 13:38 amodigli
+
+ * irplib/irplib_detmon_lg.c: made verbose an error message
+
+2008-01-16 13:38 amodigli
+
+ * irplib/irplib_detmon_lg.h: improved lin-gain man page
+
+2008-01-16 11:34 amodigli
+
+ * irplib/irplib_detmon.c: renamed 'ESO QC STDEV' 'ESO QC DARK
+ STDEV'
+
+2008-01-16 11:31 amodigli
+
+ * irplib/irplib_detmon.c: changed 'ESO QC BIAS METHOD BIAS' into
+ 'ESO QC BIAS METHOD VAL' for METHOD=RANDOM|HISTO|REGION
+
+2008-01-09 15:35 yjung
+
+ * recipes/hawki_util_stdstars.c: PRO TYPE key added
+
+2008-01-09 15:35 yjung
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h: new pro_type param
+ for the write_catalogs() function
+
+2008-01-09 15:25 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h, recipes/hawki_img_dark.c,
+ recipes/hawki_img_detlin.c, recipes/hawki_img_flat.c,
+ recipes/hawki_img_illum.c, recipes/hawki_img_jitter.c,
+ recipes/hawki_img_zpoint.c, recipes/hawki_util_distortion.c,
+ recipes/hawki_util_gendist.c, recipes/hawki_util_stitch.c: added
+ PRO TYPE keys in the products
+
+2008-01-08 16:40 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Downgrade of FFTW-dependant code from
+ FFTW3 to FFTW2
+
+2008-01-07 10:33 yjung
+
+ * recipes/hawki_img_dark.c: Changed QC params
+
+2008-01-04 13:54 yjung
+
+ * hawki/hawki_dfs.c, hawki/hawki_dfs.h, recipes/hawki_img_dark.c,
+ recipes/hawki_img_flat.c: changed BPM PRO.CATG
+
+2008-01-04 11:05 yjung
+
+ * hawki/hawki_dfs.c, hawki/hawki_dfs.h, recipes/hawki_img_dark.c,
+ recipes/hawki_img_flat.c, recipes/hawki_img_illum.c,
+ recipes/hawki_img_jitter.c, recipes/hawki_img_zpoint.c: changed PRO
+ keys
+
+2007-12-19 18:57 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Memory leaks fixed. Error and memory
+ handling changed in irplib_detmon_lg_save() to skip_if-end_skip
+ scheme for that reason.
+
+2007-12-19 18:21 lbilbao
+
+ * irplib/irplib_detmon.c: Memory leak and uninitialized values
+ fixed.
+
+2007-12-14 09:48 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Error in GAIN_CORR computation fixed.
+
+2007-12-13 18:45 lbilbao
+
+ * irplib/irplib_detmon.c: Error fixed and final modification in
+ irplib_get_clean_mean_window().
+
+2007-12-13 12:10 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon_lg-test.c: Memory
+ leaks fixed.
+
+2007-12-13 09:23 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: Changes in
+ irplib_get_clean_mean_window() to speed it up by a factor 5.
+
+2007-12-12 14:21 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Doxygen info added for all resting
+ functions.
+
+2007-12-12 12:12 lbilbao
+
+ * irplib/tests/: irplib_detmon-test.c, irplib_detmon_lg-test.c:
+ Removal of products simplified in irplib_detmon-test and added to
+ irplib_detmon_lg-test.
+
+2007-12-12 12:01 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c: New
+ unit tests added to irplib_detmon_lg-test.c and failures detected
+ by those new tests in irplib_detmon_lg() fixed.
+
+2007-12-11 18:39 lbilbao
+
+ * irplib/irplib_detmon.c: Bug in
+ irplib_detmon_ronbias_check_defaults() fixed.
+
+2007-12-11 16:45 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: Unused parameters --threshold_min,
+ --threshold_max and --threshold removed.
+
+2007-12-11 15:06 lbilbao
+
+ * irplib/irplib_detmon_lg.c: irplib_detmon_gain() modified to make
+ use of skip_if-end_skip scheme.
+
+2007-12-11 14:47 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Bug in irplib_detmon_gain() fixed.
+ Unnecessary variable fit_table removed overall. Other minor
+ warnings fixed.
+
+2007-12-11 11:50 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Doxygen info added.
+
+2007-12-10 15:30 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c: Bug
+ fixed. Unit test activated and frameset creation modified.
+
+2007-12-04 19:51 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c:
+ Linearity polynomial definition changed back. Effective linearity
+ correction applied. Error checking improved at some points. Bug in
+ irplib_detmon_lg_opt_lampcr() fixed. Changes in
+ irplib_detmon_lg_split_onoff(). Some doxygen information added.
+ Unit test inputs adapted.
+
+2007-11-30 15:47 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2007-11-30 15:44 yjung
+
+ * recipes/hawki_img_zpoint.c: added --detect_sigma option
+
+2007-11-29 14:27 lbilbao
+
+ * irplib/irplib_detmon.c: Forgotten instruction to destroy
+ fftw_plan added.
+
+2007-11-29 14:25 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Modifications on some pointers to make
+ code clearer.
+
+2007-11-28 16:54 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Bug in previous commit fixed.
+
+2007-11-28 16:44 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Overall changes to process
+ multi-extension cases in a more efficient way, loading just an
+ extension at a time instead of all together.
+
+2007-11-27 18:08 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: Drop unnecessary
+ functions irplib_detmon_{image, propertylist, table,
+ imagelist}_{new, delete}().
+
+2007-11-27 18:04 lbilbao
+
+ * irplib/: irplib_detmon_body.h, Makefile.am: Drop
+ irplib_detmon_body.h
+
+2007-11-27 17:35 lbilbao
+
+ * irplib/irplib_detmon.c: FFTW part of
+ irplib_detmon_pernoise_reduce() changed to use
+ fftwf_plan_many_dft_r2c().
+
+2007-11-23 16:26 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: New parameter --pix2pix
+
+2007-11-23 10:41 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Fitted polynomial for linearity
+ modified.
+
+2007-11-22 15:03 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Some memory leaks fixed.
+
+2007-11-22 13:03 yjung
+
+ * hawki/hawki_distortion.c: [no log message]
+
+2007-11-22 13:00 yjung
+
+ * hawki/hawki_distortion.c: made dependant of CPL 4.1 by using
+ cpl_image_warp
+
+2007-11-21 13:14 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Some memory
+ leaks fixed.
+
+2007-11-20 16:52 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Method used to compute GAIN written
+ also as QC parameter.
+
+2007-11-20 16:18 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c: Bug
+ fixed in irplib_detmon_lg() - OPT case - specific unit test.
+
+2007-11-20 15:18 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Error checking improved in
+ irplib_detmon_lg_qc_ptc().
+
+2007-11-20 11:18 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Variable median[] initialised in
+ function irplib_detmon_opt_contamination().
+
+2007-11-20 11:14 lbilbao
+
+ * irplib/irplib_detmon_lg.c: AUTOCORR and LAMP FLUX only copied
+ when computed (to avoid to copy initialisation (meaningless)
+ values). Error checking added in irplib_detmon_opt_contamination().
+
+2007-11-19 19:21 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: Avoid to write OPT-specific
+ parameters in NIR case; changes in irplib_detmon_lg_fill_parlist()
+ and irplib_detmon_lg_retrieve_parlist(), API included to receive
+ OPT/NIR boolean.
+
+2007-11-19 18:50 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: irplib_detmon_fill_params() changed
+ into irplib_detmon_lg_fill_parlist() and
+ irplib_detmon_fill_params_default() into 2 functions,
+ irplib_detmon_lg_fill_parlist_nir_default() and
+ irplib_detmon_lg_fill_parlist_opt_default().
+
+2007-11-19 18:08 lbilbao
+
+ * irplib/tests/irplib_detmon_lg-test.c: New unit test added for
+ cases with more than a setting.
+
+2007-11-19 15:53 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, tests/irplib_detmon_lg-test.c:
+ Change in DIT extraction; DIT keyword is read in NIR case, WIN1
+ UIT1 when OPT. As a consequence, changes in test files' creation
+ functions in irplib_detmon_lg-test.c. Error checking improved in
+ irplib_detmon_pair_extract (API changed to return a cpl_error_code.
+
+2007-11-19 14:47 lbilbao
+
+ * irplib/irplib_detmon.h: API of function
+ irplib_detmon_fill_parlist() changed.
+
+2007-11-19 12:45 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_ronbias_check_defaults()
+ function modified to retrieve PRE-/OVERSCAN parameters from input
+ FITS header.
+
+2007-11-19 10:48 llundin
+
+ * irplib/irplib_plugin.c: irplib_parameterlist_get_*(): Improved
+ error handling
+
+2007-11-16 16:39 jmlarsen
+
+ * irplib/tests/irplib_filter-test.c: Implemented median filter
+ border mode: extrapolate. Decreased test image sizes
+
+2007-11-16 16:38 jmlarsen
+
+ * irplib/tests/filter_median_type.c: Removed first call of
+ irplib_image_filter, did not work with image size 1x1 and radii 0
+
+2007-11-16 16:36 jmlarsen
+
+ * irplib/irplib_filter.c: Implemented median filter border mode:
+ extrapolate
+
+2007-11-16 16:35 jmlarsen
+
+ * irplib/filter_median.c: Implemented border mode: extrapolate
+
+2007-11-16 14:51 jmlarsen
+
+ * irplib/tests/filter_median_type.c: IRPLIB_FILTER_BORDER_COPY: Use
+ constant extrapolation
+
+2007-11-16 14:29 jmlarsen
+
+ * irplib/: irplib_filter.c, tests/filter_median_type.c,
+ tests/irplib_filter-test.c: Implemented median filter border mode:
+ copy
+
+2007-11-16 14:28 jmlarsen
+
+ * irplib/filter_median.c: Implemented border mode: copy
+
+2007-11-16 12:20 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE(): Warning/Info
+ message replaces failure on CPL run-/compile-version mismatch
+
+2007-11-16 12:02 lbilbao
+
+ * irplib/irplib_detmon_lg.c: New function added
+ irplib_detmon_lg_lamp_stab() to compute lamp stability.
+
+2007-11-16 08:57 jmlarsen
+
+ * irplib/tests/irplib_filter-test.c: Implemented median filter
+ border mode: filter
+
+2007-11-16 08:56 jmlarsen
+
+ * irplib/tests/filter_median_type.c: Changed selection of
+ lower/higher median for border mode IRPLIB_FILTER_BORDER_FILTER
+
+2007-11-16 08:52 jmlarsen
+
+ * irplib/irplib_filter.c: Implemented median filtering border mode:
+ filter
+
+2007-11-16 08:52 jmlarsen
+
+ * irplib/: filter_median.c, irplib_filter_double.c,
+ irplib_filter_float.c, irplib_filter_int.c: Implemented border
+ mode: filter
+
+2007-11-15 17:44 lbilbao
+
+ * irplib/tests/irplib_detmon_lg-test.c: #if defined added to avoid
+ error due to CPL HEAD dependency of the function to be checked.
+
+2007-11-15 17:38 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Variable name changed to a more
+ descriptive one (procatg_lincoeff -> procatg_coeffscube).
+
+2007-11-15 17:18 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Parameter --rescale to
+ activate/deactivate rescaling of ON/OFF frames introduced.
+
+2007-11-15 16:44 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Unnecessary variable x_pos removed
+ from several places. #if defined statement corrected. QC parameters
+ for fitting errors added. Bug in linearity polynomial computation
+ fixed.
+
+2007-11-15 15:08 jmlarsen
+
+ * irplib/tests/filter_median_type.c: Removed dead code
+
+2007-11-15 13:53 jmlarsen
+
+ * irplib/tests/filter_median_type.c: Do not compare numbers if
+ filtering function fails
+
+2007-11-15 13:52 jmlarsen
+
+ * irplib/: irplib_filter.c, tests/irplib_filter-test.c: Implemented
+ median filtering border mode: crop
+
+2007-11-15 13:47 jmlarsen
+
+ * irplib/filter_median.c: Implemented border mode: crop
+
+2007-11-14 17:53 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Modify saving of data-cube to be
+ compliant with CPL4.0.1
+
+2007-11-14 17:51 jmlarsen
+
+ * irplib/tests/irplib_filter-test.c: Test with non-quadratic images
+ and kernels
+
+2007-11-14 17:41 jmlarsen
+
+ * irplib/tests/filter_median_type.c: Removed line breaks from
+ message strings
+
+2007-11-14 17:39 jmlarsen
+
+ * irplib/irplib_filter.c: Support median filtering with
+ non-quadratic images and kernels
+
+2007-11-14 17:36 jmlarsen
+
+ * irplib/filter_median.c: Make work with non-quadratic kernels
+
+2007-11-14 16:54 jmlarsen
+
+ * irplib/filter_median.c: Support non-quadratic images
+
+2007-11-14 16:31 llundin
+
+ * irplib/irplib_detmon.c: irplib_detmon_ronbias_random(): Fixed
+ (false) uninit warning
+
+2007-11-14 16:25 jmlarsen
+
+ * irplib/tests/irplib_filter-test.c: Print debugging statements at
+ debug, not warning, message level
+
+2007-11-14 16:23 jmlarsen
+
+ * irplib/tests/irplib_filter-test.c: Prepare for testing with
+ non-quadratic images/kernels
+
+2007-11-14 16:21 jmlarsen
+
+ * irplib/tests/filter_median_type.c: Allow non-quadratic kernels
+
+2007-11-14 16:20 jmlarsen
+
+ * irplib/irplib_filter.c: Support hsizex = 0 and/or hsizey = 0
+
+2007-11-14 16:19 jmlarsen
+
+ * irplib/filter_median.c: Support radius = (0, 0)
+
+2007-11-14 12:58 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Datacube saving for multi-extension
+ case added.
+
+2007-11-14 12:21 lbilbao
+
+ * irplib/irplib_detmon.c: Change in irplib_detmon_ronbias() to
+ support processing on difference frames.
+
+2007-11-14 11:42 yjung
+
+ * configure.ac: 0.2.0 -> 0.3.0
+
+2007-11-13 16:47 yjung
+
+ * recipes/hawki_util_stitch.c: [no log message]
+
+2007-11-13 16:00 yjung
+
+ * recipes/: Makefile.am, hawki_util_stitch.c: [no log message]
+
+2007-11-13 15:37 yjung
+
+ * hawki/hawki_distortion.c: [no log message]
+
+2007-11-13 15:26 yjung
+
+ * hawki/: hawki_distortion.c, hawki_distortion.h: [no log message]
+
+2007-11-13 14:19 llundin
+
+ * irplib/irplib_test.h: cpl_test_init(): Take also
+ PACKAGE_BUGREPORT
+
+2007-11-13 13:42 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Change in irplib_detmon_lg() to make
+ irplib_detmon_lg_check_defaults() usable for AMBER and other cases
+ at the same time.
+
+2007-11-13 11:44 yjung
+
+ * hawki/: hawki_distortion.c, hawki_distortion.h, hawki_utils.c,
+ hawki_utils.h: [no log message]
+
+2007-11-13 11:40 yjung
+
+ * recipes/: hawki_img_jitter.c, hawki_util_distortion.c: [no log
+ message]
+
+2007-11-12 18:33 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h: New
+ AMBER-specific recipe added for testing purposes. Necessary
+ modifications done in irplib_detmon_lg(), including API change to
+ get a pointer to AMBER-specific function.
+
+2007-11-12 12:50 yjung
+
+ * recipes/hawki_util_distortion.c: [no log message]
+
+2007-11-12 12:16 yjung
+
+ * hawki/: hawki_dfs.c, hawki_dfs.h: [no log message]
+
+2007-11-09 15:57 lbilbao
+
+ * irplib/: irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/irplib_detmon_lg-test.c: irplib_detmon_lg() API changed to
+ enable a new feature needed to process AMBER data.
+
+2007-11-09 14:04 llundin
+
+ * irplib/: irplib_test.c, irplib_test.h: CPL test macros used when
+ available
+
+2007-11-08 17:53 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Change ir PAF creation
+ (multi-extension case) to get mandatory keywords from both primary
+ and extension headers.
+
+2007-11-08 15:37 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Partial change in
+ irplib_detmon_lg_save() to save linearity coefficients into a data
+ cube (done only for no-extension case).
+
+2007-11-08 13:27 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-11-08 12:05 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Some warnings fixed.
+
+2007-11-08 12:03 lbilbao
+
+ * irplib/tests/irplib_detmon_lg-test.c: Unnecessary #define REGEXP
+ removed (now in irplib_detmon_lg.h).
+
+2007-11-08 11:28 yjung
+
+ * recipes/: hawki_img_illum.c, hawki_img_jitter.c: [no log message]
+
+2007-11-08 11:23 yjung
+
+ * hawki/: hawki_distortion.c, hawki_distortion.h: [no log message]
+
+2007-11-08 11:20 yjung
+
+ * hawki/Makefile.am: [no log message]
+
+2007-11-08 11:11 yjung
+
+ * hawki/: hawki_utils.c, hawki_utils.h: [no log message]
+
+2007-11-08 10:57 yjung
+
+ * hawki/: hawki_utils.c, hawki_utils.h: [no log message]
+
+2007-11-07 17:24 lbilbao
+
+ * irplib/irplib_detmon_lg.c: New CRIRES-specific recipe added for
+ testing purposes. Some needed changes in irplib_detmon_lg_save()
+ related to correction PAF creation in multi-extension cases.
+
+2007-11-07 14:24 lbilbao
+
+ * irplib/irplib_detmon_lg.h: New SINFONI-specific recipe added for
+ testing purposes.
+
+2007-11-07 10:38 lbilbao
+
+ * irplib/irplib_detmon_lg.c: Errors in QC parameters' names and
+ corresponding comments fixed.
+
+2007-11-06 18:48 lbilbao
+
+ * irplib/: Makefile.am, irplib_detmon.c, irplib_detmon.h,
+ irplib_detmon_body.h, irplib_detmon_lg.c, irplib_detmon_lg.h,
+ tests/Makefile.am, tests/irplib_detmon-test.c,
+ tests/irplib_detmon_lg-test.c: irplib_detmon module splitted. New
+ module irplib_detmon_lg with Lin/Gain functions.
+
+2007-11-06 17:06 lbilbao
+
+ * irplib/Makefile.am: Bug introduced in previous erroneus commit
+ fixed
+
+2007-11-06 16:59 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h, irplib_detmon_body.h,
+ Makefile.am: API change in irplib_detmon_lg() (return changed from
+ int to cpl_error_code. Changes in error checking overall the same
+ function to meet skip_if - end_skip model. New functions
+ irplib_detmon_{table, propertylist, imagelist, image}_{new, delete}
+ to ease multi-extension support. New file irplib_detmon_body.h for
+ these functions.
+
+2007-11-06 16:04 yjung
+
+ * recipes/hawki_img_illum.c: add subtraction of the next images
+
+2007-11-06 15:14 yjung
+
+ * hawki/hawki_dfs.h: [no log message]
+
+2007-11-06 15:14 yjung
+
+ * recipes/hawki_img_zpoint.c: add check product
+
+2007-11-06 14:41 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h, hawki/hawki_utils.c,
+ hawki/hawki_utils.h, recipes/hawki_img_dark.c,
+ recipes/hawki_img_flat.c, recipes/hawki_img_zpoint.c,
+ recipes/hawki_util_distortion.c: [no log message]
+
+2007-11-06 13:42 yjung
+
+ * hawki/: hawki_dfs.c, hawki_dfs.h: [no log message]
+
+2007-11-06 11:58 yjung
+
+ * recipes/hawki_img_flat.c: [no log message]
+
+2007-11-06 11:41 yjung
+
+ * recipes/hawki_img_jitter.c: allow big offsets through command
+ line options
+
+2007-11-06 11:16 yjung
+
+ * hawki/hawki_dfs.h, hawki/hawki_utils.c, hawki/hawki_utils.h,
+ recipes/hawki_img_dark.c, recipes/hawki_img_flat.c: added options
+ and products
+
+2007-11-05 16:48 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_sprintf moved to cpl_sprintf.
+ Error checking changed to skip_if style in irplib_detmon_lg(),
+ irplib_detmon_lg_reduce() and irplib_detmon_lg_reduce_all(). New
+ creation functions added to encapsulate initialisation of
+ multi-extension objects. clreturn_if macro unused and removed.
+
+2007-11-05 15:16 lbilbao
+
+ * irplib/irplib_detmon.c: Redefinition of QC parameters according
+ to DFO's requirements. Adaptation to these redefinitions in
+ functions irplib_detmon_lg_qc_ptc() and irplib_detmon_lg_qc_med().
+ Error checking in these functions improved with the use of skip_if
+ macro.
+
+2007-11-05 12:49 lbilbao
+
+ * irplib/irplib_detmon.c: New function irplib_detmon_lg_qc_med().
+ Error checking clarified overall.
+
+2007-11-05 11:59 lbilbao
+
+ * irplib/irplib_detmon.c: Some warnings in
+ irplib_detmon_lg_reduce_dit() and irplib_detmon_lg_reduce_all()
+ fixed.
+
+2007-11-02 17:10 llundin
+
+ * irplib/: irplib_filter.c, irplib_filter_body.c:
+ irplib_image_filter(): Allow reciprocal multiplication in averaging
+
+2007-11-02 10:47 llundin
+
+ * irplib/irplib_filter_body.c: irplib_image_filter_*_*(): Drop
+ variable j
+
+2007-11-02 10:17 llundin
+
+ * irplib/: filter_median.c, irplib_filter.c, irplib_filter.h,
+ irplib_filter_body.c, tests/filter_median_type.c,
+ tests/irplib_filter-test.c: IRPLIB_FILTER_BORDER_FILTER replaces
+ IRPLIB_FILTER_BORDER_ANY
+
+2007-11-01 09:37 llundin
+
+ * irplib/tests/: filter_median_type.c, irplib_filter-test.c:
+ Replace CPL average ref with two alternative refs (bf and uves).
+ Enable more tests for averaging, drop tol for median back to zero
+
+2007-10-31 17:45 llundin
+
+ * irplib/tests/filter_median_type.c: Lower bar on double
+
+2007-10-31 17:42 llundin
+
+ * irplib/tests/irplib_filter-test.c: Disable some average modes not
+ supported by brute force
+
+2007-10-31 17:42 llundin
+
+ * irplib/tests/filter_median_type.c: warning -> info
+
+2007-10-31 17:41 llundin
+
+ * irplib/irplib_filter_body.c: 1st working prototype
+
+2007-10-31 16:05 llundin
+
+ * irplib/tests/: filter_median_type.c, irplib_filter-test.c:
+ filter_average_bf(): Added
+
+2007-10-31 15:13 llundin
+
+ * irplib/tests/irplib_filter-test.c: Loop over filter mode
+ (IRPLIB_FILTER_MEDIAN, IRPLIB_FILTER_AVERAGE with error calls, do
+ not enable actual test of IRPLIB_FILTER_AVERAGE
+
+2007-10-31 15:12 llundin
+
+ * irplib/: irplib_filter.c, irplib_filter_body.c:
+ irplib_image_filter(): Allow r=0 in one dim.
+ irplib_image_filter_*_*(): int replaces unsigned, use ACCU_TYPE for
+ accumulation, Add prototype body
+
+2007-10-31 09:56 lbilbao
+
+ * irplib/irplib_detmon.c: const modifier added in API of function
+ irplib_detmon_lg_reduce_all() and subsequently to several
+ variables.
+
+2007-10-30 18:10 llundin
+
+ * irplib/: Makefile.am, irplib_filter.c, irplib_filter_body.c:
+ irplib_image_filter(): Add stubs for average filter
+
+2007-10-30 17:27 llundin
+
+ * irplib/irplib_filter.c: irplib_image_filter(): Prep for
+ IRPLIB_FILTER_AVERAGE support
+
+2007-10-30 16:56 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: --method parameter added to
+ irplib_detmon_lg(), to choose between PTC and MED. New function
+ irplib_detmon_lg_qc_ptc() for the 1. method. As a consequence, API
+ change in irplib_detmon_fill_params(). API change in
+ irplib_detmon_linearity(), too, to make it capable to manage all
+ posible cases in a single call.
+
+2007-10-30 11:32 lbilbao
+
+ * irplib/irplib_detmon.c: clreturn_if unused macro removed from
+ irplib_detmon_lg_reduce(). Bug in the creation of opt_offs variable
+ (in the same function) fixed.
+
+2007-10-30 11:12 lbilbao
+
+ * irplib/irplib_detmon.c: Minor changes in
+ irplib_detmon_pair_extract() to avoid failure in Solaris machines
+
+2007-10-30 09:34 lbilbao
+
+ * irplib/: irplib_detmon.h, tests/irplib_detmon-test.c: Untabified
+
+2007-10-29 19:26 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_ilist_load_fset() modified
+ to be used for framesets with any number of frames (not only 2).
+ This function is used then in irplib_detmon_lg_reduce_dit(),
+ removing a piece of code.
+
+2007-10-29 18:57 lbilbao
+
+ * irplib/irplib_detmon.c: Modifications in
+ irplib_detmon_lg_reduce_dit() to make the code cleaner.
+
+2007-10-29 18:14 lbilbao
+
+ * irplib/irplib_detmon.c: New function added
+ irplib_detmon_lg_reduce_dit() to encapsulate some code previously
+ in irplib_detmon_lg_reduce().
+
+2007-10-29 15:35 lbilbao
+
+ * irplib/irplib_detmon.c: Some tabs removed. Some functions
+ redefined as static.
+
+2007-10-29 14:58 llundin
+
+ * irplib/tests/filter_median_type.c: test_irplib_image_filter_*():
+ call memset only on IRPLIB_FILTER_BORDER_NOP
+
+2007-10-29 13:16 lbilbao
+
+ * irplib/irplib_detmon.c: New function added
+ irplib_detmon_pair_extract() to encapsulate some code previously in
+ irplib_detmon_lg_reduce().
+
+2007-10-29 09:53 cguirao
+
+ * Makefile.purify.in, configure.ac, m4macros/purify.m4: NRI
+ compliant
+
+2007-10-26 16:36 llundin
+
+ * irplib/: filter_median.c, irplib_filter.h,
+ tests/filter_median_type.c, tests/irplib_filter-test.c:
+ IRPLIB_FILTER_BORDER_NOP replaces IRPLIB_FILTER_BORDER_COPY as
+ default
+
+2007-10-26 16:01 llundin
+
+ * irplib/: filter_median.c, irplib_filter.c, irplib_filter.h,
+ tests/filter_median_type.c, tests/irplib_filter-test.c:
+ IRPLIB_FILTER_BORDER_ANY replaces IRPLIB_FILTER_BORDER_LOWER
+
+2007-10-26 14:39 llundin
+
+ * irplib/irplib_filter.c: Document lack of support for bad pixels
+
+2007-10-26 14:22 llundin
+
+ * irplib/tests/filter_median_type.c:
+ test_irplib_image_filter_{double,float,int}(): test of
+ irplib_image_filter() replaces test of
+ irplib_image_filter_{double,float,int}()
+
+2007-10-26 14:06 llundin
+
+ * irplib/: filter_median.c, irplib_filter.c,
+ tests/filter_median_type.c, tests/irplib_filter-test.c:
+ filter_median_1(): Support border-lower-median
+
+2007-10-26 10:53 lbilbao
+
+ * irplib/irplib_detmon.c: New function added
+ irplib_detmon_ilist_load_frameset() to encapsulate some code
+ previously in irplib_detmon_lg_reduce().
+
+2007-10-25 17:21 jmlarsen
+
+ * irplib/filter_median.c: Fixed documentation of probabilities for
+ 3x3 filtering, added doxygen doc
+
+2007-10-25 17:18 jmlarsen
+
+ * irplib/irplib_filter.c: Added doxygen end marker
+
+2007-10-25 16:42 lbilbao
+
+ * irplib/irplib_detmon.c: Comment moved to the proper place.
+
+2007-10-25 15:57 lbilbao
+
+ * irplib/irplib_detmon.c: Change in irplib_detmon_gain() to speed
+ execution for optical recipe.
+
+2007-10-25 15:32 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: --filter option added to filter images
+ with a median flux value higher than the one given by the user
+ (change in API of function irplib_detmon_fill_params()). Update of
+ the QC parameters (bug in GAIN FIT computation fixed, new QC
+ parameters added). Small bug in
+ irplib_detmon_autocorrelation_factor() fixed.
+
+2007-10-25 15:16 llundin
+
+ * irplib/: filter_median.c, tests/filter_median_type.c,
+ tests/irplib_filter-test.c: Support and test
+ IRPLIB_FILTER_BORDER_CROP for r=1
+
+2007-10-25 15:15 llundin
+
+ * irplib/tests/irplib_filter-test.c: Add macro BENCHSIZE for bench
+ mark calls
+
+2007-10-25 11:25 llundin
+
+ * irplib/tests/irplib_filter-test.c: Test border modes copy and
+ crop via loop
+
+2007-10-24 17:11 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: API of irplib_detmon_lg() changed to
+ pass a regexp to the function signalling which instrument-specific
+ keywords must be copied to the PAF file.
+
+2007-10-24 15:45 lbilbao
+
+ * irplib/irplib_detmon.c: Comments added to QC parameters. Old
+ ifdef (CPL 3.1) removed.
+
+2007-10-23 18:37 lbilbao
+
+ * irplib/irplib_detmon.c: Additional check for --intermediate
+ option added.
+
+2007-10-23 17:26 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Bug in previous modification
+ fixed
+
+2007-10-23 17:12 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Remove more testing products
+
+2007-10-23 17:03 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Remove testing products
+
+2007-10-23 16:14 lbilbao
+
+ * irplib/irplib_detmon.c: Changes in irplib_detmon_lg_save() to
+ load keywords from input file's extension header into product
+ file's extension header.
+
+2007-10-23 10:07 llundin
+
+ * irplib/tests/: filter_median_type.c, irplib_filter-test.c: Drop
+ stdbool.h
+
+2007-10-22 15:24 llundin
+
+ * irplib/: filter_median.c, irplib_filter.c, irplib_filter.h,
+ tests/filter_median_type.c, tests/irplib_filter-test.c: Add
+ IRPLIB_FILTER_BORDER_CROP, IRPLIB_FILTER_BORDER_COPY (r=1) with
+ unit tests
+
+2007-10-22 15:21 llundin
+
+ * irplib/irplib_test.c: Time the unit tests
+
+2007-10-22 14:48 llundin
+
+ * irplib/tests/Makefile.am: Move filter test one down
+
+2007-10-22 12:44 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Imagesize reduced in unit
+ tests
+
+2007-10-22 11:02 llundin
+
+ * irplib/filter_median.c: Drop stdbool.h
+
+2007-10-22 10:25 llundin
+
+ * irplib/: filter_median.c, irplib_filter_double.c,
+ irplib_filter_float.c, irplib_filter_int.c: filter_median():
+ Support different pixel types in input and output
+
+2007-10-20 12:47 llundin
+
+ * irplib/tests/: filter_median_type.c, irplib_filter-test.c: Add
+ unit test for rectangular images, Rx=Ry=1
+
+2007-10-20 03:06 yjung
+
+ * recipes/: hawki_img_flat.c, hawki_img_dark.c, hawki_img_flat.c:
+ [no log message]
+
+2007-10-20 02:34 yjung
+
+ * hawki/: hawki_pfits.c, hawki_pfits.h: [no log message]
+
+2007-10-20 01:54 yjung
+
+ * recipes/hawki_img_flat.c: classify by DIT
+
+2007-10-20 01:48 yjung
+
+ * recipes/hawki_img_dark.c: add sigma as a input and apply average
+ with rejection
+
+2007-10-19 22:56 llundin
+
+ * irplib/: filter_median.c, irplib_filter.c,
+ irplib_filter_double.c, irplib_filter_float.c, irplib_filter_int.c:
+ Support rectangular images (for r=1) - NO UNIT TEST YET
+
+2007-10-19 22:37 llundin
+
+ * irplib/: irplib_filter.c, irplib_filter.h,
+ irplib_filter_double.c, irplib_filter_float.c, irplib_filter_int.c,
+ tests/filter_median_type.c: Prepare for supporting Nx X Ny, Rx X Ry
+
+2007-10-19 21:06 llundin
+
+ * irplib/filter_median.c: filter_median_1(): Fix (false) uninit
+ warning
+
+2007-10-19 16:07 llundin
+
+ * irplib/tests/filter_median_type.c: Put timings in same message
+
+2007-10-19 15:52 llundin
+
+ * irplib/tests/irplib_filter-test.c: Add some more tests
+
+2007-10-19 15:51 llundin
+
+ * irplib/tests/filter_median_type.c: cpl_msg_info/error() replaces
+ printf()
+
+2007-10-19 15:23 jmlarsen
+
+ * irplib/irplib_filter.c: Added check of input/output type
+ consistency
+
+2007-10-19 15:22 jmlarsen
+
+ * irplib/tests/Makefile.am: Added filter_median_type.c to
+ distributions
+
+2007-10-19 15:21 jmlarsen
+
+ * irplib/Makefile.am: Added filter_median.c to distributions
+
+2007-10-19 14:36 llundin
+
+ * irplib/: Makefile.am, filter_median.c, irplib_filter.c,
+ irplib_filter.h, irplib_filter_double.c, irplib_filter_float.c,
+ irplib_filter_int.c, tests/Makefile.am, tests/filter_median_type.c,
+ tests/irplib_filter-test.c: Added module irplib_filter with unit
+ tests
+
+2007-10-19 07:04 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-10-18 02:29 yjung
+
+ * hawki/hawki_utils.h: [no log message]
+
+2007-10-18 02:29 yjung
+
+ * recipes/: hawki_img_illum.c, hawki_img_zpoint.c: photometry
+ aperture computed from the star fwhm
+
+2007-10-18 01:36 yjung
+
+ * recipes/hawki_img_zpoint.c: photometry aperture uses the fwhm
+
+2007-10-17 03:58 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-10-17 02:43 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-10-16 22:58 yjung
+
+ * recipes/: hawki_img_zpoint.c, hawki_img_zpoint.c: [no log
+ message]
+
+2007-10-16 22:38 yjung
+
+ * recipes/hawki_img_illum.c: [no log message]
+
+2007-10-16 20:20 yjung
+
+ * recipes/hawki_img_illum.c: [no log message]
+
+2007-10-16 11:50 lbilbao
+
+ * irplib/irplib_detmon.c: Doxygen info of irplib_detmon_lg()
+ updated.
+
+2007-10-16 05:38 yjung
+
+ * hawki/hawki_pfits.c: add support for OPEN and open
+
+2007-10-16 04:28 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-10-16 04:16 yjung
+
+ * irplib/irplib_stdstar.c, irplib/irplib_stdstar.h,
+ recipes/hawki_img_zpoint.c: [no log message]
+
+2007-10-16 03:48 yjung
+
+ * catalogs/stdstars/UKIRT-Fundamental.txt: [no log message]
+
+2007-10-16 03:42 yjung
+
+ * recipes/hawki_img_illum.c, recipes/hawki_img_zpoint.c,
+ hawki/hawki_dfs.h, hawki/hawki_utils.c, hawki/hawki_utils.h: [no
+ log message]
+
+2007-10-15 23:51 yjung
+
+ * recipes/: Makefile.am, hawki_util_gendata.c,
+ hawki_util_harmonize.c, hawki_util_lsbg.c, hawki_util_split.c,
+ hawki_util_stitch.c, hawki_util_test.c: [no log message]
+
+2007-10-15 21:12 yjung
+
+ * recipes/hawki_img_illum.c: [no log message]
+
+2007-10-15 21:04 yjung
+
+ * hawki/hawki_dfs.h, recipes/hawki_img_illum.c: [no log message]
+
+2007-10-15 04:00 yjung
+
+ * recipes/hawki_img_illum.c: [no log message]
+
+2007-10-15 03:53 yjung
+
+ * recipes/hawki_img_illum.c: [no log message]
+
+2007-10-15 03:00 yjung
+
+ * hawki/: hawki_utils.c, hawki_utils.h: added cpl_bivector *
+ hawki_get_offsets(cpl_frameset * fset)
+
+2007-10-15 02:13 yjung
+
+ * recipes/hawki_img_illum.c: [no log message]
+
+2007-10-15 02:04 yjung
+
+ * hawki/hawki_dfs.h: [no log message]
+
+2007-10-15 01:40 yjung
+
+ * hawki/: hawki_dfs.c, hawki_dfs.h: [no log message]
+
+2007-10-15 01:22 yjung
+
+ * recipes/: hawki_img_illum.c, Makefile.am: [no log message]
+
+2007-10-15 00:48 yjung
+
+ * configure.ac, hawki/hawki_utils.c, hawki/hawki_utils.h: [no log
+ message]
+
+2007-10-14 21:44 yjung
+
+ * hawki/hawki_dfs.h, recipes/hawki_util_gendist.c: [no log message]
+
+2007-10-14 20:58 yjung
+
+ * catalogs/: dist_map.txt, dist_map_chip1.txt, dist_map_chip2.txt,
+ dist_map_chip3.txt, dist_map_chip4.txt: [no log message]
+
+2007-10-14 05:10 yjung
+
+ * recipes/hawki_util_gendist.c: [no log message]
+
+2007-10-14 04:43 yjung
+
+ * hawki/hawki_utils.c: [no log message]
+
+2007-10-14 04:38 yjung
+
+ * hawki/hawki_dfs.h, recipes/hawki_img_jitter.c,
+ recipes/hawki_util_stitch.c: added stitched in jitter
+
+2007-10-14 04:17 yjung
+
+ * hawki/hawki_utils.c, hawki/hawki_utils.h,
+ recipes/hawki_util_stitch.c: [no log message]
+
+2007-10-14 01:34 yjung
+
+ * recipes/hawki_util_stitch.c: [no log message]
+
+2007-10-14 00:44 yjung
+
+ * recipes/hawki_img_jitter.c, hawki/hawki_saa.c: [no log message]
+
+2007-10-14 00:17 yjung
+
+ * recipes/hawki_img_jitter.c: Add the SKY frames handling
+
+2007-10-13 21:35 yjung
+
+ * recipes/hawki_img_flat.c: separate the input frames by filter
+
+2007-10-06 11:10 lbilbao
+
+ * irplib/irplib_detmon.c: Unnecessary error messages removed
+
+2007-10-05 14:27 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: Saving of intermediate products moved
+ to irplib_detmon_lg_save(), required by DFO on detmon-kit-0.0.4.
+ Changes needed in API for functions
+ irplib_detmon_autocorr_factor(), irplib_detmon_gain(),
+ irplib_detmon_lg_reduce() and irplib_detmon_lg().
+
+2007-10-05 09:51 lbilbao
+
+ * irplib/irplib_detmon.c: False uninit warning(s) fixed
+
+2007-10-04 18:30 lbilbao
+
+ * irplib/irplib_detmon.c: Changes introduced in functions
+ irplib_detmon_lg_reduce_all() and irplib_detmon_opt_contamination()
+ to meet requests from DFO on detmon-kit-0.0.4
+
+2007-10-04 16:34 lbilbao
+
+ * irplib/irplib_detmon.h: New recipe added: detmon_dark
+
+2007-10-04 15:13 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_dark() and corresponding
+ subfunctions added with unit test for detmon_dark new recipe.
+
+2007-09-26 13:12 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_compute(): fix spacing
+
+2007-09-26 13:11 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_compute():
+ cpl_ensure_code() replaces assert(). IRPLIB_MATH_PI replaces
+ IRPLIB_PI. double strehl_error_coefficient replaces
+ STREHL_ERROR_COEFFICIENT
+
+2007-09-26 12:52 llundin
+
+ * irplib/irplib_detmon.c: irplib_detmon_pernoise_qc(): variable
+ iquad replaces quad, which shadows a global variable
+
+2007-09-26 12:49 llundin
+
+ * irplib/irplib_oddeven.c: irplib_oddeven_monitor(): variable iquad
+ replaces quad, which shadows a global variable
+
+2007-09-26 12:45 llundin
+
+ * irplib/irplib_utils.c: Fix for missing isnan() prototype
+
+2007-09-26 10:15 llundin
+
+ * irplib/irplib_plugin.c: recipe_sof_test_image_empty(): remove()
+ replaces unlink()
+
+2007-09-25 12:10 llundin
+
+ * irplib/irplib_plot.c: cpl_sprintf() replaces snprintf() (and
+ irplib_sprintf()). Move temporary filename and executable to plot
+ struct - fixes bug when IRPLIB_IMAGER is different from the
+ (gnu-)plot command
+
+2007-09-21 22:19 llundin
+
+ * irplib/tests/irplib_detmon-test.c: sin() -> sinf()
+
+2007-09-21 15:56 lbilbao
+
+ * irplib/irplib_detmon.c: Usage of cosf changed into cos
+
+2007-09-21 15:39 lbilbao
+
+ * irplib/irplib_detmon.c: Measurements in
+ irplib_detmon_opt_contamination() unnormalized. New step
+ (extraction) added to processing in
+ irplib_detmon_pernoise_reduce(). Changes in
+ irplib_detmon_pernoise_rm_bpixs() although this function is now
+ inactive. Refinement of peak selection in
+ irplib_detmon_pernoise_qc().
+
+2007-09-21 09:36 llundin
+
+ * irplib/irplib_plugin.c: recipe_sof_test_image_empty(): declare
+ unlink()
+
+2007-09-21 09:29 llundin
+
+ * irplib/irplib_plugin.c: recipe_sof_test_image_empty(): Cast for
+ %u
+
+2007-09-20 13:14 llundin
+
+ * irplib/irplib_slitpos.c: irplib_slitpos_analysis(): Fixed
+ mem-leak on error
+
+2007-09-20 12:48 llundin
+
+ * irplib/irplib_plugin.c: recipe_sof_test_image_empty(): Added.
+ irplib_plugin_test(): Call recipe_sof_test_image_empty()
+
+2007-09-20 11:18 lbilbao
+
+ * irplib/irplib_detmon.c: Math constants replaced by new ones in
+ irplib_math_const.h. sinf(x) and cosf(x) modified.
+
+2007-09-20 10:33 llundin
+
+ * irplib/irplib_plugin.c: recipe_frameset_empty(): Added.
+ recipe_sof_test_local(): Add call to
+ cpl_dfs_update_product_header(), recipe_frameset_empty()
+
+2007-09-19 16:06 lbilbao
+
+ * irplib/irplib_detmon.c: Error checking improved in
+ irplib_detmon_pernoise_save()
+
+2007-09-19 16:05 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Bug in irplib_detmon-test
+ fixed (wrong test inputs)
+
+2007-09-17 16:44 lbilbao
+
+ * irplib/irplib_detmon.c: sinf and cosf extended to be used on
+ Solaris machines
+
+2007-09-17 16:27 lbilbao
+
+ * irplib/irplib_detmon.c: Bug in saving the products fixed.
+
+2007-09-14 17:52 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_pernoise() high-level
+ function for detmon_pernoise() recipe added with necessary
+ sub-functions.
+
+2007-09-14 16:28 llundin
+
+ * irplib/irplib_stdstar.c: Use IRPLIB_MATH constants
+
+2007-09-14 16:25 llundin
+
+ * irplib/: Makefile.am, irplib_math_const.h: Added
+ irplib_math_const.h
+
+2007-09-13 10:03 lbilbao
+
+ * irplib/irplib_detmon.c: Lin/Gain parameters description
+ improvement
+
+2007-09-12 16:44 lbilbao
+
+ * irplib/tests/Makefile.am: Revert previous erroneus commit
+
+2007-09-12 16:25 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/Makefile.am: Interpolation
+ introduce to refine max in irplib_detmon_ronbias_histo().
+
+2007-09-12 16:08 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: API of
+ irplib_detmon_fill_ronbias_params() changed.
+ irplib_detmon_retrieve_ronbias_params() changed. Histogram related
+ parameters removed.
+
+2007-09-12 15:40 lbilbao
+
+ * irplib/irplib_detmon.c: Bug when empty frameset given fixed
+
+2007-09-12 14:29 lbilbao
+
+ * irplib/irplib_detmon.c: Message coherence for multi-extension
+ case revised. PAF files created now for each extension. Error
+ checking added.
+
+2007-09-12 11:37 lbilbao
+
+ * irplib/irplib_detmon.c: Bug found and fixed in
+ irplib_detmon_ronbias_histo().
+
+2007-09-07 16:23 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_hist.c, irplib_hist.h,
+ tests/irplib_hist-test.c: Major update of the irplib_hist module
+
+2007-09-06 17:13 lbilbao
+
+ * irplib/irplib_detmon.c: Indenting improved overall. Tabs removed.
+
+2007-09-06 12:07 lbilbao
+
+ * irplib/irplib_detmon.c: Column inserted back - SIG_ON_DIF
+
+2007-09-04 17:35 lbilbao
+
+ * irplib/irplib_detmon.c: Error checking update and rename for
+ several variables
+
+2007-08-30 11:19 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_hist.c, irplib_hist.h: Several
+ warnings removed.
+
+2007-08-30 10:39 lbilbao
+
+ * irplib/: irplib_hist.c, tests/irplib_hist-test.c: binwidth = 1
+ (theoretical maximum optimal size for integer images)
+
+2007-08-30 10:35 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_ronbias_histo() changed to
+ make use of irplib_hist.h module. Error checking improved overall.
+
+2007-08-29 10:20 lbilbao
+
+ * irplib/: Makefile.am, irplib_hist.c, irplib_hist.h,
+ tests/Makefile.am, tests/irplib_hist-test.c: New module
+ irplib_hist.{h,c} with unit tests. Functionalities to work with
+ histograms.
+
+2007-08-28 14:44 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Bug fixed
+
+2007-08-28 14:40 lbilbao
+
+ * irplib/irplib_detmon.c: Bug fixed because of variable used
+ unitialised (nraws in function irplib_detmon_ronbias_preoverscan().
+
+2007-08-28 13:48 amodigli
+
+ * irplib/tests/irplib_detmon-test.c: commented out test to have
+ make distcheck working. Pls Lander fix the bug.
+
+2007-08-27 17:06 lbilbao
+
+ * irplib/irplib_detmon.c: Usage of irplib_get_clean_mean_window()
+ included in functions irplib_detmon_ronbias_preoverscan(),
+ irplib_detmon_ronbias_region() and irplib_detmon_ronbias_master()
+ to remove bad pixels' effect on RON computation. Error checking
+ improved overall.
+
+2007-08-24 12:27 lbilbao
+
+ * irplib/irplib_detmon.c: Bug in parameters' description fixed.
+
+2007-08-24 11:42 lbilbao
+
+ * irplib/irplib_detmon.c: New function
+ irplib_detmon_add_adl_column() added to compute ADL column of the
+ LINEAR_TABLE in irplib_detmon_lg().
+
+2007-08-24 10:15 lbilbao
+
+ * irplib/irplib_detmon.c: Warnings because of unused variables
+ avoided.
+
+2007-08-23 18:10 lbilbao
+
+ * irplib/irplib_detmon.c: Bugs in irplib_detmon_ronbias_random()
+ and irplib_detmon_ronbias_histo() refered to RON computation fixed.
+
+2007-08-23 17:01 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: New parameter --rescale with default
+ value TRUE added to set ON / OFF the option of rescaling the input
+ pairs of frames one to the level of the other one.
+
+2007-08-23 16:41 lbilbao
+
+ * irplib/irplib_detmon.c: Rescaling of the frames before
+ autocorrelation introduced to get better autocorrelation factor.
+ New function irplib_detmon_lg_rescale().
+
+2007-08-23 13:53 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: New unit test added, for the
+ case when input frames are multi-extension but computation is done
+ only on one of the extensions.
+
+2007-08-23 13:48 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Bug in
+ irplib_detmon_lg() fixed, now it also accepts to be several pairs
+ with the same DIT value. Corresponding unit test added, too.
+
+2007-08-22 17:25 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: New unit test for
+ multi-extension case added. irplib_detmon_tests_fill_frameset()
+ function enlarged (API changed) to make it able to fill
+ multi-extension framesets, too.
+
+2007-08-22 17:23 lbilbao
+
+ * irplib/irplib_detmon.c: Strong error checking added overall.
+
+2007-08-22 14:57 lbilbao
+
+ * irplib/irplib_detmon.c: Minor changes to fix memory leaks only
+ detected by valgrind
+
+2007-08-22 14:24 yjung
+
+ * irplib/: irplib_irlist.h, irplib_std.c, irplib_std.h,
+ irplib_irlist.h, irplib_std.c, irplib_std.h: [no log message]
+
+2007-08-22 14:03 llundin
+
+ * irplib/: Makefile.am, irplib_irlist.h, irplib_std.c,
+ irplib_std.h: irplib_std.{c,h} and irplib_irlist.h replaced by
+ irplib_stdstar
+
+2007-08-22 13:35 lbilbao
+
+ * irplib/irplib_detmon.c: Bug fixed in irplib_detmon_lg_save()
+ (when saving products after a multi-extension computation, primary
+ unit was used instead of being left empty, as it should to follow
+ inputs' structure).
+
+2007-08-22 13:19 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE(): Improve
+ documentation of run-time version check
+
+2007-08-22 13:01 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_fill_params() modified
+ (new API included). Now it is possible to give the values of the
+ parameters to the recipe throught this new API (this feature will
+ be used to call the recipe with different parameters' value in the
+ testingcycle. New function irplib_detmon_fill_params_default()
+ where no values need to be given (default values hard-coded here).
+
+2007-08-22 11:51 lbilbao
+
+ * irplib/irplib_detmon.c: Important changes for full operational
+ support of multi-extension FITS. Major code changes in
+ irplib_detmon_lg() and irplib_detmon_lg_reduce(). API changes also
+ in irplib_detmon_gain() and irplib_detmon_linearity(). New function
+ irplib_detmon_lg_reduce_init() just to initialise all the variable
+ used in irplib_detmon_lg_reduce().
+
+2007-08-21 15:06 jmlarsen
+
+ * irplib/: Makefile.am, irplib_access.c, irplib_access.h: Removed
+ irplib_access module, largely deprecated by CPL-4
+
+2007-08-21 11:30 yjung
+
+ * configure.ac: 0.0.1 -> 0.1.0
+
+2007-08-21 10:53 yjung
+
+ * acinclude.m4: srcdir-> builddir
+
+2007-08-20 14:57 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_lg() API modified.
+ Parameter extnum removed (moved to command-line parameter --exts).
+ This new parameter is used to manage FITS exts, as usual: 0 for
+ primary unit, -1 for all exts, n for extension nb n.
+
+2007-08-10 11:03 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE(): Let
+ cpl_plugin_get_info() verify run-time version of CPL
+
+2007-08-09 15:21 llundin
+
+ * irplib/irplib_plugin.c: recipe_sof_test_local(): Test recipe in
+ ./<recipe>.sof
+
+2007-08-09 05:50 yjung
+
+ * hawki/hawki_dfs.h, hawki/hawki_utils.c, hawki/hawki_utils.h,
+ recipes/hawki_util_distortion.c: [no log message]
+
+2007-08-09 05:06 yjung
+
+ * recipes/Makefile.am: added hawki_util_distortion
+
+2007-08-09 05:04 yjung
+
+ * hawki/hawki_dfs.c, hawki/hawki_dfs.h,
+ recipes/hawki_util_distortion.c: [no log message]
+
+2007-08-09 04:57 yjung
+
+ * catalogs/dist_map.txt, recipes/hawki_util_gendist.c: [no log
+ message]
+
+2007-08-09 04:47 yjung
+
+ * hawki/hawki_dfs.h, recipes/hawki_util_gendist.c,
+ catalogs/dist_map.txt: [no log message]
+
+2007-08-09 04:33 yjung
+
+ * catalogs/dist_map.txt: removed last column
+
+2007-08-09 04:14 yjung
+
+ * catalogs/dist_map.txt: [no log message]
+
+2007-08-09 03:32 yjung
+
+ * recipes/hawki_util_gendist.c: [no log message]
+
+2007-08-09 00:50 yjung
+
+ * hawki/hawki_dfs.h, recipes/hawki_util_gendist.c: [no log message]
+
+2007-08-09 00:10 yjung
+
+ * recipes/hawki_util_gendist.c: [no log message]
+
+2007-08-09 00:00 yjung
+
+ * recipes/Makefile.am: added hawki_util_gendist.c
+
+2007-08-08 23:54 yjung
+
+ * hawki/hawki_dfs.c: [no log message]
+
+2007-08-08 23:53 yjung
+
+ * hawki/hawki_dfs.h: added distortion map
+
+2007-08-08 23:46 yjung
+
+ * catalogs/dist_map.txt: [no log message]
+
+2007-08-08 23:35 yjung
+
+ * ChangeLog, recipes/hawki_util_test.c: [no log message]
+
+2007-08-08 20:36 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: irplib_bpp_find():
+ Removed
+
+2007-08-08 11:26 llundin
+
+ * irplib/: Makefile.am, irplib_error.c, irplib_error.h,
+ irplib_dfs.c, irplib_dfs.h: irplib_dfs and irplib_error dropped
+
+2007-08-08 11:21 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE(): Drop call to
+ cpl_dfs_update_product_header()
+
+2007-08-08 11:20 llundin
+
+ * irplib/irplib_utils.c: irplib_reset(): Drop call to
+ irplib_error_reset()
+
+2007-08-08 11:20 llundin
+
+ * irplib/irplib_std.c: irplib_std_get_mag_zero(): const warnings
+ resolved
+
+2007-08-08 11:19 llundin
+
+ * irplib/irplib_stdstar.c: Removed unneeded include of irplib_dfs.h
+
+2007-08-08 10:49 lbilbao
+
+ * irplib/irplib_detmon.c: 2 new columns added to the GAIN table for
+ testing purposes. Some more error checking added, too.
+
+2007-08-08 10:30 llundin
+
+ * irplib/irplib_detmon.c: Removed unneeded include of irplib_dfs.h
+
+2007-08-08 09:55 llundin
+
+ * irplib/irplib_access.c: Fix compiler warnings by using CPL 4.0
+ _const functons. Most of if not all of the modified functions
+ should be replaced by their CPL 4.0 counterpart
+
+2007-08-08 00:23 yjung
+
+ * recipes/hawki_util_test.c: [no log message]
+
+2007-08-07 20:53 yjung
+
+ * recipes/: Makefile.am, hawki_util_test.c: [no log message]
+
+2007-08-07 14:15 llundin
+
+ * irplib/irplib_flat.c: irplib_flat_fit_slope_robust():
+ cpl_vector_get_median_const() => cpl_vector_get_median()
+
+2007-08-07 10:09 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Warnings
+ because of mixed code and unused variables removed.
+
+2007-08-07 06:47 yjung
+
+ * hawki/: hawki_load.c, hawki_load.h: [no log message]
+
+2007-08-07 05:38 yjung
+
+ * hawki/hawki_saa.c, hawki/hawki_saa.h, recipes/hawki_img_jitter.c,
+ recipes/hawki_util_stitch.c: [no log message]
+
+2007-08-07 01:20 yjung
+
+ * hawki/: hawki_saa.c, hawki_saa.h: [no log message]
+
+2007-08-07 01:19 yjung
+
+ * hawki/Makefile.am: added hawki_saa
+
+2007-08-07 01:01 yjung
+
+ * recipes/hawki_img_flat.c: handle now the ghosts passing through
+ the image
+
+2007-08-06 12:54 lbilbao
+
+ * irplib/irplib_detmon.c: Parameter --stacking.method converted
+ from int to string.
+
+2007-08-06 10:47 lbilbao
+
+ * irplib/irplib_detmon.c: Better description of defaults values
+ inserted in irplib_detmon_fill_params().
+
+2007-08-06 10:31 lbilbao
+
+ * irplib/irplib_detmon.c: Warning included to prevent the user from
+ executing --autocorr option without FFTW installed.
+
+2007-08-06 10:17 lbilbao
+
+ * irplib/irplib_detmon.c: New default value for
+ --histo.npoints=10000. Computations in
+ irplib_detmon_ronbias_histo() improved.
+
+2007-08-06 09:49 lbilbao
+
+ * irplib/irplib_detmon.c: --collapse set to TRUE by default for
+ detmon_opt_lg. New functions irplib_detmon_lg_check_defaults() and
+ irplib_detmon_ronbias_check_defaults() to set in a dynamic way the
+ defaults values for areas {llx, lly, urx, ury}. These are now set
+ referenced to dimensions of input images instead of being
+ hard-coded.
+
+2007-08-06 07:30 yjung
+
+ * recipes/hawki_img_flat.c: [no log message]
+
+2007-08-06 05:54 yjung
+
+ * recipes/: hawki_img_flat.c, hawki_util_stitch.c: [no log message]
+
+2007-08-06 03:43 yjung
+
+ * recipes/: hawki_img_flat.c, hawki_img_jitter.c,
+ hawki_util_stitch.c: [no log message]
+
+2007-08-06 02:17 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-05 22:08 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-05 08:50 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-05 08:35 yjung
+
+ * recipes/: hawki_img_jitter.c, hawki_util_stitch.c: [no log
+ message]
+
+2007-08-05 06:25 yjung
+
+ * recipes/: hawki_img_jitter.c, hawki_img_jitter.c: [no log
+ message]
+
+2007-08-05 04:52 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-05 03:25 yjung
+
+ * hawki/hawki_utils.c: [no log message]
+
+2007-08-05 03:19 yjung
+
+ * recipes/hawki_util_stitch.c: [no log message]
+
+2007-08-05 02:09 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-05 01:55 yjung
+
+ * hawki/: hawki_load.c, hawki_load.h: [no log message]
+
+2007-08-05 01:50 yjung
+
+ * hawki/hawki_utils.c: [no log message]
+
+2007-08-05 01:43 yjung
+
+ * hawki/hawki_utils.h: [no log message]
+
+2007-08-05 01:31 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h, hawki/hawki_utils.c,
+ recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-05 01:07 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-04 22:27 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-04 20:55 yjung
+
+ * recipes/hawki_util_stitch.c: [no log message]
+
+2007-08-04 08:38 yjung
+
+ * recipes/hawki_util_stitch.c: [no log message]
+
+2007-08-04 08:14 yjung
+
+ * recipes/hawki_util_stitch.c: [no log message]
+
+2007-08-04 07:16 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h,
+ recipes/hawki_img_jitter.c: [no log message]
+
+2007-08-04 05:00 yjung
+
+ * hawki/hawki_load.c, recipes/hawki_img_jitter.c,
+ recipes/hawki_util_stitch.c, recipes/hawki_img_jitter.c: [no log
+ message]
+
+2007-08-04 01:08 yjung
+
+ * hawki/hawki_load.c, recipes/Makefile.am,
+ recipes/hawki_util_stitch.c: [no log message]
+
+2007-08-04 00:59 yjung
+
+ * hawki/hawki_load.c, recipes/hawki_img_jitter.c,
+ recipes/hawki_img_zpoint.c: handled the chip order
+
+2007-08-04 00:08 yjung
+
+ * hawki/: hawki_pfits.c, hawki_pfits.h: [no log message]
+
+2007-08-03 03:50 yjung
+
+ * hawki/hawki_pfits.c, hawki/hawki_utils.c,
+ recipes/hawki_util_stdstars.c: [no log message]
+
+2007-08-02 17:00 lbilbao
+
+ * irplib/irplib_detmon.c: #define M_SQRT1_2 added to make
+ compilable with c99
+
+2007-08-02 14:32 llundin
+
+ * irplib/: irplib_framelist.c, irplib_plugin.c, irplib_plugin.h,
+ irplib_stdstar.c, irplib_utils.c, irplib_utils.h: Use CPL 4.0
+ (cpl_errorstate, cpl_dfs_save_*(), etc.
+
+2007-08-02 13:45 lbilbao
+
+ * irplib/irplib_detmon.h: Export irplib_detmon_autocorrelate()
+
+2007-08-02 12:58 lbilbao
+
+ * irplib/irplib_detmon.c: Descriptions of some parameters for
+ detmon_ronbias() improved.
+
+2007-08-02 12:52 lbilbao
+
+ * irplib/irplib_detmon.c: Parameters nsamples, sizex and sizey in
+ detmon_ronbias() renamed random.nsamples, random.sizex and
+ random.sizey
+
+2007-08-02 12:20 lbilbao
+
+ * irplib/irplib_detmon.c: Parameter method modified for
+ detmon_ronbias()
+
+2007-08-01 17:12 lbilbao
+
+ * irplib/irplib_detmon.c: Error in irplib_detmon_ronbias_histo()
+ algorithm corrected.
+
+2007-08-01 13:56 lbilbao
+
+ * irplib/irplib_detmon.c: New function
+ irplib_flux_get_bias_window() added. Error checking improved in
+ function irplib_detmon_autocorrelate(). Memory bug regarding
+ variable opt_offs in irplib_detmon_lg_reduce() removed.
+
+2007-08-01 13:52 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: New unit test added for
+ irplib_detmon_autocorrelate()
+
+2007-08-01 10:40 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_{table, image, paf}_save()
+ deprecated functions replaced by cpl_dfs_save_{table, image, paf}.
+ New function irplib_detmon_rm_bpixs() added.
+
+2007-07-31 09:22 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-30 16:56 yjung
+
+ * recipes/: hawki_img_jitter.c, hawki_img_jitter.c: [no log
+ message]
+
+2007-07-30 16:00 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2007-07-30 15:04 yjung
+
+ * recipes/hawki_img_zpoint.c: bug with catalog search (ret = -1)
+
+2007-07-30 14:47 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-30 14:47 yjung
+
+ * hawki/: hawki_pfits.c, hawki_pfits.h: added pixscale
+
+2007-07-30 13:19 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-30 11:53 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-30 11:40 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-27 16:02 yjung
+
+ * recipes/hawki_img_jitter.c: in progress
+
+2007-07-27 16:01 yjung
+
+ * hawki/hawki_dfs.h: [no log message]
+
+2007-07-27 15:08 yjung
+
+ * hawki/hawki_dfs.h: [no log message]
+
+2007-07-27 13:55 yjung
+
+ * recipes/: hawki_img_flat.c, hawki_img_zpoint.c: [no log message]
+
+2007-07-27 13:45 yjung
+
+ * hawki/: hawki_dfs.c, hawki_dfs.h: [no log message]
+
+2007-07-27 13:39 yjung
+
+ * hawki/: hawki_dfs.c, hawki_dfs.h: [no log message]
+
+2007-07-27 13:26 yjung
+
+ * recipes/Makefile.am: added jitter
+
+2007-07-27 13:08 yjung
+
+ * hawki/hawki_utils.c: warning
+
+2007-07-27 09:20 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Missing #ifdef HAVE_FFTW
+ inserted
+
+2007-07-26 14:58 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: New function irplib_detmon_pernoise()
+ added, with correspondent unit test. New CPL accessor functions
+ included.
+
+2007-07-26 09:15 jmlarsen
+
+ * irplib/irplib_error.h: Fixed reverse logic bug
+
+2007-07-26 09:07 jmlarsen
+
+ * irplib/irplib_error.h: irplib_error_assure(): evaluate format
+ string only if condition failed
+
+2007-07-26 07:05 llundin
+
+ * irplib/irplib_error.h: irplib_error_push():
+ cpl_error_set_message_macro() replaces irplib_error_push_macro().
+ All functions deprecated
+
+2007-07-26 07:03 llundin
+
+ * irplib/irplib_dfs.h: irplib_{image,table,paf}_save(): deprecated
+
+2007-07-26 07:02 llundin
+
+ * irplib/tests/: Makefile.am, irplib_utils-test.c,
+ irplib_dfs-test.c, irplib_error-test.c: Dropped unit tests of
+ deprecated functions
+
+2007-07-25 16:17 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_pfits.c, hawki/hawki_utils.c,
+ recipes/hawki_img_dark.c, recipes/hawki_img_flat.c,
+ recipes/hawki_img_zpoint.c, recipes/hawki_util_gendata.c,
+ recipes/hawki_util_harmonize.c, recipes/hawki_util_lsbg.c,
+ recipes/hawki_util_split.c, recipes/hawki_util_stdstars.c: fixed
+ warnings with more strict compiler options
+
+2007-07-25 15:27 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_utils.c,
+ recipes/hawki_img_flat.c, recipes/hawki_util_gendata.c: fixed const
+ warnings
+
+2007-07-25 15:17 yjung
+
+ * hawki/Makefile.am: removed isaac_fit
+
+2007-07-25 15:16 yjung
+
+ * recipes/hawki_img_flat.c, hawki/hawki_fit.c, hawki/hawki_fit.h,
+ hawki/hawki_fit_body.h, recipes/hawki_img_jitter.c: [no log
+ message]
+
+2007-07-25 15:11 yjung
+
+ * hawki/hawki_load.c, recipes/hawki_img_dark.c,
+ recipes/hawki_img_detlin.c, recipes/hawki_img_flat.c,
+ recipes/hawki_util_gendata.c, recipes/hawki_util_harmonize.c,
+ recipes/hawki_util_lsbg.c, recipes/hawki_util_split.c: [no log
+ message]
+
+2007-07-25 15:08 yjung
+
+ * recipes/: hawki_img_dark.c, hawki_img_flat.c, hawki_img_jitter.c,
+ hawki_img_zpoint.c, hawki_img_dark.c, hawki_img_flat.c,
+ hawki_img_jitter.c, hawki_img_zpoint.c, hawki_util_gendata.c,
+ hawki_util_harmonize.c, hawki_util_lsbg.c, hawki_util_split.c,
+ hawki_util_stdstars.c: [no log message]
+
+2007-07-25 14:28 yjung
+
+ * recipes/hawki_img_detlin.c, recipes/hawki_img_flat.c,
+ hawki/hawki_dfs.c, hawki/hawki_dfs.h: [no log message]
+
+2007-07-25 14:08 yjung
+
+ * recipes/hawki_img_detlin.c: [no log message]
+
+2007-07-25 14:04 yjung
+
+ * recipes/Makefile.am: added hawki_img_detlin
+
+2007-07-25 14:03 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h, recipes/hawki_img_flat.c:
+ added the stats product
+
+2007-07-25 13:29 yjung
+
+ * hawki/hawki_dfs.h: added PRO CATG
+
+2007-07-25 13:24 yjung
+
+ * recipes/hawki_img_flat.c: added parameter --zone
+
+2007-07-25 11:40 yjung
+
+ * recipes/hawki_img_flat.c: removed confusing messages
+
+2007-07-25 11:31 yjung
+
+ * recipes/hawki_img_dark.c: removed division by DIT
+
+2007-07-25 11:30 yjung
+
+ * recipes/hawki_img_dark.c: add zone parameter
+
+2007-07-25 11:06 yjung
+
+ * recipes/hawki_img_dark.c: add nb of pixels
+
+2007-07-25 10:43 yjung
+
+ * recipes/Makefile.am: rm tmp jitter
+
+2007-07-25 08:29 llundin
+
+ * irplib/irplib_flat.c: irplib_flat_fit_proportional():
+ cpl_vector_get_median_const() => cpl_vector_get_median()
+
+2007-07-25 08:25 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_ring_background():
+ cpl_vector_get_median_const() => cpl_vector_get_median()
+
+2007-07-24 14:59 yjung
+
+ * irplib/irplib_stdstar.c: fixed typo
+
+2007-07-24 11:15 yjung
+
+ * irplib/: irplib_utils.c, irplib_wlxcorr.c: fixed const warnings
+
+2007-07-24 10:28 yjung
+
+ * irplib/: irplib_plot.c, irplib_ppm.c, irplib_slitpos.c,
+ irplib_stdstar.c, irplib_utils.c, irplib_wlxcorr.c: fixed const
+ warnings
+
+2007-07-24 10:03 yjung
+
+ * irplib/irplib_ppm.c: cpl_ppm_match_positions() has 2 new
+ arguments !!!
+
+2007-07-24 09:07 yjung
+
+ * irplib/irplib_strehl.c: cpl_flux_get_noise_ring() used double for
+ the ring specs
+
+2007-07-23 16:53 yjung
+
+ * irplib/: irplib_detmon.c, irplib_distortion.c, irplib_flat.c,
+ irplib_spectrum.c, irplib_strehl.c: cpl_vector_get_median ->
+ cpl_vector_get_median_const
+
+2007-07-23 16:47 jmlarsen
+
+ * irplib/: irplib_error.h, irplib_error.c: Implemented
+ irplib_error_assure using the new CPL 4 error module
+
+2007-07-23 16:45 jmlarsen
+
+ * irplib/irplib_plugin.h: Use CPL error module instead of IRPLIB
+ error module
+
+2007-07-23 15:45 yjung
+
+ * irplib/: irplib_spectrum.c, irplib_spectrum.h: add a const
+ modifier
+
+2007-07-23 11:27 yjung
+
+ * irplib/: irplib_ppm.c, irplib_ppm.h: removed
+ irplib_ppm_match_positions (-> CPL)
+
+2007-07-23 10:59 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: removed functions
+ that are now in CPL
+
+2007-07-19 15:06 yjung
+
+ * hawki/hawki_dfs.h, recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-19 10:43 yjung
+
+ * recipes/hawki_img_jitter.c: [no log message]
+
+2007-07-19 10:17 yjung
+
+ * recipes/Makefile.am: added jitter
+
+2007-07-17 11:40 llundin
+
+ * irplib/irplib_test.c: irplib_test_init_macro(): Call cpl_init()
+ correctly also for CPL 4.0
+
+2007-07-10 17:02 jmlarsen
+
+ * irplib/tests/Makefile.am: Uncommented reference to
+ Makefile.purify
+
+2007-07-10 16:41 cguirao
+
+ * irplib/tests/Makefile.am: Adding make clean-am MAKE_PURIFY=on
+
+2007-06-29 11:17 jmlarsen
+
+ * irplib/tests/Makefile.am: Cleanup generated FITS files
+
+2007-06-27 14:44 llundin
+
+ * irplib/irplib_error.c: irplib_error_validate_state(),
+ irplib_error_push_macro(): Use cpl_error_set_message_macro() with
+ CPL 4.0
+
+2007-06-22 16:03 lbilbao
+
+ * irplib/irplib_detmon.c: Warning because of uninitialised variable
+ masterbias in irplib_detmon_ronbias_master() removed
+
+2007-06-22 14:04 yjung
+
+ * recipes/hawki_img_zpoint.c, hawki/hawki_load.c,
+ hawki/hawki_load.h, hawki/hawki_pfits.c, hawki/hawki_pfits.h: [no
+ log message]
+
+2007-06-21 17:29 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Warnings
+ because of unused variables removed
+
+2007-06-21 16:18 yjung
+
+ * irplib/: irplib_distortion.c, irplib_spectrum.c: [no log message]
+
+2007-06-21 16:15 yjung
+
+ * irplib/: irplib_distortion.c, irplib_spectrum.c: replaced
+ CPL_PIXEL_MAXVAL by DBL_MAX
+
+2007-06-21 14:04 lbilbao
+
+ * irplib/irplib_detmon.c: Error message in
+ irplib_detmon_ronbias_save() changed
+
+2007-06-21 13:01 lbilbao
+
+ * irplib/irplib_detmon.c: 2 bugs fixed. First in
+ irplib_detmon_ronbias_histo() and second in
+ irplib_detmon_build_synthetic()
+
+2007-06-21 10:26 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: irplib_detmon unit tests
+ reactivated
+
+2007-06-21 10:21 lbilbao
+
+ * irplib/irplib_detmon.c: Changes in
+ irplib_detmon_build_synthetic()
+
+2007-06-20 16:09 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_compute(): Adapt to new API
+ of cpl_flux_get_noise_ring()
+
+2007-06-20 11:17 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: irplib_detmon unit test
+ deactivated
+
+2007-06-19 19:45 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c:
+ irplib_detmon_ronbias_dutycycl() added
+
+2007-06-19 18:59 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_lg() API extended to
+ support FITS with multiple extensions
+
+2007-06-19 17:23 lbilbao
+
+ * irplib/irplib_detmon.c: Input validity check added in
+ irplib_detmon_ronbias_region()
+
+2007-06-19 17:22 lbilbao
+
+ * irplib/irplib_detmon.c: Input validity check added in
+ irplib_detmon_ronbias_preoverscan()
+
+2007-06-19 16:14 yjung
+
+ * hawki/hawki_utils.c: [no log message]
+
+2007-06-19 16:14 lbilbao
+
+ * irplib/irplib_detmon.c: Changes in irplib_detmon_ronbias_region()
+
+2007-06-19 16:05 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_build_synthetic(9 new
+ function added. More changes in
+ irplib_detmon_ronbias_preoverscan().
+
+2007-06-19 15:19 yjung
+
+ * recipes/Makefile.am, recipes/hawki_util_bgss.c,
+ recipes/hawki_util_lsbg.c, recipes/hawki_util_bgss.c,
+ hawki/hawki_dfs.h, hawki/hawki_utils.c: [no log message]
+
+2007-06-19 14:33 lbilbao
+
+ * irplib/irplib_detmon.c: Error checking added in
+ irplib_detmon_ronbias(). Modifications in
+ irplib_detmon_ronbias_histo().
+
+2007-06-19 12:56 yjung
+
+ * hawki/: hawki_utils.c, hawki_utils.h: added hawki_compute_bgss()
+
+2007-06-19 12:56 yjung
+
+ * recipes/hawki_util_bgss.c: [no log message]
+
+2007-06-19 12:55 yjung
+
+ * recipes/Makefile.am: added hawki_util_bgss
+
+2007-06-19 12:52 yjung
+
+ * recipes/hawki_util_stdstars.c: [no log message]
+
+2007-06-19 10:43 lbilbao
+
+ * irplib/irplib_detmon.c: Error checking added when using
+ cpl_image_fill_polynomial()
+
+2007-06-19 10:26 lbilbao
+
+ * irplib/irplib_detmon.c: [no log message]
+
+2007-06-19 10:00 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon-test converted to smaller
+ datasets. irplib_detmon_fill_params() and
+ irplib_detmon_ronbias_params() functions' APIs changed for that
+ reason. Calls to these functions changed in units tests and
+ recipes.
+
+2007-06-18 17:19 lbilbao
+
+ * irplib/irplib_detmon.c: HISTO method changed
+
+2007-06-18 13:13 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2007-06-18 12:55 yjung
+
+ * catalogs/stdstars/Hawki.txt: [no log message]
+
+2007-06-18 11:52 yjung
+
+ * catalogs/stdstars/Hawki.txt: added 9181/S234-E
+
+2007-06-18 11:36 yjung
+
+ * irplib/irplib_stdstar.c, recipes/hawki_util_stdstars.c: [no log
+ message]
+
+2007-06-18 11:26 yjung
+
+ * catalogs/stdstars/Hawki.txt: [no log message]
+
+2007-06-18 11:08 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2007-06-18 10:33 yjung
+
+ * hawki/Makefile.am, hawki/hawki_dfs.c, hawki/hawki_dfs.h,
+ hawki/hawki_std.c, hawki/hawki_std.h, hawki/hawki_utils.c,
+ hawki/hawki_utils.h, recipes/hawki_img_zpoint.c,
+ recipes/hawki_util_stdstars.c: [no log message]
+
+2007-06-18 09:43 yjung
+
+ * recipes/: Makefile.am, hawki_util_stdstars.c: [no log message]
+
+2007-06-18 09:40 yjung
+
+ * catalogs/stdstars/Hawki.txt: [no log message]
+
+2007-06-15 13:50 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h:
+ irplib_detmon_ronbias_save() function added
+
+2007-06-15 10:32 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Test
+ failure for CPL 3.1 fixed
+
+2007-06-14 10:20 lbilbao
+
+ * irplib/irplib_detmon.c: New functions
+ irplib_detmon_ronbias_histo() and
+ irplib_detmon_ronbias_preoverscan() added
+
+2007-06-14 09:45 yjung
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h: [no log message]
+
+2007-06-13 16:33 yjung
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h: STD stars catalog
+ made external . Rm dependency to irplib_std
+
+2007-06-13 15:29 yjung
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h: [no log message]
+
+2007-06-13 11:35 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_ronbias_random() function
+ modified. Computing and writing of the QC params included
+
+2007-06-13 11:20 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_ronbias_random() function
+ added
+
+2007-06-13 10:44 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: New functions irplib_detmon_ronbias(),
+ irplib_detmon_fill_ronbias_params() and
+ irplib_detmon_retrieve_ronbias_params() added (to be used by new
+ recipe detmon_ronbias)
+
+2007-06-12 15:48 yjung
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h: [no log message]
+
+2007-06-12 13:51 yjung
+
+ * irplib/irplib_stdstar.c: [no log message]
+
+2007-06-12 13:32 yjung
+
+ * hawki/hawki_std.h, recipes/hawki_img_zpoint.c: [no log message]
+
+2007-06-12 13:26 yjung
+
+ * irplib/irplib_stdstar.h: [no log message]
+
+2007-06-12 12:54 lbilbao
+
+ * irplib/irplib_detmon.h: irplib_detmon_get_description macro moved
+ to irplib_detmon_lg_get_description. New macro
+ irplib_detmon_ronbias_get_description added.
+
+2007-06-12 12:26 lbilbao
+
+ * irplib/irplib_detmon.c: Some variable moved to smallest possible
+ scope. New function irplib_detmon_lg_reduce_all() added, which
+ comprises code that was previously at the end of
+ irplib_detmon_lg_reduce().
+
+2007-06-12 11:37 yjung
+
+ * irplib/: irplib_stdstar.c, irplib_stdstar.h: [no log message]
+
+2007-06-12 10:49 yjung
+
+ * irplib/: Makefile.am, irplib_stdstar.c, irplib_stdstar.h: [no log
+ message]
+
+2007-06-12 09:23 yjung
+
+ * hawki/: Makefile.am, hawki_dfs.c, hawki_dfs.h, hawki_pfits.c,
+ hawki_pfits.h, hawki_std.c, hawki_std.h, hawki_utils.c,
+ hawki_utils.h: [no log message]
+
+2007-06-11 13:37 lbilbao
+
+ * irplib/irplib_detmon.c: sprintf() moved to irplib_sprintf()
+
+2007-06-08 18:04 lbilbao
+
+ * irplib/irplib_detmon.c: Variables name, desc and type moved in
+ irplib_detmon_fill_parlist() to smallest possble scope
+
+2007-06-08 17:57 lbilbao
+
+ * irplib/irplib_detmon.c: Most variables in irplib_detmon_lg()
+ moved to smallest possible scope
+
+2007-06-08 17:43 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_sprintf() replaced in
+ if(intermediate) by sprintf() because of weird error. dit replaced
+ by exptime to make the recipe more general (apliable to UVES data
+ which doesn't have a DIT keyword)
+
+2007-06-08 11:53 lbilbao
+
+ * irplib/irplib_detmon.c: collapse parameter added. Code modified
+ where needed depending on this parameter's value, functions
+ irplib_detmon_lg(), irplib_detmon_lg_reduce() and
+ irplib_detmon_lg_linearity().
+
+2007-06-08 10:21 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_fill_params() changed. New
+ function irplib_detmon_fill_parlist() added and used there.
+
+2007-06-05 09:44 yjung
+
+ * recipes/hawki_img_zpoint.c: [no log message]
+
+2007-06-05 09:18 yjung
+
+ * recipes/: Makefile.am, hawki_img_zpoint.c: [no log message]
+
+2007-06-04 17:01 yjung
+
+ * hawki/hawki_load.c, hawki/hawki_load.h, hawki/hawki_utils.c,
+ hawki/hawki_utils.h, recipes/hawki_util_harmonize.c: [no log
+ message]
+
+2007-06-04 15:09 yjung
+
+ * recipes/: hawki_util_gendata.c, hawki_util_harmonize.c,
+ hawki_util_split.c: [no log message]
+
+2007-06-04 14:42 yjung
+
+ * recipes/hawki_util_harmonize.c: [no log message]
+
+2007-06-04 14:38 yjung
+
+ * recipes/hawki_util_split.c: [no log message]
+
+2007-06-04 14:35 yjung
+
+ * recipes/hawki_util_split.c: [no log message]
+
+2007-06-04 14:24 yjung
+
+ * recipes/hawki_util_gendata.c: [no log message]
+
+2007-06-04 14:11 yjung
+
+ * recipes/: Makefile.am, hawki_util_gendata.c: [no log message]
+
+2007-06-04 12:16 llundin
+
+ * irplib/irplib_detmon.c: irplib_detmon_lg_reduce(): Move coeff
+ declaration to smallest possible scope (and fix no-use warning on
+ CPL 3.1)
+
+2007-06-01 16:59 yjung
+
+ * hawki/hawki_dfs.c, hawki/hawki_dfs.h, recipes/hawki_img_flat.c:
+ flat usable
+
+2007-06-01 16:14 yjung
+
+ * recipes/: hawki_img_flat2.c, Makefile.am, hawki_img_flat.c,
+ hawki_img_flat2.c: [no log message]
+
+2007-06-01 14:55 yjung
+
+ * hawki/hawki_load.c, recipes/hawki_img_flat2.c: [no log message]
+
+2007-06-01 14:43 yjung
+
+ * hawki/: Makefile.am, hawki_fit.c, hawki_fit.h, hawki_fit_body.h,
+ hawki_load.c, hawki_load.h: [no log message]
+
+2007-05-31 16:58 yjung
+
+ * recipes/: Makefile.am, hawki_img_flat2.c: [no log message]
+
+2007-05-31 16:56 yjung
+
+ * hawki/hawki_dfs.c, hawki/hawki_dfs.h, hawki/hawki_load.c,
+ hawki/hawki_utils.c, hawki/hawki_utils.h, recipes/hawki_img_dark.c:
+ finalised dark recipe
+
+2007-05-31 15:33 yjung
+
+ * hawki/: hawki_load.c, hawki_load.h: added hawki_load_image()
+
+2007-05-31 15:28 yjung
+
+ * recipes/: hawki_img_dark.c, hawki_img_dark2.c, Makefile.am,
+ hawki_img_dark2.c: [no log message]
+
+2007-05-31 14:16 yjung
+
+ * recipes/: Makefile.am, hawki_img_dark2.c: [no log message]
+
+2007-05-30 15:13 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: irplib_detmon_lg() API
+ modified. Error in int (* compare) declaration fixed
+
+2007-05-25 15:06 lbilbao
+
+ * irplib/irplib_detmon.c: indent applied to remove some tabs and to
+ match some other coding standards
+
+2007-05-25 09:16 lbilbao
+
+ * irplib/irplib_detmon.c: cpl_sprintf() moved back to
+ irplib_sprintf() as it is not supported for CPL 3.1
+
+2007-05-24 17:41 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: Little change in the
+ irplib_detmon_lg() API
+
+2007-05-24 17:32 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_sprintf() and sprintf() moved to
+ cpl_sprintf()
+
+2007-05-24 17:28 lbilbao
+
+ * irplib/irplib_detmon.c: New parameter --intermediate added. Macro
+ insert_par added for function irplib_detmon_fill_params(). Function
+ irplib_detmon_retrieve_par() added.
+
+2007-05-24 15:05 yjung
+
+ * recipes/: hawki_img_dark.c, hawki_img_flat.c: [no log message]
+
+2007-05-24 14:25 yjung
+
+ * recipes/hawki_img_flat.c: back to 3.1
+
+2007-05-24 12:56 lbilbao
+
+ * irplib/irplib_detmon.c: clreturn_if macro added in function
+ irplib_detmon_lg_reduce()
+
+2007-05-24 10:26 lbilbao
+
+ * irplib/irplib_detmon.c: Extra tokens in undef directive removed
+
+2007-05-24 09:46 llundin
+
+ * irplib/irplib_std.c: irplib_great_circle_dist(): Copied from
+ VISIR. irplib_std_get_closest_star(): Replace Euclidian distance
+ with irplib_great_circle_dist(), add debugging statements.
+ IRPLIB_STD_MAXRADIUS: Definable at compile time
+
+2007-05-24 09:31 jmlarsen
+
+ * irplib/tests/irplib_utils-test.c: Disabled the tests using NaN
+ because NaN is not easy to produce portably
+
+2007-05-23 15:39 jmlarsen
+
+ * irplib/irplib_strehl.c: Use irplib_isnan instead of isnan
+
+2007-05-23 15:33 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: const modifier added
+ in some functions declarations
+
+2007-05-23 15:10 yjung
+
+ * configure.ac: added check isinf isnan
+
+2007-05-23 15:06 lbilbao
+
+ * irplib/irplib_detmon.c: Macro clreturn_if added in
+ irplib_detmon_lg()
+
+2007-05-23 14:48 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h,
+ tests/irplib_utils-test.c: Added irplib_isinf, irplib_isnan
+
+2007-05-22 10:33 jmlarsen
+
+ * irplib/irplib_plot.c: Added cast to suppress CPL warning
+
+2007-05-22 10:21 jmlarsen
+
+ * irplib/: irplib_plot.c, irplib_plot.h: Eliminated usage of POSIX
+ popen/pclose calls and implemented the plotting i/o using just the
+ ANSI system() call. This change was made in order to allow
+ compiling with gcc's C99 mode which is convenient.
+
+2007-05-21 15:15 lbilbao
+
+ * irplib/irplib_detmon.c: Some warnings because declarations and
+ code mixed removed
+
+2007-05-16 14:16 lbilbao
+
+ * irplib/irplib_detmon.c: Unnecessary error messages removed
+
+2007-05-16 14:00 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: IR Recipe code
+ modified. Description macro moved to irplib_detmon.c, #include
+ detmon_dfs.h and #include detmon_utils.h removed
+
+2007-05-14 14:02 llundin
+
+ * irplib/irplib_dfs.c: irplib_image_save(): Document creation of
+ FITS header
+
+2007-05-14 10:23 lbilbao
+
+ * irplib/irplib_detmon.c: Memory leak in irplib_detmon_linearity()
+ in case OPT fixed. See else at the end of the function.
+
+2007-05-14 09:18 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Unused variables removed
+
+2007-05-11 11:18 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: CPL_BPP_DEFAULT changed to
+ CPL_BPP_IEEE_FLOAT. Unnecessary tests also removed.
+
+2007-05-10 16:50 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_detect_badpixs() removed
+ (unnecessary). Error checking improved overall.
+
+2007-05-10 15:09 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h:
+ irplib_detmon_create_bpm_dark_or_bias() unnecessary and removed
+
+2007-05-10 15:03 lbilbao
+
+ * irplib/irplib_detmon.c: New function irplib_detmon_opt_lampcr()
+ added
+
+2007-05-10 10:58 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: removed plotting
+ from irplib_wlxcorr_best_poly()
+
+2007-05-10 09:51 lbilbao
+
+ * irplib/irplib_detmon.c: Contamination part with corresponding
+ parameters added
+
+2007-05-09 16:56 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: [no log message]
+
+2007-05-09 15:45 yjung
+
+ * recipes/hawki_img_flat.c: const modifs for cpl_frameset_labelise
+
+2007-05-09 13:56 lbilbao
+
+ * irplib/irplib_detmon.c: Changes in irplib_detmon_gain() to
+ compute new fitting formula. Changes in irplib_detmon_lg() to
+ compute optical-specific QC parameters. Linearity coeffs images
+ disabled for the optical domain
+
+2007-05-09 11:45 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_ir_lg_split_onoff(),
+ irplib_detmon_ir_lg_reduce() and irplib_detmon_ir_lg_save() changed
+ to irplib_detmon_lg_split_onoff(), irplib_detmon_lg_reduce() and
+ irplib_detmon_lg_save(). A more general API to be used also for the
+ optical domain
+
+2007-05-09 10:27 lbilbao
+
+ * irplib/irplib_detmon.c: Warnings because of variables declared
+ inside the code removed
+
+2007-05-08 15:44 lbilbao
+
+ * irplib/irplib_detmon.c: static modifier added to functions that
+ won't be exported
+
+2007-05-08 15:18 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c:
+ irplib_detmon_lg() enabled to process first 2 frames separately in
+ the optical domain. Unit test expanded
+
+2007-05-07 17:19 yjung
+
+ * hawki/hawki_load.c: CPL_BPP_DEFAULT CPL_BPP_IEEE_FLOAT
+
+2007-05-07 16:50 yjung
+
+ * irplib/: irplib_detmon.c, irplib_dfs.c: CPL_BPP_DEFAULT ->
+ CPL_BPP_IEEE_FLOAT
+
+2007-05-07 14:20 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_fill_params() changed to
+ make it independent from the calling recipe
+
+2007-05-07 12:26 jmlarsen
+
+ * irplib/irplib_detmon.h: Removed compile time version check of CPL
+ version
+
+2007-05-07 12:26 jmlarsen
+
+ * irplib/irplib_detmon.c: Added inclusion of cpl.h
+
+2007-05-07 10:52 lbilbao
+
+ * irplib/tests/Makefile.am: Back to previous version
+
+2007-05-07 10:15 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h, tests/Makefile.am,
+ tests/irplib_detmon-test.c: New boolean parameter added and name
+ changed to irplib_detmon_lg().
+
+2007-05-02 16:34 lbilbao
+
+ * irplib/irplib_detmon.c: QC parameters added to PAF file
+
+2007-05-02 16:27 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: Different PRO.CATGs for different
+ products added. qclist added. PAF file created.
+
+2007-05-02 12:03 lbilbao
+
+ * irplib/irplib_detmon.c: Boolean parameter used in
+ irplib_detmon_autocorr_factor() to de-/activate computation of
+ autocorr factor
+
+2007-05-02 11:51 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c:
+ CPL_TYPE_FLOAT instead of CPL_TYPE_DOUBLE overall
+
+2007-05-02 10:53 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Unnecessary
+ propertylist loads removed in irplib_detmon_ir_lg_save().
+ Unnecessary error message removed in irplib_detmon_split_onoff().
+ New parameters (autocorr, m, n) added to the recipe.
+
+2007-04-27 17:04 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: irplib_detmon_ir_lg()
+ and irplib_detmon_compare_dits APIs changed to adapt to new
+ prototype of cpl_frameset_labelise(). Single-precision FFT in
+ irplib_detmon_image_autocorrelate_fftw()
+
+2007-04-27 12:12 lbilbao
+
+ * irplib/irplib_detmon.c: Prototype of
+ irplib_detmon_image_autocorrelate_fftw() was missing
+
+2007-04-27 12:08 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_image_autocorrelate_fftw()
+ function added
+
+2007-04-27 10:35 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: irplib_detmon_ir_lg()
+ API changed to avoid warning in cpl_frameset_labelise(). const
+ modifier applied to cpl_parameterlist (and casted back without
+ const) in irplib_detmon_retrieve_params().
+
+2007-04-27 09:58 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Unnecessary
+ CPL_ERROR_UNSUPPORTED_MODE msgs removed
+
+2007-04-27 09:42 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: const modifier applied to
+ variables tag_on and tag_off
+
+2007-04-27 09:40 lbilbao
+
+ * irplib/irplib_detmon.c: Info and error msgs added overall.
+ irplib_get_clean_mean_window() improved: Condition to stop
+ iteration included
+
+2007-04-26 17:05 lbilbao
+
+ * irplib/irplib_detmon.c: Memory leaks in irplib_detmon_ir_lg() and
+ irplib_detmon_ir_lg_split_onoff() fixed: several cpl_xx_delete()
+ calls added
+
+2007-04-26 16:08 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h,
+ tests/irplib_detmon-test.c: irplib_detmon_ir_lg() API changed to
+ fix some warnings
+
+2007-04-25 16:23 yjung
+
+ * irplib/tests/Makefile.am: [no log message]
+
+2007-04-25 16:13 yjung
+
+ * recipes/: hawki_img_dark.c, hawki_img_flat.c: irplib_sprintf ->
+ cpl_sprintf
+
+2007-04-25 16:06 yjung
+
+ * irplib/tests/: Makefile.am, irplib_fit-test.c: moved to CPL
+
+2007-04-25 15:56 lbilbao
+
+ * irplib/irplib_detmon.c: Autocorrelation through cpl_image_fft()
+ added: function irplib_detmon_autocorrelate()
+
+2007-04-25 15:31 yjung
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h: removed
+ irplib_fit.ch (-> CPL)
+
+2007-04-25 13:44 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: New function:
+ irplib_detmon_fill_params() added
+
+2007-04-25 12:21 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Failure related to CPL 3.1
+ fixed
+
+2007-04-25 11:54 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_lg_reduce(): Added
+ computation of GAIN via polynomial fit
+
+2007-04-25 11:25 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_gain(): Added creation of
+ fit_table, to be used to compute GAIN via polynomial fit
+
+2007-04-25 10:41 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Warnings in
+ irplib_detmon_tests() fixed
+
+2007-04-25 10:25 lbilbao
+
+ * irplib/irplib_detmon.c: Warnings in irplib_detmon_bpixs() and
+ irplib_detmon_ir_lg_save() fixed
+
+2007-04-25 09:49 lbilbao
+
+ * irplib/irplib_detmon.c: Warnings in
+ irplib_detmon_image_correlate() and irplib_detmon_autocorr_factor()
+ fixed
+
+2007-04-24 16:07 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: ifdef CPL_VERSION inserted
+
+2007-04-24 15:36 lbilbao
+
+ * irplib/irplib_detmon.c: irplib_detmon_lg_reduce() : use
+ cpl_fit_imagelist_polynomial
+
+2007-04-24 14:27 llundin
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h,
+ irplib_fit_body.h, tests/irplib_fit-test.c:
+ irplib_fit_imagelist_polynomial(): Moved to CPL
+
+2007-04-24 11:54 lbilbao
+
+ * irplib/irplib_detmon.c: Function for bad pixels added
+
+2007-04-24 10:47 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: irplib_vsprintf(),
+ irplib_sprintf(): define as CPL function for CPL versions at least
+ 3.1.90. Drop support for CPL versions less than 3.1
+
+2007-04-20 15:37 lbilbao
+
+ * irplib/irplib_detmon.c: Save linearity table: included
+
+2007-04-20 15:11 lbilbao
+
+ * irplib/irplib_detmon.c: Linearity table included
+
+2007-04-17 11:37 llundin
+
+ * irplib/irplib_std.c: irplib_std_get_mag_one_cat(): Added
+ diagnostics message
+
+2007-04-17 11:21 lbilbao
+
+ * irplib/: irplib_detmon.c, tests/irplib_detmon-test.c: Products
+ saving included
+
+2007-04-17 09:36 lbilbao
+
+ * irplib/irplib_detmon.c: FFTW dependency corrected
+
+2007-04-16 16:56 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Unit tests updated with
+ irplib_detmon_ir_lg
+
+2007-04-16 16:55 lbilbao
+
+ * irplib/: irplib_detmon.c, irplib_detmon.h: First prototype of
+ irplib_detmon_ir_lg
+
+2007-04-05 10:24 llundin
+
+ * irplib/irplib_plugin.h: Revert to 1.11
+
+2007-04-05 09:48 llundin
+
+ * irplib/irplib_plugin.c: Revert to 1.8
+
+2007-04-05 09:47 llundin
+
+ * irplib/irplib_plugin.c: irplib_plugin_exec(): use fork()
+
+2007-04-04 15:48 llundin
+
+ * irplib/irplib_plugin.c: irplib_plugin_exec(): Removed test-part
+ of code
+
+2007-04-04 15:38 llundin
+
+ * irplib/: irplib_plugin.c, irplib_plugin.h: Added
+ irplib_plugin_exec()
+
+2007-03-26 11:48 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_load_propertylist():
+ Improved error message
+
+2007-03-22 10:45 jmlarsen
+
+ * irplib/irplib_test.c: Fixed documentation
+
+2007-03-14 09:19 llundin
+
+ * irplib/: irplib_error.c, irplib_plugin.c, irplib_slitpos.c,
+ tests/irplib_utils-test.c: include string.h
+
+2007-03-14 08:38 amodigli
+
+ * irplib/irplib_test.c: defined strlen-fixed portability problem on
+ sun4u (SUNW,Ultra-250)
+
+2007-03-06 15:01 lbilbao
+
+ * irplib/tests/irplib_detmon-test.c: Test unit improved
+
+2007-03-06 14:22 lbilbao
+
+ * irplib/: Makefile.am, irplib_detmon.c, irplib_detmon.h,
+ tests/Makefile.am, tests/irplib_detmon-test.c: Added detmon module
+ with testing
+
+2007-03-06 08:11 jmlarsen
+
+ * irplib/irplib_test.c: irplib_test_init_macro(): Fixed some bad
+ code structure
+
+2007-03-05 14:31 jmlarsen
+
+ * irplib/irplib_test.c: Treat properly the situation where __FILE__
+ contains a path (needed for make distcheck and VPATH builds)
+
+2007-03-05 12:42 llundin
+
+ * irplib/tests/irplib_fit-test.c:
+ irplib_fit_imagelist_polynomial_tests(): Restrict checks on CPL
+ error code, use cpl_vector_fill_polynomial() to fill vdit
+
+2007-03-05 11:57 amodigli
+
+ * irplib/irplib_strehl.c: fixed typo
+
+2007-03-05 11:31 amodigli
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h: remove static and
+ bring irplib_strehl_disk_max to .h
+
+2007-03-02 14:26 yjung
+
+ * hawki/hawki_dfs.c, hawki/hawki_dfs.h, recipes/hawki_img_flat.c:
+ [no log message]
+
+2007-03-02 10:14 jmlarsen
+
+ * irplib/tests/Makefile.am: Added the missing dependencies from
+ test programs to LIBIRPLIB, updated TESTS target to avoid
+ duplication
+
+2007-03-02 10:12 jmlarsen
+
+ * irplib/Makefile.am: Fixed SUBDIRS target to realize the
+ dependency from the tests subdirectory to the current directory
+
+2007-03-02 09:54 llundin
+
+ * irplib/irplib_test.h: irplib_test_macro(): Renamed __func__ to
+ cpl_func
+
+2007-03-02 08:20 yjung
+
+ * recipes/: Makefile.am, hawki_img_flat.c: [no log message]
+
+2007-03-02 08:09 yjung
+
+ * hawki/hawki_load.c: [no log message]
+
+2007-03-02 08:08 yjung
+
+ * recipes/hawki_img_dark.c: first working version
+
+2007-03-01 08:29 llundin
+
+ * irplib/irplib_test.c: irplib_test_init_macro(): Replaced __func__
+ with cpl_func
+
+2007-02-28 11:40 llundin
+
+ * irplib/tests/irplib_fit-test.c: irplib_fit_image_is_zero_macro():
+ Fix compiler warning introduced by previous change
+
+2007-02-27 16:20 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h:
+ irplib_fit_imagelist_polynomial_find_block_size() used for
+ generalization of L2-cache-optimization
+
+2007-02-27 15:53 jmlarsen
+
+ * irplib/: irplib_test.c, irplib_test.h: Do not crash when
+ comparing NULL strings
+
+2007-02-27 14:42 jmlarsen
+
+ * irplib/tests/: irplib_dfs-test.c, irplib_error-test.c,
+ irplib_fit-test.c, irplib_utils-test.c: Update to new interface of
+ IRPLIB_TEST_INIT
+
+2007-02-27 14:40 jmlarsen
+
+ * irplib/: irplib_test.c, irplib_test.h, tests/irplib_test.h,
+ tests/Makefile.am, Makefile.am: Moved unit test infrastructure to
+ top-level ./irplib directory
+
+2007-02-26 11:48 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h,
+ tests/irplib_fit-test.c: irplib_fit_imagelist_polynomial(): Round
+ off instead of truncating when using integer pixel types
+
+2007-02-26 11:10 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit.h, irplib_fit_body.h,
+ tests/irplib_fit-test.c: irplib_fit_imagelist_polynomial(): Add
+ output pixel-type, document use of cpl_matrix_decomp_chol()
+
+2007-02-20 16:24 llundin
+
+ * irplib/irplib_fit.c: irplib_matrix_solve_chol_transpose(): Merge
+ bread/bwrite into bk. irplib_matrix_product_transpose(): Drop
+ ds-row optimization
+
+2007-02-20 15:30 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h:
+ irplib_fit_imagelist_residual_*(): Move xpow computation out to
+ irplib_fit_imagelist_polynomial()
+
+2007-02-19 15:40 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h,
+ tests/irplib_fit-test.c: irplib_fit_imagelist_residual(): Fixed
+ fiterror-bug (mindeg ==0, xmean not 0, maxdeg > 1) and removed
+ wrong fiterror-info from doxygen
+
+2007-02-19 09:33 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h: Added
+ irplib_matrix_product_transpose(),
+ irplib_matrix_solve_chol_transpose(),
+ irplib_fit_imagelist_residual_{int,float,double}().
+ irplib_fit_imagelist_polynomial(): Improved doxygen, use
+ _transpose+residual-functions, do cpl_matrix_decomp_chol()
+
+2007-02-19 09:28 llundin
+
+ * irplib/tests/irplib_fit-test.c:
+ irplib_fit_imagelist_polynomial_tests(): Added more tests
+
+2007-02-16 17:12 llundin
+
+ * irplib/irplib_fit_body.h:
+ irplib_fit_imagelist_polynomial_double(): Use memcpy()
+
+2007-02-16 17:12 llundin
+
+ * irplib/irplib_fit.c: irplib_fit_imagelist_polynomial(): Improved
+ doxygen
+
+2007-02-16 14:40 llundin
+
+ * irplib/tests/irplib_fit-test.c:
+ irplib_fit_imagelist_polynomial(): Test with is_eqdist set to
+ CPL_TRUE
+
+2007-02-16 14:39 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h: Removed dead code,
+ copied irplib_matrix_product_normal_create() from CPL,
+ irplib_fit_imagelist_polynomial(): Support is_eqdist and use
+ irplib_matrix_product_normal_create()
+
+2007-02-15 09:19 llundin
+
+ * irplib/irplib_dfs.c: irplib_paf_save(): Updated doxygen example
+ (Take filename as parameter)
+
+2007-02-13 17:10 yjung
+
+ * hawki/hawki_load.c, recipes/hawki_img_dark.c: [no log message]
+
+2007-02-13 17:03 yjung
+
+ * AUTHORS, BUGS, COPYING, COPYING.LIB, ChangeLog, INSTALL,
+ Makefile.am, NEWS, README, TODO, acinclude.m4, bootstrap,
+ configure.ac, setup, admin/config.guess, admin/config.sub,
+ admin/depcomp, admin/html.am, admin/install-sh, admin/ltmain.sh,
+ admin/missing, admin/mkinstalldirs, doxygen/Doxyfile.in,
+ hawki/Makefile.am, hawki/hawki_combine.c, hawki/hawki_combine.h,
+ hawki/hawki_dfs.c, hawki/hawki_dfs.h, hawki/hawki_load.c,
+ hawki/hawki_load.h, hawki/hawki_pfits.c, hawki/hawki_pfits.h,
+ hawki/hawki_utils.c, hawki/hawki_utils.h, m4macros/cpl.m4,
+ m4macros/eso.m4, recipes/Makefile.am, recipes/hawki_img_dark.c,
+ tests/Makefile.am: Initial revision
+
+2007-02-13 17:03 yjung
+
+ * AUTHORS, BUGS, COPYING, COPYING.LIB, ChangeLog, INSTALL,
+ Makefile.am, NEWS, README, TODO, acinclude.m4, bootstrap,
+ configure.ac, setup, admin/config.guess, admin/config.sub,
+ admin/depcomp, admin/html.am, admin/install-sh, admin/ltmain.sh,
+ admin/missing, admin/mkinstalldirs, doxygen/Doxyfile.in,
+ hawki/Makefile.am, hawki/hawki_combine.c, hawki/hawki_combine.h,
+ hawki/hawki_dfs.c, hawki/hawki_dfs.h, hawki/hawki_load.c,
+ hawki/hawki_load.h, hawki/hawki_pfits.c, hawki/hawki_pfits.h,
+ hawki/hawki_utils.c, hawki/hawki_utils.h, m4macros/cpl.m4,
+ m4macros/eso.m4, recipes/Makefile.am, recipes/hawki_img_dark.c,
+ tests/Makefile.am: HAWKI pipeline
+
+2007-02-12 11:34 amodigli
+
+ * irplib/: irplib_calib.c, irplib_calib.h: removed a few warnings
+
+2007-02-12 10:35 amodigli
+
+ * irplib/irplib_calib.c: changed gain computation function to have
+ better final accuracy
+
+2007-02-12 09:46 jmlarsen
+
+ * irplib/tests/irplib_dfs-test.c: Added a few QC comments
+
+2007-02-12 09:12 jmlarsen
+
+ * irplib/irplib_dfs.h: Removed obsolete stdarg.h inclusion, added
+ cpl.h inclusion
+
+2007-02-12 09:11 jmlarsen
+
+ * irplib/tests/: Makefile.am, irplib_dfs-test.c: Added irplib_dfs
+ unit test
+
+2007-02-08 14:20 llundin
+
+ * irplib/irplib_fit_body.h: irplib_polynomial_shift(): Removed
+ debugging call of cpl_matrix_dump()
+
+2007-02-08 14:19 llundin
+
+ * irplib/: irplib_fit.c, irplib_fit_body.h:
+ irplib_polynomial_shift(): Use irplib_vector_transform_mean() when
+ mindeg == 0
+
+2007-02-08 13:07 llundin
+
+ * irplib/tests/irplib_fit-test.c:
+ irplib_fit_imagelist_polynomial_tests(): Raised tolerance and
+ accept a non-failure of irplib_fit_imagelist_polynomial()
+
+2007-02-07 14:38 llundin
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h,
+ irplib_fit_body.h, tests/Makefile.am, tests/irplib_fit-test.c:
+ irplib_fit_imagelist_polynomial(): Added with unit tests
+
+2007-02-06 09:29 llundin
+
+ * irplib/irplib_fit.c: Moved static functions to end-of-source and
+ out of doxygen
+
+2007-01-17 14:55 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE(): Use
+ cpl_dfs_update_product_header() in epilogue of <recipe>_exec()
+
+2007-01-17 14:54 llundin
+
+ * irplib/: irplib_dfs.c, irplib_dfs.h:
+ irplib_dfs_update_frameset(): Moved to
+ cpl_dfs_update_product_header()
+
+2007-01-16 10:57 yjung
+
+ * irplib/irplib_dfs.c: Fixed assert bug in irplib_product_save()
+
+2007-01-10 14:51 llundin
+
+ * irplib/: irplib_dfs.c, irplib_dfs.h:
+ irplib_dfs_update_frameset(): Disabled per default
+
+2007-01-10 14:51 llundin
+
+ * irplib/irplib_plugin.h: Reverted previous edit
+
+2007-01-10 13:58 llundin
+
+ * irplib/: irplib_dfs.c, irplib_dfs.h, irplib_plugin.h:
+ irplib_dfs_update_frameset(): Added (for use by <recipe>_exec()
+
+2007-01-09 15:36 yjung
+
+ * irplib/irplib_irlist.h: additional errors in DEC signs of 50
+ stars (DFS03307)
+
+2007-01-08 13:47 yjung
+
+ * irplib/irplib_irlist.h: changed coordinates for Hip025028 and
+ Hip025044 (DFS03307)
+
+2006-12-13 12:29 jmlarsen
+
+ * irplib/irplib_plot.c: Documentation: Added som cpl_error_codes to
+ list of possible errors
+
+2006-12-07 09:42 llundin
+
+ * irplib/irplib_utils.c: irplib_vsprintf_macro(): Cast to cxsize in
+ call to cx_vsnprintf()
+
+2006-12-05 13:17 llundin
+
+ * irplib/tests/irplib_test.h: IRPLIB_TEST_END(): Fix
+ end-of-statement warning
+
+2006-12-05 13:16 llundin
+
+ * irplib/irplib_utils.c: irplib_vsprintf(): Use cx_vsnprintf()
+
+2006-12-05 13:16 llundin
+
+ * irplib/tests/irplib_utils-test.c: Moved check of null up (in prep
+ for reset)
+
+2006-12-01 11:01 amodigli
+
+ * irplib/tests/irplib_test.h: added guard IRPLIB_TEST_H
+
+2006-11-30 15:54 llundin
+
+ * irplib/tests/: Makefile.am, irplib_test.h, irplib_utils-test.c:
+ Added irplib_test.h
+
+2006-11-29 14:22 yjung
+
+ * irplib/: irplib_slitpos.c, irplib_slitpos.h: added a parameter to
+ irplib_slitpos_analysis() that returns the slit flux
+
+2006-11-28 15:45 jmlarsen
+
+ * irplib/tests/irplib_error-test.c: Fixed doc. bug
+
+2006-11-28 15:16 llundin
+
+ * irplib/tests/irplib_utils-test.c: Fixed two doxygen warnings
+
+2006-11-28 09:25 jmlarsen
+
+ * irplib/tests/Makefile.am: Factored out LDADD
+
+2006-11-27 15:23 llundin
+
+ * irplib/tests/irplib_utils-test.c: irplib_bpp_find(): Support CPL
+ 3.0
+
+2006-11-27 15:17 llundin
+
+ * irplib/irplib_utils.c: irplib_bpp_find(): Support CPL 3.0
+
+2006-11-27 11:25 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h, tests/Makefile.am,
+ tests/irplib_utils-test.c: irplib_bpp_find(): Added.
+ irplib_vsprintf(): Fixed memory-leak on illegal format string
+
+2006-11-27 09:58 llundin
+
+ * irplib/: irplib_dfs.c, irplib_dfs.h:
+ irplib_{image,table,paf}_save(): Take filename as parameter.
+ irplib_{image,table}_save(): Take regexp for FITS key removal.
+ irplib_image_save(): Take BPP. irplib_table_save(): Take
+ propertylist for extension
+
+2006-11-23 15:13 llundin
+
+ * irplib/irplib_framelist.c: irplib_type_as_string(): Fixed
+ break-bug introduced in previous commit
+
+2006-11-23 11:07 llundin
+
+ * irplib/irplib_framelist.c: irplib_type_as_string(): Replace
+ assert() with cpl_ensure()
+
+2006-11-23 11:02 jmlarsen
+
+ * irplib/tests/irplib_error-test.c: Fixed doxybug
+
+2006-11-23 10:46 llundin
+
+ * irplib/irplib_slitpos.c: irplib_slitpos_analysis(): Fixed uninit
+ warning (bis)
+
+2006-11-23 09:33 jmlarsen
+
+ * irplib/tests/irplib_error-test.c: Added missing
+ exit(EXIT_SUCCESS) statement
+
+2006-11-22 13:23 jmlarsen
+
+ * irplib/tests/Makefile.am: Updated AUTOMAKE_OPTIONS to 1.8 and
+ fixed FSF address
+
+2006-11-22 12:11 jmlarsen
+
+ * irplib/: Makefile.am, tests/Makefile.am,
+ tests/irplib_error-test.c: Added unit test module
+
+2006-11-22 11:58 llundin
+
+ * irplib/irplib_slitpos.c: irplib_slitpos_find_vert_slit_ends():
+ Fixed uninit warning. irplib_slitpos_analysis(): Fixed uninit
+ warning.
+
+2006-11-22 11:50 llundin
+
+ * irplib/irplib_framelist.c: irplib_property_equal(): Fixed uninit
+ warning. irplib_type_as_string(): Fixed missing return warning
+
+2006-11-22 09:36 jmlarsen
+
+ * irplib/tests/: Makefile.am, irplib_error-test.c: Reverted
+ previous erroneous commit
+
+2006-11-22 09:22 jmlarsen
+
+ * irplib/tests/: Makefile.am, irplib_error-test.c: Set message
+ level according to preprocessor symbol
+
+2006-11-21 10:49 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_compute(): Replace
+ IRPLIB_STREHL_BORDER with new IRPLIB_STREHL_RAD_CENTRAL
+
+2006-11-21 08:54 amodigli
+
+ * irplib/irplib_fit.c: replaced __func__ by cpl_func
+
+2006-11-20 21:23 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_disk_max(): Fix minor cast
+ bug
+
+2006-11-20 17:40 llundin
+
+ * irplib/: irplib_dfs.c, irplib_framelist.c, irplib_plot.c,
+ irplib_plugin.c, irplib_utils.c, irplib_utils.h:
+ irplib_vsnprintf_create(): Renamed to irplib_vsprintf().
+ irplib_string_concatenate_all(): Renamed to irplib_sprintf()
+
+2006-11-20 15:31 llundin
+
+ * irplib/irplib_strehl.c: irplib_strehl_compute(): Use
+ irplib_strehl_disk_max() for max star flux, Round-off to nearest
+ for ring[] to cpl_flux_get_noise_ring(). PSF_H1(): Remove arbitrary
+ constant
+
+2006-11-20 10:18 amodigli
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h: added
+ irplib_fit .c .h
+
+2006-11-20 09:56 llundin
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h:
+ irplib_strehl_compute(): Use type double for (xpos, ypos), Replace
+ hardcoded 5 with IRPLIB_STREHL_BORDER for image border, Use double
+ for star_radius and ring spec to irplib_strehl_ring_background(),
+ Propagate error in cpl_flux_get_noise_ring()
+
+2006-11-16 13:26 yjung
+
+ * irplib/irplib_calib.c: solved leak
+
+2006-11-16 11:17 amodigli
+
+ * irplib/irplib_calib.c: fix doxygen warning
+
+2006-11-15 18:03 amodigli
+
+ * irplib/irplib_calib.c: irplib_get_clean_mean_window
+
+2006-11-15 15:10 jmlarsen
+
+ * irplib/tests/: Makefile.am, irplib_error-test.c: Removed files
+ that were erroneously added
+
+2006-11-15 15:04 jmlarsen
+
+ * irplib/: irplib_access.c, irplib_access.h, tests/Makefile.am,
+ tests/irplib_error-test.c: Removed non-const version of
+ parameterlist_get_first/last/next which is already in CPL, added
+ const-safe wrapper, unwrapper and deallocator functions
+
+2006-11-15 09:33 llundin
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h:
+ irplib_strehl_disk_flux(): Use doubles for pixel arguments, use CPL
+ error handling. irplib_strehl_ring_background(): Ditto + use new
+ irplib_strehl_bg_method enum + support NANs in both modes
+
+2006-11-14 10:00 jmlarsen
+
+ * irplib/: Makefile.am, irplib_access.c, irplib_access.h: Added
+ irplib_access module
+
+2006-11-13 16:17 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE():
+ cpl_plugin_get_info(): Cast to void
+
+2006-11-06 09:12 amodigli
+
+ * irplib/irplib_calib.c: added doxygen
+
+2006-11-03 10:41 llundin
+
+ * irplib/irplib_wlxcorr.c: irplib_wlxcorr_gen_signal(): Fixed
+ doxygen typo
+
+2006-10-27 12:05 amodigli
+
+ * irplib/: irplib_calib.c, irplib_calib.h: added
+ irplib_compute_gain and irplib_compute_linearity as ported by
+ sinfoni
+
+2006-10-23 19:49 llundin
+
+ * irplib/irplib_plot.c: Removed many splint warnings, mostly
+ regarding sprintf()
+
+2006-10-23 17:05 llundin
+
+ * irplib/: irplib_dfs.c, irplib_framelist.c, irplib_slitpos.c,
+ irplib_utils.c, irplib_utils.h: Fixed various splint warnings
+
+2006-10-23 10:24 jmlarsen
+
+ * irplib/irplib_plugin.h: Included irplib_error.h and
+ irplib_utils.h
+
+2006-10-17 12:54 llundin
+
+ * irplib/irplib_slitpos.c: Add units to table.
+ IRPLIB_SLITPOS_KERNEL_SIZE_Y and IRPLIB_SLITPOS_MAX_EROSION
+
+2006-10-17 12:53 llundin
+
+ * irplib/irplib_utils.c: irplib_vsnprintf_create(): Assume either
+ va_copy or __va_copy() (and fix cpp warning)
+
+2006-10-17 10:12 llundin
+
+ * irplib/irplib_slitpos.c: irplib_slitpos_analysis(): Incremented
+ slit_length
+
+2006-10-17 09:23 llundin
+
+ * irplib/irplib_slitpos.c: irplib_slitpos_find_vert_slit_ends():
+ Use memchr()/memrchr(). Simplify error check
+
+2006-10-17 07:40 llundin
+
+ * irplib/: irplib_slitpos.c, irplib_slitpos.h:
+ irplib_slitpos_analysis(): Add const modifier, Use cpl_ensure(),
+ Drop redundant cpl_image_filter_median(), Improve error messages
+ and add diagnostics. irplib_slitpos_find_vert_pos(): Keep slitpos
+ away from image boundary. irplib_slitpos_find_edges_one_line(): Do
+ not crash on non-float pixels.
+ irplib_slitpos_find_vert_slit_ends(): Prevent out-of-bounds array
+ indexing
+
+2006-10-13 09:59 llundin
+
+ * irplib/irplib_plot.c: Added description of
+ CPL_ERROR_UNSUPPORTED_MODE failure. Moved static functions to end
+
+2006-10-13 09:51 llundin
+
+ * irplib/irplib_plot.h: irplib_plot_manpage: Fixed unused variable
+ warning
+
+2006-10-12 15:21 jmlarsen
+
+ * irplib/irplib_plot.c: Replaced POSIX mkstemp/write/close system
+ calls with ANSI equivalents
+
+2006-10-11 14:02 llundin
+
+ * irplib/irplib_error.c: IRPLIB_ERROR_MAX_STRING_LENGTH=256 and
+ IRPLIB_ERROR_MAX_ERRORS=20
+
+2006-10-11 13:55 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_contains(): Improve
+ grammar in messages
+
+2006-10-10 16:42 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_error.h: Changed returntype of
+ the internal function irplib_error_push_macro from cpl_error_code
+ to void. The returnvalue was redundant and not used
+
+2006-10-10 16:33 llundin
+
+ * irplib/irplib_plugin.h: IRPLIB_RECIPE_DEFINE(): Redefined to
+ require trailing ; when invoked
+
+2006-10-06 22:46 yjung
+
+ * irplib/: irplib_oddeven.c, irplib_oddeven.h: remove useles
+ irplib_oddeven_correct_auto
+
+2006-10-06 13:26 llundin
+
+ * irplib/irplib_framelist.c: irplib_error_push() needed by
+ functions whose failure may be recoverable
+
+2006-10-06 13:25 llundin
+
+ * irplib/irplib_plugin.c: irplib_parameterlist_get_*(): Use
+ cpl_error_set_where()
+
+2006-10-06 09:36 llundin
+
+ * irplib/irplib_plugin.h: cpl_plugin_get_info(): Return 1 on error
+
+2006-10-06 03:29 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-10-06 01:39 yjung
+
+ * irplib/irplib_wlxcorr.c: added sorted corr values plot
+
+2006-10-05 16:44 jmlarsen
+
+ * irplib/irplib_plugin.h: Added author's email address as parameter
+ to IRPLIB_RECIPE_DEFINE
+
+2006-10-04 16:32 llundin
+
+ * irplib/: irplib_plugin.c, irplib_plugin.h: Added
+ irplib_parameterlist_{set,get}_{string,bool,int,double}()
+
+2006-10-04 16:31 llundin
+
+ * irplib/: irplib_calib.c, irplib_calib.h:
+ irplib_flat_dark_bpm_calib() and irplib_detlin_correct(): Added
+ const modifiers to file names
+
+2006-10-04 13:27 jmlarsen
+
+ * irplib/irplib_error.c: Fixed documentation typos
+
+2006-10-04 13:26 jmlarsen
+
+ * irplib/irplib_error.h: Fixed documentation typo
+
+2006-09-29 10:13 yjung
+
+ * irplib/irplib_distortion.c: Bug in cpl_mask_closing() : replace
+ by erosion / dilation to avoid being affected by the Bug fix in CPL
+ (DFS03150)
+
+2006-09-27 18:12 llundin
+
+ * irplib/irplib_plugin.c: Added @defgroup
+
+2006-09-27 09:00 llundin
+
+ * irplib/irplib_plugin.c: recipe_msg_set_level_from_env(): Fix
+ old-style definition
+
+2006-09-26 10:11 llundin
+
+ * irplib/: irplib_std.c, irplib_std.h: irplib_std_get_name(),
+ irplib_std_get_catalog(), irplib_std_get_type_spectral() added
+
+2006-09-22 16:24 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-09-21 17:06 cizzo
+
+ * irplib/irplib_ppm.c: Initialise disp variable in
+ irplib_ppm_match_positions() (to avoid compiler warning)
+
+2006-09-21 11:25 llundin
+
+ * irplib/: Makefile.am, irplib_plugin.c, irplib_plugin.h:
+ IRPLIB_RECIPE_DEFINE()
+
+2006-09-20 17:09 yjung
+
+ * irplib/: irplib_oddeven.c, irplib_oddeven.h: oddeven method (FFT
+ -> automatic removal) in progress
+
+2006-09-20 15:28 yjung
+
+ * irplib/irplib_wlxcorr.c: Plot the difference between the computed
+ and the initial solutions
+
+2006-09-20 13:53 llundin
+
+ * irplib/irplib_utils.c: irplib_vsnprintf_create(): HAVE_VA_COPY =>
+ IRPLIB_VA_COPY
+
+2006-09-20 09:20 llundin
+
+ * irplib/irplib_utils.c: irplib_vsnprintf_create(): Revert to 1.30
+
+2006-09-20 08:45 llundin
+
+ * irplib/irplib_utils.c: irplib_vsnprintf_create(): HAVE_VA_COPY =>
+ HAVE_DECL_VA_COPY
+
+2006-09-19 13:03 llundin
+
+ * irplib/irplib_utils.c: irplib_vsnprintf_create(): Check
+ HAVE_VA_COPY
+
+2006-09-18 18:02 yjung
+
+ * irplib/irplib_irlist.h: updated coordinates of HD40335 on E.
+ Mason request
+
+2006-09-18 14:32 llundin
+
+ * irplib/irplib_dfs.c: irplib_image_save(): Support NULL image
+
+2006-09-15 17:32 yjung
+
+ * irplib/irplib_wlxcorr.c: removed level correction
+
+2006-09-12 16:54 llundin
+
+ * irplib/: irplib_calib.c, irplib_distortion.c, irplib_oddeven.c,
+ irplib_ppm.c, irplib_slitpos.c, irplib_spectrum.c, irplib_std.c,
+ irplib_utils.h, irplib_wlxcorr.c: Replaced __func__ with cpl_func
+
+2006-09-12 11:16 llundin
+
+ * irplib/: irplib_error.c, irplib_error.h, irplib_framelist.c,
+ irplib_strehl.c, irplib_utils.h: Replaced __func__ by cpl_func
+
+2006-09-04 10:48 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_flat.c, irplib_framelist.c,
+ irplib_plot.c, irplib_slitpos.c, irplib_std.c, irplib_std.h,
+ irplib_strehl.c: Added/moved a few doxygen tags to make it explicit
+ that parts of the file are not supposed to be documented
+
+2006-08-29 12:59 yjung
+
+ * irplib/irplib_std.c: [no log message]
+
+2006-08-24 09:08 jmlarsen
+
+ * irplib/irplib_dfs.c: Added printf format attributes for local
+ functions
+
+2006-08-23 17:05 jmlarsen
+
+ * irplib/: irplib_plot.c, irplib_plot.h: Added
+ irplib_bivectors_plot()
+
+2006-08-21 16:18 yjung
+
+ * irplib/irplib_std.c: support case where SEDs too short
+
+2006-08-21 14:13 yjung
+
+ * irplib/irplib_slitpos.c: removed warning
+
+2006-08-21 11:37 cizzo
+
+ * irplib/irplib_ppm.c: Fix doc errors in
+ irplib_ppm_match_positions()
+
+2006-08-17 08:58 jmlarsen
+
+ * irplib/irplib_error.c: Disabled local function format attributes
+ for older versions of GCC
+
+2006-08-10 13:09 jmlarsen
+
+ * irplib/irplib_error.c: Added function pointer format attributes,
+ explicit void at function definition
+
+2006-08-07 01:08 yjung
+
+ * irplib/irplib_wlxcorr.c: mem leak
+
+2006-08-07 00:45 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-08-04 22:49 yjung
+
+ * irplib/irplib_dfs.c: increased the decimal precision for doubles
+ in the paf file
+
+2006-08-04 15:55 yjung
+
+ * irplib/irplib_std.c: corrected units with Chris inpouts
+
+2006-08-04 02:28 yjung
+
+ * irplib/irplib_std.c: [no log message]
+
+2006-08-03 02:40 yjung
+
+ * irplib/irplib_std.c: forgot to deallocate a table
+
+2006-07-28 17:59 yjung
+
+ * irplib/irplib_std.c: [no log message]
+
+2006-07-28 14:45 yjung
+
+ * irplib/irplib_std.c: [no log message]
+
+2006-07-27 15:07 yjung
+
+ * irplib/: irplib_irlist.h, irplib_std.c, irplib_std.h: [no log
+ message]
+
+2006-07-26 16:47 yjung
+
+ * irplib/: irplib_distortion.c, irplib_distortion.h: added kappa
+ parameter for arcs detection
+
+2006-07-26 16:25 llundin
+
+ * irplib/irplib_dfs.c: irplib_dfs_get_filename(): Use
+ irplib_vsnprintf_create(). Add nonnull __attribute__ for some
+ static functions
+
+2006-07-26 16:24 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Added
+ irplib_vsnprintf_create()
+
+2006-07-26 16:22 llundin
+
+ * irplib/irplib_framelist.c: Fixed warning for unsupported nonnull
+ attribute
+
+2006-07-26 10:46 cizzo
+
+ * irplib/irplib_ppm.c: Fix bug on unitialised maxpos variable in
+ irplib_ppm_match_positions()
+
+2006-07-25 10:13 llundin
+
+ * irplib/irplib_dfs.c: irplib_table_save(): Moved WCS removal to
+ cpl_table_save(). irplib_table_save() and irplib_image_save():
+ rawframes -> usedframes, propagate cpl_dfs_setup_product_header()
+ failure
+
+2006-07-24 11:45 llundin
+
+ * irplib/irplib_utils.c: irplib_string_concatenate_all(): Added
+ cast for cpl_realloc()
+
+2006-07-24 08:55 llundin
+
+ * irplib/irplib_plot.c: irplib_mplot_open(): Added getuid() check
+
+2006-07-21 17:16 llundin
+
+ * irplib/: irplib_dfs.c, irplib_plot.c: Replaced strcpy(), sprintf,
+ snprintf() - mostly with irplib_string_concatenate_all()
+
+2006-07-21 13:27 llundin
+
+ * irplib/irplib_framelist.c: irplib_property_equal(): Use
+ irplib_string_concatenate_all()
+
+2006-07-21 10:44 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_contains(): Avoid
+ variable-size array
+
+2006-07-21 09:20 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Added
+ irplib_string_concatenate_all()
+
+2006-07-20 15:46 llundin
+
+ * irplib/irplib_framelist.c: Added example
+
+2006-07-20 14:48 llundin
+
+ * irplib/irplib_framelist.c: Removed irplib_error.h dependency
+
+2006-07-20 13:45 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h:
+ irplib_framelist_load_propertylist{,_all}(): Added invert flag
+
+2006-07-20 13:17 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h:
+ irplib_framelist_extract_regexp(): Added invert flag
+
+2006-07-20 12:47 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h: Do not export
+ IRPLIB_FITS_STRLEN
+
+2006-07-20 12:35 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h: Added
+ irplib_framelist_get{,_propertylist}_const()
+
+2006-07-20 11:55 llundin
+
+ * irplib/irplib_framelist.c: Removed dependency on irplib_tools.h.
+ irplib_framelist_load_propertylist(): Use
+ cpl_propertylist_load_regexp()
+
+2006-07-20 11:21 llundin
+
+ * irplib/irplib_framelist.c: irplib_property_equal(): strncmp() ->
+ strcmp()
+
+2006-07-20 10:36 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h: Removed
+ dependence on irplib_pfits
+
+2006-07-20 10:14 llundin
+
+ * irplib/: Makefile.am, irplib_framelist.c, irplib_framelist.h: New
+ module: irplib_framelist
+
+2006-07-20 09:22 llundin
+
+ * irplib/irplib_dfs.c: irplib_assure_code() -> cpl_ensure_code()
+
+2006-07-19 09:46 llundin
+
+ * irplib/irplib_dfs.c: Removed unneeded #includes
+
+2006-07-13 13:06 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: wl_error from double
+ to vector
+
+2006-07-12 16:17 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: [no log message]
+
+2006-07-12 11:37 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-07-12 08:24 yjung
+
+ * irplib/: irplib_ppm.c, irplib_wlxcorr.c, irplib_wlxcorr.h: [no
+ log message]
+
+2006-07-11 18:41 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-07-11 18:09 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: added
+ irplib_wlxcorr_plot_solution
+
+2006-07-11 12:29 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-07-11 11:30 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: FIRST working
+ version of the best_poly() function
+
+2006-07-10 10:26 llundin
+
+ * irplib/irplib_dfs.c: irplib_paf_save(): Added example
+
+2006-07-05 16:58 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-07-05 16:56 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: added
+ irplib_wlxcorr_best_poly()
+
+2006-07-04 17:49 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-07-04 15:33 yjung
+
+ * irplib/: irplib_ppm.c, irplib_ppm.h: [no log message]
+
+2006-07-03 17:08 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: [no log message]
+
+2006-07-03 16:26 yjung
+
+ * irplib/: irplib_ppm.c, irplib_wlxcorr.c, irplib_wlxcorr.h: [no
+ log message]
+
+2006-06-30 16:03 yjung
+
+ * irplib/irplib_ppm.c: [no log message]
+
+2006-06-30 15:48 yjung
+
+ * irplib/: irplib_ppm.c, irplib_ppm.h, irplib_wlxcorr.c,
+ irplib_wlxcorr.h: FIRST VERSION USING PPM
+
+2006-06-28 17:11 yjung
+
+ * irplib/irplib_wlxcorr.c: types error
+
+2006-06-28 14:48 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-06-27 09:23 llundin
+
+ * irplib/irplib_utils.c: static
+ irplib_paf_dump_{int,double,string}(): Removed
+
+2006-06-26 16:27 llundin
+
+ * irplib/irplib_dfs.c: irplib_product_save(): Improved doc
+
+2006-06-26 16:25 llundin
+
+ * irplib/irplib_dfs.c: irplib_<table,image,paf>_save(): Removed
+ irplib_error usage
+
+2006-06-26 11:56 jmlarsen
+
+ * irplib/: Makefile.am, Makefile.am: Changed irplib from dynamic to
+ static (i.e. not installed) library. This was to avoid conflicts
+ between pipelines that use incompatible library versions
+
+2006-06-26 09:45 jmlarsen
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h,
+ irplib_spline.c, irplib_spline.h: Removed LM-fitting,
+ spline-fitting modules
+
+2006-06-23 15:03 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-06-23 13:56 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-06-23 10:55 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: added
+ sofi_wlcalib_catalog_plot
+
+2006-06-23 10:22 yjung
+
+ * irplib/irplib_wlxcorr.c: [no log message]
+
+2006-06-23 10:17 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: [no log message]
+
+2006-06-23 09:18 yjung
+
+ * irplib/: irplib_wlxcorr.c, irplib_wlxcorr.h: [no log message]
+
+2006-06-23 09:14 yjung
+
+ * irplib/: Makefile.am, irplib_wlxcorr.c, irplib_wlxcorr.h: [no log
+ message]
+
+2006-06-22 11:28 llundin
+
+ * irplib/irplib_flat.c: removed __func__ ---> cpl_func
+
+2006-06-21 15:07 yjung
+
+ * irplib/: irplib_utils.c, irplib_utils.h: removed
+ irplib_propertylist_dump_paf() and irplib_paf_print_header()
+
+2006-06-02 17:07 llundin
+
+ * irplib/irplib_dfs.c: irplib_{image,table}_save():
+ cpl_propertylist_copy_property_regexp() ->
+ cpl_propertylist_append(), Removed IRPLIB_DFS_ERASE_REGEXP, use
+ CPL_BPP_32_SIGNED for saving int-pixel images
+
+2006-06-02 13:57 llundin
+
+ * irplib/irplib_dfs.c: Renamed macro
+
+2006-06-02 10:45 jmlarsen
+
+ * irplib/irplib_spline.c: Documented supported column types
+
+2006-06-02 10:33 jmlarsen
+
+ * irplib/: Makefile.am, irplib_spline.c, irplib_spline.h: Added
+ spline interpolation routines
+
+2006-05-31 15:25 llundin
+
+ * irplib/irplib_dfs.c: Resolved include problem
+
+2006-05-31 15:20 llundin
+
+ * irplib/irplib_dfs.c: Resolved include problem
+
+2006-05-31 12:55 llundin
+
+ * irplib/Makefile.am: Added module dfs
+
+2006-05-30 16:27 llundin
+
+ * irplib/irplib_dfs.c: irplib_{image,table}_save(): Do not call
+ cpl_propertylist_load()
+
+2006-05-30 13:33 llundin
+
+ * irplib/irplib_dfs.c: irplib_paf_init(): Fixed doxygen bug
+
+2006-05-30 13:07 llundin
+
+ * irplib/irplib_dfs.c: Copied from HEAD: irplib_paf_save(): Do not
+ use (deprecated) PAF-functions
+
+2006-05-30 13:07 llundin
+
+ * irplib/irplib_dfs.c: irplib_paf_save(): Do not use (deprecated)
+ PAF-functions
+
+2006-05-30 12:59 llundin
+
+ * irplib/irplib_utils.h: Revert change of 1.19
+
+2006-05-30 11:51 llundin
+
+ * irplib/irplib_utils.h: irplib_paf_print_header(): deprecated.
+ irplib_propertylist_dump_paf(): deprecated
+
+2006-05-30 11:33 llundin
+
+ * irplib/irplib_dfs.c: Copied from HEAD:
+ irplib_{image,table,paf}_save(): Improved documentation
+
+2006-05-30 11:32 llundin
+
+ * irplib/irplib_dfs.c: irplib_{image,table,paf}_save(): Improved
+ documentation
+
+2006-05-30 11:31 llundin
+
+ * irplib/irplib_utils.h: irplib_assure{,_code}(): Use
+ irplib_error_push()
+
+2006-05-29 16:50 llundin
+
+ * irplib/: Makefile.am, irplib_dfs.c, irplib_dfs.h, irplib_dfs.c,
+ irplib_dfs.h: Added in IRPLIB: irplib_{image,table,paf}_save()
+
+2006-05-29 12:30 llundin
+
+ * irplib/: irplib_utils.h, irplib_utils.c:
+ irplib_frameset_extract{,_regexp}(): Removed
+
+2006-05-29 12:05 llundin
+
+ * irplib/irplib_plot.c: Indentation. __func__ -> cpl_func. Merged
+ changes from CPL-2_1-BRANCH: Compiler warnings
+
+2006-05-29 12:03 llundin
+
+ * irplib/irplib_plot.h: irplib_plot_manpage(): Merged changes from
+ CPL-2_1-BRANCH
+
+2006-05-19 14:31 yjung
+
+ * irplib/: irplib_oddeven.c, irplib_oddeven.h: added first files
+
+2006-05-19 14:25 yjung
+
+ * irplib/: Makefile.am, irplib_oddeven.c, irplib_oddeven.h: [no log
+ message]
+
+2006-05-18 16:29 yjung
+
+ * irplib/: irplib_plot.c, irplib_plot.h, irplib_std.c,
+ irplib_std.h, irplib_utils.c: warnings
+
+2006-05-18 15:21 llundin
+
+ * irplib/irplib_utils.h: Replaced cpl_assure{,_code} with
+ cpl_ensure{,_code}
+
+2006-05-18 15:18 llundin
+
+ * irplib/: irplib_fit.c, irplib_plot.c, irplib_strehl.c,
+ irplib_utils.c: Replaced cpl_assure{,_code}() with
+ cpl_ensure{,_code}()
+
+2006-05-15 08:51 yjung
+
+ * irplib/: irplib_distortion.c, irplib_distortion.h: added a
+ parameter to irplib_distortion_estimate() : the degree of the
+ polynomial
+
+2006-05-11 14:26 yjung
+
+ * irplib/: irplib_distortion.c, irplib_distortion.h: added the
+ degree parameter to the distortion estimation
+
+2006-05-11 14:21 yjung
+
+ * irplib/: irplib_plot.c, irplib_plot.h: added
+ irplib_vectors_plot()
+
+2006-05-05 14:36 jmlarsen
+
+ * irplib/: irplib_irlist.h, irplib_irlist.h: Added missing
+ copyright header
+
+2006-05-05 13:39 jmlarsen
+
+ * irplib/: irplib_std.c, irplib_std.h: Changed type char * -> const
+ char * of variables pointing to string constants
+
+2006-05-05 13:34 jmlarsen
+
+ * irplib/: irplib_std.c, irplib_std.h: Changed type char * -> const
+ char * of variables pointing to string constants
+
+2006-05-04 11:22 jmlarsen
+
+ * irplib/irplib_fit.c: Bugfix in get_candidate(): M -> Mfit (Wrong
+ indexing if one or more fit parameters are held constant)
+
+2006-04-24 13:48 jmlarsen
+
+ * irplib/: irplib_fit.c, irplib_fit.h: Added a check that the value
+ of the 'fix_pars' argument to irplib_fit_gaussian_1d() makes sense
+
+2006-04-24 11:12 jmlarsen
+
+ * irplib/: irplib_fit.c, irplib_fit.h: Generalized
+ irplib_fit_gaussian_1d and irplib_fit to allow fixing any
+ combination of fit parameters
+
+2006-04-13 13:55 yjung
+
+ * irplib/Makefile.am: added irplib_ppm.ch
+
+2006-04-13 13:55 yjung
+
+ * irplib/: irplib_ppm.c, irplib_ppm.h: [no log message]
+
+2006-04-13 13:53 yjung
+
+ * irplib/: irplib_ppm.c, irplib_ppm.h: import mos_identify_peaks
+ from VIMOS
+
+2006-04-10 11:25 jmlarsen
+
+ * irplib/irplib_fit.c: Replaced __func__ -> cpl_func
+
+2006-04-07 15:00 yjung
+
+ * irplib/: irplib_utils.c, irplib_utils.h: removed
+ irplib_bivector_load()
+
+2006-04-07 11:24 jmlarsen
+
+ * irplib/: irplib_fit.c, irplib_fit.c: Defined a maximum number of
+ iterations in order to guarantee that the LM-loop always
+ terminates, even in the (currently non-observed but difficult to
+ exclude) case where a nan/inf causes the math logic to break down.
+
+2006-04-06 17:17 yjung
+
+ * irplib/irplib_plot.c: [no log message]
+
+2006-04-06 17:04 yjung
+
+ * irplib/: irplib_calib.c, irplib_distortion.c, irplib_flat.c,
+ irplib_plot.c, irplib_slitpos.c, irplib_spectrum.c, irplib_utils.c:
+ removed fctid ---> __func__
+
+2006-03-23 13:43 jmlarsen
+
+ * irplib/: irplib_fit.c, irplib_utils.c, irplib_utils.h: Removed
+ workaround for DFS02390 (cpl_matrix_solve returning nan)
+
+2006-03-22 17:27 yjung
+
+ * irplib/irplib_spectrum.c: 10 -> 30 for spectrum detection shadows
+ criteria
+
+2006-03-22 17:26 yjung
+
+ * irplib/irplib_spectrum.c: 10 -> 30 for the spectrum factor
+
+2006-03-01 14:22 jmlarsen
+
+ * irplib/irplib_error.h: Defined one instead of many error handling
+ macros
+
+2006-03-01 14:20 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_error.c: Proper handling of the
+ case where error queue is out of sync. with CPL's error state;
+ Disallow CPL_ERROR_NONE as error code
+
+2006-03-01 14:17 jmlarsen
+
+ * irplib/irplib_error.h: Defined one instead of many error handling
+ macros
+
+2006-02-23 11:01 llundin
+
+ * irplib/irplib_error.h: From CPL-2.1 branch: Renamed
+ irplib_assert() to irplib_assert_msg(). Added irplib_assert()
+
+2006-02-23 11:01 llundin
+
+ * irplib/irplib_error.h: Renamed irplib_assert() to
+ irplib_assert_msg(). Added irplib_assert()
+
+2006-02-22 11:56 jmlarsen
+
+ * irplib/irplib_fit.c: From CPL-2.1 branch: Fixed a few doc. bugs
+
+2006-02-22 11:52 jmlarsen
+
+ * irplib/irplib_fit.c: Fixed a few doc. bugs
+
+2006-02-17 17:08 yjung
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h, irplib_strehl.c,
+ irplib_strehl.h: [no log message]
+
+2006-02-15 16:25 llundin
+
+ * irplib/irplib_plot.c: Fixed some gcc warnings
+
+2006-02-15 09:11 yjung
+
+ * irplib/: irplib_strehl.c, irplib_strehl.c: Fixed DFS02233
+
+2006-02-07 16:34 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_error.h: From CPL-2.1 branch:
+ Changed return type of irplib_error_push_macro
+
+2006-02-07 16:30 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_error.h: Changed return type of
+ irplib_error_push_macro
+
+2006-02-07 15:30 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_error.h: From CPL-2.1 branch:
+ Added parameter to irplib_error_dump; Add existing error to the
+ queue
+
+2006-02-07 15:21 llundin
+
+ * irplib/: irplib_dfs.c, irplib_dfs.h, irplib_pfits.c,
+ irplib_pfits.h: Removed modules: dfs, pfits
+
+2006-02-07 15:20 jmlarsen
+
+ * irplib/: irplib_error.c, irplib_error.h: Added parameter to
+ irplib_error_dump; Add existing error to the queue
+
+2006-02-07 15:18 llundin
+
+ * irplib/Makefile.am: Removed modules: pfits, dfs
+
+2006-02-07 15:14 llundin
+
+ * irplib/: Makefile.am, irplib_dfs.c, irplib_dfs.h,
+ irplib_framelist.c, irplib_framelist.h, irplib_pfits.c,
+ irplib_pfits.h, irplib_plugin.c, irplib_plugin.h: Removed modules:
+ dfs, pfits,plugin,framelist
+
+2006-02-07 02:42 llundin
+
+ * irplib/irplib_plugin.c: ifdef-ed xmemory reference
+
+2006-02-07 01:58 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_extract*(): Extract
+ also propertylists - update index correctly
+
+2006-02-07 01:45 llundin
+
+ * irplib/: irplib_error.c, irplib_error.h: Oops. Reverted to
+ version prior to erroneous commit
+
+2006-02-07 01:36 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_extract*(): Extract
+ also propertylists
+
+2006-02-07 01:15 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h: Added
+ irplib_frameset_cast()
+
+2006-02-06 23:26 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_extract*(): Extract
+ also propertylists
+
+2006-02-06 23:01 llundin
+
+ * irplib/: irplib_error.c, irplib_error.h, irplib_framelist.c,
+ irplib_framelist.h: irplib_framelist_extract*(): Redeclared to take
+ irplib_framelist
+
+2006-02-06 18:58 llundin
+
+ * irplib/irplib_plugin.c: Removed testing msg
+
+2006-02-06 18:51 llundin
+
+ * irplib/irplib_plugin.c: Added info msg
+
+2006-02-06 18:39 llundin
+
+ * irplib/irplib_plugin.c: recipe_sof_test_random(): uses tags from
+ caller
+
+2006-02-06 17:33 llundin
+
+ * irplib/irplib_plugin.c: test function returns number of failures
+
+2006-02-06 17:05 llundin
+
+ * irplib/: irplib_plugin.c, irplib_plugin.h: irplib_plugin_test():
+ Added main()-style parameters. (removed CPL_MSG_DEBUG-work-around)
+
+2006-02-06 16:40 llundin
+
+ * irplib/irplib_plugin.c: 1st attempt at irplib_plugin_test() -
+ from recipe_main.c
+
+2006-02-06 16:37 llundin
+
+ * irplib/irplib_plugin.c: file irplib_plugin.c was initially added
+ on branch CPL-2_1-BRANCH.
+
+2006-02-06 16:37 llundin
+
+ * irplib/: Makefile.am, irplib_plugin.c, irplib_plugin.h,
+ irplib_utils.h: Created irplib_plugin
+
+2006-02-06 16:37 llundin
+
+ * irplib/irplib_plugin.h: file irplib_plugin.h was initially added
+ on branch CPL-2_1-BRANCH.
+
+2006-02-06 04:14 llundin
+
+ * irplib/irplib_plot.h: Added man-text for plotting
+
+2006-02-06 00:34 llundin
+
+ * irplib/irplib_utils.h: Use irplib_error
+
+2006-02-05 21:41 llundin
+
+ * irplib/irplib_dfs.c: irplib_dfs_check_frame_tag(): Take
+ propertylist
+
+2006-02-05 18:33 llundin
+
+ * irplib/irplib_framelist.c:
+ irplib_framelist_load_propertylist_all(): Added diagnostics
+
+2006-02-04 16:47 llundin
+
+ * irplib/irplib_utils.c: irplib_get_license(): Changed to a macro
+ (multi-recipe safe)
+
+2006-02-04 16:44 llundin
+
+ * irplib/irplib_utils.h: irplib_get_license(): Changed to a macro
+ (multi-recipe safe)
+
+2006-02-04 16:43 llundin
+
+ * irplib/irplib_framelist.c: Removed one unnecessary error check.
+ Fixed typo
+
+2006-02-04 03:41 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: irplib_get_license().
+ irplib_plugin_get_info(). irplib_recipe_create().
+ irplib_recipe_exec(). irplib_recipe_destroy()
+
+2006-02-03 21:55 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h, irplib_utils.h:
+ irplib_framelist_set(): Reorder 2nd and 3rd argument.
+ irplib_framelist_extract(). irplib_framelist_extract_regexp().
+ irplib_imagelist_load_framelist(). Deprecate
+ irplib_frameset_extract*()
+
+2006-02-03 15:21 llundin
+
+ * irplib/: irplib_dfs.c, irplib_dfs.h: frameset check -> framelist
+ check
+
+2006-02-03 14:26 llundin
+
+ * irplib/Makefile.am: Removed irplib_framelist for the moment
+
+2006-02-03 09:34 jmlarsen
+
+ * irplib/Makefile.am: Added irplib_error.[ch] entries
+
+2006-02-03 02:17 llundin
+
+ * irplib/Makefile.am: Added irplib_framelist
+
+2006-02-02 23:19 llundin
+
+ * irplib/irplib_framelist.c: irplib_framelist_contains(): Add type
+ to an error msg
+
+2006-02-02 22:53 llundin
+
+ * irplib/: irplib_framelist.c, irplib_framelist.h:
+ irplib_framelist_contains()
+
+2006-02-02 16:32 llundin
+
+ * irplib/irplib_framelist.c: file irplib_framelist.c was initially
+ added on branch CPL-2_1-BRANCH.
+
+2006-02-02 16:32 llundin
+
+ * irplib/irplib_framelist.h: file irplib_framelist.h was initially
+ added on branch CPL-2_1-BRANCH.
+
+2006-02-02 16:32 llundin
+
+ * irplib/: Makefile.am, irplib_framelist.c, irplib_framelist.h:
+ irplib_framelist
+
+2006-02-02 15:53 jmlarsen
+
+ * irplib/irplib_utils.c: Removed duplicate function definition
+
+2006-02-02 15:49 jmlarsen
+
+ * irplib/: irplib_fit.c, irplib_plot.c, irplib_std.c,
+ irplib_strehl.c, irplib_utils.c: From CPL-2.1 branch: Removed a few
+ doxygen warnings
+
+2006-02-02 15:35 jmlarsen
+
+ * irplib/: irplib_fit.c, irplib_plot.c, irplib_std.c,
+ irplib_strehl.c, irplib_utils.c: Removed a few doxygen warnings
+
+2006-02-02 14:58 jmlarsen
+
+ * irplib/: Makefile.am, irplib_error.c, irplib_error.h: From
+ CPL-2.1 branch: Added error handling module
+
+2006-02-02 14:57 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h: From CPL-2.1 branch:
+ Added irplib_reset()
+
+2006-02-02 14:44 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Added irplib_reset()
+
+2006-02-02 14:42 jmlarsen
+
+ * irplib/irplib_error.h: file irplib_error.h was initially added on
+ branch CPL-2_1-BRANCH.
+
+2006-02-02 14:42 jmlarsen
+
+ * irplib/irplib_error.c: file irplib_error.c was initially added on
+ branch CPL-2_1-BRANCH.
+
+2006-02-02 14:42 jmlarsen
+
+ * irplib/: Makefile.am, irplib_error.c, irplib_error.h: Added error
+ handling module
+
+2006-02-01 20:34 llundin
+
+ * irplib/irplib_utils.h: __func_ is #defined if needed
+
+2006-01-30 08:01 jmlarsen
+
+ * irplib/irplib_fit.c: Fixed doxygen bug
+
+2006-01-30 07:58 jmlarsen
+
+ * irplib/irplib_fit.c: Fixed doxygen bug
+
+2006-01-26 16:06 llundin
+
+ * irplib/: Makefile.am, irplib_dfs.c, irplib_dfs.h: From CPL-2.1
+ branch: Added irplib_dfs_check_frameset_tag()
+
+2006-01-26 16:05 llundin
+
+ * irplib/: irplib_pfits.c, irplib_pfits.h: From CPL-2.1 branch:
+ Added irplib_pfits_get_dpr_{catg,tech,type}()
+
+2006-01-26 09:47 yjung
+
+ * irplib/irplib_strehl.c: implemented the nan values for SINFONI
+
+2006-01-26 09:43 yjung
+
+ * irplib/irplib_strehl.c: implemented the nan checks
+
+2006-01-25 17:12 yjung
+
+ * irplib/: irplib_distortion.c, irplib_distortion.h: [no log
+ message]
+
+2006-01-25 17:06 yjung
+
+ * irplib/: Makefile.am, irplib_distortion.c, irplib_distortion.h:
+ [no log message]
+
+2006-01-25 16:44 yjung
+
+ * irplib/: irplib_distortion.c, irplib_distortion.h: moved the
+ distortion estimation from ISAAC to IRPLIB
+
+2006-01-25 16:31 yjung
+
+ * irplib/: Makefile.am, irplib_distortion.c, irplib_distortion.h:
+ [no log message]
+
+2006-01-25 16:31 yjung
+
+ * irplib/irplib_distortion.c: file irplib_distortion.c was
+ initially added on branch CPL-2_1-BRANCH.
+
+2006-01-25 16:31 yjung
+
+ * irplib/irplib_distortion.h: file irplib_distortion.h was
+ initially added on branch CPL-2_1-BRANCH.
+
+2006-01-25 12:43 jmlarsen
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h, irplib_utils.c,
+ irplib_utils.h: Simplified interface of gauss. fitting, moved to
+ irplib_fit.c
+
+2006-01-25 12:03 jmlarsen
+
+ * irplib/: Makefile.am, irplib_fit.c, irplib_fit.h, irplib_utils.c,
+ irplib_utils.h: Simplified interface of gauss. fitting, moved to
+ irplib_fit.c
+
+2006-01-25 12:03 jmlarsen
+
+ * irplib/irplib_fit.c: file irplib_fit.c was initially added on
+ branch CPL-2_1-BRANCH.
+
+2006-01-25 12:03 jmlarsen
+
+ * irplib/irplib_fit.h: file irplib_fit.h was initially added on
+ branch CPL-2_1-BRANCH.
+
+2006-01-23 11:30 llundin
+
+ * irplib/irplib_dfs.c: Reset error on missing DPR
+
+2006-01-22 11:31 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h:
+ irplib_frameset_get_first_from_group()
+
+2006-01-22 10:14 llundin
+
+ * irplib/: Makefile.am, irplib_dfs.c, irplib_dfs.h, irplib_pfits.c,
+ irplib_pfits.h: Check of DPR <=> consistency
+
+2006-01-22 10:14 llundin
+
+ * irplib/irplib_dfs.h: file irplib_dfs.h was initially added on
+ branch CPL-2_1-BRANCH.
+
+2006-01-22 10:14 llundin
+
+ * irplib/irplib_dfs.c: file irplib_dfs.c was initially added on
+ branch CPL-2_1-BRANCH.
+
+2006-01-18 13:31 jmlarsen
+
+ * irplib/: irplib_plot.c, irplib_plot.c: Added missing doxygen end
+ tag
+
+2006-01-13 15:23 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Changed type bool to
+ cpl_boolean
+
+2006-01-13 15:15 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Changed type bool to
+ cpl_boolean
+
+2006-01-12 14:53 jmlarsen
+
+ * irplib/: irplib_utils.h, irplib_utils.c: Shortened lines to 80
+ characters
+
+2006-01-12 14:40 jmlarsen
+
+ * irplib/irplib_utils.c: Shortened lines to 80 characters
+
+2006-01-12 13:25 jmlarsen
+
+ * irplib/irplib_utils.h: Shortened lines to 80 characters
+
+2006-01-12 12:55 jmlarsen
+
+ * irplib/irplib_utils.h: Just testing
+
+2006-01-12 10:15 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Added 1d gauss. fit
+
+2006-01-12 10:11 jmlarsen
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Added 1d gauss. fit
+
+2006-01-05 14:13 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Merged changes from
+ CPL-2_1-BRANCH (irplib_apertures_find_max_flux())
+
+2006-01-05 14:02 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h:
+ irplib_apertures_find_max_flux()
+
+2006-01-04 17:31 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Merged changes from
+ CPL-2_1-BRANCH (visir_frameset_*() -> irplib_frameset_*()
+
+2006-01-04 17:26 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h: Added
+ irplib_frameset_{find_file,extract,extract_regexp}()
+
+2006-01-04 09:19 llundin
+
+ * irplib/irplib_strehl.c: Merged changes from CPL-2_1-BRANCH
+ (removed definition of __func__, irplib_assure*()
+
+2006-01-03 16:11 llundin
+
+ * irplib/: Makefile.am, irplib_pfits.c, irplib_pfits.h,
+ irplib_strehl.c, irplib_utils.c, irplib_utils.h: Merged changes
+ from CPL-2_1-BRANCH
+
+2005-12-22 16:33 llundin
+
+ * irplib/irplib_pfits.c: file irplib_pfits.c was initially added on
+ branch CPL-2_1-BRANCH.
+
+2005-12-22 16:33 llundin
+
+ * irplib/: Makefile.am, irplib_pfits.c, irplib_pfits.h: pfits
+ support functions
+
+2005-12-22 16:33 llundin
+
+ * irplib/irplib_pfits.h: file irplib_pfits.h was initially added on
+ branch CPL-2_1-BRANCH.
+
+2005-12-22 16:32 llundin
+
+ * irplib/: irplib_strehl.c, irplib_utils.c, irplib_utils.h: Some
+ error testing
+
+2005-12-13 15:44 llundin
+
+ * irplib/irplib_strehl.c: Removed arbitrary constant. Require M1 to
+ be greater than M2
+
+2005-12-13 13:34 llundin
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h: Merged changes from
+ CPL-2_1-BRANCH
+
+2005-12-13 13:30 llundin
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h: Added error checks:
+ pixel type, negative inputs. const cpl_image * input. Use CPL error
+ system. Forbid negative Strehl and Strehl-error estimate. Added
+ IRPLIB_STREHL_BORDER
+
+2005-11-25 09:38 yjung
+
+ * irplib/irplib_strehl.c: new API in CPL
+
+2005-11-24 17:15 yjung
+
+ * irplib/irplib_strehl.c: back to compile with cpl 2.1
+
+2005-11-24 09:50 yjung
+
+ * irplib/irplib_flat.c: check that at least 2 images are input in
+ the flat function
+
+2005-11-21 11:26 yjung
+
+ * irplib/irplib_strehl.c: Changed the cpl_image_fft() call !!!
+
+2005-11-17 12:27 yjung
+
+ * irplib/irplib_flat.c: DFS02648: irplib_flat_fit_set() check if
+ the input is FLOAT
+
+2005-10-19 12:24 jmlarsen
+
+ * irplib/irplib_plot.c: Added support for plotting int/float table
+ columns
+
+2005-10-19 11:01 jmlarsen
+
+ * irplib/irplib_plot.c: Disabled calls to popen/pclose when not
+ available
+
+2005-10-19 10:59 jmlarsen
+
+ * irplib/irplib_flat.c: Remove warnings about uninitialized
+ variables
+
+2005-10-19 09:53 jmlarsen
+
+ * irplib/irplib_flat.c: Remove warnings about uninitialized
+ variables
+
+2005-10-12 15:01 yjung
+
+ * irplib/Makefile.am: do not install
+
+2005-10-06 16:56 llundin
+
+ * irplib/irplib_plot.c: irplib_image_{row,col}_plot(): Rewrote
+ internals to support multiple plots
+
+2005-09-29 11:07 llundin
+
+ * irplib/: irplib_plot.c, irplib_plot.h:
+ irplib_image_{row,col}_plot(): Added first, last, step
+
+2005-09-29 10:09 llundin
+
+ * irplib/irplib_plot.c: Defined and use has_process_io
+
+2005-09-19 15:39 llundin
+
+ * irplib/: irplib_flat.c, irplib_std.c, irplib_utils.c: Fixed
+ doxygen errors
+
+2005-09-15 14:16 llundin
+
+ * irplib/irplib_plot.c: Cast %p-argument to void*
+
+2005-09-15 13:47 llundin
+
+ * irplib/: Makefile.am, irplib_calib.c, irplib_calib.h,
+ irplib_flat.c, irplib_flat.h, irplib_plot.c, irplib_plot.h,
+ irplib_slitpos.c, irplib_slitpos.h, irplib_spectrum.c,
+ irplib_spectrum.h, irplib_std.c, irplib_std.h, irplib_strehl.c,
+ irplib_strehl.h, irplib_utils.c, irplib_utils.h: Fixed DFS02446
+
+2005-09-13 10:54 yjung
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h: added a param to
+ irplib_strehl_ring_background()
+
+2005-09-13 10:43 llundin
+
+ * irplib/irplib_plot.c: irplib_image_{row,col}_plot_macro(): Fixed
+ -t bug on empty options string
+
+2005-08-03 08:56 yjung
+
+ * irplib/irplib_std.c: warning removed
+
+2005-08-01 15:10 yjung
+
+ * irplib/irplib_spectrum.c: [no log message]
+
+2005-08-01 15:08 yjung
+
+ * irplib/irplib_spectrum.c: added some checks to avoir CPL_ERROR on
+ borders
+
+2005-08-01 10:01 yjung
+
+ * irplib/: irplib_spectrum.c, irplib_spectrum.h: changed interface
+ to support vert spec
+
+2005-08-01 09:30 yjung
+
+ * irplib/: irplib_spectrum.c, irplib_spectrum.h: changed name
+
+2005-08-01 09:23 yjung
+
+ * irplib/: irplib_spectrum.c, irplib_spectrum.h: new revision
+
+2005-08-01 09:22 yjung
+
+ * irplib/Makefile.am: added irplib_spectrum.c
+
+2005-07-27 16:15 yjung
+
+ * irplib/: irplib_utils.c, irplib_utils.h: added
+ irplib_bivector_load()
+
+2005-06-30 13:45 yjung
+
+ * irplib/irplib_strehl.c: removed usage of M_PI
+
+2005-06-28 17:46 yjung
+
+ * irplib/: irplib_irlist.h, irplib_std.c, irplib_std.h: added stad
+ star temperatures
+
+2005-06-16 16:45 yjung
+
+ * irplib/: irplib_std.c, irplib_std.h: added irplib_std_band_name()
+
+2005-06-10 13:43 yjung
+
+ * irplib/irplib_std.h: added some isaac BB
+
+2005-06-07 14:56 llundin
+
+ * irplib/: irplib_plot.c, irplib_plot.h: Renamed visir to irplib in
+ private names. Moved plotting struct from .h to .c
+
+2005-06-07 14:18 llundin
+
+ * irplib/: Makefile.am, irplib_plot.c, irplib_plot.h: visir_plot =>
+ irplib_plot
+
+2005-05-19 11:30 llundin
+
+ * irplib/irplib_utils.c: removed useless call of
+ cpl_error_get_code() in irplib_propertylist_dump_paf()
+
+2005-05-19 11:22 llundin
+
+ * irplib/: irplib_utils.c, irplib_utils.h:
+ irplib_propertylist_dump_paf()
+
+2005-05-11 10:18 yjung
+
+ * irplib/: irplib_strehl.c, irplib_strehl.h: added 2 params to
+ irplib_strehl_compute()
+
+2005-05-10 10:43 yjung
+
+ * irplib/: irplib_calib.c, irplib_calib.h: added
+ irplib_detlin_correct()
+
+2005-05-03 08:59 yjung
+
+ * irplib/: irplib_std.c, irplib_std.h: removed filter info
+ functions
+
+2005-05-03 08:49 yjung
+
+ * irplib/: Makefile.am, irplib_std.c, irplib_std.h: in progress
+
+2005-05-02 15:19 yjung
+
+ * irplib/: Makefile.am, irplib_irlist.h: added irplib_irlist.h
+
+2005-04-28 15:28 yjung
+
+ * irplib/irplib_strehl.c: remove check on TYPE==FLOAT
+
+2005-04-28 14:42 yjung
+
+ * irplib/: irplib_calib.c, irplib_calib.h: [no log message]
+
+2005-04-28 10:53 yjung
+
+ * irplib/irplib_calib.c: small typo
+
+2005-04-28 10:35 yjung
+
+ * irplib/: irplib_calib.c, irplib_calib.h: added
+ irplib_flat_dark_bpm_calib()
+
+2005-04-28 10:00 yjung
+
+ * irplib/: Makefile.am, irplib_calib.c, irplib_calib.h: added
+ irplib_calib
+
+2005-04-26 16:52 llundin
+
+ * irplib/: irplib_flat.c, irplib_flat.h, irplib_slitpos.h,
+ irplib_strehl.c, irplib_strehl.h, irplib_utils.c, irplib_utils.h:
+ Replaced tabulation with 4 spaces (bis)
+
+2005-04-26 16:32 llundin
+
+ * irplib/: irplib_flat.c, irplib_flat.h, irplib_slitpos.h,
+ irplib_strehl.c, irplib_strehl.h, irplib_utils.c, irplib_utils.h:
+ Replaced tabulation with 4 spaces
+
+2005-04-25 14:51 yjung
+
+ * irplib/irplib_slitpos.c: added missing include
+
+2005-04-25 14:44 yjung
+
+ * irplib/: Makefile.am, irplib_slitpos.c, irplib_slitpos.h: added
+ irplib_slitpos.[ch]
+
+2005-04-25 14:12 yjung
+
+ * irplib/: Makefile.am, irplib_strehl.c, irplib_strehl.h: added
+ irplib_strehl.[ch]
+
+2005-04-25 13:50 yjung
+
+ * irplib/: Makefile.am, irplib_utils.c, irplib_utils.h: added
+ irplib_utils
+
+2005-04-25 13:28 yjung
+
+ * irplib/: Makefile.am, irplib_flat.c, irplib_flat.h: Initial
+ revision
+
+2005-04-25 13:28 yjung
+
+ * irplib/: Makefile.am, irplib_flat.c, irplib_flat.h: Library for
+ infrared pipelines
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..54caf7c
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,229 @@
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+ This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..2604c47
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,70 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the hawki Pipeline
+## Copyright (C) 2002,2003 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
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+ACLOCAL_AMFLAGS = -I m4macros
+
+DISTCLEANFILES = *~
+
+
+COMPILE_FIRST =
+
+TOPSUBDIRS = irplib hawki recipes regtests reflex
+
+COMPILE_LAST = tests
+
+
+HTML_SUBDIRS =
+
+SUBDIRS = $(COMPILE_FIRST) $(TOPSUBDIRS) $(COMPILE_LAST)
+
+EXTRA_DIST = catalogs m4macros/eso.m4 m4macros/cpl.m4 admin/html.am \
+ doxygen/Doxyfile.in setup
+
+
+pipedocs_DATA = ChangeLog AUTHORS NEWS README TODO
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in configure stamp-h.in
+
+clean-local: clean-html
+
+dist-hook: html
+ @if test -d $(top_srcdir)/html; then \
+ echo "cp -pr $(top_srcdir)/html $(distdir)"; \
+ cp -pr $(top_srcdir)/html $(distdir); \
+ fi
+ find $(distdir) -type d ! -perm -222 -exec chmod u+w {} \; -o \
+ -type f ! -perm -222 -exec chmod u+w {} \; || chmod -R u+w $(distdir)
+
+else
+
+clean-local:
+
+endif
+
+uninstall-local: uninstall-html
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+include $(top_srcdir)/admin/html.am
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..f69fa5a
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,925 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/Makefile.purify.in \
+ $(srcdir)/config.h.in $(top_srcdir)/admin/html.am \
+ $(top_srcdir)/configure $(top_srcdir)/doxygen/Doxyfile.in \
+ AUTHORS COPYING COPYING.LIB ChangeLog INSTALL NEWS TODO \
+ admin/compile admin/config.guess admin/config.sub \
+ admin/depcomp admin/install-sh admin/ltmain.sh admin/missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = Makefile.purify doxygen/Doxyfile
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(pipedocsdir)"
+DATA = $(pipedocs_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d "$(distdir)" \
+ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr "$(distdir)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+ACLOCAL_AMFLAGS = -I m4macros
+DISTCLEANFILES = *~
+COMPILE_FIRST =
+TOPSUBDIRS = irplib hawki recipes regtests reflex
+COMPILE_LAST = tests
+HTML_SUBDIRS =
+SUBDIRS = $(COMPILE_FIRST) $(TOPSUBDIRS) $(COMPILE_LAST)
+EXTRA_DIST = catalogs m4macros/eso.m4 m4macros/cpl.m4 admin/html.am \
+ doxygen/Doxyfile.in setup
+
+pipedocs_DATA = ChangeLog AUTHORS NEWS README TODO
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in configure stamp-h.in
+ at MAINTAINER_MODE_FALSE@HTML_RECURSIVE_TARGETS = install-html-recursive
+ at MAINTAINER_MODE_TRUE@HTML_RECURSIVE_TARGETS = install-html-recursive
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/admin/html.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+Makefile.purify: $(top_builddir)/config.status $(srcdir)/Makefile.purify.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+doxygen/Doxyfile: $(top_builddir)/config.status $(top_srcdir)/doxygen/Doxyfile.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+install-pipedocsDATA: $(pipedocs_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(pipedocsdir)" || $(MKDIR_P) "$(DESTDIR)$(pipedocsdir)"
+ @list='$(pipedocs_DATA)'; test -n "$(pipedocsdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pipedocsdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pipedocsdir)" || exit $$?; \
+ done
+
+uninstall-pipedocsDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pipedocs_DATA)'; test -n "$(pipedocsdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pipedocsdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pipedocsdir)" && rm -f $$files
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ at MAINTAINER_MODE_FALSE@dist-hook:
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @$(am__cd) '$(distuninstallcheck_dir)' \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(pipedocsdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+ at MAINTAINER_MODE_FALSE@html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pipedocsDATA
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-local uninstall-pipedocsDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ ctags-recursive install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-generic \
+ clean-libtool clean-local ctags ctags-recursive dist dist-all \
+ dist-bzip2 dist-gzip dist-hook dist-lzma dist-shar dist-tarZ \
+ dist-xz dist-zip distcheck distclean distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags distcleancheck \
+ distdir distuninstallcheck dvi dvi-am html html-am info \
+ info-am install install-am install-data install-data-am \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-pipedocsDATA \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-local uninstall-pipedocsDATA
+
+
+ at MAINTAINER_MODE_TRUE@clean-local: clean-html
+
+ at MAINTAINER_MODE_TRUE@dist-hook: html
+ at MAINTAINER_MODE_TRUE@ @if test -d $(top_srcdir)/html; then \
+ at MAINTAINER_MODE_TRUE@ echo "cp -pr $(top_srcdir)/html $(distdir)"; \
+ at MAINTAINER_MODE_TRUE@ cp -pr $(top_srcdir)/html $(distdir); \
+ at MAINTAINER_MODE_TRUE@ fi
+ at MAINTAINER_MODE_TRUE@ find $(distdir) -type d ! -perm -222 -exec chmod u+w {} \; -o \
+ at MAINTAINER_MODE_TRUE@ -type f ! -perm -222 -exec chmod u+w {} \; || chmod -R u+w $(distdir)
+
+ at MAINTAINER_MODE_FALSE@clean-local:
+
+uninstall-local: uninstall-html
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+ at MAINTAINER_MODE_TRUE@html-am:
+ at MAINTAINER_MODE_TRUE@ @if test -f doxygen/Doxyfile; then \
+ at MAINTAINER_MODE_TRUE@ echo "cd doxygen && $(DOXYGEN)"; \
+ at MAINTAINER_MODE_TRUE@ d=`pwd`; cd doxygen && $(DOXYGEN); cd $$d; \
+ at MAINTAINER_MODE_TRUE@ if test -n "$(POST_DOXYGEN_CLEANFILES)"; then \
+ at MAINTAINER_MODE_TRUE@ cd $(top_srcdir)/html && rm -f $(POST_DOXYGEN_CLEANFILES); \
+ at MAINTAINER_MODE_TRUE@ fi; \
+ at MAINTAINER_MODE_TRUE@ else \
+ at MAINTAINER_MODE_TRUE@ echo "Nothing to be done for \`$@'."; \
+ at MAINTAINER_MODE_TRUE@ fi
+
+ at MAINTAINER_MODE_TRUE@clean-html: clean-html-am
+
+ at MAINTAINER_MODE_TRUE@clean-html-am:
+ at MAINTAINER_MODE_TRUE@ -rm -rf $(top_srcdir)/html
+
+ at MAINTAINER_MODE_TRUE@install-html-am: html-am install-html-generic
+
+ at MAINTAINER_MODE_FALSE@install-html-am: install-html-generic
+
+install-html: install-html-recursive
+
+install-html-generic:
+ @$(NORMAL_INSTALL)
+ @if test -d $(top_srcdir)/html; then \
+ echo "$(mkinstalldirs) $(DESTDIR)$(htmldir)"; \
+ $(mkinstalldirs) $(DESTDIR)$(htmldir); \
+ list="`ls -1 $(top_srcdir)/html`"; \
+ for p in $$list; do \
+ if test -f $(top_srcdir)/html/$$p; then \
+ echo " $(INSTALL_DATA) $(top_srcdir)/html/$$p $(DESTDIR)$(htmldir)/$$p"; \
+ $(INSTALL_DATA) $(top_srcdir)/html/$$p $(DESTDIR)$(htmldir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/$$p; \
+ fi; fi; \
+ done; \
+ fi
+
+uninstall-html:
+ @$(NORMAL_UNINSTALL)
+ @list="`ls -1 $(DESTDIR)$(htmldir)`"; for p in $$list; do \
+ echo " rm -f $(DESTDIR)$(htmldir)/$$p"; \
+ rm -f $(DESTDIR)$(htmldir)/$$p; \
+ done
+
+$(HTML_RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(HTML_SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Makefile.purify.in b/Makefile.purify.in
new file mode 100644
index 0000000..a8e3b25
--- /dev/null
+++ b/Makefile.purify.in
@@ -0,0 +1,109 @@
+#*******************************************************************************
+# E.S.O. - VLT project
+#
+# "@(#) $Id: Makefile.purify.in,v 1.2 2008/05/09 14:01:27 cguirao Exp $"
+#
+# Makefile of Pipeline subsystem.
+#
+# who when what
+# -------- ---------- ----------------------------------------------
+#
+
+
+ifdef MAKE_PURE
+ ENABLE_PURIFY=on
+ ENABLE_PURECOV=on
+ ENABLE_PURE=on
+endif
+
+ifdef MAKE_PUREGUI
+ ENABLE_PURIFY=on
+ ENABLE_PURECOV=on
+endif
+
+ifdef MAKE_PURIFY
+ ENABLE_PURIFY=on
+endif
+
+ifdef MAKE_PURECOV
+ ENABLE_PURECOV=on
+endif
+
+# -user-path="../test:../src:src:test" \
+
+
+ifdef ENABLE_PURIFY
+ PURIFY = purify \
+ -always-use-cache-dir \
+ -g++=yes \
+ -log-file=./.purifydir/MemoryReport \
+ -linker=$(GNU_ROOT)/bin/ld \
+ -append-logfile=yes \
+ -messages=batch \
+ -dlclose-mode=2 \
+ -view-file=./.purifydir/purify-%v.pv \
+ -chain-length=100
+
+else
+ PURIFY =
+endif
+
+ifdef MAKE_PUREGUI
+ PURIFY = purify \
+ -always-use-cache-dir \
+ -user-path="../test:../src:src:test" \
+ -g++=yes \
+ -linker=$(GNU_ROOT)/bin/ld
+endif
+
+ifdef ENABLE_PURECOV
+ PURECOV = purecov \
+ -always-use-cache-dir \
+ -counts-file=./.purifydir/purecov-%v.pcv
+ ifdef MAKE_PUREGUI
+ PURECOV = purecov -always-use-cache-dir
+ endif
+else
+ PURECOV =
+endif
+
+ifdef ENABLE_PURIFY
+ CCLD = "$(PURIFY)" $(CC)
+endif
+
+ifdef ENABLE_PURECOV
+ CCLD = "$(PURECOV)" $(CC)
+endif
+
+ifdef ENABLE_PURE
+ CCLD = "$(PURIFY) $(PURECOV)" $(CC)
+endif
+
+
+pureReport:
+ @ purecov -export=.purifydir/CoverageReport .purifydir/*.pcv
+ @ echo "== Purify coverage report in '.purifydir/CoverageReport'."
+
+pureGUI:
+ @ ls purecov*.pcv > /dev/null 2>&1; if [ $$? = "0" ]; then purecov -view purecov*.pcv &; fi
+ @ ls purify*.pv > /dev/null 2>&1; if [ $$? = "0" ]; then \
+ for member in `ls purify*.pv`; \
+ do purify -view $$member & \
+ done \
+ fi
+
+check-am: make_links
+
+make_links:
+ifeq ($(ENABLE_PURIFY),on)
+ - at if [ ! -d .purifydir ]; then mkdir .purifydir ; fi
+endif
+
+ifeq ($(ENABLE_PURECOV),on)
+ - at if [ ! -d .purifydir ]; then mkdir .purifydir ;fi
+endif
+
+clean-am: pureClean
+
+pureClean:
+ -@ rm -rf .purifydir/*
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..e69de29
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..98deba7
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,166 @@
+
+# HAWKI_SET_VERSION_INFO(VERSION, [CURRENT], [REVISION], [AGE])
+#----------------------------------------------------------------
+# Setup various version information, especially the libtool versioning
+AC_DEFUN([HAWKI_SET_VERSION_INFO],
+[
+ hawki_version=`echo "$1" | sed -e 's/[[a-z,A-Z]].*$//'`
+
+ hawki_major_version=`echo "$hawki_version" | \
+ sed 's/\([[0-9]]*\).\(.*\)/\1/'`
+ hawki_minor_version=`echo "$hawki_version" | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'`
+ hawki_micro_version=`echo "$hawki_version" | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+ if test -z "$hawki_major_version"; then hawki_major_version=0
+ fi
+
+ if test -z "$hawki_minor_version"; then hawki_minor_version=0
+ fi
+
+ if test -z "$hawki_micro_version"; then hawki_micro_version=0
+ fi
+
+ HAWKI_VERSION="$hawki_version"
+ HAWKI_MAJOR_VERSION=$hawki_major_version
+ HAWKI_MINOR_VERSION=$hawki_minor_version
+ HAWKI_MICRO_VERSION=$hawki_micro_version
+
+ if test -z "$4"; then HAWKI_INTERFACE_AGE=0
+ else HAWKI_INTERFACE_AGE="$4"
+ fi
+
+ HAWKI_BINARY_AGE=`expr 100 '*' $HAWKI_MINOR_VERSION + $HAWKI_MICRO_VERSION`
+ HAWKI_BINARY_VERSION=`expr 10000 '*' $HAWKI_MAJOR_VERSION + \
+ $HAWKI_BINARY_AGE`
+
+ AC_SUBST(HAWKI_VERSION)
+ AC_SUBST(HAWKI_MAJOR_VERSION)
+ AC_SUBST(HAWKI_MINOR_VERSION)
+ AC_SUBST(HAWKI_MICRO_VERSION)
+ AC_SUBST(HAWKI_INTERFACE_AGE)
+ AC_SUBST(HAWKI_BINARY_VERSION)
+ AC_SUBST(HAWKI_BINARY_AGE)
+
+ AC_DEFINE_UNQUOTED(HAWKI_MAJOR_VERSION, $HAWKI_MAJOR_VERSION,
+ [HAWKI major version number])
+ AC_DEFINE_UNQUOTED(HAWKI_MINOR_VERSION, $HAWKI_MINOR_VERSION,
+ [HAWKI minor version number])
+ AC_DEFINE_UNQUOTED(HAWKI_MICRO_VERSION, $HAWKI_MICRO_VERSION,
+ [HAWKI micro version number])
+ AC_DEFINE_UNQUOTED(HAWKI_INTERFACE_AGE, $HAWKI_INTERFACE_AGE,
+ [HAWKI interface age])
+ AC_DEFINE_UNQUOTED(HAWKI_BINARY_VERSION, $HAWKI_BINARY_VERSION,
+ [HAWKI binary version number])
+ AC_DEFINE_UNQUOTED(HAWKI_BINARY_AGE, $HAWKI_BINARY_AGE,
+ [HAWKI binary age])
+
+ ESO_SET_LIBRARY_VERSION([$2], [$3], [$4])
+])
+
+
+# HAWKI_SET_PATHS
+#------------------
+# Define auxiliary directories of the installed directory tree.
+AC_DEFUN([HAWKI_SET_PATHS],
+[
+ if test -z "$plugindir"; then
+ plugindir='${libdir}/esopipes-plugins/${PACKAGE}-${VERSION}'
+ fi
+
+ if test -z "$privatelibdir"; then
+ privatelibdir='${libdir}/${PACKAGE}-${VERSION}'
+ fi
+
+ if test -z "$pipedocsdir"; then
+ pipedocsdir='${datadir}/doc/esopipes/${PACKAGE}-${VERSION}/'
+ fi
+
+ htmldir='${pipedocsdir}/html'
+
+ if test -z "$configdir"; then
+ configdir='${datadir}/${PACKAGE}/config'
+ fi
+
+ if test -z "$wkfextradir"; then
+ wkfextradir='${datadir}/esopipes/${PACKAGE}-${VERSION}/reflex'
+ fi
+
+ if test -z "$wkfcopydir"; then
+ wkfcopydir='${datadir}/reflex/workflows/${PACKAGE}-${VERSION}'
+ fi
+
+ AC_SUBST(plugindir)
+ AC_SUBST(privatelibdir)
+ AC_SUBST(htmldir)
+ AC_SUBST(pipedocsdir)
+ AC_SUBST(configdir)
+ AC_SUBST(wkfextradir)
+ AC_SUBST(wkfcopydir)
+
+
+ # Define a preprocesor symbol for the plugin search paths
+
+ AC_DEFINE_UNQUOTED(HAWKI_PLUGIN_DIR,"esopipes-plugins",
+ [Plugin directory tree prefix])
+
+ eval plugin_dir="$plugindir"
+ plugin_path=`eval echo $plugin_dir | \
+ sed -e "s/\/${PACKAGE}-${VERSION}.*$//"`
+
+ AC_DEFINE_UNQUOTED(HAWKI_PLUGIN_PATH, "$plugin_path",
+ [Absolute path to the plugin directory tree])
+
+])
+
+
+# HAWKI_CREATE_SYMBOLS
+#-----------------------
+# Define include and library related makefile symbols
+AC_DEFUN([HAWKI_CREATE_SYMBOLS],
+[
+
+ # Symbols for package include file and library search paths
+
+ HAWKI_INCLUDES='-I$(top_srcdir)/hawki -I$(top_srcdir)/irplib'
+ HAWKI_LDFLAGS='-L$(top_builddir)/hawki'
+
+ all_includes='$(HAWKI_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(HAWKI_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
+
+ # Library aliases
+
+ LIBHAWKI='$(top_builddir)/hawki/libhawki.la'
+ LIBIRPLIB='$(top_builddir)/irplib/libirplib.la'
+
+ # Substitute the defined symbols
+
+ AC_SUBST(HAWKI_INCLUDES)
+ AC_SUBST(HAWKI_LDFLAGS)
+
+ AC_SUBST(LIBHAWKI)
+ AC_SUBST(LIBIRPLIB)
+
+ # Check for CPL and user defined libraries
+ AC_REQUIRE([CPL_CHECK_LIBS])
+ AC_REQUIRE([ESO_CHECK_EXTRA_LIBS])
+
+ all_includes='$(HAWKI_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(HAWKI_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
+
+ AC_SUBST(all_includes)
+ AC_SUBST(all_ldflags)
+])
+
+# HAWKI_CHECK_OPENMP_LIBS
+# -----------------------
+# Add the OpenMP libraries to linking libraries
+AC_DEFUN([HAWKI_CHECK_OPENMP_LIBS],
+[
+ if test -n "$OPENMP_CFLAGS" ; then
+ AC_SEARCH_LIBS([omp_get_num_threads], [gomp mtsk omp], [],
+ AC_MSG_ERROR([OpenMP runtime environment not found!]))
+ fi
+
+])
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..2088c59
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,1235 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.11.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], UPC, [depcc="$UPC" am_compiler_list=],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+
+# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+AC_DEFUN([AM_WITH_DMALLOC],
+[AC_MSG_CHECKING([if malloc debugging is wanted])
+AC_ARG_WITH(dmalloc,
+[ --with-dmalloc use dmalloc, as in
+ http://www.dmalloc.com/dmalloc.tar.gz],
+[if test "$withval" = yes; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_DMALLOC,1,
+ [Define if using the dmalloc debugging malloc package])
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ AC_MSG_RESULT(no)
+fi], [AC_MSG_RESULT(no)])
+])
+
+AU_DEFUN([fp_WITH_DMALLOC], [AM_WITH_DMALLOC])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4macros/cpl.m4])
+m4_include([m4macros/eso.m4])
+m4_include([m4macros/gsl.m4])
+m4_include([m4macros/libtool.m4])
+m4_include([m4macros/ltoptions.m4])
+m4_include([m4macros/ltsugar.m4])
+m4_include([m4macros/ltversion.m4])
+m4_include([m4macros/lt~obsolete.m4])
+m4_include([m4macros/openmp.m4])
+m4_include([m4macros/purify.m4])
+m4_include([acinclude.m4])
diff --git a/admin/compile b/admin/compile
new file mode 100755
index 0000000..c0096a7
--- /dev/null
+++ b/admin/compile
@@ -0,0 +1,143 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2009-10-06.20; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
+# Foundation, Inc.
+# Written by Tom Tromey <tromey at cygnus.com>.
+#
+# 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, 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, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as `compile cc -o foo foo.c'.
+ # So we strip `-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no `-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # `.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/admin/config.guess b/admin/config.guess
new file mode 100755
index 0000000..dc84c68
--- /dev/null
+++ b/admin/config.guess
@@ -0,0 +1,1501 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+# Free Software Foundation, Inc.
+
+timestamp='2009-11-20'
+
+# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[456])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel at ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes at openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf at swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/admin/config.sub b/admin/config.sub
new file mode 100755
index 0000000..2a55a50
--- /dev/null
+++ b/admin/config.sub
@@ -0,0 +1,1705 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+# Free Software Foundation, Inc.
+
+timestamp='2009-11-20'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tile*)
+ basic_machine=tile-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/admin/depcomp b/admin/depcomp
new file mode 100755
index 0000000..df8eea7
--- /dev/null
+++ b/admin/depcomp
@@ -0,0 +1,630 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
+
+# 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, 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, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u="sed s,\\\\\\\\,/,g"
+ depmode=msvisualcpp
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> "$depfile"
+ echo >> "$depfile"
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add `dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/admin/html.am b/admin/html.am
new file mode 100755
index 0000000..368e94e
--- /dev/null
+++ b/admin/html.am
@@ -0,0 +1,74 @@
+if MAINTAINER_MODE
+
+HTML_RECURSIVE_TARGETS = install-html-recursive
+
+html-am:
+ @if test -f doxygen/Doxyfile; then \
+ echo "cd doxygen && $(DOXYGEN)"; \
+ d=`pwd`; cd doxygen && $(DOXYGEN); cd $$d; \
+ if test -n "$(POST_DOXYGEN_CLEANFILES)"; then \
+ cd $(top_srcdir)/html && rm -f $(POST_DOXYGEN_CLEANFILES); \
+ fi; \
+ else \
+ echo "Nothing to be done for \`$@'."; \
+ fi
+
+clean-html: clean-html-am
+
+clean-html-am:
+ -rm -rf $(top_srcdir)/html
+
+install-html-am: html-am install-html-generic
+
+else
+
+HTML_RECURSIVE_TARGETS = install-html-recursive
+
+install-html-am: install-html-generic
+
+endif
+
+install-html: install-html-recursive
+
+install-html-generic:
+ @$(NORMAL_INSTALL)
+ @if test -d $(top_srcdir)/html; then \
+ echo "$(mkinstalldirs) $(DESTDIR)$(htmldir)"; \
+ $(mkinstalldirs) $(DESTDIR)$(htmldir); \
+ list="`ls -1 $(top_srcdir)/html`"; \
+ for p in $$list; do \
+ if test -f $(top_srcdir)/html/$$p; then \
+ echo " $(INSTALL_DATA) $(top_srcdir)/html/$$p $(DESTDIR)$(htmldir)/$$p"; \
+ $(INSTALL_DATA) $(top_srcdir)/html/$$p $(DESTDIR)$(htmldir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/$$p; \
+ fi; fi; \
+ done; \
+ fi
+
+uninstall-html:
+ @$(NORMAL_UNINSTALL)
+ @list="`ls -1 $(DESTDIR)$(htmldir)`"; for p in $$list; do \
+ echo " rm -f $(DESTDIR)$(htmldir)/$$p"; \
+ rm -f $(DESTDIR)$(htmldir)/$$p; \
+ done
+
+$(HTML_RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(HTML_SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
diff --git a/admin/install-sh b/admin/install-sh
new file mode 100755
index 0000000..6781b98
--- /dev/null
+++ b/admin/install-sh
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/admin/ltmain.sh b/admin/ltmain.sh
new file mode 100755
index 0000000..78cf017
--- /dev/null
+++ b/admin/ltmain.sh
@@ -0,0 +1,9636 @@
+
+# libtool (GNU libtool) 2.4
+# Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+# --config show all configuration variables
+# --debug enable verbose shell tracing
+# -n, --dry-run display commands without modifying any files
+# --features display basic configuration information and exit
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --no-quiet, --no-silent
+# print informational messages (default)
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print more informational messages than default
+# --no-verbose don't print the extra informational messages
+# --version print version information
+# -h, --help, --help-all print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+# clean remove files from the build directory
+# compile compile a source file into a libtool object
+# execute automatically set library path, then run a program
+# finish complete the installation of libtool libraries
+# install install libraries or executables
+# link create a library or an executable
+# uninstall remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE. When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.4
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool at gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.4
+TIMESTAMP=""
+package_revision=1.3293
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+ fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+ s@/\./@/@g
+ t dotsl
+ s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+# value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+ # Start from root dir and reassemble the path.
+ func_normal_abspath_result=
+ func_normal_abspath_tpath=$1
+ func_normal_abspath_altnamespace=
+ case $func_normal_abspath_tpath in
+ "")
+ # Empty path, that just means $cwd.
+ func_stripname '' '/' "`pwd`"
+ func_normal_abspath_result=$func_stripname_result
+ return
+ ;;
+ # The next three entries are used to spot a run of precisely
+ # two leading slashes without using negated character classes;
+ # we take advantage of case's first-match behaviour.
+ ///*)
+ # Unusual form of absolute path, do nothing.
+ ;;
+ //*)
+ # Not necessarily an ordinary path; POSIX reserves leading '//'
+ # and for example Cygwin uses it to access remote file shares
+ # over CIFS/SMB, so we conserve a leading double slash if found.
+ func_normal_abspath_altnamespace=/
+ ;;
+ /*)
+ # Absolute path, do nothing.
+ ;;
+ *)
+ # Relative path, prepend $cwd.
+ func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+ ;;
+ esac
+ # Cancel out all the simple stuff to save iterations. We also want
+ # the path to end with a slash for ease of parsing, so make sure
+ # there is one (and only one) here.
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+ while :; do
+ # Processed it all yet?
+ if test "$func_normal_abspath_tpath" = / ; then
+ # If we ascended to the root using ".." the result may be empty now.
+ if test -z "$func_normal_abspath_result" ; then
+ func_normal_abspath_result=/
+ fi
+ break
+ fi
+ func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcar"`
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcdr"`
+ # Figure out what to do with it
+ case $func_normal_abspath_tcomponent in
+ "")
+ # Trailing empty path component, ignore it.
+ ;;
+ ..)
+ # Parent dir; strip last assembled component from result.
+ func_dirname "$func_normal_abspath_result"
+ func_normal_abspath_result=$func_dirname_result
+ ;;
+ *)
+ # Actual path component, append it.
+ func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+ ;;
+ esac
+ done
+ # Restore leading double-slash if one was found on entry.
+ func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+# value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+ func_relative_path_result=
+ func_normal_abspath "$1"
+ func_relative_path_tlibdir=$func_normal_abspath_result
+ func_normal_abspath "$2"
+ func_relative_path_tbindir=$func_normal_abspath_result
+
+ # Ascend the tree starting from libdir
+ while :; do
+ # check if we have found a prefix of bindir
+ case $func_relative_path_tbindir in
+ $func_relative_path_tlibdir)
+ # found an exact match
+ func_relative_path_tcancelled=
+ break
+ ;;
+ $func_relative_path_tlibdir*)
+ # found a matching prefix
+ func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+ func_relative_path_tcancelled=$func_stripname_result
+ if test -z "$func_relative_path_result"; then
+ func_relative_path_result=.
+ fi
+ break
+ ;;
+ *)
+ func_dirname $func_relative_path_tlibdir
+ func_relative_path_tlibdir=${func_dirname_result}
+ if test "x$func_relative_path_tlibdir" = x ; then
+ # Have to descend all the way to the root!
+ func_relative_path_result=../$func_relative_path_result
+ func_relative_path_tcancelled=$func_relative_path_tbindir
+ break
+ fi
+ func_relative_path_result=../$func_relative_path_result
+ ;;
+ esac
+ done
+
+ # Now calculate path; take care to avoid doubling-up slashes.
+ func_stripname '' '/' "$func_relative_path_result"
+ func_relative_path_result=$func_stripname_result
+ func_stripname '/' '/' "$func_relative_path_tcancelled"
+ if test "x$func_stripname_result" != x ; then
+ func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+ fi
+
+ # Normalisation. If bindir is libdir, return empty string,
+ # else relative path ending with a slash; either way, target
+ # file name can be directly appended.
+ if test ! -z "$func_relative_path_result"; then
+ func_stripname './' '' "$func_relative_path_result/"
+ func_relative_path_result=$func_stripname_result
+ fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=:
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes. A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$opt_dry_run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+ fi
+
+ $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+ esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "$1" | $SED \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+ *)
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result. All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+ case $1 in
+ [0-9]* | *[!a-zA-Z0-9_]*)
+ func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+ ;;
+ * )
+ func_tr_sh_result=$1
+ ;;
+ esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $opt_debug
+
+ $SED -n '/(C)/!b go
+ :more
+ /\./!{
+ N
+ s/\n# / /
+ b more
+ }
+ :go
+ /^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/^# *.*--help/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ echo
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ :print
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+ p
+ d
+ }
+ /^# .* home page:/b print
+ /^# General help using/b print
+ ' < "$progpath"
+ ret=$?
+ if test -z "$1"; then
+ exit $ret
+ fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ $opt_debug
+
+ func_error "missing argument for $1."
+ exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+ my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+ my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+ func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+ func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
+
+ func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+ func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+ func_quote_for_eval "${2}"
+ eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+ done
+
+ exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+
+ exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
+
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
+
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ fi
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
+ ;;
+compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
+ ;;
+execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
+ ;;
+finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
+ ;;
+install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
+ ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly. This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+ # this just eases exit handling
+ while test $# -gt 0; do
+ opt="$1"
+ shift
+ case $opt in
+ --debug|-x) opt_debug='set -x'
+ func_echo "enabling shell trace mode"
+ $opt_debug
+ ;;
+ --dry-run|--dryrun|-n)
+ opt_dry_run=:
+ ;;
+ --config)
+ opt_config=:
+func_config
+ ;;
+ --dlopen|-dlopen)
+ optarg="$1"
+ opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+ shift
+ ;;
+ --preserve-dup-deps)
+ opt_preserve_dup_deps=:
+ ;;
+ --features)
+ opt_features=:
+func_features
+ ;;
+ --finish)
+ opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+ ;;
+ --help)
+ opt_help=:
+ ;;
+ --help-all)
+ opt_help_all=:
+opt_help=': help-all'
+ ;;
+ --mode)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_mode="$optarg"
+case $optarg in
+ # Valid mode arguments:
+ clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+esac
+ shift
+ ;;
+ --no-silent|--no-quiet)
+ opt_silent=false
+func_append preserve_args " $opt"
+ ;;
+ --no-verbose)
+ opt_verbose=false
+func_append preserve_args " $opt"
+ ;;
+ --silent|--quiet)
+ opt_silent=:
+func_append preserve_args " $opt"
+ opt_verbose=false
+ ;;
+ --verbose|-v)
+ opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+ ;;
+ --tag)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+
+ # Separate optargs to long options:
+ --*=*)
+ func_split_long_opt "$opt"
+ set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ # Separate non-argument short options:
+ -\?*|-h*|-n*|-v*)
+ func_split_short_opt "$opt"
+ set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set dummy "$opt" ${1+"$@"}; shift; break ;;
+ esac
+ done
+
+ # Validate options:
+
+ # save first non-option argument
+ if test "$#" -gt 0; then
+ nonopt="$opt"
+ shift
+ fi
+
+ # preserve --debug
+ test "$opt_debug" = : || func_append preserve_args " --debug"
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+ *)
+ opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+ ;;
+ esac
+
+ $opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
+ fi
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+ func_error "unrecognized option \`-dlopen'"
+ $ECHO "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$progname --help --mode=$opt_mode' for more information."
+ }
+
+
+ # Bail if the options were screwed
+ $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot. Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+ func_resolve_sysroot_result=$1
+ case $func_resolve_sysroot_result in
+ =*)
+ func_stripname '=' '' "$func_resolve_sysroot_result"
+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+ ;;
+ esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+ case "$lt_sysroot:$1" in
+ ?*:"$lt_sysroot"*)
+ func_stripname "$lt_sysroot" '' "$1"
+ func_replace_sysroot_result="=$func_stripname_result"
+ ;;
+ *)
+ # Including no sysroot.
+ func_replace_sysroot_result=$1
+ ;;
+ esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case "$@ " in
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+ $opt_debug
+ func_convert_core_file_wine_to_w32_result="$1"
+ if test -n "$1"; then
+ # Unfortunately, winepath does not exit with a non-zero error code, so we
+ # are forced to check the contents of stdout. On the other hand, if the
+ # command is not found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both error code of
+ # zero AND non-empty stdout, which explains the odd construction:
+ func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+ func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ func_convert_core_file_wine_to_w32_result=
+ fi
+ fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+ $opt_debug
+ # unfortunately, winepath doesn't convert paths, only file names
+ func_convert_core_path_wine_to_w32_result=""
+ if test -n "$1"; then
+ oldIFS=$IFS
+ IFS=:
+ for func_convert_core_path_wine_to_w32_f in $1; do
+ IFS=$oldIFS
+ func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+ if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+ if test -z "$func_convert_core_path_wine_to_w32_result"; then
+ func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+ else
+ func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+ fi
+ fi
+ done
+ IFS=$oldIFS
+ fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+ $opt_debug
+ if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+ func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+ if test "$?" -ne 0; then
+ # on failure, ensure result is empty
+ func_cygpath_result=
+ fi
+ else
+ func_cygpath_result=
+ func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+ fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format. Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+ $opt_debug
+ # awkward: cmd appends spaces to result
+ func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+ $opt_debug
+ if test -z "$2" && test -n "$1" ; then
+ func_error "Could not determine host file name corresponding to"
+ func_error " \`$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_file_result="$1"
+ fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+ $opt_debug
+ if test -z "$4" && test -n "$3"; then
+ func_error "Could not determine the host path corresponding to"
+ func_error " \`$3'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This is a deliberately simplistic "conversion" and
+ # should not be "improved". See libtool.info.
+ if test "x$1" != "x$2"; then
+ lt_replace_pathsep_chars="s|$1|$2|g"
+ func_to_host_path_result=`echo "$3" |
+ $SED -e "$lt_replace_pathsep_chars"`
+ else
+ func_to_host_path_result="$3"
+ fi
+ fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+ $opt_debug
+ case $4 in
+ $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+ ;;
+ esac
+ case $4 in
+ $2 ) func_append func_to_host_path_result "$3"
+ ;;
+ esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+ $opt_debug
+ $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result. If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+ $opt_debug
+ case ,$2, in
+ *,"$to_tool_file_cmd",*)
+ func_to_tool_file_result=$1
+ ;;
+ *)
+ $to_tool_file_cmd "$1"
+ func_to_tool_file_result=$func_to_host_file_result
+ ;;
+ esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+ func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+ # LT_CYGPATH in this case.
+ func_to_host_file_result=`cygpath -m "$1"`
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format. Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_file_wine_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_msys_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+ func_convert_core_file_wine_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format. If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+# file name conversion function : func_convert_file_X_to_Y ()
+# path conversion function : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same. If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+ $opt_debug
+ if test -z "$to_host_path_cmd"; then
+ func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+ to_host_path_cmd="func_convert_path_${func_stripname_result}"
+ fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+ $opt_debug
+ func_init_to_host_path_cmd
+ $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+ func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from ARG. MSYS
+ # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+ # and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format. Requires a wine environment and
+# a working winepath. Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+ pie_flag=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
+ arg_mode=target
+ continue
+ ;;
+
+ -pie | -fpie | -fPIE)
+ func_append pie_flag " $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
+ func_append later " $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+ func_append_quoted lastarg "$arg"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
+
+ # Add the arguments to base_compile.
+ func_append base_compile " $lastarg"
+ continue
+ ;;
+
+ *)
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ func_append_quoted base_compile "$lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ func_fatal_error "you must specify an argument for -Xcompile"
+ ;;
+ target)
+ func_fatal_error "you must specify a target with \`-o'"
+ ;;
+ *)
+ # Get the name of the library object.
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ case $libobj in
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
+ esac
+
+ case $libobj in
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+ *)
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
+ -static)
+ build_libtool_libs=no
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
+ lobj=${xdir}$objdir/$objname
+
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+ func_append removelist " $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
+ fi
+
+ $opt_dry_run || $RM $removelist
+ func_append removelist " $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+ func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+ srcfile=$func_to_tool_file_result
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ func_mkdir_p "$xdir$objdir"
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ func_append command " -o $lobj"
+ fi
+
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile$pie_flag"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ func_append command " -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ func_append command "$suppress_output"
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+ test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $opt_mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ compile)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to build PIC objects only
+ -prefer-non-pic try to build non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only build a \`.o' file suitable for static linking
+ -Wc,FLAG pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+ execute)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+ finish)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+ install)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -bindir BINDIR specify path to binaries directory (for systems where
+ libraries must be found in the PATH setting at runtime)
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+ -Wc,FLAG
+ -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
+ -Wl,FLAG
+ -Xlinker FLAG pass linker-specific FLAG directly to the linker
+ -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+ uninstall)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+ ;;
+ esac
+
+ echo
+ $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+ if test "$opt_help" = :; then
+ func_mode_help
+ else
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ func_mode_help
+ done
+ } | sed -n '1p; 2,$s/^Usage:/ or: /p'
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ echo
+ func_mode_help
+ done
+ } |
+ sed '1d
+ /^When reporting/,/^Report/{
+ H
+ d
+ }
+ $x
+ /information about other modes/d
+ /more detailed .*MODE/d
+ s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+ fi
+ exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $opt_dlopen; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ func_append dir "/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -* | *.la | *.lo ) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_append_quoted args "$file"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+ echo "export $shlibpath_var"
+ fi
+ $ECHO "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ libs=
+ libdirs=
+ admincmds=
+
+ for opt in "$nonopt" ${1+"$@"}
+ do
+ if test -d "$opt"; then
+ func_append libdirs " $opt"
+
+ elif test -f "$opt"; then
+ if func_lalib_unsafe_p "$opt"; then
+ func_append libs " $opt"
+ else
+ func_warning "\`$opt' is not a valid libtool archive"
+ fi
+
+ else
+ func_fatal_error "invalid argument \`$opt'"
+ fi
+ done
+
+ if test -n "$libs"; then
+ if test -n "$lt_sysroot"; then
+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+ sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+ else
+ sysroot_cmd=
+ fi
+
+ # Remove sysroot references
+ if $opt_dry_run; then
+ for lib in $libs; do
+ echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+ done
+ else
+ tmpdir=`func_mktempdir`
+ for lib in $libs; do
+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+ > $tmpdir/tmp-la
+ mv -f $tmpdir/tmp-la $lib
+ done
+ ${RM}r "$tmpdir"
+ fi
+ fi
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || func_append admincmds "
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $ECHO " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $ECHO " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+
+ echo "See any operating system documentation about shared libraries for"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ echo "pages."
+ ;;
+ *)
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ echo "----------------------------------------------------------------------"
+ fi
+ exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ case $nonopt in *shtool*) :;; *) false;; esac; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ func_append install_prog "$func_quote_for_eval_result"
+ install_shared_prog=$install_prog
+ case " $install_prog " in
+ *[\\\ /]cp\ *) install_cp=: ;;
+ *) install_cp=false ;;
+ esac
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ no_mode=:
+ for arg
+ do
+ arg2=
+ if test -n "$dest"; then
+ func_append files " $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ if $install_cp; then :; else
+ prev=$arg
+ fi
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ if test "x$prev" = x-m && test -n "$install_override_mode"; then
+ arg2=$install_override_mode
+ no_mode=false
+ fi
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ func_quote_for_eval "$arg"
+ func_append install_prog " $func_quote_for_eval_result"
+ if test -n "$arg2"; then
+ func_quote_for_eval "$arg2"
+ fi
+ func_append install_shared_prog " $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -n "$install_override_mode" && $no_mode; then
+ if $install_cp; then :; else
+ func_quote_for_eval "$install_override_mode"
+ func_append install_shared_prog " -m $func_quote_for_eval_result"
+ fi
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ func_append staticlibs " $file"
+ ;;
+
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append current_libdirs " $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append future_libdirs " $libdir" ;;
+ esac
+ fi
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ func_append dir "$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ fi
+ }
+ else
+ # Install the binary that we compiled earlier.
+ file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ for progfile in $progfiles; do
+ func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+ func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+ $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ # if an import library, we need to obtain dlname
+ if func_win32_import_lib_p "$dlprefile"; then
+ func_tr_sh "$dlprefile"
+ eval "curr_lafile=\$libfile_$func_tr_sh_result"
+ dlprefile_dlbasename=""
+ if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+ # Use subshell, to avoid clobbering current variable values
+ dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+ if test -n "$dlprefile_dlname" ; then
+ func_basename "$dlprefile_dlname"
+ dlprefile_dlbasename="$func_basename_result"
+ else
+ # no lafile. user explicitly requested -dlpreopen <import library>.
+ $sharedlib_from_linklib_cmd "$dlprefile"
+ dlprefile_dlbasename=$sharedlib_from_linklib_result
+ fi
+ fi
+ $opt_dry_run || {
+ if test -n "$dlprefile_dlbasename" ; then
+ eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+ else
+ func_warning "Could not compute DLL name from $name"
+ eval '$ECHO ": $name " >> "$nlist"'
+ fi
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+ $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+ }
+ else # not an import lib
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ fi
+ ;;
+ *)
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ ;;
+ esac
+ done
+
+ $opt_dry_run || {
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $MV "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if $GREP -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ $GREP -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ echo >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) func_append symtab_cflags " $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+ fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+ $opt_debug
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+ $opt_debug
+ sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+ $opt_debug
+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+ $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+ $SED '/^Contents of section '"$match_literal"':/{
+ # Place marker at beginning of archive member dllname section
+ s/.*/====MARK====/
+ p
+ d
+ }
+ # These lines can sometimes be longer than 43 characters, but
+ # are always uninteresting
+ /:[ ]*file format pe[i]\{,1\}-/d
+ /^In archive [^:]*:/d
+ # Ensure marker is printed
+ /^====MARK====/p
+ # Remove all lines with less than 43 characters
+ /^.\{43\}/!d
+ # From remaining lines, remove first 43 characters
+ s/^.\{43\}//' |
+ $SED -n '
+ # Join marker and all lines until next marker into a single line
+ /^====MARK====/ b para
+ H
+ $ b para
+ b
+ :para
+ x
+ s/\n//g
+ # Remove the marker
+ s/^====MARK====//
+ # Remove trailing dots and whitespace
+ s/[\. \t]*$//
+ # Print
+ /./p' |
+ # we now have a list, one entry per line, of the stringified
+ # contents of the appropriate section of all members of the
+ # archive which possess that section. Heuristic: eliminate
+ # all those which have a first or second character that is
+ # a '.' (that is, objdump's representation of an unprintable
+ # character.) This should work for all archives with less than
+ # 0x302f exports -- but will fail for DLLs whose name actually
+ # begins with a literal '.' or a single character followed by
+ # a '.'.
+ #
+ # Of those that remain, print the first one.
+ $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+ test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+ test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+ $opt_debug
+ if func_cygming_gnu_implib_p "$1" ; then
+ # binutils import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+ elif func_cygming_ms_implib_p "$1" ; then
+ # ms-generated import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+ else
+ # unknown
+ sharedlib_from_linklib_result=""
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ if test "$lock_old_archive_extraction" = yes; then
+ lockfile=$f_ex_an_ar_oldlib.lock
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ fi
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+ 'stat=$?; rm -f "$lockfile"; exit $stat'
+ if test "$lock_old_archive_extraction" = yes; then
+ $opt_dry_run || rm -f "$lockfile"
+ fi
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`basename "$darwin_archive"`
+ darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ $LIPO -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ $RM -rf unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd $darwin_orig_dir
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ done
+
+ func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=${1-no}
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='$macro_version'
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$ECHO are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ file=\"\$0\""
+
+ qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+ $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+ ECHO=\"$qECHO\"
+ fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+ lt_script_arg0=\$0
+ shift
+ for lt_opt
+ do
+ case \"\$lt_opt\" in
+ --lt-debug) lt_option_debug=1 ;;
+ --lt-dump-script)
+ lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+ test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+ lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+ cat \"\$lt_dump_D/\$lt_dump_F\"
+ exit 0
+ ;;
+ --lt-*)
+ \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ # Print the debug banner immediately:
+ if test -n \"\$lt_option_debug\"; then
+ echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+ fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+ lt_dump_args_N=1;
+ for lt_arg
+ do
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+ lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+ done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2* | *-cegcc*)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+ for lt_wr_arg
+ do
+ case \$lt_wr_arg in
+ --lt-*) ;;
+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+ esac
+ shift
+ done
+ func_exec_program_core \${1+\"\$@\"}
+}
+
+ # Parse options
+ func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+ done
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" ||
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $MKDIR \"\$progdir\"
+ else
+ $RM \"\$progdir/\$file\"
+ fi"
+
+ $ECHO "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $RM \"\$progdir/\$program\";
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $RM \"\$progdir/\$file\"
+ fi"
+ else
+ $ECHO "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # fixup the dll searchpath if we need to.
+ #
+ # Fix the DLL searchpath if we need to. Do this before prepending
+ # to shlibpath, because on Windows, both are PATH and uninstalled
+ # libraries must come first.
+ if test -n "$dllsearchpath"; then
+ $ECHO "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $ECHO "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ $ECHO "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+ func_exec_program \${1+\"\$@\"}
+ fi
+ else
+ # The program doesn't exist.
+ \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+ \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+*/
+EOF
+ cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+ cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_path "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_path "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ newargz = XMALLOC (char *, argc + 1);
+
+ /* very simple arg parsing; don't want to rely on getopt
+ * also, copy all non cwrapper options to newargz, except
+ * argz[0], which is handled differently
+ */
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ lt_dump_script (stdout);
+ return 0;
+ }
+ if (strcmp (argv[i], debug_opt) == 0)
+ {
+ lt_debug = 1;
+ continue;
+ }
+ if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal (__FILE__, __LINE__,
+ "unrecognized %s option: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+EOF
+ cat <<EOF
+ /* The GNU banner must be the first non-error debug message */
+ lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+ cat <<"EOF"
+ lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (before symlink chase) at: %s\n",
+ tmp_pathspec);
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (after symlink chase) at: %s\n",
+ actual_cwrapper_path);
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) libtool target name: %s\n",
+ target_name);
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
+ be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+ because on Windows, both *_VARNAMEs are PATH but uninstalled
+ libraries must come first. */
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+ lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+ nonnull (lt_argv_zero));
+ for (i = 0; i < newargc; i++)
+ {
+ lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+ i, nonnull (newargz[i]));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ newargz = prepare_spawn (newargz);
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) failed to launch target \"%s\": %s\n",
+ lt_argv_zero, nonnull (strerror (errno)));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+ void *p = (void *) malloc (num);
+ if (!p)
+ lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+ string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+ nonempty (wrapper));
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char *path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char *q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR (*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name =
+ XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name =
+ XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ lt_debugprintf (__FILE__, __LINE__,
+ "checking path component for symlinks: %s\n",
+ tmp_pathspec);
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "error accessing file \"%s\": %s",
+ tmp_pathspec, nonnull (strerror (errno)));
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert (str != NULL);
+ assert (pat != NULL);
+
+ len = strlen (str);
+ patlen = strlen (pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp (str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ if (lt_debug)
+ {
+ (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+ int line, const char *mode,
+ const char *message, va_list ap)
+{
+ fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+ va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+ return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+ return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_setenv) setting '%s' to '%s'\n",
+ nonnull (name), nonnull (value));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+EOF
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+ Note that spawn() does not by itself call the command interpreter
+ (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+ ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&v);
+ v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+ }) ? "cmd.exe" : "command.com").
+ Instead it simply concatenates the arguments, separated by ' ', and calls
+ CreateProcess(). We must quote the arguments since Win32 CreateProcess()
+ interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+ special way:
+ - Space and tab are interpreted as delimiters. They are not treated as
+ delimiters if they are surrounded by double quotes: "...".
+ - Unescaped double quotes are removed from the input. Their only effect is
+ that within double quotes, space and tab are treated like normal
+ characters.
+ - Backslashes not followed by double quotes are not special.
+ - But 2*n+1 backslashes followed by a double quote become
+ n backslashes followed by a double quote (n >= 0):
+ \" -> "
+ \\\" -> \"
+ \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+ size_t argc;
+ char **new_argv;
+ size_t i;
+
+ /* Count number of arguments. */
+ for (argc = 0; argv[argc] != NULL; argc++)
+ ;
+
+ /* Allocate new argument vector. */
+ new_argv = XMALLOC (char *, argc + 1);
+
+ /* Put quoted arguments into the new argument vector. */
+ for (i = 0; i < argc; i++)
+ {
+ const char *string = argv[i];
+
+ if (string[0] == '\0')
+ new_argv[i] = xstrdup ("\"\"");
+ else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+ {
+ int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+ size_t length;
+ unsigned int backslashes;
+ const char *s;
+ char *quoted_string;
+ char *p;
+
+ length = 0;
+ backslashes = 0;
+ if (quote_around)
+ length++;
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ length += backslashes + 1;
+ length++;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ length += backslashes + 1;
+
+ quoted_string = XMALLOC (char, length + 1);
+
+ p = quoted_string;
+ backslashes = 0;
+ if (quote_around)
+ *p++ = '"';
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ {
+ unsigned int j;
+ for (j = backslashes + 1; j > 0; j--)
+ *p++ = '\\';
+ }
+ *p++ = c;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ {
+ unsigned int j;
+ for (j = backslashes; j > 0; j--)
+ *p++ = '\\';
+ *p++ = '"';
+ }
+ *p = '\0';
+
+ new_argv[i] = quoted_string;
+ }
+ else
+ new_argv[i] = (char *) string;
+ }
+ new_argv[argc] = NULL;
+
+ return new_argv;
+}
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+ func_emit_wrapper yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
+
+ cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+ $opt_debug
+ case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+ *import*) : ;;
+ *) false ;;
+ esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args=$nonopt
+ base_compile="$nonopt $@"
+ compile_command=$nonopt
+ finalize_command=$nonopt
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+ new_inherited_linker_flags=
+
+ avoid_version=no
+ bindir=
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+ weak_libs=
+ single_module="${wl}-single_module"
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ func_warning "complete static linking is impossible in this configuration"
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ bindir)
+ bindir="$arg"
+ prev=
+ continue
+ ;;
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ func_append dlfiles " $arg"
+ else
+ func_append dlprefiles " $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) func_append deplibs " $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat "$save_arg"`
+ do
+# func_append moreargs " $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ done
+ else
+ func_fatal_error "link input file \`$arg' does not exist"
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) func_append rpath " $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) func_append xrpath " $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ weak)
+ func_append weak_libs " $arg"
+ prev=
+ continue
+ ;;
+ xcclinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xcompiler)
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xlinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $wl$qarg"
+ prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append finalize_command " $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -bindir)
+ prev=bindir
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework)
+ prev=framework
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ func_stripname "-L" '' "$arg"
+ if test -z "$func_stripname_result"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "* | *" $arg "*)
+ # Will only happen for absolute or sysroot arguments
+ ;;
+ *)
+ # Preserve sysroot, but never include relative directories
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+ *) func_append deplibs " -L$dir" ;;
+ esac
+ func_append lib_search_path " $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
+ *) func_append dllsearchpath ":$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ func_append deplibs " System.ltframework"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ func_append deplibs " $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot|--sysroot)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) func_append new_inherited_linker_flags " $arg" ;;
+ esac
+ continue
+ ;;
+
+ -multi_module)
+ single_module="${wl}-multi_module"
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # and Darwin in order for the loader to find any dlls it needs.
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ continue
+ ;;
+
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -static | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -weak)
+ prev=weak
+ continue
+ ;;
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $func_quote_for_eval_result"
+ func_append compiler_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $wl$func_quote_for_eval_result"
+ func_append compiler_flags " $wl$func_quote_for_eval_result"
+ func_append linker_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # Flags to be passed through unchanged, with rationale:
+ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
+ # -r[0-9][0-9]* specify processor for the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+ # +DA*, +DD* enable 64-bit mode for the HP compiler
+ # -q* compiler args for the IBM compiler
+ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+ # -F/path path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
+ # @file GCC response files
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ func_append compiler_flags " $arg"
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ *.$objext)
+ # A standard object.
+ func_append objs " $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ func_append deplibs " $arg"
+ func_append old_deplibs " $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ func_resolve_sysroot "$arg"
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ func_append dlfiles " $func_resolve_sysroot_result"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ func_append dlprefiles " $func_resolve_sysroot_result"
+ prev=
+ else
+ func_append deplibs " $func_resolve_sysroot_result"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+ done # argument parsing loop
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ func_basename "$output"
+ outputname="$func_basename_result"
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
+ func_to_tool_file "$output_objdir/"
+ tool_output_objdir=$func_to_tool_file_result
+ # Create the object directory.
+ func_mkdir_p "$output_objdir"
+
+ # Determine the type of output
+ case $output in
+ "")
+ func_fatal_help "you must specify an output file"
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if $opt_preserve_dup_deps ; then
+ case "$libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append libs " $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if $opt_duplicate_compiler_generated_deps; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ esac
+ func_append pre_post_deps " $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+
+ case $linkmode in
+ lib)
+ passes="conv dlpreopen link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+
+ for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ func_resolve_sysroot "$lib"
+ case $lib in
+ *.la) func_source "$func_resolve_sysroot_result" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ func_basename "$deplib"
+ deplib_base=$func_basename_result
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) func_append deplibs " $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append compiler_flags " $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ func_warning "\`-l' is ignored for archives/objects"
+ continue
+ fi
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
+ if test "$linkmode" = lib; then
+ searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+ else
+ searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+ fi
+ for searchdir in $searchdirs; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if func_lalib_p "$lib"; then
+ library_names=
+ old_library=
+ func_source "$lib"
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ *)
+ func_warning "\`-L' is ignored for archives/objects"
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ func_stripname '-R' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ lib=$func_resolve_sysroot_result
+ ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ echo
+ $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not use here."
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ func_append newdlprefiles " $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append newdlfiles " $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+ fi
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ inherited_linker_flags=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && func_append dlfiles " $dlopen"
+ test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ func_append convenience " $ladir/$objdir/$old_library"
+ func_append old_convenience " $ladir/$objdir/$old_library"
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ func_fatal_error "\`$lib' is not a convenience library"
+ fi
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ if test -n "$old_library" &&
+ { test "$prefer_static_libs" = yes ||
+ test "$prefer_static_libs,$installed" = "built,no"; }; then
+ linklib=$old_library
+ else
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ fi
+ if test -z "$linklib"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ func_append dlprefiles " $lib $dependency_libs"
+ else
+ func_append newdlfiles " $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ func_basename "$lib"
+ laname="$func_basename_result"
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ func_warning "library \`$lib' was moved."
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$lt_sysroot$libdir"
+ absdir="$lt_sysroot$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ fi
+ fi # $installed = yes
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+ fi
+ case "$host" in
+ # special handling for platforms with PE-DLLs.
+ *cygwin* | *mingw* | *cegcc* )
+ # Linker will automatically link against shared library if both
+ # static and shared are present. Therefore, ensure we extract
+ # symbols from the import library if a shared library is present
+ # (otherwise, the dlopen module name will be incorrect). We do
+ # this by putting the import library name into $newdlprefiles.
+ # We recover the dlopen module name by 'saving' the la file
+ # name in a special purpose variable, and (later) extracting the
+ # dlname from the la file.
+ if test -n "$dlname"; then
+ func_tr_sh "$dir/$linklib"
+ eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+ func_append newdlprefiles " $dir/$linklib"
+ else
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ fi
+ ;;
+ * )
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ func_append newdlprefiles " $dir/$dlname"
+ else
+ func_append newdlprefiles " $dir/$linklib"
+ fi
+ ;;
+ esac
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ func_append newlib_search_path " $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) func_append temp_rpath "$absdir:" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ func_append notinst_deplibs " $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ func_append notinst_deplibs " $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ echo
+ if test "$linkmode" = prog; then
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $ECHO "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.a
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
+ if /usr/bin/file -L $add 2> /dev/null |
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; then
+ $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ echo
+ echo "*** And there doesn't seem to be a static archive available"
+ echo "*** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ func_fatal_configuration "unsupported hardcode properties"
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ $ECHO "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) func_append xrpath " $temp_xrpath";;
+ esac;;
+ *) func_append temp_deplibs " $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ func_append newlib_search_path " $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result";;
+ *) func_resolve_sysroot "$deplib" ;;
+ esac
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $func_resolve_sysroot_result "*)
+ func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ esac
+ fi
+ func_append tmp_libs " $func_resolve_sysroot_result"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ path=
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
+ func_dirname "$deplib" "" "."
+ dir=$func_dirname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ func_warning "cannot determine absolute directory name of \`$dir'"
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if $GREP "^installed=no" $deplib > /dev/null; then
+ case $host in
+ *-*-darwin*)
+ depdepl=
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
+ fi
+ fi
+ ;;
+ *)
+ path="-L$absdir/$objdir"
+ ;;
+ esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
+ ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test "$pass" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) func_append lib_search_path " $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ func_append tmp_libs " $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
+
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ func_append objs "$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+ $ECHO "*** objects $objs is not portable!"
+ func_append libobjs " $objs"
+ fi
+ fi
+
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+ set dummy $rpath
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ shift
+ IFS="$save_ifs"
+
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ darwin|linux|osf|windows|none)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|qnx|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_minor"
+ lt_irix_increment=no
+ ;;
+ esac
+ ;;
+ no)
+ current="$1"
+ revision="$2"
+ age="$3"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ func_arith $current + 1
+ minor_current=$func_arith_result
+ xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ irix | nonstopux)
+ if test "X$lt_irix_increment" = "Xno"; then
+ func_arith $current - $age
+ else
+ func_arith $current - $age + 1
+ fi
+ major=$func_arith_result
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ func_append verstring ":${current}.0"
+ ;;
+
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+
+ *)
+ func_fatal_configuration "unknown library version type \`$version_type'"
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ func_warning "undefined symbols not allowed in $host shared libraries"
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ fi
+
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ func_append libobjs " $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
+ if test "$opt_mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$ECHO "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext | *.gcno)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ func_append removelist " $p"
+ ;;
+ *) ;;
+ esac
+ done
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ func_append oldlibs " $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ #for path in $notinst_path; do
+ # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+ # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ #done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ func_replace_sysroot "$libdir"
+ func_append temp_xrpath " -R$func_replace_sysroot_result"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) func_append dlfiles " $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) func_append dlprefiles " $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ func_append deplibs " System.ltframework"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ func_append deplibs " -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $opt_dry_run || $RM conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ if test -n "$file_magic_glob"; then
+ libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+ else
+ libnameglob=$libname
+ fi
+ test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ if test "$want_nocaseglob" = yes; then
+ shopt -s nocaseglob
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ $nocaseglob
+ else
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ fi
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ done
+ fi
+ case $tmp_deplibs in
+ *[!\ \ ]*)
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ ;;
+ esac
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ func_append linknames " $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ func_append delfiles " $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd1 in $cmds; do
+ IFS="$save_ifs"
+ # Take the normal branch if the nm_file_list_spec branch
+ # doesn't work or if tool conversion is not needed.
+ case $nm_file_list_spec~$to_tool_file_cmd in
+ *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+ try_normal_branch=yes
+ eval cmd=\"$cmd1\"
+ func_len " $cmd"
+ len=$func_len_result
+ ;;
+ *)
+ try_normal_branch=no
+ ;;
+ esac
+ if test "$try_normal_branch" = yes \
+ && { test "$len" -lt "$max_cmd_len" \
+ || test "$max_cmd_len" -le -1; }
+ then
+ func_show_eval "$cmd" 'exit $?'
+ skipped_export=false
+ elif test -n "$nm_file_list_spec"; then
+ func_basename "$output"
+ output_la=$func_basename_result
+ save_libobjs=$libobjs
+ save_output=$output
+ output=${output_objdir}/${output_la}.nm
+ func_to_tool_file "$output"
+ libobjs=$nm_file_list_spec$func_to_tool_file_result
+ func_append delfiles " $output"
+ func_verbose "creating $NM input file list: $output"
+ for obj in $save_libobjs; do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > "$output"
+ eval cmd=\"$cmd1\"
+ func_show_eval "$cmd" 'exit $?'
+ output=$save_output
+ libobjs=$save_libobjs
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ func_append tmp_deplibs " $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ else
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ func_append linker_flags " $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ func_basename "$output"
+ output_la=$func_basename_result
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ last_robj=
+ k=1
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ echo 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ echo ')' >> $output
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$func_to_tool_file_result
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append objlist " $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ reload_objs=$objlist
+ eval concat_cmds=\"$reload_cmds\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=" $obj"
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ func_append delfiles " $output"
+
+ else
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+ fi
+ fi
+
+ test -n "$save_libobjs" &&
+ func_verbose "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+ fi
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
+ fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
+
+ case $output in
+ *.lo)
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $opt_dry_run || $RM $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # If we're not building shared, we need to use non_pic_objs
+ test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+ fi
+
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
+ esac
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
+
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ case $host in
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ func_append compile_command " ${wl}-bind_at_load"
+ func_append finalize_command " ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ func_append compile_command " $compile_deplibs"
+ func_append finalize_command " $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
+ *) func_append dllsearchpath ":$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ fi
+
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
+ fi
+
+ wrappers_required=yes
+ case $host in
+ *cegcc* | *mingw32ce*)
+ # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
+ # Replace the output file specification.
+ compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Delete the generated files.
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $opt_dry_run || $RM $output
+ # Link the executable and exit
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output_objdir/$outputname"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Now create the wrapper script.
+ func_verbose "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
+
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
+ ;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_wrapper no > $output
+ chmod +x $output
+ ;;
+ esac
+ }
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save $symfileobj"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ func_append oldobjs " $symfileobj"
+ fi
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $addlibs
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ echo "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+ func_mkdir_p "$gentop"
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ func_basename "$obj"
+ objbase="$func_basename_result"
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ func_arith $counter + 1
+ counter=$func_arith_result
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ func_append oldobjs " $gentop/$newobj"
+ ;;
+ *) func_append oldobjs " $obj" ;;
+ esac
+ done
+ fi
+ eval cmds=\"$old_archive_cmds\"
+
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ elif test -n "$archiver_list_spec"; then
+ func_verbose "using command file archive linking..."
+ for obj in $oldobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > $output_objdir/$libname.libcmd
+ func_to_tool_file "$output_objdir/$libname.libcmd"
+ oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ func_verbose "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ oldobjs=
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+ for obj in $save_oldobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ len=$len0
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ func_execute_cmds "$cmds" 'exit $?'
+ done
+
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ func_verbose "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+ # Only create the output if not a dry run.
+ $opt_dry_run || {
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ func_basename "$deplib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ -L*)
+ func_stripname -L '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -L$func_replace_sysroot_result"
+ ;;
+ -R*)
+ func_stripname -R '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -R$func_replace_sysroot_result"
+ ;;
+ *) func_append newdependency_libs " $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+
+ for lib in $dlfiles; do
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ *) func_append newdlfiles " $lib" ;;
+ esac
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ esac
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlfiles " $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlprefiles " $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $RM $output
+ # place dlname in correct position for cygwin
+ # In fact, it would be nice if we could use this code for all target
+ # systems that can't hard-code library paths into their executables
+ # and that have no shared library path variable independent of PATH,
+ # but it turns out we can't easily determine that from inspecting
+ # libtool variables, so we have to hard-code the OSs to which it
+ # applies here; at the moment, that means platforms that use the PE
+ # object format with DLL files. See the long comment at the top of
+ # tests/bindir.at for full details.
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+ # If a -bindir argument was supplied, place the dll there.
+ if test "x$bindir" != x ;
+ then
+ func_relative_path "$install_libdir" "$bindir"
+ tdlname=$func_relative_path_result$dlname
+ else
+ # Otherwise fall back on heuristic.
+ tdlname=../bin/$dlname
+ fi
+ ;;
+ esac
+ $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $ECHO >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ }
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+ func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) func_append RM " $arg"; rmforce=yes ;;
+ -*) func_append RM " $arg" ;;
+ *) func_append files " $arg" ;;
+ esac
+ done
+
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
+
+ rmdirs=
+
+ for file in $files; do
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
+ odir="$objdir"
+ else
+ odir="$dir/$objdir"
+ fi
+ func_basename "$file"
+ name="$func_basename_result"
+ test "$opt_mode" = uninstall && odir="$dir"
+
+ # Remember odir for removal later, being careful to avoid duplicates
+ if test "$opt_mode" = clean; then
+ case " $rmdirs " in
+ *" $odir "*) ;;
+ *) func_append rmdirs " $odir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if { test -L "$file"; } >/dev/null 2>&1 ||
+ { test -h "$file"; } >/dev/null 2>&1 ||
+ test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ func_append rmfiles " $odir/$n"
+ done
+ test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+ case "$opt_mode" in
+ clean)
+ case " $library_names " in
+ *" $dlname "*) ;;
+ *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ esac
+ test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if func_lalib_p "$file"; then
+
+ # Read the .lo file
+ func_source $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" &&
+ test "$pic_object" != none; then
+ func_append rmfiles " $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
+ func_append rmfiles " $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$opt_mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ func_append rmfiles " $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ func_append rmfiles " $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ func_append rmfiles " $odir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ func_append rmfiles " $odir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ func_show_eval "$RM $rmfiles" 'exit_status=1'
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ func_show_eval "rmdir $dir >/dev/null 2>&1"
+ fi
+ done
+
+ exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+ eval exec "$exec_cmd"
+ exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/admin/missing b/admin/missing
new file mode 100755
index 0000000..28055d2
--- /dev/null
+++ b/admin/missing
@@ -0,0 +1,376 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# 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, 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, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake at gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar*)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar*)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/calib/cal/HI_GSSC_081103A_stdstars_cat.fits b/calib/cal/HI_GSSC_081103A_stdstars_cat.fits
new file mode 100644
index 0000000..5ce0856
Binary files /dev/null and b/calib/cal/HI_GSSC_081103A_stdstars_cat.fits differ
diff --git a/calib/cal/distmap.fits b/calib/cal/distmap.fits
new file mode 100644
index 0000000..d25e97c
Binary files /dev/null and b/calib/cal/distmap.fits differ
diff --git a/calib/cal/distmap_x.fits b/calib/cal/distmap_x.fits
new file mode 100644
index 0000000..ec572a4
Binary files /dev/null and b/calib/cal/distmap_x.fits differ
diff --git a/calib/cal/distmap_y.fits b/calib/cal/distmap_y.fits
new file mode 100644
index 0000000..e9cb669
Binary files /dev/null and b/calib/cal/distmap_y.fits differ
diff --git a/calib/cal/master_2mass_tbl.fits b/calib/cal/master_2mass_tbl.fits
new file mode 100644
index 0000000..695a9fa
Binary files /dev/null and b/calib/cal/master_2mass_tbl.fits differ
diff --git a/calib/dic/ESO-DFS-DIC.HAWKI_QC b/calib/dic/ESO-DFS-DIC.HAWKI_QC
new file mode 100644
index 0000000..33c39f4
--- /dev/null
+++ b/calib/dic/ESO-DFS-DIC.HAWKI_QC
@@ -0,0 +1,948 @@
+#******************************************************************************
+# E.S.O. - VLT project
+#
+# $Id: ESO-DFS-DIC.HAWKI_QC,v 1.20 2011/11/25 09:59:56 cgarcia Exp $
+# $Author: cgarcia $
+# $Date: 2011/11/25 09:59:56 $
+# $Revision: 1.20 $
+#
+#******************************************************************************
+# NAME
+# ESO-DFS-DIC.HAWKI_QC - Data Interface Dictionary for HAWKI Quality
+# control (level 1) parameters.
+# -----------------------------------------------------------------------------
+Dictionary Name: ESO-DFS-DIC.HAWKI_QC
+Scope: QC
+Source: ESO SDD/PSD
+Version Control: "$Id: ESO-DFS-DIC.HAWKI_QC,v 1.20 2011/11/25 09:59:56 cgarcia Exp $"
+Revision: 1.0
+Date: 2007-08-20
+Status: submitted
+Description: HAWKI Quality Control dictionary.
+
+# QC Category
+
+Parameter Name: QC RON MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the RONs
+Description: Mean of the RON (QC RONi) from each input frame
+
+Parameter Name: QC RON MED
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the RONs
+Description: Median of the RON (QC RONi) from each input frame
+
+Parameter Name: QC RON STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard Deviation of the RONs
+Description: Standard Deviation of the RON (QC RONi) from each
+input frame
+
+Parameter Name: QC RONi
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Read-out noise
+Description: Measured read-out noise of the whole array of each
+ input frame
+
+Parameter Name: QC DARK MED
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the medians from each input frame
+Description: Median of the medians from each input frame
+
+Parameter Name: QC DARK MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the medians from each input frame
+Description: Mean of the medians from each input frame
+
+Parameter Name: QC DARK STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard dev. of the medians from each input frame
+Description: Standard dev. of the medians from each input frame
+
+Parameter Name: QC DARK NBADPIX
+Class: header|qc-log
+Context: process
+Type: int
+Value Format: %d
+Unit: pixels
+Comment Field: Number of bad pixels
+Description: Number of bad pixels
+
+Parameter Name: QC DARK VCi MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of video channel <i> subregion of the current extension
+Description: Mean of video channel <i> subregion of the current extension
+
+Parameter Name: QC DARK VCi MED
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of video channel <i> subregion of the current extension
+Description: Median of video channel <i> subregion of the current extension
+
+Parameter Name: QC DARK VCi STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of video channel <i> subregion of the current extension
+Description: Standard deviation of video channel <i> subregion of the current extension
+
+Parameter Name: QC FLAT NORM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Normalisation factor
+Description: Normalisation factor
+
+Parameter Name: QC FLAT MEDMIN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pix
+Comment Field: Minimum value of median values.
+Description: For each frame, the median is computed, this keyword is
+ the minimum median values.
+
+Parameter Name: QC FLAT MEDMAX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pix
+Comment Field: Maximum value of median values.
+Description: For each frame, the median is computed, this keyword is
+ the maximum median values.
+
+Parameter Name: QC FLAT MEDMED
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median value of median values.
+Description: For each frame, the median is computed, this keyword is
+ the median of the median values.
+
+
+Parameter Name: QC FLAT MEDMEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Average value of median values.
+Description: For each frame, the median is computed, this keyword is
+ the average of the median values.
+
+Parameter Name: QC FLAT MEDSTDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of median values.
+Description: For each frame, the median is computed, this keyword is
+ the standard deviation of the median values.
+
+Parameter Name: QC FLAT MEDRANG
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Range of values of median values.
+Description: For each frame, the median is computed, this keyword is
+ the maximum minus the minumum values.
+
+Parameter Name: QC FLAT MEDNRANG
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Relative range of values of median values.
+Description: For each frame, the median is computed, this keyword is
+ the maximum minus the minumum values divided by the median
+
+Parameter Name: QC FLAT NBADPIX
+Class: header|qc-log
+Context: process
+Type: int
+Value Format: %d
+Unit: pixels
+Comment Field: Number of bad pixels
+Description: Number of bad pixels
+
+Parameter Name: QC DETLIN MEDA
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: Median value
+Description: Median value of the A coefficients
+
+Parameter Name: QC DETLIN MEDB
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: Median value
+Description: Median value of the B coefficients
+
+Parameter Name: QC DETLIN MEDC
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: Median value
+Description: Median value of the C coefficients
+
+Parameter Name: QC DETLIN MEDQ
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: Median value
+Description: Median value of the Q
+
+Parameter Name: QC DETLIN LAMP
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: percent
+Comment Field: Lamp stability
+Description: Lamp stability
+
+Parameter Name: QC BACKGD INSTMAG
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: The instrument magnitude of the background
+Description: -2.5*log10(backgd_mean/pixscale/pixscale/DIT)
+
+Parameter Name: QC BACKGD STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: The standard deviation of the background values.
+Description: The standard deviation of the background values.
+
+Parameter Name: QC BACKGD MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: The mean of the background values.
+Description: The mean of the background values.
+
+
+Parameter Name: QC FWHM PIX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: (pixels) median FWHM in image
+Description: Median value of the full-width at half-maximum of all
+ detected objects in the final reduced frame.
+
+Parameter Name: QC FWHM ARCSEC
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: arcsec
+Comment Field: (arcsec) median FWHM in image
+Description: Median value of the full-width at half-maximum of all
+ detected objects in the final reduced frame, multiplied
+ by the pixel size in arcsec/pixel.
+
+Parameter Name: QC FWHM MODE
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: (pixels) FWHM mode
+Description:
+
+Parameter Name: QC NBOBJS
+Class: header|qc-log
+Context: process
+Type: integer
+Value Format: %d
+Unit: none
+Comment Field: Number of detected objects in the combined image
+Description: Number of detected objects in the combined image
+
+Parameter Name: QC IQ
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: arcsec
+Comment Field: Estimated image quality (arcsec)
+Description: Estimated value of the image quality, based on
+ the median FWHM of all star-like objects in the
+ final product frame.
+
+Parameter Name: QC OBJ ANGLE MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: degrees
+Comment Field: Mean of the orientations of objects detected in an image
+Description: Mean of the orientations of objects detected in an image
+
+Parameter Name: QC OBJ ANGLE MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: degrees
+Comment Field: Median of the orientations of objects detected in an image
+Description: Median of the orientations of objects detected in an image
+
+Parameter Name: QC OBJ ANGLE MIN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: degrees
+Comment Field: Minimum of the orientations of objects detected in an image
+Description: Minimum of the orientations of objects detected in an image
+
+Parameter Name: QC OBJ ANGLE MAX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: degrees
+Comment Field: Maximum of the orientations of objects detected in an image
+Description: Maximum of the orientations of objects detected in an image
+
+Parameter Name: QC OBJ ANGLE STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: degrees
+Comment Field: Standard deviations of the orientations of
+ objects detected in an image
+Description: Standard deviations of the orientations of
+ objects detected in an image
+
+Parameter Name: QC OBJ ELLIP MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: Mean of the ellipticities of objects detected in an image
+Description: Mean of the ellipticities of objects detected in an image
+
+Parameter Name: QC OBJ ELLIP MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: Median of the ellipticities of objects detected in an image
+Description: Median of the ellipticities of objects detected in an image
+
+Parameter Name: QC OBJ ELLIP MIN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: Minimum of the ellipticities of objects detected in an image
+Description: Minimum of the ellipticities of objects detected in an image
+
+Parameter Name: QC OBJ ELLIP MAX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: Maximum of the ellipticities of objects detected in an image
+Description: Maximum of the ellipticities of objects detected in an image
+
+Parameter Name: QC OBJ ELLIP STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit:
+Comment Field: Standard deviations of the ellipticities of
+ objects detected in an image
+Description: Standard deviations of the ellipticities of
+ objects detected in an image
+
+Parameter Name: QC COMBINED POSX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: Position in x of the first image
+Description: Position in x of the first image
+
+Parameter Name: QC COMBINED POSY
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.2f
+Unit: pix
+Comment Field: Position in y of the first image
+Description: Position in y of the first image
+
+Parameter Name: QC FILTER OBS
+Class: header|qc-log
+Context: process
+Type: string
+Value Format: %20s
+Unit:
+Comment Field: Observation filter
+Description: This is the filter used to observe the star. It might
+ be different from the one used to get the star
+ magnitude in the database.
+
+Parameter Name: QC FILTER REF
+Class: header|qc-log
+Context: process
+Type: string
+Value Format: %20s
+Unit:
+Comment Field: Reference filter
+Description: If the filter used for observation corresponds to an
+ unknown magnitude value in the database, an association
+ rule is used to see which other magnitude could be
+ used. In that case, this value differs from the
+ actually used filter for observation.
+
+Parameter Name: QC AMBI RHUM AVG
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %.f
+Unit:
+Comment Field: (percent) ambient relative humidity @ 30/2 m
+Description: Temporal mean of site ambient relative humidity
+ measured at sensor position i = 1/2 in 30m/2m height.
+ This parameter is delivered by the ASM at intervals
+ of typically 1 minute. This keyword stores the average
+ of all measured values during the zero-point
+ measurement.
+
+Parameter Name: QC AIRMASS MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit:
+Comment Field: Average airmass
+Description: Average airmass during the zero-point acquisition.
+
+Parameter Name: QC STDNAME
+Class: header|qc-log
+Context: process
+Type: string
+Value Format: %20s
+Unit:
+Comment Field: Standard star name
+Description: Name of the standard star used for ZP computation
+
+Parameter Name: QC STARMAG
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %g
+Unit:
+Comment Field: Standard star magnitude in observed filter
+Description: Standard star magnitude in observed filter
+
+Parameter Name: QC STARMAG H
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %g
+Unit:
+Comment Field: Standard star magnitude in H
+Description: Standard star magnitude in H
+
+Parameter Name: QC STARMAG J
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %g
+Unit:
+Comment Field: Standard star magnitude in J
+Description: Standard star magnitude in J
+
+Parameter Name: QC STARMAG K
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %g
+Unit:
+Comment Field: Standard star magnitude in K
+Description: Standard star magnitude in K
+
+Parameter Name: QC STARMAG Y
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %g
+Unit:
+Comment Field: Standard star magnitude in Y
+Description: Standard star magnitude in Y
+
+Parameter Name: QC SPECTYPE
+Class: header|qc-log
+Context: process
+Type: string
+Value Format: %s
+Unit:
+Comment Field: Standard star spectral type
+Description: Standard star spectral type
+
+Parameter Name: QC CATNAME
+Class: header|qc-log
+Context: process
+Type: string
+Value Format: %20s
+Unit:
+Comment Field: Standard star catalogue name
+Description: Name of the catalogue from which the standard star
+ has been extracted.
+
+Parameter Name: QC ZPOINT MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: mag
+Comment Field: Mean measured zero-point for all the chips.
+Description: Mean measured zero-point for all the chips
+
+Parameter Name: QC ATX0 MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: mag
+Comment Field: Mean extinction corrected zero-point for all the chips.
+Description: Mean extinction corrected zero-point for all the chips
+
+Parameter Name: QC ZPOINT
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: mag
+Comment Field: Measured zero-point for a given chip.
+Description: Measured zero-point for a given chip.
+
+Parameter Name: QC ATX0
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: mag
+Comment Field: Extinction corrected zero-point for a given chip.
+Description: Extinction corrected zero-point for a given chip.
+
+Parameter Name: QC ZPOINT EXT COEFF
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: mag/airmass
+Comment Field: Extinction coefficient used in the computation of ATX0.
+Description: Extinction coefficient used in the computation of ATX0.
+
+Parameter Name: QC ZPOINT POSX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pixels
+Comment Field:
+Description: X position of the standard star
+
+
+Parameter Name: QC ZPOINT POSY
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pixels
+Comment Field:
+Description: Y position of the standard star
+
+Parameter Name: QC ZPOINT FLUX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field:
+Description: Flux of the standard star
+
+Parameter Name: QC ZPOINT PEAK
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field:
+Description: Peak of the standard star
+
+Parameter Name: QC ZPOINT BGD
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field:
+Description: Background around the standard star
+
+Parameter Name: QC ZPOINT FWHMX
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pixels
+Comment Field:
+Description: X FWHM of the standard star
+
+Parameter Name: QC ZPOINT FWHMY
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pixels
+Comment Field:
+Description: Y FWHM of the standard star
+
+Parameter Name: QC ZPOINT FWHM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: pixels
+Comment Field:
+Description: FWHM of the standard star
+
+Parameter Name: QC ZPOINT FWHMX_AS
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Field:
+Description: X FWHM of the standard star
+
+Parameter Name: QC ZPOINT FWHMY_AS
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Field:
+Description: Y FWHM of the standard star
+
+Parameter Name: QC ZPOINT FWHM_AS
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Field:
+Description: FWHM of the standard star
+
+Parameter Name: QC DATANCOM
+Class: header|qc-log
+Context: process
+Type: int
+Value Format: %d
+Unit: number of files
+Comment Field:
+Description: Number of files used for the reduction
+
+Parameter Name: QC RAW MINIMUM MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the minimum values of a list of raw frames
+Description: Mean of the minimum values of a list of raw frames
+
+Parameter Name: QC RAW MINIMUM MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the minimum values of a list of raw frames
+Description: Median of the minimum values of a list of raw frames
+
+Parameter Name: QC RAW MINIMUM MINIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Minimum of the minimum values of a list of raw frames
+Description: Minimum of the minimum values of a list of raw frames
+
+Parameter Name: QC RAW MINIMUM MAXIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Maximum of the minimum values of a list of raw frames
+Description: Maximum of the minimum values of a list of raw frames
+
+Parameter Name: QC RAW MINIMUM STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of the minimum values of a list of raw frames
+Description: Standard deviation of the minimum values of a list of raw frames
+
+Parameter Name: QC RAW MAXIMUM MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the maximum values of a list of raw frames
+Description: Mean of the maximum values of a list of raw frames
+
+Parameter Name: QC RAW MAXIMUM MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the maximum values of a list of raw frames
+Description: Median of the maximum values of a list of raw frames
+
+Parameter Name: QC RAW MAXIMUM MINIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Minimum of the maximum values of a list of raw frames
+Description: Minimum of the maximum values of a list of raw frames
+
+Parameter Name: QC RAW MAXIMUM MAXIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Maximum of the maximum values of a list of raw frames
+Description: Maximum of the maximum values of a list of raw frames
+
+Parameter Name: QC RAW MAXIMUM STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of the maximum values of a list of raw frames
+Description: Standard deviation of the maximum values of a list of raw frames
+
+Parameter Name: QC RAW MEDIAN MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the median values of a list of raw frames
+Description: Mean of the median values of a list of raw frames
+
+Parameter Name: QC RAW MEDIAN MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the median values of a list of raw frames
+Description: Median of the median values of a list of raw frames
+
+Parameter Name: QC RAW MEDIAN MINIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Minimum of the median values of a list of raw frames
+Description: Minimum of the median values of a list of raw frames
+
+Parameter Name: QC RAW MEDIAN MAXIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Maximum of the median values of a list of raw frames
+Description: Maximum of the median values of a list of raw frames
+
+Parameter Name: QC RAW MEDIAN STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of the median values of a list of raw frames
+Description: Standard deviation of the median values of a list of raw frames
+
+Parameter Name: QC RAW MEAN MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the mean values of a list of raw frames
+Description: Mean of the mean values of a list of raw frames
+
+Parameter Name: QC RAW MEAN MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the mean values of a list of raw frames
+Description: Median of the mean values of a list of raw frames
+
+Parameter Name: QC RAW MEAN MINIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Minimum of the mean values of a list of raw frames
+Description: Minimum of the mean values of a list of raw frames
+
+Parameter Name: QC RAW MEAN MAXIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Maximum of the mean values of a list of raw frames
+Description: Maximum of the mean values of a list of raw frames
+
+Parameter Name: QC RAW MEAN STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of the mean values of a list of raw frames
+Description: Standard deviation of the mean values of a list of raw frames
+
+Parameter Name: QC RAW RMS MEAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Mean of the rms values of a list of raw frames
+Description: Mean of the rms values of a list of raw frames
+
+Parameter Name: QC RAW RMS MEDIAN
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Median of the rms values of a list of raw frames
+Description: Median of the rms values of a list of raw frames
+
+Parameter Name: QC RAW RMS MINIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Minimum of the rms values of a list of raw frames
+Description: Minimum of the rms values of a list of raw frames
+
+Parameter Name: QC RAW RMS MAXIMUM
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Maximum of the rms values of a list of raw frames
+Description: Maximum of the rms values of a list of raw frames
+
+Parameter Name: QC RAW RMS STDEV
+Class: header|qc-log
+Context: process
+Type: double
+Value Format: %f
+Unit: ADU
+Comment Field: Standard deviation of the rms values of a list of raw frames
+Description: Standard deviation of the rms values of a list of raw frames
+
diff --git a/calib/dic/ESO-VLT-DIC.HAWKI_CFG b/calib/dic/ESO-VLT-DIC.HAWKI_CFG
new file mode 100644
index 0000000..c99a872
--- /dev/null
+++ b/calib/dic/ESO-VLT-DIC.HAWKI_CFG
@@ -0,0 +1,929 @@
+#************************************************************************
+# E.S.O. - VLT project
+#
+# "@(#) $Id: ESO-VLT-DIC.HAWKI_CFG,v 1.1 2007/08/21 09:28:25 yjung Exp $"
+#
+# who when what
+# -------- --------- ------------------------------------------------
+# mkiekebu 2007-08-03 added OCS.CON.DETi.CRPIXi and OCS.CON.DETi.ROT
+# mkiekebu 2007-07-16 added XGAP,YGAP and NDET keywords
+# mkiekebu 2007-07-03 improved keyword description.
+# mkiekebu 2007-07-02 CLAMP replace by LPIN
+# mkiekebu 2007-06-02 added test keywords for digital controller
+# mkiekebu 2007-05-28 added FC configuration keywords
+# mkiekebu 2007-05-25 added INS.SENSORi.MONTIME
+# mkiekebu 2007-05-06 added config keys for filter user function
+# pbiereic 01/12/06 created
+#
+
+#************************************************************************
+# DESCRIPTION
+# HAWKI configuration dictionary for devices and assemblies
+#
+# The letters within () indicate the class to which the keyword belongs to:
+# c = config
+# h = header
+# l = conf-log
+# p = private
+# s = setup
+# o = ops-log
+#
+#************************************************************************
+
+Dictionary Name: ESO-VLT-DIC.HAWKI_CFG
+Scope: HAWKI
+Source: ESO VLT
+Version Control: @(#) $Id: ESO-VLT-DIC.HAWKI_CFG,v 1.1 2007/08/21 09:28:25 yjung Exp $
+Revision: $Revision: 1.1 $
+Date: 2007-08-21
+Status: Development
+Description: HAWKI ICS keywords
+
+
+#########################################################################
+# TCS SETINSD
+#
+Parameter Name: OCS CON INSDi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %80s
+Unit:
+Comment Format: INS data
+Description: Configuration parameters for tif command SETINSD
+
+
+#########################################################################
+# INS
+#
+Parameter Name: INS FILTi DARKi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Filter dark positions
+Description: Keyword to configure dark filter positions.
+
+Parameter Name: INS FILTi LPSIGNAL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Use locking pin signal
+Description: If T, function will use the locking pin
+ enable signal during motor initialization
+ as a second reference switch.
+
+Parameter Name: INS FILTi IMOTSTP
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Motor init step index
+Description: Motor initialization sequence index for
+ step just before to lauch the init user
+ function.
+
+Parameter Name: INS FILTi EMOTSTP
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Motor end step index
+Description: Motor initialization sequence index for
+ the final step which is updated by the
+ init user function.
+
+
+#########################################################################
+# RTD
+#
+Parameter Name: OCS CON RTD TIMEOUT
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: s
+Comment Format: RTD command timeout [s]
+Description: Default RTD command timeout.
+
+Parameter Name: OCS CON RTD STRTIME
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: s
+Comment Format: RTD startup wait time [s]
+Description: RTD startup wait time [s]
+
+
+#########################################################################
+# OCS.CON
+#
+Parameter Name: OCS CON CREFX
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: pixel
+Comment Format: Nominal reference pixel X [pixel]
+Description: Nominal reference pixel X [pixel]
+
+Parameter Name: OCS CON CREFY
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: pixel
+Comment Format: Nominal reference pixel Y [pixel]
+Description: Nominal reference pixel Y [pixel]
+
+Parameter Name: OCS CON XGAP
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Detector gap along X
+Description: Detector gap along X
+
+Parameter Name: OCS CON YGAP
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Detector gap along Y
+Description: Detector gap along Y
+
+Parameter Name: OCS CON NDET
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Number of detectors in the mosaic
+Description: Number of detector chips in the instrument
+ mosaic (c).
+
+Parameter Name: OCS CON DETi CRPIXi
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Reference pixel of center of rotation.
+Description: Reference pixel for each detector in the
+ mosaic related to the center of rotation
+ from the lower left corner.
+
+Parameter Name: OCS CON DETi ROT
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Detector rotation
+Description: Tilt of each detector in the mosaic.
+
+Parameter Name: OCS CON XSECPIX
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec/pixel
+Comment Format: Image Scale along axis X [arcsec/pixel]
+Description: Image Scale along axis X [arcsec/pixel]
+
+Parameter Name: OCS CON YSECPIX
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec/pixel
+Comment Format: Image Scale along axis Y [arcsec/pixel]
+Description: Image Scale along axis Y [arcsec/pixel]
+
+Parameter Name: OCS CON ANGSGN
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Rotator angular sign
+Description: Rotator angular sign
+
+Parameter Name: OCS CON FC SAMP
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: s
+Comment Format: Field compensation sampling [s]
+Description: Keyword configuring the frequency used by the
+ flexure compensation loop.
+
+Parameter Name: OCS CON FC IMGSCALE
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcs/pixel
+Comment Format: Detector image scale [arcs/pixel]
+Description: Detector image scale [arcs/pixel]
+
+Parameter Name: OCS CON FC MAXERRS
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Number of allowed consecutive errors
+Description: Keyword configuring the maximum allowed
+ consecutive errors during the flexure
+ compensation before to stop the loop.
+
+Parameter Name: OCS CON FC NMODES
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Number of FC models
+Description: Keyword defining the number of flexure
+ compensation models.
+
+Parameter Name: OCS CON FC MNAMEi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: FC Model name
+Description: Name of each flexure compensation model.
+
+Parameter Name: OCS CON FC AXi
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Amplitud of the FC model along axis X
+Description: Amplitud of the flexure compensation model
+ along the axis X.
+
+Parameter Name: OCS CON FC PHXi
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Phase of the FC model along axis X
+Description: Phase fo the flexure compensation model
+ along the axis X
+
+Parameter Name: OCS CON FC AYi
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Amplitud of the FC model along axis Y
+Description: Amplitud of the flexure compensation model
+ along the axis Y.
+
+Parameter Name: OCS CON FC PHYi
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit:
+Comment Format: Phase of the FC model along axis Y
+Description: Phase fo the flexure compensation model
+ along the axis Y.
+
+Parameter Name: OCS CON MINTOFF
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Format: Min. TCS offset throw [arcsec]
+Description: Offset steps less that OCS.CON.MINTOFF are not sent to TCS
+
+Parameter Name: OCS CON MAXTOFF
+Class: config
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Format: Max. allowed TCS offset throw [arcsec]
+Description: This keyword defines the maximum offset
+ that will be sent to the telescope.
+
+#########################################################################
+# FITS log
+#
+Parameter Name: INS FITSLOG PERIOD
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: s
+Comment Format: Sensor values FITS log period [s]
+Description: Frequency of the fits logging loop
+ for the special sensors (Lakeshore and Yokogawa).
+
+
+#########################################################################
+# INS.LPINi: LPIN device configuration keywords
+#
+Parameter Name: INS LPINi SWSIM
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, function is software simulated
+Description: If T, function is software simulated
+
+Parameter Name: INS LPINi NAME
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Device name.
+Description: Device name.
+
+Parameter Name: INS LPINi LCUID
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Id. of the LCU managing the device.
+Description: Id. of the LCU managing the device.
+
+Parameter Name: INS LPINi DEVNAME
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Name of the ICS device.(c)
+Description: Name of the ICS device.(c)
+
+Parameter Name: INS LPINi DEVDESC
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Description of the ICS device.
+Description: Description of the ICS device.
+
+Parameter Name: INS LPINi PREFIX
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Device FITS prefix.
+Description: Device FITS prefix.
+
+Parameter Name: INS LPINi JUSTCHECK
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Only checks if action is possible
+Description: Configure locking pin device to verify
+ that action is possible but not to execute
+ it. Special feature to verify if filter
+ wheel motors are loosing steps.
+
+Parameter Name: INS LPINi SIGNUM
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Number of signals configured.
+Description: Number of signals configured.
+
+Parameter Name: INS LPINi SIGCONFi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Signal configuration
+Description: Keyword to define each entry of the
+ locking pin signals table.
+
+Parameter Name: INS LPINi POSNAME1
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: position status.
+Description: Status reported when the locking pin is retracted (F).
+
+Parameter Name: INS LPINi POSNAME2
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: position status.
+Description: Status reported when the locking pin is inserted (T).
+
+Parameter Name: INS LPINi CKLOCAL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Check local control.
+Description: It verifies if locking pin is in manual mode.
+
+Parameter Name: INS LPINi CKENABLE
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Check enable status bit
+Description: It verifies if enable status bit is active
+ before to insert the locking pin.
+
+Parameter Name: INS LPINi BICONTROL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Enable bi-control.
+Description: Enable bi-stable control. Two different
+ control signals used for in and out.
+
+Parameter Name: INS LPINi BISTATUS
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Enable bi-status.
+Description: If T, locking pin is using two signals for status.
+
+Parameter Name: INS LPINi RESET
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Reset control
+Description: If T, locking pin will reset its status
+ to retracted when going online. Only valid
+ when bi-control is enabled.
+
+Parameter Name: INS LPINi TIMEOUT
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: ms
+Comment Format: Activation timeout [ms].
+Description: Maximum timeout to reach the status of the
+ locking pin.
+
+Parameter Name: INS LPINi UIFCLASS
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: UIF class
+Description: UIF class
+
+Parameter Name: INS LPINi UIFSPECIAL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: UIF special device
+Description: UIF special device
+
+Parameter Name: INS LPINi UIFNB
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: UIF
+Description: UIF
+
+Parameter Name: INS LPINi UIFTB
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: UIF
+Description: UIF
+
+Parameter Name: INS LPINi PROCNAME
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Procedure Name
+Description: Procedure Name
+
+Parameter Name: INS LPINi TESTMAX
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Maximum number of test commands
+Description: Maximum number of test commands
+
+Parameter Name: INS LPINi TESTCMDi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Test Command name
+Description: Test Command name
+
+Parameter Name: INS LPINi TESTPARi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %256s
+Unit:
+Comment Format: Test Paramaters string
+Description: Test Paramaters string
+
+Parameter Name: INS LPINi TESTERRi
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Test Expected Error Reply
+Description: Test Expected Error Reply
+
+#########################################################################
+# INS.SHUTi: SHUT device configuration keywords
+#
+Parameter Name: INS SHUTi SWSIM
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, function is software simulated
+Description: If T, function is software simulated
+
+Parameter Name: INS SHUTi NAME
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Device name.
+Description: Device name.
+
+Parameter Name: INS SHUTi LCUID
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Id. of the LCU managing the device.
+Description: Id. of the LCU managing the device.
+
+Parameter Name: INS SHUTi ID
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Device ID
+Description: Device ID
+
+Parameter Name: INS SHUTi DEVNAME
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Name of the ICS device.(c)
+Description: Name of the ICS device.(c)
+
+Parameter Name: INS SHUTi DEVDESC
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Description of the ICS device.
+Description: Description of the ICS device.
+
+Parameter Name: INS SHUTi PREFIX
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Device FITS prefix.
+Description: Device FITS prefix.
+
+Parameter Name: INS SHUTi SIGNUM
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Number of signals configured.
+Description: Number of signals configured.
+
+Parameter Name: INS SHUTi SIGCONFi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Signal configuration
+Description: Keyword to define each entry of the
+ shutter signals table.
+
+Parameter Name: INS SHUTi POSNAME1
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: position status
+Description: Status reported when the shutter is closed (F).
+
+Parameter Name: INS SHUTi POSNAME2
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: position status
+Description: Status reported when the shutter is open (F).
+
+Parameter Name: INS SHUTi CKLOCAL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Check local control
+Description: It verifies if shutter is in manual mode.
+
+Parameter Name: INS SHUTi CKENABLE
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Check enable status bit
+Description: It verifies if enable status bit is active
+ before to open the shutter.
+
+Parameter Name: INS SHUTi BICONTROL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Enable bi-control.
+Description: Enable bi-stable control. Two different
+ control signals used for open and close.
+
+Parameter Name: INS SHUTi BISTATUS
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Enable bi-status.
+Description: If T, shutter is using two signals for status.
+
+Parameter Name: INS SHUTi RESET
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Reset control
+Description: If T, shutter will reset its status
+ to closed when going online. Only valid
+ when bi-control is enabled.
+
+Parameter Name: INS SHUTi TIMEOUT
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: ms
+Comment Format: Activation timeout [ms].
+Description: Activation timeout [ms].
+
+Parameter Name: INS SHUTi UIFCLASS
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: UIF class
+Description: UIF class
+
+Parameter Name: INS SHUTi UIFSPECIAL
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: UIF special device
+Description: UIF special device
+
+Parameter Name: INS SHUTi UIFNB
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: UIF
+Description: UIF
+
+Parameter Name: INS SHUTi UIFTB
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: UIF
+Description: UIF
+
+Parameter Name: INS SHUTi PROCNAME
+Class: config
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Procedure Name
+Description: Procedure Name
+
+Parameter Name: INS SHUTi TESTMAX
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Maximum number of test commands
+Description: Maximum number of test commands
+
+Parameter Name: INS SHUTi TESTCMDi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Test Command name
+Description: Test Command name
+
+Parameter Name: INS SHUTi TESTPARi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %256s
+Unit:
+Comment Format: Test Paramaters string
+Description: Test Paramaters string
+
+Parameter Name: INS SHUTi TESTERRi
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Test Expected Error Reply
+Description: Test Expected Error Reply
+
+#########################################################################
+# INS.SENSORi: Generic SENSOR device
+#
+Parameter Name: INS SENSORi PREFIXi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Device prefix
+Description: Device prefix
+
+Parameter Name: INS SENSORi AVAILi
+Class: config
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, sensor is available
+Description: If T, sensor is available
+
+Parameter Name: INS SENSORi STATi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Requested statistics
+Description: Requested statistics
+
+Parameter Name: INS SENSORi SPAREi
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Channel number of spare sensor
+Description: Channel number of spare sensor
+
+Parameter Name: INS SENSORi CHARBITSi
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Lakeshore: bits per character
+Description: Lakeshore: bits per character
+
+Parameter Name: INS SENSORi INFOi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %8s
+Unit:
+Comment Format: Sensor info: ALARM, WARN, STAT, N/A
+Description: Sensor info: ALARM, WARN, STAT, N/A
+
+Parameter Name: INS SENSORi MONTIME
+Class: config
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: ms
+Comment Format: Monitoring period [ms]
+Description: Monitoring period [ms]
+
+
+#########################################################################
+# INS.SENSOR1: Yokogawa SENSOR device
+#
+Parameter Name: INS SENSORi INITSi
+Class: config
+Context: Instrument
+Type: string
+Value Format: %16s
+Unit:
+Comment Format: Device initialization string
+Description: Device initialization string
+
+#
+# ___HAWKI___
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/calib/dic/ESO-VLT-DIC.HAWKI_ICS b/calib/dic/ESO-VLT-DIC.HAWKI_ICS
new file mode 100644
index 0000000..18648ce
--- /dev/null
+++ b/calib/dic/ESO-VLT-DIC.HAWKI_ICS
@@ -0,0 +1,1057 @@
+#*******************************************************************
+# E.S.O. - VLT project
+#
+# "@(#) $Id: ESO-VLT-DIC.HAWKI_ICS,v 1.1 2007/08/21 09:28:25 yjung Exp $"
+#
+# who when what
+# -------- -------- ----------------------------------------------
+# mkiekebu 2007-08-02 added INS.PIXSCALE
+# mkiekebu 2007-07-05 Overwritten temperature and sensor information.
+# mkiekebu 2007-07-03 corrected some keyword units according input
+# from Adam.
+# mkiekebu 2007-07-02 CLAMP replaced by LPIN
+# mkiekebu 2007-05-30 added JCHK keyword for locking pin devices
+# mkiekebu 2007-05-10 added shutter and locking pin actions keywords.
+# mkiekebu 2007-04-06 added CFILT assembly keyword
+# mkiekebu 2007-04-02 added SHUT and CLAMP keywords
+# pbiereic 01/12/06 created
+#
+
+#******************************************************************************
+# DESCRIPTION
+# HAWKI_ICS dictionary
+# Refer to appendix A of document VLT-SPE-ESO-17240-1676 for details.
+#
+# The letters within () indicate the class to which the keyword belongs to:
+# c = config
+# h = header
+# l = conf-log
+# p = private
+# s = setup
+# o = ops-log
+#
+#******************************************************************************
+
+Dictionary Name: ESO-VLT-DIC.HAWKI_ICS
+Scope: HAWKI
+Source: ESO VLT
+Version Control: @(#) $Id: ESO-VLT-DIC.HAWKI_ICS,v 1.1 2007/08/21 09:28:25 yjung Exp $
+Revision: $Revision: 1.1 $
+Date: 2007-08-21
+Status: Development
+Description: HAWKI ICS keywords
+
+
+Parameter Name: INSi ID
+Class: conf-log|config|header
+Context: Instrument
+Type: string
+Value Format: %30s
+Unit:
+Comment Format: Instrument ID
+Description: Combines the ESO identification of the instrument
+ and the software version of the control software.
+ Format: NAME/HW-REV/SW-VERSION
+
+Parameter Name: INSi DID
+Class: config|header
+Context: Instrument
+Type: string
+Value Format: %30s
+Unit:
+Comment Format: Data dictionary
+Description: Name and version of ESO DID to which INS keywords
+ comply to.
+
+Parameter Name: INSi DATE
+Class: conf-log|config|header
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Instrument release date (dd/mm/yy)
+Description: Date of last release of the instrument system.
+
+Parameter Name: INSi OPER
+Class: header|setup
+Context: Instrument
+Type: string
+Value Format: %30s
+Unit:
+Comment Format: Instrument Operator
+Description: Initials and family name of instrument operator or
+ service observer.
+
+Parameter Name: INSi SWSIM
+Class: config|header|setup
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Software simulation
+Description: Possible values:
+ NORMAL: no simulation.
+ LCU_SIM: LCU is simulated by WS simulator.
+
+Parameter Name: INSi MODE
+Class: header|setup
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Instrument mode
+Description: Acronym of instrument mode used. This acronym identifies
+ the optical path within the instrument. Examples:
+ BLUE, RED, DIC1, DIC2
+
+Parameter Name: INSi PATH
+Class: header|setup
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Optical path used
+Description: The optical path within the instrument used for
+ this exposure.
+
+Parameter Name: INSi PIXSCALE
+Class: header
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec/pixel
+Comment Format: Detector pixel scale [arcsec/pixel]
+Description: Detector pixel scale [arcsec/pixel]
+
+#########################################################################
+# Assembly Keywords
+#
+Parameter Name: INS LFILTi NAME
+Class: conf-log|config|setup
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Element name
+Description: Assembly keyword for locking pin and
+ filter.
+
+#########################################################################
+# Shutter, DCONTROL devic
+#
+
+#########################################################################
+# Locking Pin, DCONTROL device
+Parameter Name: INS LPINi ID
+Class: header
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Locking Pin ID
+Description: Hardware identification of locking pin unit.
+
+Parameter Name: INS LPINi NAME
+Class: header
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Locking Pin device name
+Description: Name for the locking pin device.
+
+Parameter Name: INS LPINi SWSIM
+Class: config|header|ops-log
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, sw is simulated
+Description: If T, sw is simulated
+
+Parameter Name: INS LPINi STAT
+Class: header|setup
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Locking Pin device position
+Description: Status position of locking pin device:
+ In or Out
+
+Parameter Name: INS LPINi ST
+Class: header|setup
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Locking Pin device status
+Description: If T, locking pin is inserted otherwise
+ is retracted.
+
+Parameter Name: INS LPINi JCHK
+Class: header
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Check only mode
+Description: When this option is enabled, locking pin is
+ used only to verify that it is possible to
+ execute the action.
+
+Parameter Name: INS LPINi IN
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Locking Pin In
+Description: Action keyword to record when locking pin
+ is inserted.
+
+Parameter Name: INS LPINi OUT
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Locking Pin Out
+Description: Action keyword to record when locking pin
+ is retracted.
+
+Parameter Name: INS SHUTi ID
+Class: header
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Moveable Cover ID
+Description: Hardware identification of the moveable cover unit.
+
+Parameter Name: INS SHUTi NAME
+Class: header
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Moveable Cover name
+Description: Name for the moveable cover.
+
+Parameter Name: INS SHUTi SWSIM
+Class: config|header|ops-log
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, sw is simulated
+Description: If T, sw is simulated
+
+Parameter Name: INS SHUTi STAT
+Class: header|setup
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Moveable Cover position
+Description: Moveable cover position: Closed or Open
+
+Parameter Name: INS SHUTi ST
+Class: header|setup
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Moveable Cover Status
+Description: If T, moveable cover is open.
+
+Parameter Name: INS SHUTi OPEN
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Moveable Cover Open
+Description: Action keyword to record when moveable
+ cover is open.
+
+Parameter Name: INS SHUTi CLOSED
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Moveable Cover Closed
+Description: Action keyword to record when moveable
+ cover is closed.
+
+
+#########################################################################
+# Filter wheels, FILT device
+#
+Parameter Name: INS FILTi SWSIM
+Class: config|header|ops-log
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, function is software simulated
+Description: If T, function is software simulated
+
+Parameter Name: INS FILTi ID
+Class: conf-log|config|setup
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Identification
+Description: Hardware identification for filter wheels.
+
+Parameter Name: INS FILTi NAME
+Class: conf-log|config|header|setup
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Element name
+Description: Element name
+
+Parameter Name: INS FILTi TYPE
+Class: conf-log|config|header
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Element type
+Description: Element type
+
+Parameter Name: INS FILTi NO
+Class: conf-log|header|setup
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Element number
+Description: Index of the selected position of the filter wheel.
+
+Parameter Name: INS FILTi ENC
+Class: header|ops-log|setup
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: Enc
+Comment Format: Absolute position [Enc]
+Description: Absolute position [Enc]
+
+Parameter Name: INS FILTi ENCREL
+Class: setup
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: Enc
+Comment Format: Relative position [Enc]
+Description: Relative position [Enc]
+
+Parameter Name: INS FILTi LIMIT
+Class: setup
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Move to the limit
+Description: Move to lower or upper limit.
+
+Parameter Name: INS FILTi TURN
+Class: setup
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Turn the wheel right/left
+Description: Turn the wheel to the right or to the left.
+
+Parameter Name: INS FILTi SPEED
+Class: setup
+Context: Instrument
+Type: double
+Value Format: %.1f
+Unit:
+Comment Format: Moving speed
+Description: Speed (default units) the wheel is turned (see TURN).
+
+Parameter Name: INS FILTi POS
+Class: header|ops-log|setup
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: deg
+Comment Format: Position [deg]
+Description: Position [deg]
+
+# Ops logs
+Parameter Name: INS FILTi INIT
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Hardware initialisation
+Description: Hardware initialisation
+
+Parameter Name: INS FILTi MOVE
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Motion execution
+Description: Motion execution
+
+Parameter Name: INS FILTi STOP
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Motion stop
+Description: Motion stop
+
+Parameter Name: INS FILTi CHANGE
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Device was physically changed
+Description: Filter element has been physically replaced.
+ Maintenance operation.
+
+Parameter Name: INS FILTi LPWIN
+Class: ops-log
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: Enc
+Comment Format: LPIN enable switch encoder window [Enc]
+Description: Locking pin enable switch encoder window
+ registered during the initialization.
+
+Parameter Name: INS FILTi LPABS
+Class: ops-log
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit: Enc
+Comment Format: LPIN enable center encoder position [Enc]
+Description: Center of the locking pin enable encoder
+ window registerd during the initialization.
+
+Parameter Name: INS FILTi
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Filter Wheel device
+Description: Filter Wheel device
+
+#########################################################################
+# Sensors (physical devices)
+#
+Parameter Name: INSi SENSORi SWSIM
+Class: config|header|ops-log
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: If T, function is software simulated
+Description: If T, function is software simulated
+
+Parameter Name: INSi SENSORi ID
+Class: config|ops-log
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Sensor device unique id
+Description: ESO identification number for the sensor device.
+
+Parameter Name: INSi SENSORi NAME
+Class: config|header|ops-log
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Sensor device common name
+Description: ESO name for the sensor device.
+
+Parameter Name: INSi SENSORi INIT
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Hardware initialisation
+Description: Hardware initialisation
+
+Parameter Name: INSi SENSORi OK
+Class: header
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: If sensor was operational
+Description: Indicate if a complete sensor reading was succesful.
+
+Parameter Name: INSi SENSORi DIRECT
+Class: setup
+Context: Instrument
+Type: string
+Value Format: %30s
+Unit:
+Comment Format: Direct command to sensor device
+Description: Send direct commands to the sensor device.
+
+
+#########################################################################
+# Sensors header FITS keywords
+#
+Parameter Name: INS SENSi ID
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Sensor type
+Description: Hardware identification for generic sensor
+
+Parameter Name: INS SENSi NAME
+Class: header|ops-log
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Sensor name
+Description: Name of the generic sensor.
+
+Parameter Name: INS SENSi VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Sensor numeric value
+Description: Sensor numeric value
+
+Parameter Name: INS SENSi STAT
+Class: header|ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Sensor string value
+Description: Sensor string value
+
+Parameter Name: INS SENSi UNITi
+Class: config|header
+Context: Instrument
+Type: string
+Value Format: %.8s
+Unit:
+Comment Format: Sensor unit
+Description: Identifier of the generic sensor unit.
+
+# Sensor statistics values during an exposure (e.g. pressure, humidity)
+Parameter Name: INS SENSi MIN
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Minimum value
+Description: Minimum value
+
+Parameter Name: INS SENSi MAX
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Maximum value
+Description: Maximum value
+
+Parameter Name: INS SENSi MEAN
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Average value
+Description: Average value
+
+Parameter Name: INS SENSi RMS
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: RMS of samples over exposure
+Description: RMS of samples over exposure
+
+Parameter Name: INS SENSi TMMEAN
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Time waighted average
+Description: Time waighted average
+
+Parameter Name: INS SENSi GRAD
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Linear regression slope
+Description: Linear regression slope
+
+Parameter Name: INS SENSi LRCONST
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Linear regression constant
+Description: Linear regression constant
+
+Parameter Name: INS SENSi LRRMS
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Linear regression RMS
+Description: Linear regression RMS
+
+Parameter Name: INS SENSi DETCOEF
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Determination coefficient
+Description: Linear regression determination
+ coefficient.
+
+# Temperature sensor statistics values during an exposure
+Parameter Name: INS TEMPi ID
+Class: header|ops-log
+Context: Instrument
+Type: string
+Value Format: %10s
+Unit:
+Comment Format: Temperature sensor ID
+Description: Hardware identification for temperature sensor
+
+Parameter Name: INS TEMPi NAME
+Class: header|ops-log
+Context: Instrument
+Type: string
+Value Format: %15s
+Unit:
+Comment Format: Temperature sensor name
+Description: Name of the temperature sensor.
+
+Parameter Name: INS TEMPi VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Temperature numeric sensor value [K]
+Description: Temperature numeric sensor value [K]
+
+Parameter Name: INS TEMPi UNITi
+Class: config|header
+Context: Instrument
+Type: string
+Value Format: %.8s
+Unit:
+Comment Format: Temperature sensor unit
+Description: Identifier of the temperature sensor unit.
+
+Parameter Name: INS TEMPi MIN
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Minimum temperature value
+Description: Minimum temperature value
+
+Parameter Name: INS TEMPi MAX
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Maximum temperature value
+Description: Maximum temperature value
+
+Parameter Name: INS TEMPi MEAN
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Average temperature value
+Description: Average temperature value
+
+Parameter Name: INS TEMPi RMS
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: RMS of samples over exposure
+Description: RMS of samples over exposure
+
+Parameter Name: INS TEMPi TMMEAN
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Time weighted average
+Description: Time weighted average
+
+Parameter Name: INS TEMPi GRAD
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Linear regression slope
+Description: Linear regression slope
+
+Parameter Name: INS TEMPi LRCONST
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Linear regression constant
+Description: Linear regression constant
+
+Parameter Name: INS TEMPi LRRMS
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Linear regression RMS
+Description: Linear regression RMS
+
+Parameter Name: INS TEMPi DETCOEF
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Determination coefficient
+Description: Linear regression determination
+ coefficient.
+
+# Redefinition of temperature keywords to overwrite generic
+# units and comments.
+Parameter Name: INS TEMP1 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: M1 [K]
+Description: M1 [K]
+
+Parameter Name: INS TEMP2 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Heater of M1 [K]
+Description: Heater of M1 [K]
+
+Parameter Name: INS TEMP3 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Heater of M4 [K]
+Description: Heater of M4 [K]
+
+Parameter Name: INS TEMP4 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: M2 [K]
+Description: M2 [K]
+
+Parameter Name: INS TEMP5 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Heater of M2 [K]
+Description: Heater of M2 [K]
+
+Parameter Name: INS TEMP6 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Filter Wheel 1 [K]
+Description: Filter Wheel 1 [K]
+
+Parameter Name: INS TEMP7 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Filter Wheel 2 [K]
+Description: Filter Wheel 2 [K]
+
+Parameter Name: INS TEMP8 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Detector copper bar [K]
+Description: Detector copper bar [K]
+
+Parameter Name: INS TEMP9 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Cold structure [K]
+Description: Cold structure [K]
+
+Parameter Name: INS TEMP10 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: LN2 in [K]
+Description: LN2 in [K]
+
+Parameter Name: INS TEMP11 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Pollux [K]
+Description: Pollux [K]
+
+Parameter Name: INS TEMP12 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Castor [K]
+Description: Castor [K]
+
+Parameter Name: INS TEMP13 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Absortion pump [K]
+Description: Absortion pump [K]
+
+Parameter Name: INS TEMP14 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: LN2 out [K]
+Description: LN2 out [K]
+
+Parameter Name: INS TEMP15 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: C
+Comment Format: Vessel [C]
+Description: Vessel [C]
+
+Parameter Name: INS TEMP16 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: C
+Comment Format: Ambient [C]
+Description: Ambient [C]
+
+Parameter Name: INS TEMP17 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: C
+Comment Format: Entrance Window 1 [C]
+Description: Entrance Window 1 [C]
+
+Parameter Name: INS TEMP18 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Cold structure 2 [K]
+Description: Cold structure 2 [K]
+
+Parameter Name: INS TEMP19 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Radiation Shield 3 [K]
+Description: Radiation Shield 3 [K]
+# TEMP20 spare
+Parameter Name: INS TEMP21 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: C
+Comment Format: Defogging Heaters [C]
+Description: Defogging Heaters [C]
+
+Parameter Name: INS TEMP22 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: C
+Comment Format: Dew point [C]
+Description: Dew point [C]
+# TEMP23-27 spare
+Parameter Name: INS SENS28 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: V
+Comment Format: CLOCK Logo [V]
+Description: CLOCK Logo [V]
+# TEMP29 spare
+Parameter Name: INS SENS30 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3e
+Unit: mb
+Comment Format: Vaccum pressure [mb]
+Description: Vaccum pressure [mb]
+
+Parameter Name: INS TEMP31 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Detector Temperature [K]
+Description: Detector Temperature [K]
+
+Parameter Name: INS TEMP32 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: K
+Comment Format: Detector setpoint [K]
+Description: Detector setpoint [K]
+
+Parameter Name: INS SENS33 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: LS Proportional value
+Description: LakeShore PID control loop parameter (P).
+
+Parameter Name: INS SENS34 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: LS Integral value
+Description: LakeShore PID control loop parameter (I).
+
+Parameter Name: INS SENS35 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: LS Derivative value
+Description: LakeShore PID control loop parameter (D).
+
+Parameter Name: INS SENS36 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: LS Heater Range value
+Description: LakeShore Heater Range
+
+Parameter Name: INS SENS37 VAL
+Class: header|ops-log
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: LS Heater Output value
+Description: LakeShore Heater output as a percentage.
+
+
+
+#
+# ___HAWKI___
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/calib/dic/ESO-VLT-DIC.HAWKI_OS b/calib/dic/ESO-VLT-DIC.HAWKI_OS
new file mode 100644
index 0000000..9d85562
--- /dev/null
+++ b/calib/dic/ESO-VLT-DIC.HAWKI_OS
@@ -0,0 +1,409 @@
+#******************************************************************************
+# E.S.O. - VLT project
+#
+# "@(#) $Id: ESO-VLT-DIC.HAWKI_OS,v 1.1 2007/08/21 09:28:25 yjung Exp $"
+#
+# who when what
+# -------- -------- ----------------------------------------------
+# mkiekebu 2007-07-03 improved SEQ keywords description.
+# mkiekebu 2007-07-02 improved WCS keywords description.
+# mkiekebu 2007-07-02 added SEQ.FC.ST
+# mkiekebu 2007-05-29 added flexure compensation keywords
+# pbiereic 01/12/06 created
+#
+
+#******************************************************************************
+# DESCRIPTION
+# HAWKI_OS dictionary
+#
+# The letters within () indicate the class to which the keyword belongs to:
+# c = config
+# h = header
+# l = conf-log
+# p = private
+# s = setup
+# o = ops-log
+#
+#******************************************************************************
+
+Dictionary Name: ESO-VLT-DIC.HAWKI_OS
+Scope: HAWKI
+Source: ESO VLT
+Version Control: @(#) $Id: ESO-VLT-DIC.HAWKI_OS,v 1.1 2007/08/21 09:28:25 yjung Exp $
+Revision: $Revision: 1.1 $
+Date: 2007-08-21
+Status: Development
+Description: Template Instrument OS keywords
+
+
+#########################################################################
+# WCS keys
+#
+Parameter Name: CTYPEi
+Class: header
+Context: Instrument
+Type: string
+Value Format: %.10s
+Unit:
+Comment Format: Pixel coordinate system
+Description: Defines the coordinate system for CRPIXi.
+
+Parameter Name: CRPIXi
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Ref. pixel of center of rotation.
+Description: Reference pixel in the coordinate frame given by CTYPEi.
+ The reference pixel is defined as the pixel
+ (possibly with fraction if the accuracy is achieved)
+ through which the center of rotation of the adapter.
+
+Parameter Name: CRVALi
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.6e
+Unit:
+Comment Format: Value of ref pixel 1
+Description: Value of ref pixel 1
+
+Parameter Name: CD1_1
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.6e
+Unit:
+Comment Format: Translation matrix element.
+Description: The PC translation matrix allows for general
+ rotations and skew.
+
+Parameter Name: CD1_2
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.6e
+Unit:
+Comment Format: Translation matrix element.
+Description: The PC translation matrix allows for general
+ rotations and skew.
+
+Parameter Name: CD2_1
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.6e
+Unit:
+Comment Format: Translation matrix element.
+Description: The PC translation matrix allows for general
+ rotations and skew.
+
+Parameter Name: CD2_2
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.6e
+Unit:
+Comment Format: Translation matrix element.
+Description: The PC translation matrix allows for general
+ rotations and skew.
+
+
+#########################################################################
+# RTD
+#
+Parameter Name: OCS RTD ST
+Class: setup
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Start/Stop RTD
+Description: Keyword that allows to start/stop HAWKI RTD
+
+#########################################################################
+# Flexure Compensation (FC)
+#
+Parameter Name: OCS FC START
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Flexure Compensation started
+Description: Action keyword to register when OS flexure
+ compensation has been started.
+
+Parameter Name: OCS FC STOP
+Class: ops-log
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Flexure Compensation stopped
+Description: Action keyword to register when OS flexure
+ compensation has been stopped.
+
+Parameter Name: OCS FC OFFSALPHA
+Class: ops-log
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Format: Flexure Compensation in alpha [arcsec]
+Description: Record alpha computed flexure compensation
+ based on the rotator offset and the current
+ flexure model.
+
+Parameter Name: OCS FC OFFSDELTA
+Class: ops-log
+Context: Instrument
+Type: double
+Value Format: %f
+Unit: arcsec
+Comment Format: Flexure Compensation in delta [arcsec]
+Description: Record delta computed flexure compensation
+ based on the rotator offset and the current
+ flexure model.
+
+#########################################################################
+# Template keys
+#
+Parameter Name: SEQ JITTER WIDTH
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Jitter box width [arcsec]
+Description: Defines the box where offsets will be randomly
+ distributed.
+
+Parameter Name: SEQ CUMOFFSETX
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: pixel
+Comment Format: Cummulative offset along axis X [pixel]
+Description: Cummulative offset along axis X [pixel]
+
+Parameter Name: SEQ CUMOFFSETY
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: pixel
+Comment Format: Cummulative offset along axis Y [pixel]
+Description: Cummulative offset along axis Y [pixel]
+
+Parameter Name: SEQ RELOFFSETX
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: pixel
+Comment Format: Relative offset along axis X [pixel]
+Description: Relative offset along axis X [pixel]
+
+Parameter Name: SEQ RELOFFSETY
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: pixel
+Comment Format: Relative offset along axis Y [pixel]
+Description: Relative offset along axis Y [pixel]
+
+Parameter Name: SEQ CUMOFFSETA
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Cummulative alpha offset [arcsec]
+Description: Cummulative alpha offset [arcsec]
+
+Parameter Name: SEQ CUMOFFSETD
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Cummulative delta offset [arcsec]
+Description: Cummulative delta offset [arcsec]
+
+Parameter Name: SEQ RELOFFSETA
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Relative alpha offset [arcsec]
+Description: Relative alpha offset [arcsec]
+
+Parameter Name: SEQ RELOFFSETD
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Relative delta offset [arcsec]
+Description: Relative delta offset [arcsec]
+
+Parameter Name: SEQ SKYTHROW
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Sky Offset Throw [arcsec]
+Description: Defines the constant distance for sky
+ observations from the original telescope
+ position that will be randomly distributed
+ between 0 and 360 degrees.
+
+Parameter Name: SEQ SKYOFFSET ALPHA
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Sky Offset Alpha [arcsec]
+Description: Defines fixed alpha offsets for which
+ sky position will be randomly distributed
+ around.
+
+Parameter Name: SEQ SKYOFFSET DELTA
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit: arcsec
+Comment Format: Sky Offset Delta [arcsec]
+Description: Defines fixed delta offsets for which
+ sky position will be randomly distributed
+ around.
+
+Parameter Name: SEQ POISSON
+Class: header
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Poisson value
+Description: Randomness factor specifying the
+ condition that the distance between any
+ two points in a series of values is
+ greater that a certain number.
+
+Parameter Name: SEQ NABCYCLES
+Class: header
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: Number of AB and BA cycles
+Description: Number of OBJECT and SKY cycles to be executed.
+
+Parameter Name: SEQ NDIT OBJECT
+Class: header
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: NDIT on OBJECT positions
+Description: It defines the number of
+ subintegrations for object frames
+
+Parameter Name: SEQ NDIT SKY
+Class: header
+Context: Instrument
+Type: integer
+Value Format: %d
+Unit:
+Comment Format: NDIT on SKY positions
+Description: It defines the number of
+ subintegrations for sky frames
+
+Parameter Name: SEQ ROTPUPIL
+Class: header
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Pupil rotation compensation
+Description: Defines if instrument will be rotated
+ between object and sky frames so that
+ the pupil ghost can be minimized.
+
+Parameter Name: SEQ NODPOS
+Class: header
+Context: Instrument
+Type: string
+Value Format: %.1s
+Unit:
+Comment Format: Nodding position (A or B)
+Description: Used for the record of the nodding positions:
+ object (A), sky (B).
+
+Parameter Name: SEQ OBSTYPE
+Class: header
+Context: Instrument
+Type: string
+Value Format: %.1s
+Unit:
+Comment Format: Sequence observation type (O or S)
+Description: Observation type defined for each image
+ entered as list. O stands for OBJECT and
+ assign the DPR CATG header keyword
+ to SCIENCE. S stands for Sky and assigns
+ the DPR CATG header keyword to SKY.
+
+Parameter Name: SEQ OFFSET COORDS
+Class: header
+Context: Instrument
+Type: string
+Value Format: %s
+Unit:
+Comment Format: Offset coordinate type
+Description: Indicates offsets coordinate type:
+ (in SKY or DETECTOR coordinates)
+
+Parameter Name: SEQ AIRMASS
+Class: header
+Context: Instrument
+Type: double
+Value Format: %.3f
+Unit:
+Comment Format: Airmass set by template
+Description: Defines the airmass used for the
+ skyflats observations.
+
+Parameter Name: SEQ FC ST
+Class: header
+Context: Instrument
+Type: logical
+Value Format: %c
+Unit:
+Comment Format: Flexure compensation flag
+Description: Indicates if OS flexure compensation will be
+ used during observations.
+
+#
+#___HAWKI___
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/calib/gasgano/config/HAWKI.prefs b/calib/gasgano/config/HAWKI.prefs
new file mode 100644
index 0000000..b20d08e
--- /dev/null
+++ b/calib/gasgano/config/HAWKI.prefs
@@ -0,0 +1,53 @@
+# Gasgano Application Properties
+# Date: Wed Mar 23 14:44:37 MET 2005
+AUTO_DISPLAY=false
+CLASSRULE_FILE=/cal/hawki/rul/hawki.oca
+COMPONENT_FONT=Dialog:14
+CUBE_TO_VIEWER=
+CUBE_VIEWER_TYPE=SKYCAT
+DATA_FILES=
+DBOBS_DISPLAY_COLUMNS=CLASSIFICATION:RA:DEC:TPL.EXPNO:TPL.NEXP
+DBOBS_DISPLAY_COLUMNS_SIZE=0:0:0:0:0
+DBOBS_INSTRUMENT=All
+DBOBS_INSTRUMENTS=ISAAC;FORS1;FORS2;UVES;VIMOS;CONICA;EFOSC;CES;SUSI;SOFI;EMMI;WFI;VINCI;MIDI;CRIRE;HAWKI
+DBOBS_PERIOD=66
+DBOBS_REQUIRED=false
+DBOBS_SERVER_ID=
+DBOBS_SERVER_URL=jdbc:sybase:Tds:
+DBOBS_USERID=
+DB_SERVER_URL=jdbc:sybase:Tds:
+DB_USER_NAME=qc
+DISPLAY_COLUMNS=OBS.NAME:DPR.TYPE:DPR.CATG:INS.FILT1.NAME:INS.FILT2.NAME:DET.DIT:DET.NDIT:PRO.CATG:TEL.AIRM.START
+DISPLAY_COLUMNS_SIZE=0:0:0:0:0
+FILTER_FILE=gasgano/filter.rul
+FITS_TO_VIEWER=skycat
+FITS_VIEWER_TYPE=SKYCAT
+FRAME_BOUNDS=331,0,920,891
+INSTRUMENT_GROUPING=ISAAC=;FORS1=;FORS2=;UVES=;VIMOS=;CONICA=;EFOSC=;CES=;SUSI=;SOFI=;EMMI=;WFI=;VINCI=;MIDI=;CRIRE=;HAWKI=;
+KEYWORDLIST_DIR=gasgano/keywords
+MENU_CUSTOM1=
+MENU_CUSTOM1_LBL=Custom Menu1
+MENU_CUSTOM2=
+MENU_CUSTOM2_LBL=Custom Menu2
+MENU_CUSTOM3=
+MENU_CUSTOM3_LBL=Custom Menu3
+MENU_CUSTOM4=
+MENU_CUSTOM4_LBL=Custom Menu4
+MENU_RETRIEVE=dpclient -renameschema ARCFILE -outpath
+MJD_SORTING=false
+OBSTATUS_MAPPING=P:Partially defined D:Defined Q:queued for scheduling I:Initiated S:Started p:Paused during execution A:Aborted X:Executed R:Reduced C:Completed L:released K:Cancelled
+OB_STATUS_FROM_DB_REQUIRED=false
+PRINTER_NAME=lp
+PRINT_FONT=Monospaced:16
+PRINT_ORIENTATION=P
+RADEC_CONVERSION=true
+RECIPE_SET=hawki_cal_dark=/home/quality/pipelines/hawki/lib/esopipes-plugins/hawki-1.8.9/hawki_cal_dark.so;hawki_cal_flat=/home/quality/pipelines/hawki/lib/esopipes-plugins/hawki-1.8.9/hawki_cal_flat.so;hawki_cal_zpoint=/home/quality/pipelines/hawki/lib/esopipes-plugins/hawki-1.8.9/hawki_cal_zpoint.so;hawki_sci_jitter=/home/quality/pipelines/hawki/lib/esopipes-plugins/hawki-1.8.9/hawki_sci_jitter.so;hawki_cal_distortion=/home/quality/pipelines/hawki/lib/esopipes-plugins/hawki-1.8.9/hawki [...]
+SCRIPTS_DIR=gasgano/scripts
+SHORTEN_FILES_PATH=true
+SHORT_FILENAME=true
+SHOW_EXTENSIONS=true
+TEXTFILE_EXTENSIONS=ascii;paf;longlog
+TFITS_TO_VIEWER=
+TFITS_VIEWER_TYPE=SKYCAT
+UPDATE_TIMER=0
+VERBOSE_LEVEL=0
diff --git a/calib/gasgano/config/HAWKI.prefs.in b/calib/gasgano/config/HAWKI.prefs.in
new file mode 100644
index 0000000..f7f3b9b
--- /dev/null
+++ b/calib/gasgano/config/HAWKI.prefs.in
@@ -0,0 +1,53 @@
+# Gasgano Application Properties
+# Date: Wed Mar 23 14:44:37 MET 2005
+AUTO_DISPLAY=false
+CLASSRULE_FILE=@sysconf@/gasgano/HAWKI.rul
+COMPONENT_FONT=Dialog:14
+CUBE_TO_VIEWER=
+CUBE_VIEWER_TYPE=SKYCAT
+DATA_FILES=
+DBOBS_DISPLAY_COLUMNS=CLASSIFICATION:RA:DEC:TPL.EXPNO:TPL.NEXP
+DBOBS_DISPLAY_COLUMNS_SIZE=0:0:0:0:0
+DBOBS_INSTRUMENT=All
+DBOBS_INSTRUMENTS=ISAAC;FORS1;FORS2;UVES;VIMOS;CONICA;EFOSC;CES;SUSI;SOFI;EMMI;WFI;VINCI;MIDI;CRIRE;HAWKI
+DBOBS_PERIOD=66
+DBOBS_REQUIRED=false
+DBOBS_SERVER_ID=
+DBOBS_SERVER_URL=jdbc:sybase:Tds:
+DBOBS_USERID=
+DB_SERVER_URL=jdbc:sybase:Tds:
+DB_USER_NAME=qc
+DISPLAY_COLUMNS=OBS.NAME:DPR.TYPE:DPR.CATG:INS.FILT1.NAME:INS.FILT2.NAME:DET.DIT:DET.NDIT:PRO.CATG:TEL.AIRM.START
+DISPLAY_COLUMNS_SIZE=0:0:0:0:0
+FILTER_FILE=gasgano/filter.rul
+FITS_TO_VIEWER=skycat
+FITS_VIEWER_TYPE=SKYCAT
+FRAME_BOUNDS=331,0,920,891
+INSTRUMENT_GROUPING=ISAAC=;FORS1=;FORS2=;UVES=;VIMOS=;CONICA=;EFOSC=;CES=;SUSI=;SOFI=;EMMI=;WFI=;VINCI=;MIDI=;CRIRE=;HAWKI=;
+KEYWORDLIST_DIR=gasgano/keywords
+MENU_CUSTOM1=
+MENU_CUSTOM1_LBL=Custom Menu1
+MENU_CUSTOM2=
+MENU_CUSTOM2_LBL=Custom Menu2
+MENU_CUSTOM3=
+MENU_CUSTOM3_LBL=Custom Menu3
+MENU_CUSTOM4=
+MENU_CUSTOM4_LBL=Custom Menu4
+MENU_RETRIEVE=dpclient -renameschema ARCFILE -outpath
+MJD_SORTING=false
+OBSTATUS_MAPPING=P:Partially defined D:Defined Q:queued for scheduling I:Initiated S:Started p:Paused during execution A:Aborted X:Executed R:Reduced C:Completed L:released K:Cancelled
+OB_STATUS_FROM_DB_REQUIRED=false
+PRINTER_NAME=lp
+PRINT_FONT=Monospaced:16
+PRINT_ORIENTATION=P
+RADEC_CONVERSION=true
+RECIPE_SET=hawki_cal_dark=@plugindir@/hawki_cal_dark.so;hawki_cal_flat=@plugindir@/hawki_cal_flat.so;hawki_cal_zpoint=@plugindir@/hawki_cal_zpoint.so;hawki_sci_jitter=@plugindir@/hawki_sci_jitter.so;hawki_cal_illum=@plugindir@/hawki_cal_illum.so;hawki_cal_distortion=@plugindir@/hawki_cal_distortion.so;hawki_tec_filtchk=@plugindir@/hawki_tec_filtchk.so;hawki_step_basic_calib=@plugindir@/hawki_step_basic_calib.so;hawki_step_combine=@plugindir@/hawki_step_combine.so;hawki_step_compute_bkg=@ [...]
+SCRIPTS_DIR=gasgano/scripts
+SHORTEN_FILES_PATH=true
+SHORT_FILENAME=true
+SHOW_EXTENSIONS=true
+TEXTFILE_EXTENSIONS=ascii;paf;longlog
+TFITS_TO_VIEWER=
+TFITS_VIEWER_TYPE=SKYCAT
+UPDATE_TIMER=0
+VERBOSE_LEVEL=0
diff --git a/calib/gasgano/config/hawki.oca b/calib/gasgano/config/hawki.oca
new file mode 100644
index 0000000..42aae25
--- /dev/null
+++ b/calib/gasgano/config/hawki.oca
@@ -0,0 +1,375 @@
+if DPR.CATG like "%ACQUISITION%" then
+{
+ DO.CATG = "ACQ_IMAGE";
+}
+if DPR.TYPE like "%TEST%" then
+{
+ DO.CATG = "TEST";
+}
+if DPR.CATG like "%TECHNICAL%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%STD%" then
+{
+ DO.CATG = "TEC_STD";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%ASTROMETRY,OBJECT%" then
+{
+ DO.CATG = "DISTOR_OBS";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%ASTROMETRY,SKY%" then
+{
+ DO.CATG = "DISTOR_SKY";
+}
+if DPR.CATG like "%TECHNICAL%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%ASTROMETRY%" and DPR.TYPE like "%STD%" then
+{
+ DO.CATG = "TEC_ASTRO";
+}
+if DPR.CATG like "%TECHNICAL%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%FOCUS%" then
+{
+ DO.CATG = "TEC_FOCUS";
+}
+if DPR.CATG like "%TECHNICAL%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%FLAT%" then
+{
+ DO.CATG = "TEC_FLAT";
+}
+if DPR.CATG like "%SCIENCE%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%OBJECT%" then
+{
+ DO.CATG = "JITTER_OBS";
+}
+if DPR.CATG like "%SCIENCE%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%SKY%" then
+{
+ DO.CATG = "JITTER_SKY";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%DARK%" then
+{
+ DO.CATG = "DARK";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%FLAT%" then
+{
+ DO.CATG = "FLAT";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%STD%" then
+{
+ DO.CATG = "ZPOINT";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%LINEARITY,FLAT,DETCHAR%" then
+{
+ DO.CATG = "DETMON_LAMP_ON";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%LINEARITY,DARK,DETCHAR%" then
+{
+ DO.CATG = "DETMON_LAMP_OFF";
+}
+
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%FLAT,LAMP,DETCHECK%" then
+{
+ DO.CATG = "DETLIN_LAMP";
+}
+if DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" and DPR.TYPE like "%DARK,DETCHECK%" then
+{
+ DO.CATG = "DETLIN_DARK";
+}
+
+if PRO.CATG == "COMBINED" then
+{
+ DO.CATG = "COMBINED";
+}
+
+if PRO.CATG == "STITCHED" then
+{
+ DO.CATG = "STITCHED";
+}
+
+if PRO.CATG == "DIST_CORRECTED" then
+{
+ DO.CATG = "DIST_CORRECTED";
+}
+
+if PRO.CATG == "ILLUM" then
+{
+ DO.CATG = "ILLUM";
+}
+
+if PRO.CATG == "BKG_IM" then
+{
+ DO.CATG = "BKG_IM";
+}
+
+if PRO.CATG == "BKG_MASK" then
+{
+ DO.CATG = "BKG_MASK";
+}
+
+if PRO.CATG == "OBJ_PARAM" then
+{
+ DO.CATG = "OBJ_PARAM";
+}
+
+if PRO.CATG == "OBJ_MASK" then
+{
+ DO.CATG = "OBJ_MASK";
+}
+
+if PRO.CATG == "SCIENCE_PCS" then
+{
+ DO.CATG = "SCIENCE_PCS";
+}
+
+if PRO.CATG == "FLAT_ERRMAP" then
+{
+ DO.CATG = "FLAT_ERRMAP";
+}
+
+if PRO.CATG == "BPM" then
+{
+ DO.CATG = "BPM";
+}
+
+if PRO.CATG == "BPM_HOT" then
+{
+ DO.CATG = "BPM_HOT";
+}
+
+if PRO.CATG == "BPM_COLD" then
+{
+ DO.CATG = "BPM_COLD";
+}
+
+if PRO.CATG == "FLAT_IM" then
+{
+ DO.CATG = "FLAT_IM";
+}
+
+if PRO.CATG == "FLAT_ERR" then
+{
+ DO.CATG = "FLAT_ERR";
+}
+
+if PRO.CATG == "FLAT_RECOMPUTED" then
+{
+ DO.CATG = "FLAT_RECOMPUTED";
+}
+
+if PRO.CATG == "DARK_IM" then
+{
+ DO.CATG = "DARK_IM";
+}
+
+if PRO.CATG == "DARK_ERR" then
+{
+ DO.CATG = "DARK_ERR";
+}
+
+if PRO.CATG == "ILLUM_PHOTOM" then
+{
+ DO.CATG = "ILLUM_PHOTOM";
+}
+
+if PRO.CATG == "FLAT_STATS" then
+{
+ DO.CATG = "FLAT_STATS";
+}
+
+if PRO.CATG == "FLAT_STATS_EVEN_COL" then
+{
+ DO.CATG = "FLAT_STATS_EVEN_COL";
+}
+
+if PRO.CATG == "FLAT_STATS_ODD_COL" then
+{
+ DO.CATG = "FLAT_STATS_ODD_COL";
+}
+
+if PRO.CATG == "FLAT_STATS_EVEN_ROW" then
+{
+ DO.CATG = "FLAT_STATS_EVEN_ROW";
+}
+
+if PRO.CATG == "FLAT_STATS_ODD_ROW" then
+{
+ DO.CATG = "FLAT_STATS_ODD_ROW";
+}
+
+if PRO.CATG == "DARK_STATS" then
+{
+ DO.CATG = "DARK_STATS";
+}
+
+if PRO.CATG == "ZPOINT_STATS" then
+{
+ DO.CATG = "ZPOINT_STATS";
+}
+
+if PRO.CATG == "JITTER_STATS" then
+{
+ DO.CATG = "JITTER_STATS";
+}
+
+if PRO.CATG == "BKG_STATS" then
+{
+ DO.CATG = "BKG_STATS";
+}
+
+if PRO.CATG == "STDSTARS_CATS" then
+{
+ DO.CATG = "STDSTARS_CATS";
+}
+
+if PRO.CATG == "DISTORTION_X" then
+{
+ DO.CATG = "DISTORTION_X";
+}
+
+if PRO.CATG == "DISTORTION_Y" then
+{
+ DO.CATG = "DISTORTION_Y";
+}
+
+if PRO.CATG == "ZPOINT_RES" then
+{
+ DO.CATG = "ZPOINT_RES";
+}
+
+if PRO.CATG == "ZPOINT_IMA" then
+{
+ DO.CATG = "ZPOINT_IMA";
+}
+
+if PRO.CATG == "DETLIN_A" then
+{
+ DO.CATG = "DETLIN_A";
+}
+
+if PRO.CATG == "DETLIN_B" then
+{
+ DO.CATG = "DETLIN_B";
+}
+
+if PRO.CATG == "DETLIN_C" then
+{
+ DO.CATG = "DETLIN_C";
+}
+
+if PRO.CATG == "DETLIN_Q" then
+{
+ DO.CATG = "DETLIN_Q";
+}
+
+if PRO.CATG == "LINGAIN_LIN" then
+{
+ DO.CATG = "LINGAIN_LIN";
+}
+
+if PRO.CATG == "LINGAIN_GAIN" then
+{
+ DO.CATG = "LINGAIN_GAIN";
+}
+
+if PRO.CATG == "LINGAIN_COEFFS" then
+{
+ DO.CATG = "LINGAIN_COEFFS";
+}
+
+if PRO.CATG == "LINGAIN_BPM" then
+{
+ DO.CATG = "LINGAIN_BPM";
+}
+
+if PRO.CATG == "LINGAIN_CORR" then
+{
+ DO.CATG = "LINGAIN_CORR";
+}
+
+if PRO.CATG == "LINGAIN_DIFF" then
+{
+ DO.CATG = "LINGAIN_DIFF";
+}
+
+if PRO.CATG == "BEST_FOCUS" then
+{
+ DO.CATG = "BEST_FOCUS";
+}
+
+if PRO.CATG == "BASIC_CALIBRATED" then
+{
+ DO.CATG = "BASIC_CALIBRATED";
+}
+
+if PRO.CATG == "SKY_BASIC_CALIBRATED" then
+{
+ DO.CATG = "SKY_BASIC_CALIBRATED";
+}
+
+if PRO.CATG == "BKG_SUBTRACTED" then
+{
+ DO.CATG = "BKG_SUBTRACTED";
+}
+
+if PRO.CATG == "FILTERPOS_CHECK_STATS" then
+{
+ DO.CATG = "FILTERPOS_CHECK_STATS";
+}
+
+if PRO.CATG == "OFFSETS_REFINED" then
+{
+ DO.CATG = "OFFSETS_REFINED";
+}
+
+select execute(hawki_cal_dark) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "DARK"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT;
+select execute(hawki_tec_filtchk) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "TEC_FLAT"
+ group by INS.FILT1.NAME,INS.FILT2.NAME;
+select execute(hawki_cal_flat) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "FLAT"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,INS.FILT1.NAME,INS.FILT2.NAME;
+select execute(hawki_cal_zpoint) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "ZPOINT"
+ group by INS.FILT1.NAME,INS.FILT2.NAME;
+select execute(detmon_ir_lg) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "DETMON_LAMP_ON";
+select execute(detmon_ir_lg) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "DETMON_LAMP_OFF";
+select execute(hawki_sci_jitter) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "JITTER_OBS";
+select execute(hawki_sci_jitter) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "JITTER_SKY";
+select execute(hawki_cal_distortion) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "DISTOR_OBS"
+ group by ADA.POSANG;
+select execute(hawki_cal_distortion) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "DISTOR_SKY"
+ group by ADA.POSANG;
+select execute(hawki_cal_illum) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "TEC_STD";
+
+action hawki_cal_illum
+{
+ recipe hawki_cal_illum;
+}
+action hawki_cal_distortion
+{
+ recipe hawki_cal_distortion;
+}
+action hawki_cal_dark
+{
+ recipe hawki_cal_dark;
+}
+action hawki_cal_flat
+{
+ minRet = 0; maxRet = 1;
+ recipe hawki_cal_flat
+ {
+ "--second_pass=false" ;
+ }
+}
+action detmon_ir_lg
+{
+ recipe detmon_ir_lg
+ {
+ "--exts=-1" ;
+ }
+}
+action hawki_cal_zpoint
+{
+ minRet = 1; maxRet = 1;
+ select file as STDSTARS_CATS from calibFiles
+ where DO.CATG == "STDSTARS_CATS";
+ recipe hawki_cal_zpoint;
+}
+action hawki_sci_jitter
+{
+ recipe hawki_sci_jitter;
+}
+action hawki_tec_filtchk
+{
+ recipe hawki_tec_filtchk;
+}
diff --git a/calib/gasgano/config/hawki_wkf.oca b/calib/gasgano/config/hawki_wkf.oca
new file mode 100644
index 0000000..02c4410
--- /dev/null
+++ b/calib/gasgano/config/hawki_wkf.oca
@@ -0,0 +1,264 @@
+
+
+//CLASSIFICATION
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "DARK"
+ and TPL.NEXP > 2 then
+{
+ RAW.TYPE = "DARK";
+ DO.CATG = "DARK";
+ PACK.DIR = "DARK";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "FLAT"
+ and TPL.ID != "HAWKI_img_tec_DetTest" and TPL.ID != "HAWKI_img_tec_DetLin"
+ and TPL.NEXP > 2 then
+{
+ RAW.TYPE = "FLAT";
+ DO.CATG = "FLAT";
+ PACK.DIR = "FLAT";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "STD"
+ and TPL.NEXP == 4
+ and (
+ INS.FILT1.NAME == "J" or
+ INS.FILT1.NAME == "H" or
+ INS.FILT1.NAME == "Ks" or
+ INS.FILT1.NAME == "Y"
+ ) and
+ INS.FILT2.NAME =="OPEN"
+ then
+{
+ RAW.TYPE = "STD";
+ DO.CATG = "ZPOINT";
+ PACK.DIR = "STD";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "TECHNICAL" and DPR.TECH == "IMAGE" and DPR.TYPE == "FLAT"
+ and TPL.NEXP > 1 then
+{
+ RAW.TYPE = "FILTCHK";
+ DO.CATG = "TEC_FLAT";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "ACQUISITION" then
+{
+ RAW.TYPE = "ACQUISITION";
+ DO.CATG = "ACQ_IMAGE";
+ PACK.DIR = "NONE";
+ CATG = "SCIENCE";
+}
+
+if DPR.CATG == "SCIENCE" and DPR.TECH == "IMAGE" and DPR.TYPE == "OBJECT" then
+{
+ RAW.TYPE = "SCIENCE_IMG";
+ DO.CATG = "JITTER_OBS";
+ PACK.DIR = "NONE";
+ CATG = "SCIENCE";
+}
+
+if DPR.CATG == "SCIENCE" and DPR.TECH == "IMAGE" and DPR.TYPE == "SKY" then
+{
+ RAW.TYPE = "SCIENCE_IMG";
+ DO.CATG = "JITTER_SKY";
+ PACK.DIR = "NONE";
+ CATG = "SCIENCE";
+}
+
+if DPR.CATG == "CALIB" and DPR.TYPE == "LINEARITY,DARK,DETCHAR" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_DARK";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TYPE == "LINEARITY,FLAT,DETCHAR" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_LAMP";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "BIAS,DETCHECK" and TPL.ID == "HAWKI_img_tec_DetLin" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_DARK";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "FLAT" and TPL.ID == "HAWKI_img_tec_DetLin" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_LAMP";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+if DPR.CATG == "TECHNICAL" and DPR.TECH == "IMAGE" and DPR.TYPE == "STD" then
+{
+ RAW.TYPE = "TEC_STD";
+ DO.CATG = "TEC_STD";
+ PACK.DIR = "NONE";
+ CATG = "TECH";
+}
+if PRO.CATG == "DISTORTION_X" then
+{
+ DO.CATG = "DISTORTION_X";
+ DO.CLASS = "DISTORTION_X";
+}
+if PRO.CATG == "DISTORTION_Y" then
+{
+ DO.CATG = "DISTORTION_Y";
+ DO.CLASS = "DISTORTION_Y";
+}
+if CATNAME == "2mass" then
+{
+ DO.CATG = "CAT_2MASS";
+ DO.CLASS = "CAT_2MASS";
+}
+
+
+
+//ORGANIZATION
+
+select execute(ACTION_DARK) from inputFiles where RAW.TYPE=="DARK"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_FLAT) from inputFiles where RAW.TYPE=="FLAT"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,INS.FILT1.NAME,INS.FILT2.NAME,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_STD) from inputFiles where RAW.TYPE=="STD"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,INS.FILT1.NAME,INS.FILT2.NAME,OBS.TARG.NAME,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_FILTCHK) from inputFiles where RAW.TYPE=="FILTCHK"
+ group by DET.NCORRS.NAME,DET.DIT,INS.FILT1.NAME,INS.FILT2.NAME,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_SCIENCE_IMG) from inputFiles where RAW.TYPE=="SCIENCE_IMG"
+ group by DET.NCORRS.NAME,DET.DIT,INS.FILT1.NAME,INS.FILT2.NAME,TPL.START as (TPL_A,tpl);
+
+
+
+
+action ACTION_DARK
+{
+ recipe hawki_cal_dark {
+ "--sigma=10.0";
+}
+ product DARK_IM { PRO.CATG="DARK_IM"; PRO.EXT="tpl_0001.fits";}
+ product BPM_HOT { PRO.CATG="BPM_HOT"; PRO.EXT="tpl_0002.fits";}
+}
+
+
+action ACTION_FLAT
+{
+ minRet = 0; maxRet = 1;
+ select file as DARK_IM from calibFiles where
+ PRO.CATG=="DARK_IM"
+ and inputFile.DET.DIT==DET.DIT
+ ;
+ minRet = 1; maxRet = 1;
+ select file as BPM_HOT from calibFiles where
+ PRO.CATG=="BPM_HOT"
+ // and inputFile.DET.DIT==DET.DIT
+ ;
+ recipe hawki_cal_flat{
+ "--normalise";
+ "--select_min_level=-1.0";
+ "--select_max_level=25000.0";
+ "--select_max_rms=4000.0";
+ "--select_auto=TRUE";
+ "--select_auto_max_bins=10";
+ "--select_min_nframes=3";
+ "--extra_stats=TRUE";
+ "--lowval_bpm=0.6" ;
+ "--highval_bpm=1.3" ;
+ }
+ product FLAT_IM { PRO.CATG="FLAT_IM"; PRO.EXT="tpl_0001.fits";}
+ product BPM_COLD { PRO.CATG="BPM_COLD"; PRO.EXT="tpl_0002.fits";}
+ product BPM_HOTCOLD { PRO.CATG="BPM"; PRO.EXT="tpl_0003.fits";}
+}
+
+action ACTION_STD
+{
+ minRet = 1; maxRet = 1;
+ select file as STDSTARS_CATS from calibFiles where
+ PRO.CATG=="STDSTARS_CATS"
+ ;
+ minRet = 1; maxRet = 1;
+ select file as FLAT_IM from calibFiles where
+ PRO.CATG=="FLAT_IM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME
+ ;
+ minRet = 1; maxRet = 1;
+ select file as BPM_HOTCOLD from calibFiles where
+ PRO.CATG=="BPM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME
+ ;
+ minRet = 0; maxRet = 1;
+ select file as DISTORTION_MASSOC from calibFiles where
+ PRO.CATG=="DISTORTION"
+ ;
+ minRet = 0; maxRet = 1;
+ select file as DARK_IM_MASSOC from calibFiles where
+ PRO.CATG=="DARK_IM"
+ and inputFile.DET.DIT==DET.DIT
+ ;
+ select file as BPM_HOT_MASSOC from calibFiles where
+ PRO.CATG=="BPM_HOT"
+ and inputFile.DET.DIT==DET.DIT
+ ;
+ minRet = 1; maxRet = 1;
+ select file as BPM_COLD_MASSOC from calibFiles where
+ PRO.CATG=="BPM_COLD"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME
+ ;
+ recipe hawki_cal_zpoint;
+ product ZPOINT_IMA { PRO.CATG="ZPOINT_IMA"; PRO.EXT="tpl_0001.fits";}
+ product ZPOINT_RES { PRO.CATG="ZPOINT_RES"; PRO.EXT="tpl_0002.fits";}
+}
+
+action ACTION_SCIENCE_IMG
+{
+ minRet = 0; maxRet = 1;
+ select file as DISTORTION_X from calibFiles where
+ PRO.CATG=="DISTORTION_X";
+ select file as DISTORTION_Y from calibFiles where
+ PRO.CATG=="DISTORTION_Y";
+ minRet = 1; maxRet = 1;
+ select file as FLAT_IM from calibFiles where
+ PRO.CATG=="FLAT_IM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME;
+ minRet = 1; maxRet = 1;
+ select file as BPM_HOTCOLD from calibFiles where
+ PRO.CATG=="BPM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME;
+ minRet = 0; maxRet = 1;
+ select file as DARK_IM from calibFiles where
+ PRO.CATG=="DARK_IM"
+ and inputFile.DET.DIT==DET.DIT;
+ minRet = 0; maxRet = 1;
+ select file as CAT_2MASS from inputFiles where
+ DO.CATG =="CAT_2MASS";
+
+ recipe hawki_sci_jitter
+ {
+ "--refine";
+ }
+}
+
+action ACTION_FILTCHK
+{
+ recipe hawki_tec_filtchk;
+}
diff --git a/catalogs/dist_map_chip1.txt b/catalogs/dist_map_chip1.txt
new file mode 100644
index 0000000..97197ec
--- /dev/null
+++ b/catalogs/dist_map_chip1.txt
@@ -0,0 +1,82 @@
+#DXGC DYGC I J
+2.84390 2.45460 0 0
+2.23870 1.98040 256 0
+1.63340 1.60680 512 0
+1.06490 1.10210 768 0
+0.82980 0.80000 1024 0
+0.55210 0.42790 1280 0
+0.37440 0.17950 1536 0
+0.16430 -0.01240 1792 0
+0.14150 -0.26860 2048 0
+2.48740 2.11620 0 256
+1.96600 1.66470 256 256
+1.37510 1.22280 512 256
+0.91160 0.76790 768 256
+0.52750 0.41750 1024 256
+0.33080 0.15780 1280 256
+0.20970 -0.12740 1536 256
+0.17127 -0.43477 1792 256
+0.43650 -0.76131 2048 256
+2.09120 1.62600 0 512
+1.53400 1.19510 256 512
+0.93260 0.77570 512 512
+0.57970 0.38680 768 512
+0.20200 0.11590 1024 512
+0.21698 -0.36148 1280 512
+0.03811 -0.54528 1536 512
+0.22781 -0.75603 1792 512
+0.15200 -0.71725 2048 512
+1.58110 1.06420 0 768
+1.06520 0.76480 256 768
+0.58360 0.49010 512 768
+0.40213 0.23634 768 768
+0.08376 0.04061 1024 768
+0.02407 -0.34559 1280 768
+0.03582 -0.52094 1536 768
+0.06515 -0.72514 1792 768
+0.07011 -0.93636 2048 768
+1.60167 1.18785 0 1024
+1.02741 0.75110 256 1024
+0.48779 0.42472 512 1024
+0.16570 0.18218 768 1024
+0.11906 -0.09003 1024 1024
+0.07000 -0.36990 1280 1024
+0.09602 -0.59179 1536 1024
+0.03599 -0.72682 1792 1024
+0.03970 -0.85271 2048 1024
+1.29769 0.79372 0 1280
+0.71682 0.57808 256 1280
+0.16445 0.34675 512 1280
+0.03524 0.04520 768 1280
+0.20430 -0.17830 1024 1280
+0.25196 -0.37310 1280 1280
+0.17329 -0.50335 1536 1280
+0.10241 -0.76777 1792 1280
+0.14393 -0.70270 2048 1280
+1.04804 0.86434 0 1536
+0.50647 0.49055 256 1536
+0.08444 0.22417 512 1536
+0.23151 0.10683 768 1536
+0.31978 -0.06737 1024 1536
+0.34149 -0.14829 1280 1536
+0.19145 -0.31025 1536 1536
+0.06340 -0.42043 1792 1536
+0.12776 -0.77157 2048 1536
+0.97383 0.64543 0 1792
+0.39907 0.49518 256 1792
+0.01278 0.34632 512 1792
+0.22477 0.30883 768 1792
+0.38451 0.15371 1024 1792
+0.29767 0.06126 1280 1792
+0.22504 -0.13351 1536 1792
+0.12646 -0.29359 1792 1792
+0.00978 -0.25883 2048 1792
+0.74286 0.80652 0 2048
+0.41228 0.58443 256 2048
+0.00763 0.58005 512 2048
+0.27219 0.40832 768 2048
+0.40799 0.30011 1024 2048
+0.41772 0.16860 1280 2048
+0.37450 -0.00418 1536 2048
+0.15617 -0.07722 1792 2048
+0.08522 -0.23263 2048 2048
diff --git a/catalogs/dist_map_chip2.txt b/catalogs/dist_map_chip2.txt
new file mode 100644
index 0000000..c7703d6
--- /dev/null
+++ b/catalogs/dist_map_chip2.txt
@@ -0,0 +1,82 @@
+#DXGC DYGC I J
+0.68507 -0.37879 0 0
+1.49079 -0.60040 256 0
+1.43017 -0.01965 512 0
+1.30543 0.55538 768 0
+1.15870 1.18921 1024 0
+1.04449 1.91096 1280 0
+0.32545 1.92315 1536 0
+0.18270 3.00545 1792 0
+0.65632 3.24491 2048 0
+1.06822 -1.33212 0 256
+1.09557 -0.82185 256 256
+1.05593 -0.25353 512 256
+1.04504 0.16645 768 256
+1.00672 0.76379 1024 256
+0.78317 1.53552 1280 256
+0.29344 1.56834 1536 256
+0.03982 2.21972 1792 256
+1.00180 4.27968 2048 256
+0.48489 -1.47345 0 512
+0.57734 -1.05526 256 512
+0.73405 -0.59196 512 512
+0.72243 -0.14558 768 512
+0.67773 0.45145 1024 512
+0.62170 1.01122 1280 512
+0.24107 1.91528 1536 512
+0.27885 2.63082 1792 512
+0.74588 3.16372 2048 512
+0.02641 -1.47601 0 768
+0.16536 -1.20214 256 768
+0.26612 -0.73701 512 768
+0.34514 -0.20013 768 768
+0.41019 0.26307 1024 768
+0.36321 0.72126 1280 768
+0.01244 1.39281 1536 768
+0.45606 2.05886 1792 768
+0.84700 2.68346 2048 768
+0.41032 -1.62478 0 1024
+0.31875 -1.06410 256 1024
+0.11840 -0.64570 512 1024
+0.03315 -0.26942 768 1024
+0.01228 0.22538 1024 1024
+0.01639 0.74251 1280 1024
+0.25518 1.40220 1536 1024
+0.60617 1.95507 1792 1024
+0.99831 2.39662 2048 1024
+0.92980 -1.49230 0 1280
+0.79732 -0.99347 256 1280
+0.57045 -0.58646 512 1280
+0.47400 -0.06451 768 1280
+0.36289 0.37836 1024 1280
+0.39951 0.81747 1280 1280
+0.51492 1.30267 1536 1280
+0.91818 1.83779 1792 1280
+1.25634 2.30140 2048 1280
+1.54133 -1.14478 0 1536
+1.28155 -0.87784 256 1536
+1.05452 -0.35921 512 1536
+0.92060 0.03827 768 1536
+0.87743 0.53344 1024 1536
+0.81280 0.93465 1280 1536
+0.95774 1.33075 1536 1536
+1.23558 1.85859 1792 1536
+1.59953 2.26541 2048 1536
+1.91429 -1.05830 0 1792
+1.82804 -0.62379 256 1792
+1.55051 -0.25079 512 1792
+1.39602 0.18753 768 1792
+1.28401 0.60351 1024 1792
+1.24099 1.02179 1280 1792
+1.30228 1.43832 1536 1792
+1.63446 1.85313 1792 1792
+2.14583 2.35619 2048 1792
+2.57455 -0.71080 0 2048
+2.26518 -0.49010 256 2048
+2.10786 -0.10005 512 2048
+1.74919 0.29445 768 2048
+1.82264 0.74064 1024 2048
+1.59961 1.09363 1280 2048
+1.76283 1.65589 1536 2048
+2.12481 1.98759 1792 2048
+1.65991 2.34401 2048 2048
diff --git a/catalogs/dist_map_chip3.txt b/catalogs/dist_map_chip3.txt
new file mode 100644
index 0000000..acdd0b7
--- /dev/null
+++ b/catalogs/dist_map_chip3.txt
@@ -0,0 +1,82 @@
+#DXGC DYGC I J
+0.12231 -0.07205 0 0
+0.14954 -0.09003 256 0
+0.15323 -0.26376 512 0
+0.36766 -0.43809 768 0
+0.46223 -0.43609 1024 0
+0.45321 -0.59371 1280 0
+0.40605 -0.79802 1536 0
+0.03960 -0.91718 1792 0
+0.36753 -1.01719 2048 0
+0.27577 0.35778 0 256
+0.04087 0.14572 256 256
+0.16925 -0.06186 512 256
+0.36992 -0.16564 768 256
+0.46225 -0.27729 1024 256
+0.45470 -0.50823 1280 256
+0.42896 -0.63107 1536 256
+0.08736 -0.78741 1792 256
+0.46872 -0.94023 2048 256
+0.11529 0.49878 0 512
+0.03061 0.34995 256 512
+0.15138 0.24160 512 512
+0.38804 0.11333 768 512
+0.49801 -0.14656 1024 512
+0.48207 -0.28053 1280 512
+0.35256 -0.53785 1536 512
+0.07086 -0.75989 1792 512
+0.52050 -0.89555 2048 512
+0.04872 0.65488 0 768
+0.05085 0.52259 256 768
+0.24312 0.46643 512 768
+0.36830 0.23621 768 768
+0.42019 0.07388 1024 768
+0.43550 -0.21711 1280 768
+0.29258 -0.40377 1536 768
+0.15172 -0.70625 1792 768
+0.65413 -0.90057 2048 768
+0.03618 0.75267 0 1024
+0.09667 0.67342 256 1024
+0.20306 0.49436 512 1024
+0.33687 0.33029 768 1024
+0.31841 -0.00235 1024 1024
+0.28308 -0.21576 1280 1024
+0.16469 -0.32486 1536 1024
+0.35767 -0.73478 1792 1024
+0.69328 -1.04276 2048 1024
+0.04386 0.64247 0 1280
+0.13417 0.73699 256 1280
+0.30654 0.53658 512 1280
+0.23353 0.30928 768 1280
+0.25219 0.03563 1024 1280
+0.17323 -0.17883 1280 1280
+0.16950 -0.51725 1536 1280
+0.69220 -0.84263 1792 1280
+1.20081 -1.21779 2048 1280
+0.14084 0.63901 0 1536
+0.17375 0.55235 256 1536
+0.16173 0.35895 512 1536
+0.23763 0.15133 768 1536
+0.17239 -0.16924 1024 1536
+0.07356 -0.41649 1280 1536
+0.43729 -0.96150 1536 1536
+0.80090 -0.89550 1792 1536
+1.30050 -1.09950 2048 1536
+0.24688 0.31048 0 1792
+0.21606 0.31179 256 1792
+0.15857 0.13161 512 1792
+0.20539 -0.14155 768 1792
+0.00529 -0.37683 1024 1792
+0.21189 -0.59190 1280 1792
+0.65418 -0.96813 1536 1792
+1.22930 -1.48290 1792 1792
+1.80860 -1.97800 2048 1792
+0.22566 0.09343 0 2048
+0.22013 -0.07626 256 2048
+0.07135 -0.27255 512 2048
+0.02594 -0.37304 768 2048
+0.06740 -0.68060 1024 2048
+0.42670 -0.90710 1280 2048
+0.97580 -1.51180 1536 2048
+1.58400 -1.84180 1792 2048
+2.06240 -2.08660 2048 2048
diff --git a/catalogs/dist_map_chip4.txt b/catalogs/dist_map_chip4.txt
new file mode 100644
index 0000000..56f32e8
--- /dev/null
+++ b/catalogs/dist_map_chip4.txt
@@ -0,0 +1,82 @@
+#DXGC DYGC I J
+0.77520 0.05260 0 0
+0.41345 -0.01699 256 0
+0.03004 -0.08618 512 0
+0.34766 -0.11147 768 0
+0.44635 -0.19606 1024 0
+0.42708 -0.17347 1280 0
+0.31558 -0.31345 1536 0
+0.14055 -0.30460 1792 0
+0.03095 -0.34836 2048 0
+0.56532 0.00346 0 256
+0.55822 -0.08960 256 256
+0.03107 -0.01142 512 256
+0.28913 -0.07574 768 256
+0.45124 -0.08524 1024 256
+0.39709 -0.10212 1280 256
+0.31718 -0.08498 1536 256
+0.19031 -0.20562 1792 256
+0.05726 -0.14161 2048 256
+0.72606 -0.02554 0 512
+0.57285 0.00934 256 512
+0.06122 0.09657 512 512
+0.23861 0.09930 768 512
+0.41782 0.06222 1024 512
+0.45524 0.07901 1280 512
+0.36850 -0.04480 1536 512
+0.26652 -0.01505 1792 512
+0.07746 -0.06592 2048 512
+0.94838 -0.06499 0 768
+0.54750 -0.02485 256 768
+0.18271 0.05730 512 768
+0.25109 0.09404 768 768
+0.39745 0.06351 1024 768
+0.39675 0.04623 1280 768
+0.34645 0.19600 1536 768
+0.21231 0.09572 1792 768
+0.00534 0.16048 2048 768
+1.08098 -0.20885 0 1024
+0.54138 -0.22390 256 1024
+0.29653 -0.09267 512 1024
+0.07950 0.10702 768 1024
+0.24416 0.15300 1024 1024
+0.30682 0.31041 1280 1024
+0.28405 0.34673 1536 1024
+0.17074 0.24911 1792 1024
+0.11933 0.38509 2048 1024
+1.38940 -0.45930 0 1280
+0.84640 -0.36660 256 1280
+0.64893 -0.20671 512 1280
+0.12978 -0.09667 768 1280
+0.10322 0.13907 1024 1280
+0.19242 0.22058 1280 1280
+0.18567 0.19420 1536 1280
+0.15481 0.34906 1792 1280
+0.00972 0.31770 2048 1280
+1.74630 -0.98490 0 1536
+1.23450 -0.67410 256 1536
+0.57260 -0.38460 512 1536
+0.38806 -0.32260 768 1536
+0.11751 -0.10990 1024 1536
+0.08218 0.00932 1280 1536
+0.09549 0.14651 1536 1536
+0.04582 0.21978 1792 1536
+0.04368 0.21887 2048 1536
+2.10200 -1.29980 0 1792
+1.56840 -1.08470 256 1792
+0.92750 -0.78320 512 1792
+0.67712 -0.77089 768 1792
+0.39060 -0.56369 1024 1792
+0.18558 -0.39834 1280 1792
+0.08503 -0.17226 1536 1792
+0.06485 -0.01522 1792 1792
+0.03374 0.01116 2048 1792
+2.39390 -1.70940 0 2048
+1.91960 -1.53210 256 2048
+1.17840 -1.09510 512 2048
+0.97098 -1.25791 768 2048
+0.67221 -1.02355 1024 2048
+0.40933 -0.82252 1280 2048
+0.29081 -0.57501 1536 2048
+0.11921 -0.44815 1792 2048
+0.13470 -0.48675 2048 2048
diff --git a/catalogs/stdstars/HAWKI_Persson_2008-10-30.txt b/catalogs/stdstars/HAWKI_Persson_2008-10-30.txt
new file mode 100644
index 0000000..174d82b
--- /dev/null
+++ b/catalogs/stdstars/HAWKI_Persson_2008-10-30.txt
@@ -0,0 +1,33 @@
+#Star_name RA DEC Spec_type J H K Y
+P525-E 6.1179 7.817222 -- 11.580 11.278 11.211 99
+S294-D 8.3133 -39.402778 -- 10.894 10.636 10.585 99
+S301-D 51.7246 -39.843889 -- 12.112 11.821 11.761 99
+P533-D 55.2600 6.936944 -- 11.695 11.411 11.323 99
+S055-D 64.5787 -69.459722 -- 11.516 11.305 11.244 99
+S361-D 72.4775 -35.188056 -- 11.212 11.010 10.981 99
+S252-D 77.6067 -44.879444 -- 11.020 10.745 10.697 99
+S363-D 84.1867 -34.777500 -- 12.036 11.852 11.816 99
+S121-E 97.3725 -59.658611 -- 12.075 11.817 11.754 99
+S427-D 104.9400 -30.228889 -- 10.791 10.478 10.420 99
+S005-D 109.9108 -84.585000 -- 10.844 10.578 10.502 99
+S209-D 120.3142 -50.325833 -- 10.870 10.565 10.474 99
+S312-T 126.4004 -39.099722 -- 11.910 11.648 11.597 99
+S495-E 126.8021 -25.133611 -- 11.470 11.028 10.952 99
+S165-E 133.5904 -54.802222 -- 12.450 12.193 12.126 99
+S372-S 138.9604 -36.542778 -- 11.115 10.870 10.819 99
+S264-D 161.8504 -44.568056 -- 11.601 11.314 11.252 99
+S217-D 180.4383 -50.052778 -- 11.281 10.981 10.919 99
+S064-F 180.8758 -69.082222 -- 12.069 11.783 11.709 99
+S860-D 185.4137 -0.120278 -- 12.174 11.896 11.850 99
+S008-D 215.9396 -84.166111 -- 11.194 10.970 10.892 99
+S867-V 220.2417 -0.463056 -- 12.001 11.680 11.610 99
+S273-E 224.2163 -44.820556 -- 11.294 10.904 10.839 99
+P565-C 246.6779 5.872222 -- 12.141 11.874 11.831 99
+S875-C 261.8425 -0.323611 -- 11.090 10.815 10.726 99
+S279-F 267.0942 -45.429167 -- 12.432 12.098 12.013 99
+S024-D 274.6925 -80.116111 -- 11.000 10.757 10.681 99
+S071-D 277.0371 -69.434167 -- 12.209 11.896 11.822 99
+S234-E 307.8350 -49.649444 -- 12.424 12.106 12.084 99
+S889-E 330.5238 -1.100556 -- 11.977 11.642 11.574 99
+S893-D 349.5417 0.548889 -- 11.363 11.099 11.033 99
+S677-D 350.8933 -15.351944 -- 11.819 11.575 11.527 99
diff --git a/catalogs/stdstars/HAWKI_UKIRT_2008-10-30.txt b/catalogs/stdstars/HAWKI_UKIRT_2008-10-30.txt
new file mode 100644
index 0000000..0ac0a5b
--- /dev/null
+++ b/catalogs/stdstars/HAWKI_UKIRT_2008-10-30.txt
@@ -0,0 +1,75 @@
+#Star_name RA DEC Spec_type J H K Y
+BRI0021 6.1025 -1.972778 -- 11.754 11.082 10.500 99
+FS102 6.1188 7.816694 G3 11.583 11.273 11.200 99
+FS1 8.4770 -12.132806 DK-G 13.427 13.059 12.984 13.738
+FS2 13.7914 0.720306 F5 10.699 10.495 10.470 99
+S754-C 15.8158 -4.345556 -- 11.008 10.721 10.669 99
+FS3 16.0901 4.226667 sdB 12.649 12.739 12.840 12.506
+FS105 19.7841 7.569861 K1 11.526 11.070 10.961 99
+FS5 28.6444 -6.766778 A0 12.359 12.336 12.349 12.329
+FS4 28.6571 0.716806 F5 10.538 10.304 10.266 99
+FS6 37.5693 5.264194 DA3 13.271 13.321 13.404 13.192
+P530-D 38.3837 6.427222 -- 11.267 10.936 10.878 99
+FS7 44.3384 0.310611 A2 11.076 10.961 10.933 99
+T832-38078 46.0083 0.764444 -- 11.755 11.221 10.844 99
+FS109 48.3507 18.827333 M2V 11.435 10.983 10.813 99
+FS110 55.2593 6.937750 G5 11.703 11.406 11.321 99
+FS112 56.9196 -15.220667 G0 11.182 10.919 10.855 99
+FS10 57.2092 -0.975333 DA2 14.802 14.878 14.990 14.688
+FS114 64.9238 16.756222 M7V 14.373 13.876 13.434 15.139
+FS11 73.2455 -0.244889 A3 11.329 11.264 11.241 11.378
+FS119 75.7393 -1.778500 A2 9.857 9.818 9.810 99
+S840-F 85.6338 0.151111 -- 11.365 11.099 11.019 99
+FS12 88.1153 15.887306 sdO 13.710 13.805 13.899 13.657
+FS13 89.2816 0.019833 G4V 10.471 10.176 10.126 99
+FS120 93.5060 15.166194 M1V 11.299 10.855 10.603 99
+S842-E 95.6821 -0.608333 -- 11.660 11.327 11.233 99
+SA98-653 103.0206 -0.305083 -- 9.428 9.422 9.443 99
+FS121 104.9451 -4.909222 K3 11.984 11.436 11.307 12.464
+FS14 111.0600 -0.551139 O9-B2p 14.128 14.164 14.214 14.091
+RU149D 111.0640 -0.546639 -- 11.444 11.438 11.459 11.402
+P545-C 127.3546 5.935556 -- 11.841 11.585 11.549 12.031
+LHS2026 128.1271 -1.576944 -- 11.990 11.482 11.075 99
+FS15 132.7742 11.729694 G5IV-V 12.722 12.423 12.359 99
+FS123 132.7995 11.755972 B8V 10.126 10.158 10.203 99
+FS16 132.8125 11.822556 G1V 12.968 12.702 12.650 13.197
+FS17 132.8305 11.869556 G4V 12.668 12.363 12.290 99
+FS124 133.5525 -8.084167 M5V 11.467 11.085 10.727 99
+FS126 139.8280 10.931722 K3 12.304 11.772 11.636 99
+S852-C 145.3992 0.553333 -- 11.288 11.004 10.960 99
+S708-D 147.2350 -10.508889 -- 11.034 10.736 10.671 99
+FS19 158.4281 -11.693972 DA2 13.625 13.691 13.789 13.535
+P550-C 158.4658 4.818056 -- 12.293 12.083 12.052 99
+FS128 166.2933 7.113528 M5V 12.985 12.421 12.046 99
+FS20 166.9997 -5.157250 DA3 13.427 13.457 13.509 13.389
+FS129 170.4540 -13.218861 M8V 11.792 11.173 10.639 99
+FS132 185.4140 -0.120361 G1 12.159 11.879 11.835 12.370
+FS33 194.2596 22.031333 DA1 14.085 14.165 14.296 13.929
+S791-C 199.3733 -5.543611 -- 11.605 11.283 11.227 99
+P499-E 211.8913 12.397500 -- 11.893 11.560 11.528 99
+FS135 220.2418 -0.462944 G5 11.965 11.669 11.604 99
+FS136 224.8835 -0.104722 K2 12.531 12.014 11.893 99
+T868-53850 225.1100 -0.658056 -- 11.517 10.988 10.617 99
+T868-110639 227.5708 -2.684722 -- 12.530 11.875 11.306 99
+S870-T 234.7646 0.248333 -- 10.862 10.667 10.632 99
+FS137 246.6780 5.872306 G1 12.140 11.893 11.838 99
+FS140 258.3444 -18.892722 G9 10.775 10.430 10.369 99
+FS141 267.2453 23.295472 G2 11.152 10.853 10.785 99
+FS35 276.8063 4.052611 K0 12.188 11.835 11.741 12.499
+FS143 277.4741 1.224972 -- 16.495 14.269 12.923 19.041
+FS144 277.4871 1.213083 -- 14.997 12.555 11.009 99
+L547 282.8150 -4.267222 -- 11.753 9.890 8.889 99
+S808-C 285.4808 -4.486667 -- 10.925 10.628 10.543 99
+FS148 295.3480 -3.848917 -- 9.437 9.423 9.438 99
+S813-D 310.2713 -5.061944 -- 11.434 11.118 11.053 99
+FS34 310.6447 -20.076333 -- 12.883 12.930 13.000 12.760
+P576-F 313.1971 6.668056 -- 12.215 11.924 11.854 12.473
+FS29 328.1057 2.389083 -- 13.215 13.255 13.330 13.143
+BRI2202 331.4000 -11.074167 -- 11.595 11.085 10.708 99
+FS152 336.8172 19.283111 K1 11.648 11.130 11.048 99
+FS30 340.4363 1.210139 B9 11.936 11.975 12.013 11.891
+FS153 345.6336 -3.981417 K2 11.603 11.029 10.890 99
+FS31 348.0900 10.784472 DA1 13.845 13.961 14.064 13.735
+FS32 349.0515 -1.842944 DAs 13.570 13.663 13.746 13.469
+FS154 349.5420 0.548778 G0 11.373 11.098 11.050 99
+S667-D 350.8933 -15.351944 -- 11.811 11.559 11.537 99
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..c5c79a4
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,140 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the declaration of `pclose', and to 0 if you don't.
+ */
+#undef HAVE_DECL_PCLOSE
+
+/* Define to 1 if you have the declaration of `popen', and to 0 if you don't.
+ */
+#undef HAVE_DECL_POPEN
+
+/* Define to 1 if you have the declaration of `__func__', and to 0 if you
+ don't. */
+#undef HAVE_DECL___FUNC__
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `isinf' function. */
+#undef HAVE_ISINF
+
+/* Define to 1 if you have the `isnan' function. */
+#undef HAVE_ISNAN
+
+/* 1 if GSL present */
+#undef HAVE_LIBGSL
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the `strdup' function */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* HAWKI binary age */
+#undef HAWKI_BINARY_AGE
+
+/* HAWKI binary version number */
+#undef HAWKI_BINARY_VERSION
+
+/* HAWKI interface age */
+#undef HAWKI_INTERFACE_AGE
+
+/* HAWKI major version number */
+#undef HAWKI_MAJOR_VERSION
+
+/* HAWKI micro version number */
+#undef HAWKI_MICRO_VERSION
+
+/* HAWKI minor version number */
+#undef HAWKI_MINOR_VERSION
+
+/* Plugin directory tree prefix */
+#undef HAWKI_PLUGIN_DIR
+
+/* Absolute path to the plugin directory tree */
+#undef HAWKI_PLUGIN_PATH
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+
+#ifndef HAVE_STRDUP
+# define strdup cx_strdup
+#endif
+
diff --git a/configure b/configure
new file mode 100755
index 0000000..58b2a49
--- /dev/null
+++ b/configure
@@ -0,0 +1,16224 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.68 for HAWKI Instrument Pipeline 1.8.9.
+#
+# Report bugs to <usd-help at eso.org>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+ export CONFIG_SHELL
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf at gnu.org and usd-help at eso.org
+$0: about your system, including any error possibly output
+$0: before this message. Then install a modern shell, or
+$0: manually run the script under such a shell if you do
+$0: have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='HAWKI Instrument Pipeline'
+PACKAGE_TARNAME='hawki'
+PACKAGE_VERSION='1.8.9'
+PACKAGE_STRING='HAWKI Instrument Pipeline 1.8.9'
+PACKAGE_BUGREPORT='usd-help at eso.org'
+PACKAGE_URL=''
+
+ac_unique_file="Makefile.am"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+all_ldflags
+all_includes
+LIBIRPLIB
+LIBHAWKI
+HAWKI_LDFLAGS
+HAWKI_INCLUDES
+wkfcopydir
+wkfextradir
+configdir
+pipedocsdir
+privatelibdir
+plugindir
+PURIFY_FALSE
+PURIFY_TRUE
+PURIFY_CMD
+GSL_LIBS
+GSL_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG
+PKG_CONFIG_PATH
+CPL_LDFLAGS
+CPL_INCLUDES
+LIBCPLDFS
+LIBCPLUI
+LIBCPLDRS
+LIBCPLCORE
+LIBCEXT
+CX_LDFLAGS
+CX_INCLUDES
+LIBTOOL_DEPS
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+LIBTOOL
+LATEX
+DOXYGEN
+EGREP
+GREP
+ESO_DEBUG_FLAGS
+OPENMP_CFLAGS
+LN_S
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+LT_AGE
+LT_REVISION
+LT_CURRENT
+HAWKI_BINARY_AGE
+HAWKI_BINARY_VERSION
+HAWKI_INTERFACE_AGE
+HAWKI_MICRO_VERSION
+HAWKI_MINOR_VERSION
+HAWKI_MAJOR_VERSION
+HAWKI_VERSION
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_dependency_tracking
+enable_debug
+enable_strict
+enable_static
+enable_shared
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+with_cpl
+with_cpl_includes
+with_cpl_libs
+enable_cpl_test
+with_cext
+with_cext_includes
+with_cext_libs
+enable_cext_test
+with_gsl
+enable_purify
+with_extra_includes
+with_extra_libs
+with_dmalloc
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+DOXYGEN
+LATEX
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+GSL_CFLAGS
+GSL_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used" >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures HAWKI Instrument Pipeline 1.8.9 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/hawki]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of HAWKI Instrument Pipeline 1.8.9:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-debug creates debugging code [[default=no]]
+ --enable-strict compiles with strict compiler options (may not
+ work!) [[default=no]]
+ --enable-static[=PKGS] build static libraries [default=no]
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --disable-cpl-test disables checks for the CPL library and headers
+ --disable-cext-test disables checks for the libcext library and headers
+ --disable-purify disalbes the check for the PURIFY installation
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-sysroot=DIR Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).
+ --with-cpl location where CPL is installed
+ --with-cpl-includes location of the CPL header files
+ --with-cpl-libs location of the CPL library
+ --with-cext location where libcext is installed
+ --with-cext-includes location of the libcext header files
+ --with-cext-libs location of the libcext library
+ --with-gsl location where gsl is installed
+ --with-extra-includes=DIR
+ adds non standard include paths
+ --with-extra-libs=DIR adds non standard library paths
+ --with-dmalloc use dmalloc, as in
+ http://www.dmalloc.com/dmalloc.tar.gz
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ DOXYGEN doxygen command
+ LATEX latex command
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ GSL_CFLAGS C compiler flags for GSL, overriding pkg-config
+ GSL_LIBS linker flags for GSL, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <usd-help at eso.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+HAWKI Instrument Pipeline configure 1.8.9
+generated by GNU Autoconf 2.68
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------- ##
+## Report this to usd-help at eso.org ##
+## ------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by HAWKI Instrument Pipeline $as_me 1.8.9, which was
+generated by GNU Autoconf 2.68. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in admin "$srcdir"/admin; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in admin \"$srcdir\"/admin" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+am__api_version='1.11'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='hawki'
+ VERSION='1.8.9'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+
+# Immediately before every release do:
+#-------------------------------------
+# if (the interface is totally unchanged from previous release)
+# REVISION++;
+# else {
+# /* interfaces have been added, removed or changed */
+# REVISION = 0;
+# CURRENT++;
+# if (any interfaces have been _added_ since last release)
+# AGE++;
+# if (any interfaces have been _removed_ or incompatibly changed)
+# AGE = 0;
+# }
+
+
+ hawki_version=`echo "$VERSION" | sed -e 's/[a-z,A-Z].*$//'`
+
+ hawki_major_version=`echo "$hawki_version" | \
+ sed 's/\([0-9]*\).\(.*\)/\1/'`
+ hawki_minor_version=`echo "$hawki_version" | \
+ sed 's/\([0-9]*\).\([0-9]*\)\(.*\)/\2/'`
+ hawki_micro_version=`echo "$hawki_version" | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+
+ if test -z "$hawki_major_version"; then hawki_major_version=0
+ fi
+
+ if test -z "$hawki_minor_version"; then hawki_minor_version=0
+ fi
+
+ if test -z "$hawki_micro_version"; then hawki_micro_version=0
+ fi
+
+ HAWKI_VERSION="$hawki_version"
+ HAWKI_MAJOR_VERSION=$hawki_major_version
+ HAWKI_MINOR_VERSION=$hawki_minor_version
+ HAWKI_MICRO_VERSION=$hawki_micro_version
+
+ if test -z ""; then HAWKI_INTERFACE_AGE=0
+ else HAWKI_INTERFACE_AGE=""
+ fi
+
+ HAWKI_BINARY_AGE=`expr 100 '*' $HAWKI_MINOR_VERSION + $HAWKI_MICRO_VERSION`
+ HAWKI_BINARY_VERSION=`expr 10000 '*' $HAWKI_MAJOR_VERSION + \
+ $HAWKI_BINARY_AGE`
+
+
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_MAJOR_VERSION $HAWKI_MAJOR_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_MINOR_VERSION $HAWKI_MINOR_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_MICRO_VERSION $HAWKI_MICRO_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_INTERFACE_AGE $HAWKI_INTERFACE_AGE
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_BINARY_VERSION $HAWKI_BINARY_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_BINARY_AGE $HAWKI_BINARY_AGE
+_ACEOF
+
+
+
+
+ if test -z ""; then
+ LT_CURRENT=0
+ else
+ LT_CURRENT=""
+ fi
+
+ if test -z ""; then
+ LT_REVISION=0
+ else
+ LT_REVISION=""
+ fi
+
+ if test -z ""; then
+ LT_AGE=0
+ else
+ LT_AGE=""
+ fi
+
+
+
+
+
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
+else
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+
+#Check for OPENMP
+
+
+ OPENMP_CFLAGS=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the compiler option to support OpenMP" >&5
+$as_echo_n "checking for the compiler option to support OpenMP... " >&6; }
+if ${ac_cv_prog_c_openmp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_prog_c_openmp='none needed'
+else
+ ac_cv_prog_c_openmp='unsupported'
+ for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
+ ac_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $ac_option"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_prog_c_openmp=$ac_option
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$ac_save_CFLAGS
+ if test "$ac_cv_prog_c_openmp" != unsupported; then
+ break
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_c_openmp" >&5
+$as_echo "$ac_cv_prog_c_openmp" >&6; }
+ case $ac_cv_prog_c_openmp in #(
+ "none needed" | unsupported)
+ ;; #(
+ *)
+ OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;;
+ esac
+
+
+
+ if test -n "$OPENMP_CFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing omp_get_num_threads" >&5
+$as_echo_n "checking for library containing omp_get_num_threads... " >&6; }
+if ${ac_cv_search_omp_get_num_threads+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char omp_get_num_threads ();
+int
+main ()
+{
+return omp_get_num_threads ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' gomp mtsk omp; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_omp_get_num_threads=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_omp_get_num_threads+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_omp_get_num_threads+:} false; then :
+
+else
+ ac_cv_search_omp_get_num_threads=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_omp_get_num_threads" >&5
+$as_echo "$ac_cv_search_omp_get_num_threads" >&6; }
+ac_res=$ac_cv_search_omp_get_num_threads
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+ as_fn_error $? "OpenMP runtime environment not found!" "$LINENO" 5
+fi
+
+ fi
+
+
+
+
+
+
+ # Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+ enableval=$enable_debug; eso_enable_debug=$enableval
+else
+ eso_enable_debug=no
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether debugging code should be created" >&5
+$as_echo_n "checking whether debugging code should be created... " >&6; }
+if ${eso_cv_enable_debug+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eso_cv_enable_debug=$eso_enable_debug
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_debug" >&5
+$as_echo "$eso_cv_enable_debug" >&6; }
+
+ if test x"$eso_cv_enable_debug" = xyes; then
+
+ eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[0-9]//g' \
+ -e 's/-g[0-9]//g' \
+ -e 's/-g[a-z,A-Z]* / /g' \
+ -e 's/-[Og]//g'`"
+
+
+
+
+ flag=`echo g3 | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g3" >&5
+$as_echo_n "checking whether $CC supports -g3... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -g3 -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -g3 -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -g3"
+ else
+ :
+
+ fi
+
+
+ if test x"$eso_cv_prog_cc_g3" = xyes; then
+ CFLAGS="-g3"
+ else
+ if test x"$ac_cv_prog_cc_g" = xyes; then
+ CFLAGS="-g"
+ else
+ CFLAGS=""
+ fi
+ fi
+
+
+
+
+ flag=`echo ggdb | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -ggdb" >&5
+$as_echo_n "checking whether $CC supports -ggdb... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -ggdb -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -ggdb -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -ggdb"
+ else
+ :
+
+ fi
+
+
+
+
+ flag=`echo O0 | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O0" >&5
+$as_echo_n "checking whether $CC supports -O0... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -O0 -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -O0 -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -O0"
+ else
+ :
+
+ fi
+
+
+
+
+ flag=`echo rdynamic | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -rdynamic" >&5
+$as_echo_n "checking whether $CC supports -rdynamic... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -rdynamic -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -rdynamic -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -rdynamic"
+ else
+ :
+
+ fi
+
+
+
+
+ flag=`echo Wall | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5
+$as_echo_n "checking whether $CC supports -Wall... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -Wall -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -Wall -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -Wall"
+ else
+ :
+
+ fi
+
+
+
+
+ flag=`echo W | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5
+$as_echo_n "checking whether $CC supports -W... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -W -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -W -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -W"
+ else
+ :
+
+ fi
+
+
+ CFLAGS="$CFLAGS $eso_clean_CFLAGS"
+ ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG"
+ else
+ ESO_DEBUG_FLAGS="-DNDEBUG"
+ fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+
+
+
+ # Check whether --enable-strict was given.
+if test "${enable_strict+set}" = set; then :
+ enableval=$enable_strict; eso_enable_strict=$enableval
+else
+ eso_enable_strict=no
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strict compiler options should be used" >&5
+$as_echo_n "checking whether strict compiler options should be used... " >&6; }
+if ${eso_cv_enable_strict+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eso_cv_enable_strict=$eso_enable_strict
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_strict" >&5
+$as_echo "$eso_cv_enable_strict" >&6; }
+
+
+ if test x"$eso_cv_enable_strict" = xyes; then
+
+ eso_enable_strict_std_set=no
+
+ if test -n "$CFLAGS"; then
+ echo $CFLAGS | $EGREP '(\-std=|-ansi)' >/dev/null 2>&1
+ if test x"$?" = x0; then
+ eso_enable_strict_std_set=yes
+ fi
+ fi
+
+ if test x"$eso_enable_strict_std_set" = xno; then
+
+
+
+ flag=`echo std=c99 | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5
+$as_echo_n "checking whether $CC supports -std=c99... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -std=c99 -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -std=c99 -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -std=c99"
+ else
+ :
+
+ fi
+
+ fi
+
+
+
+
+ flag=`echo pedantic | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pedantic" >&5
+$as_echo_n "checking whether $CC supports -pedantic... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -pedantic -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -pedantic -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -pedantic"
+ else
+ :
+
+ fi
+
+
+ fi
+
+
+
+
+ flag=`echo fno-builtin | sed 'y%.=/+-%___p_%'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-builtin" >&5
+$as_echo_n "checking whether $CC supports -fno-builtin... " >&6; }
+if eval \${eso_cv_prog_cc_$flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eval "eso_cv_prog_cc_$flag=no"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -fno-builtin -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -fno-builtin -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+eval ac_res=\$eso_cv_prog_cc_$flag
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ CFLAGS="$CFLAGS -fno-builtin"
+ else
+ :
+
+ fi
+
+
+
+
+ # Extract the first word of "doxygen", so it can be a program name with args.
+set dummy doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DOXYGEN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DOXYGEN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DOXYGEN=$ac_cv_path_DOXYGEN
+if test -n "$DOXYGEN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5
+$as_echo "$DOXYGEN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+ # Extract the first word of "latex", so it can be a program name with args.
+set dummy latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LATEX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $LATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_LATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+LATEX=$ac_cv_path_LATEX
+if test -n "$LATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LATEX" >&5
+$as_echo "$LATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+ if test -z "${DOXYGEN}"; then
+ DOXYGEN=":"
+ fi
+
+ if test -z "${LATEX}"; then
+ LATEX=":"
+ fi
+
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=no
+fi
+
+
+
+
+
+
+
+
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4'
+macro_revision='1.3293'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in ar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AR" && break
+ done
+fi
+if test -z "$AR"; then
+ ac_ct_AR=$AR
+ for ac_prog in ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_AR" && break
+done
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ar_at_file=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+ withval=$with_sysroot;
+else
+ with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+ ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MANIFEST_TOOL"; then
+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+ # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_MANIFEST_TOOL"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
+ MANIFEST_TOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+ fi
+else
+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&5
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ echo "$RANLIB libconftest.a" >&5
+ $RANLIB libconftest.a 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+ enable_win32_dll=no
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ lt_prog_compiler_pic='-Xcompiler -fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ lt_prog_compiler_wl='-Wl,-Wl,,'
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ file_list_spec='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ old_postinstall_cmds='chmod 644 $oldlib'
+ postlink_cmds='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ enable_shared_with_static_runtimes=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_irix_exported_symbol=yes
+else
+ lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Add ABI-specific directories to the system library path.
+ sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+# Checks for libraries.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
+$as_echo_n "checking for pow in -lm... " >&6; }
+if ${ac_cv_lib_m_pow+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pow ();
+int
+main ()
+{
+return pow ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_pow=yes
+else
+ ac_cv_lib_m_pow=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5
+$as_echo "$ac_cv_lib_m_pow" >&6; }
+if test "x$ac_cv_lib_m_pow" = xyes; then :
+ LIBS="$LIBS -lm"
+fi
+
+
+# Checks for header files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+for ac_header in string.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"
+if test "x$ac_cv_header_string_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STRING_H 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+
+# Checks for library functions.
+for ac_func in floor pow sqrt isinf isnan
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "#include <string.h>
+"
+if test "x$ac_cv_have_decl_strdup" = xyes; then :
+
+fi
+
+
+ eso_save_CFLAGS="$CFLAGS"
+
+ if test x"$GCC" = xyes; then
+ CFLAGS="$CFLAGS -pedantic-errors"
+ fi
+
+ ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
+if test "x$ac_cv_func_strdup" = xyes; then :
+
+fi
+
+
+ CFLAGS="$eso_save_CFLAGS"
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ if test x"$ac_cv_have_decl_strdup" = xyes &&
+ test x"$ac_cv_func_strdup" = xyes; then
+ $as_echo "#define HAVE_STRDUP 1" >>confdefs.h
+
+ fi
+
+
+
+
+
+
+# Check for __func__
+ac_fn_c_check_decl "$LINENO" "__func__" "ac_cv_have_decl___func__" "$ac_includes_default"
+if test "x$ac_cv_have_decl___func__" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL___FUNC__ $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "popen" "ac_cv_have_decl_popen" "$ac_includes_default"
+if test "x$ac_cv_have_decl_popen" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_POPEN $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "pclose" "ac_cv_have_decl_pclose" "$ac_includes_default"
+if test "x$ac_cv_have_decl_pclose" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PCLOSE $ac_have_decl
+_ACEOF
+
+
+# Check for CPL presence and usability
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CPL" >&5
+$as_echo_n "checking for CPL... " >&6; }
+
+ cpl_check_cpl_header="cpl.h"
+ cpl_check_cpl_lib="libcplcore.a"
+
+ cpl_incdirs=""
+ cpl_libdirs=""
+ cpl_includes=""
+ cpl_libraries=""
+
+
+# Check whether --with-cpl was given.
+if test "${with_cpl+set}" = set; then :
+ withval=$with_cpl;
+ cpl_with_cpl=$withval
+
+fi
+
+
+
+# Check whether --with-cpl-includes was given.
+if test "${with_cpl_includes+set}" = set; then :
+ withval=$with_cpl_includes; cpl_with_cpl_includes=$withval
+fi
+
+
+
+# Check whether --with-cpl-libs was given.
+if test "${with_cpl_libs+set}" = set; then :
+ withval=$with_cpl_libs; cpl_with_cpl_libs=$withval
+fi
+
+
+ # Check whether --enable-cpl-test was given.
+if test "${enable_cpl_test+set}" = set; then :
+ enableval=$enable_cpl_test; cpl_enable_cpl_test=$enableval
+else
+ cpl_enable_cpl_test=yes
+fi
+
+
+
+ if test "x$cpl_enable_cpl_test" = xyes; then
+
+ # Check for the CPL includes
+
+ if test -z "$cpl_with_cpl_includes"; then
+
+ if test -z "$cpl_with_cpl"; then
+
+ # Try some known system locations
+
+ cpl_incdirs="/opt/cpl/include"
+ cpl_incdirs="$cpl_incdirs /usr/local/include"
+ cpl_incdirs="$cpl_incdirs /usr/include"
+
+ test -n "$CPLDIR" && \
+ cpl_incdirs="$CPLDIR/include \
+ $cpl_incdirs"
+
+ else
+
+ cpl_incdirs="$cpl_with_cpl/include"
+
+ fi
+
+ else
+ cpl_incdirs="$cpl_with_cpl_includes"
+ fi
+
+
+ cpl_includes=no
+
+ for i in $cpl_incdirs; do
+ for j in $cpl_check_cpl_header; do
+
+ echo "configure: 12889: $i/$j" >&5
+
+ if test -r "$i/$j"; then
+ echo "taking that" >&5
+ cpl_includes=$i
+ break 2
+ fi
+ done
+ done
+
+
+
+ # Check for the CPL libraries
+
+ if test -z "$cpl_with_cpl_libs"; then
+
+ if test -z "$cpl_with_cpl"; then
+
+ # Try some known system locations
+
+ cpl_libdirs="/opt/cpl/lib"
+ cpl_libdirs="$cpl_libdirs /usr/local/lib64"
+ cpl_libdirs="$cpl_libdirs /usr/local/lib"
+ cpl_libdirs="$cpl_libdirs /usr/local/lib32"
+ cpl_libdirs="$cpl_libdirs /usr/lib64"
+ cpl_libdirs="$cpl_libdirs /usr/lib"
+ cpl_libdirs="$cpl_libdirs /usr/lib32"
+
+ test -n "$CPLDIR" && \
+ cpl_libdirs="$CPLDIR/lib64 $CPLDIR/lib $CPLDIR/lib32 \
+ $cpl_libdirs"
+
+ else
+
+ cpl_libdirs="$cpl_with_cpl/lib64"
+ cpl_libdirs="$cpl_libdirs $cpl_with_cpl/lib"
+ cpl_libdirs="$cpl_libdirs $cpl_with_cpl/lib32"
+
+ fi
+
+ else
+ cpl_libdirs="$cpl_with_cpl_libs"
+ fi
+
+
+ cpl_libraries=no
+
+ for i in $cpl_libdirs; do
+ for j in $cpl_check_cpl_lib; do
+
+ echo "configure: 12939: $i/$j" >&5
+
+ if test -r "$i/$j"; then
+ echo "taking that" >&5
+ cpl_libraries=$i
+ break 2
+ fi
+ done
+ done
+
+
+
+ if test x"$cpl_includes" = xno || test x"$cpl_libraries" = xno; then
+ cpl_notfound=""
+
+ if test x"$cpl_includes" = xno; then
+ if test x"$cpl_libraries" = xno; then
+ cpl_notfound="(headers and libraries)"
+ else
+ cpl_notfound="(headers)"
+ fi
+ else
+ cpl_notfound="(libraries)"
+ fi
+
+ as_fn_error $? "CPL $cpl_notfound was not found on your system. Please check!" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_libraries, headers $cpl_includes" >&5
+$as_echo "libraries $cpl_libraries, headers $cpl_includes" >&6; }
+ fi
+
+ # The libcext headers are required. By default it part of the
+ # CPL installation and it is assumed that the cext headers are
+ # present in the same location as the CPL headers
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcext" >&5
+$as_echo_n "checking for libcext... " >&6; }
+
+ cpl_cext_check_header="cxtypes.h"
+ cpl_cext_check_lib="libcext.a"
+
+ cpl_cext_incdirs=""
+ cpl_cext_libdirs=""
+
+ cpl_cext_includes=""
+ cpl_cext_libraries=""
+
+
+ # Initialize directory search paths with the arguments provided
+
+ if test -n "$cpl_includes"; then
+ cpl_cext_incdirs="$cpl_includes"
+ fi
+
+ if test -n "$cpl_libraries"; then
+ cpl_cext_libdirs="$cpl_libraries"
+ fi
+
+
+
+# Check whether --with-cext was given.
+if test "${with_cext+set}" = set; then :
+ withval=$with_cext;
+ cpl_with_cext=$withval
+
+fi
+
+
+
+# Check whether --with-cext-includes was given.
+if test "${with_cext_includes+set}" = set; then :
+ withval=$with_cext_includes; cpl_with_cext_includes=$withval
+fi
+
+
+
+# Check whether --with-cext-libs was given.
+if test "${with_cext_libs+set}" = set; then :
+ withval=$with_cext_libs; cpl_with_cext_libs=$withval
+fi
+
+
+ # Check whether --enable-cext-test was given.
+if test "${enable_cext_test+set}" = set; then :
+ enableval=$enable_cext_test; cpl_enable_cext_test=$enableval
+else
+ cpl_enable_cext_test=yes
+fi
+
+
+
+ if test "x$cpl_enable_cext_test" = xyes; then
+
+ # Check for the libcext includes
+
+ if test -z "$cpl_with_cext_includes"; then
+
+ if test -z "$cpl_with_cext"; then
+
+ if test -z "$cpl_cext_incdirs"; then
+
+ # Try some known system locations
+
+ cpl_cext_incdirs="/opt/cext/include"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include/cext"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/include/cext"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/include"
+
+ test -n "$CPLDIR" && \
+ cpl_cext_incdirs="$CPLDIR/include/cext \
+ $CPLDIR/include \
+ $cpl_cext_incdirs"
+
+ fi
+
+ else
+
+ cpl_cext_incdirs="$cpl_with_cext/include/cext"
+ cpl_cext_incdirs="$cpl_cext_incdirs $cpl_with_cext/include"
+
+ fi
+
+ else
+ cpl_cext_incdirs="$cpl_with_cext_includes"
+ fi
+
+
+ cpl_cext_includes=no
+
+ for i in $cpl_cext_incdirs; do
+ for j in $cpl_cext_check_header; do
+
+ echo "configure: 13074: $i/$j" >&5
+
+ if test -r "$i/$j"; then
+ echo "taking that" >&5
+ cpl_cext_includes=$i
+ break 2
+ fi
+ done
+ done
+
+
+
+ # Check for the libcext library
+
+ if test -z "$cpl_with_cext_libs"; then
+
+ if test -z "$cpl_with_cext"; then
+
+ if test -z "$cpl_cext_libdirs"; then
+
+ # Try some known system locations
+
+ cpl_cext_libdirs="/opt/cext/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib64"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib32"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib64"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib32"
+
+ test -n "$CPLDIR" && \
+ cpl_cext_libdirs="$CPLDIR/lib64 \
+ $CPLDIR/lib \
+ $CPLDIR/lib32 \
+ $cpl_cext_libdirs"
+
+ fi
+
+ else
+
+ cpl_cext_libdirs="$cpl_with_cext/lib64"
+ cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib32"
+
+ fi
+
+ else
+ cpl_cext_libdirs="$cpl_with_cext_libs"
+ fi
+
+
+ cpl_cext_libraries=no
+
+ for i in $cpl_cext_libdirs; do
+ for j in $cpl_cext_check_lib; do
+
+ echo "configure: 13130: $i/$j" >&5
+
+ if test -r "$i/$j"; then
+ echo "taking that" >&5
+ cpl_cext_libraries=$i
+ break 2
+ fi
+ done
+ done
+
+
+
+ if test x"$cpl_cext_includes" = xno || \
+ test x"$cpl_cext_libraries" = xno; then
+ cpl_cext_notfound=""
+
+ if test x"$cpl_cext_includes" = xno; then
+ if test x"$cpl_cext_libraries" = xno; then
+ cpl_cext_notfound="(headers and libraries)"
+ else
+ cpl_cext_notfound="(headers)"
+ fi
+ else
+ cpl_cext_notfound="(libraries)"
+ fi
+
+ as_fn_error $? "libcext $cpl_cext_notfound was not found on your system. Please check!" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_cext_libraries, headers $cpl_cext_includes" >&5
+$as_echo "libraries $cpl_cext_libraries, headers $cpl_cext_includes" >&6; }
+ fi
+
+
+ # Set up the symbols
+
+ CX_INCLUDES="-I$cpl_cext_includes"
+ CX_LDFLAGS="-L$cpl_cext_libraries"
+ LIBCEXT="-lcext"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcext can be used" >&5
+$as_echo_n "checking whether libcext can be used... " >&6; }
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ cpl_cext_cflags_save="$CFLAGS"
+ cpl_cext_ldflags_save="$LDFLAGS"
+ cpl_cext_libs_save="$LIBS"
+
+ CFLAGS="$CX_INCLUDES $CFLAGS"
+ LDFLAGS="$CX_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCEXT"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <cxutils.h>
+
+int
+main ()
+{
+
+ cx_program_set_name("MyProgram");
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ cpl_cext_is_usable="yes"
+else
+ cpl_cext_is_usable="no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cext_is_usable" >&5
+$as_echo "$cpl_cext_is_usable" >&6; }
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ CFLAGS="$cpl_cext_cflags_save"
+ LDFLAGS="$cpl_cext_ldflags_save"
+ LIBS="$cpl_cext_libs_save"
+
+ if test x"$cpl_cext_is_usable" = xno; then
+ as_fn_error $? "Linking with libcext failed! Please check architecture!" "$LINENO" 5
+ fi
+
+ else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcext checks have been disabled! This package may not build!" >&5
+$as_echo "$as_me: WARNING: libcext checks have been disabled! This package may not build!" >&2;}
+ CX_INCLUDES=""
+ CX_LDFLAGS=""
+ LIBCEXT=""
+
+ fi
+
+
+
+
+
+
+
+
+ # Set up the symbols
+
+ CPL_INCLUDES="-I$cpl_includes $CX_INCLUDES $CFITSIO_INCLUDES"
+ CPL_LDFLAGS="-L$cpl_libraries $CX_LDFLAGS $CFITSIO_LDFLAGS"
+
+
+ if test -z ""; then
+ LIBCPLCORE='-lcplcore'
+ LIBCPLDRS='-lcpldrs'
+ LIBCPLUI='-lcplui'
+ LIBCPLDFS='-lcpldfs'
+ else
+ LIBCPLCORE='$(top_builddir)/cplcore/libcplcore.la'
+ LIBCPLDRS='$(top_builddir)/cpldrs/libcpldrs.la'
+ LIBCPLUI='$(top_builddir)/cplui/libcplui.la'
+ LIBCPLDFS='$(top_builddir)/cpldfs/libcpldfs.la'
+ fi
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CPL can be used" >&5
+$as_echo_n "checking whether CPL can be used... " >&6; }
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ cpl_cflags_save="$CFLAGS"
+ cpl_ldflags_save="$LDFLAGS"
+ cpl_libs_save="$LIBS"
+
+ CFLAGS="$CPL_INCLUDES $CFLAGS"
+ LDFLAGS="$CPL_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCPLCORE $LIBCEXT $LIBS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <cpl.h>
+
+int
+main ()
+{
+
+ cpl_init(CPL_INIT_DEFAULT);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ cpl_is_usable="yes"
+else
+ cpl_is_usable="no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_is_usable" >&5
+$as_echo "$cpl_is_usable" >&6; }
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ CFLAGS="$cpl_cflags_save"
+ LDFLAGS="$cpl_ldflags_save"
+ LIBS="$cpl_libs_save"
+
+ if test x"$cpl_is_usable" = xno; then
+ as_fn_error $? "Linking with CPL failed! Please check architecture!" "$LINENO" 5
+ fi
+
+ else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CPL checks have been disabled! This package may not build!" >&5
+$as_echo "$as_me: WARNING: CPL checks have been disabled! This package may not build!" >&2;}
+ CPL_INCLUDES=""
+ CPL_LDFLAGS=""
+ LIBCPLCORE=""
+ LIBCPLDRS=""
+ LIBCPLUI=""
+ LIBCPLDFS=""
+
+ fi
+
+
+
+
+
+
+
+
+
+
+# Check for GSL
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gsl" >&5
+$as_echo_n "checking for gsl... " >&6; }
+
+
+# Check whether --with-gsl was given.
+if test "${with_gsl+set}" = set; then :
+ withval=$with_gsl;
+ cpl_gsl_dir=$withval
+
+fi
+
+
+ export PKG_CONFIG_PATH="$cpl_gsl_dir/lib/pkgconfig:$GSLDIR/lib/pkgconfig/:$PKG_CONFIG_PATH"
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GSL" >&5
+$as_echo_n "checking for GSL... " >&6; }
+
+if test -n "$GSL_CFLAGS"; then
+ pkg_cv_GSL_CFLAGS="$GSL_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gsl\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "gsl") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_GSL_CFLAGS=`$PKG_CONFIG --cflags "gsl" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$GSL_LIBS"; then
+ pkg_cv_GSL_LIBS="$GSL_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gsl\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "gsl") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_GSL_LIBS=`$PKG_CONFIG --libs "gsl" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ GSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gsl" 2>&1`
+ else
+ GSL_PKG_ERRORS=`$PKG_CONFIG --print-errors "gsl" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$GSL_PKG_ERRORS" >&5
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No GSL available" >&5
+$as_echo "$as_me: WARNING: No GSL available" >&2;}
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No GSL available" >&5
+$as_echo "$as_me: WARNING: No GSL available" >&2;}
+else
+ GSL_CFLAGS=$pkg_cv_GSL_CFLAGS
+ GSL_LIBS=$pkg_cv_GSL_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_LIBGSL 1" >>confdefs.h
+
+fi
+
+
+#AC_CHECK_LIB([gslcblas],[cblas_dgemm])
+#AC_CHECK_LIB([gsl],[gsl_blas_dgemm])
+
+# Check for purify
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PURIFY" >&5
+$as_echo_n "checking for PURIFY... " >&6; }
+
+ # Check whether --enable-purify was given.
+if test "${enable_purify+set}" = set; then :
+ enableval=$enable_purify; enable_purify=$enableval
+else
+ enable_purify=yes
+fi
+
+
+ if test "x$enable_purify" = xyes ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5
+$as_echo "enabled" >&6; }
+ # Extract the first word of "purify", so it can be a program name with args.
+set dummy purify; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PURIFY_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PURIFY_CMD"; then
+ ac_cv_prog_PURIFY_CMD="$PURIFY_CMD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_PURIFY_CMD="purify"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_prog_PURIFY_CMD" && ac_cv_prog_PURIFY_CMD="NONE"
+fi
+fi
+PURIFY_CMD=$ac_cv_prog_PURIFY_CMD
+if test -n "$PURIFY_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PURIFY_CMD" >&5
+$as_echo "$PURIFY_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "$PURIFY_CMD" = "NONE" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling purify support" >&5
+$as_echo "$as_me: WARNING: Disabling purify support" >&2;}
+ enable_purify=no
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+ fi
+
+ if test "x$enable_purify" = "xyes"; then
+ PURIFY_TRUE=
+ PURIFY_FALSE='#'
+else
+ PURIFY_TRUE='#'
+ PURIFY_FALSE=
+fi
+
+
+
+
+ if test -z "$plugindir"; then
+ plugindir='${libdir}/esopipes-plugins/${PACKAGE}-${VERSION}'
+ fi
+
+ if test -z "$privatelibdir"; then
+ privatelibdir='${libdir}/${PACKAGE}-${VERSION}'
+ fi
+
+ if test -z "$pipedocsdir"; then
+ pipedocsdir='${datadir}/doc/esopipes/${PACKAGE}-${VERSION}/'
+ fi
+
+ htmldir='${pipedocsdir}/html'
+
+ if test -z "$configdir"; then
+ configdir='${datadir}/${PACKAGE}/config'
+ fi
+
+ if test -z "$wkfextradir"; then
+ wkfextradir='${datadir}/esopipes/${PACKAGE}-${VERSION}/reflex'
+ fi
+
+ if test -z "$wkfcopydir"; then
+ wkfcopydir='${datadir}/reflex/workflows/${PACKAGE}-${VERSION}'
+ fi
+
+
+
+
+
+
+
+
+
+
+ # Define a preprocesor symbol for the plugin search paths
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_PLUGIN_DIR "esopipes-plugins"
+_ACEOF
+
+
+ eval plugin_dir="$plugindir"
+ plugin_path=`eval echo $plugin_dir | \
+ sed -e "s/\/${PACKAGE}-${VERSION}.*$//"`
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAWKI_PLUGIN_PATH "$plugin_path"
+_ACEOF
+
+
+
+
+
+
+# Check whether --with-extra-includes was given.
+if test "${with_extra_includes+set}" = set; then :
+ withval=$with_extra_includes; eso_with_extra_includes=$withval
+else
+ eso_with_extra_includes=NONE
+fi
+
+
+
+# Check whether --with-extra-libs was given.
+if test "${with_extra_libs+set}" = set; then :
+ withval=$with_extra_libs; eso_with_extra_libs=$withval
+else
+ eso_with_extra_libs=NONE
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra includes" >&5
+$as_echo_n "checking for extra includes... " >&6; }
+ if ${eso_cv_with_extra_includes+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eso_cv_with_extra_includes=$eso_with_extra_includes
+
+fi
+
+
+ if test x"$eso_cv_with_extra_includes" != xNONE; then
+ eso_save_IFS=$IFS
+ IFS=':'
+
+ for dir in $eso_cv_with_extra_includes; do
+ EXTRA_INCLUDES="$EXTRA_INCLUDES -I$dir"
+ done
+
+ IFS=$eso_save_IFS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: added" >&5
+$as_echo "added" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra libs" >&5
+$as_echo_n "checking for extra libs... " >&6; }
+ if ${eso_cv_with_extra_libs+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ eso_cv_with_extra_libs=$eso_with_extra_libs
+
+fi
+
+
+ if test x"$eso_cv_with_extra_libs" != xNONE; then
+ eso_save_IFS=$IFS
+ IFS=':'
+
+ for dir in $eso_cv_with_extra_libs; do
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$dir"
+ done
+
+ IFS=$eso_save_IFS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: added" >&5
+$as_echo "added" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+
+
+
+
+ # Symbols for package include file and library search paths
+
+ HAWKI_INCLUDES='-I$(top_srcdir)/hawki -I$(top_srcdir)/irplib'
+ HAWKI_LDFLAGS='-L$(top_builddir)/hawki'
+
+ all_includes='$(HAWKI_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(HAWKI_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
+
+ # Library aliases
+
+ LIBHAWKI='$(top_builddir)/hawki/libhawki.la'
+ LIBIRPLIB='$(top_builddir)/irplib/libirplib.la'
+
+ # Substitute the defined symbols
+
+
+
+
+
+
+
+ # Check for CPL and user defined libraries
+
+
+
+ all_includes='$(HAWKI_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(HAWKI_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if malloc debugging is wanted" >&5
+$as_echo_n "checking if malloc debugging is wanted... " >&6; }
+
+# Check whether --with-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then :
+ withval=$with_dmalloc; if test "$withval" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define WITH_DMALLOC 1" >>confdefs.h
+
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+ac_config_files="$ac_config_files Makefile Makefile.purify doxygen/Doxyfile hawki/Makefile irplib/Makefile irplib/tests/Makefile recipes/Makefile tests/Makefile reflex/Makefile reflex/Hawki_Calib_Science.xml regtests/Makefile regtests/tests/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${PURIFY_TRUE}" && test -z "${PURIFY_FALSE}"; then
+ as_fn_error $? "conditional \"PURIFY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by HAWKI Instrument Pipeline $as_me 1.8.9, which was
+generated by GNU Autoconf 2.68. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <usd-help at eso.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+HAWKI Instrument Pipeline config.status 1.8.9
+configured by $0, generated by GNU Autoconf 2.68,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "Makefile.purify") CONFIG_FILES="$CONFIG_FILES Makefile.purify" ;;
+ "doxygen/Doxyfile") CONFIG_FILES="$CONFIG_FILES doxygen/Doxyfile" ;;
+ "hawki/Makefile") CONFIG_FILES="$CONFIG_FILES hawki/Makefile" ;;
+ "irplib/Makefile") CONFIG_FILES="$CONFIG_FILES irplib/Makefile" ;;
+ "irplib/tests/Makefile") CONFIG_FILES="$CONFIG_FILES irplib/tests/Makefile" ;;
+ "recipes/Makefile") CONFIG_FILES="$CONFIG_FILES recipes/Makefile" ;;
+ "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+ "reflex/Makefile") CONFIG_FILES="$CONFIG_FILES reflex/Makefile" ;;
+ "reflex/Hawki_Calib_Science.xml") CONFIG_FILES="$CONFIG_FILES reflex/Hawki_Calib_Science.xml" ;;
+ "regtests/Makefile") CONFIG_FILES="$CONFIG_FILES regtests/Makefile" ;;
+ "regtests/tests/Makefile") CONFIG_FILES="$CONFIG_FILES regtests/tests/Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+# Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ if test x"$xsi_shell" = xyes; then
+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\ # positional parameters, so assign one to ordinary parameter first.\
+\ func_stripname_result=${3}\
+\ func_stripname_result=${func_stripname_result#"${1}"}\
+\ func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\ func_split_long_opt_name=${1%%=*}\
+\ func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\ func_split_short_opt_arg=${1#??}\
+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\ case ${1} in\
+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\ *) func_lo2o_result=${1} ;;\
+\ esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+ func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+ func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+ func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+ eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\ func_quote_for_eval "${2}"\
+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..9e1eda3
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,103 @@
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT([HAWKI Instrument Pipeline], [1.8.9], [usd-help at eso.org], [hawki])
+AC_PREREQ([2.58])
+
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_AUX_DIR([admin])
+
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER([config.h])
+
+AM_MAINTAINER_MODE
+
+
+# Immediately before every release do:
+#-------------------------------------
+# if (the interface is totally unchanged from previous release)
+# REVISION++;
+# else {
+# /* interfaces have been added, removed or changed */
+# REVISION = 0;
+# CURRENT++;
+# if (any interfaces have been _added_ since last release)
+# AGE++;
+# if (any interfaces have been _removed_ or incompatibly changed)
+# AGE = 0;
+# }
+
+HAWKI_SET_VERSION_INFO([$VERSION])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_CPP
+AM_PROG_CC_C_O
+AC_PROG_LN_S
+
+#Check for OPENMP
+CPL_OPENMP
+HAWKI_CHECK_OPENMP_LIBS
+
+ESO_ENABLE_DEBUG(no)
+ESO_ENABLE_STRICT(no)
+ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"])
+
+ESO_CHECK_DOCTOOLS
+
+AC_ENABLE_STATIC(no)
+AC_ENABLE_SHARED(yes)
+
+AC_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+# Checks for libraries.
+AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"])
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([string.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+
+# Checks for library functions.
+AC_CHECK_FUNCS([floor pow sqrt isinf isnan])
+ESO_FUNC_STRDUP
+
+# Check for __func__
+AC_CHECK_DECLS([__func__, popen, pclose])
+
+# Check for CPL presence and usability
+CPL_CHECK_LIBS
+
+# Check for GSL
+CPL_CHECK_GSL
+#AC_CHECK_LIB([gslcblas],[cblas_dgemm])
+#AC_CHECK_LIB([gsl],[gsl_blas_dgemm])
+
+# Check for purify
+CHECK_PURIFY
+
+HAWKI_SET_PATHS
+HAWKI_CREATE_SYMBOLS
+
+AM_WITH_DMALLOC
+
+
+AC_CONFIG_FILES(Makefile
+ Makefile.purify
+ doxygen/Doxyfile
+ hawki/Makefile
+ irplib/Makefile
+ irplib/tests/Makefile
+ recipes/Makefile
+ tests/Makefile
+ reflex/Makefile
+ reflex/Hawki_Calib_Science.xml
+ regtests/Makefile
+ regtests/tests/Makefile)
+AC_OUTPUT
diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in
new file mode 100644
index 0000000..2c020ad
--- /dev/null
+++ b/doxygen/Doxyfile.in
@@ -0,0 +1,1219 @@
+# Doxyfile 1.4.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "HAWKI Pipeline Reference Manual"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = @VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ..
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# This tag can be used to specify the encoding used in the generated output.
+# The encoding is not always determined by the language that is chosen,
+# but also whether or not the output is meant for Windows or non-Windows users.
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
+# forces the Windows encoding (this is the default for the Windows binary),
+# whereas setting the tag to NO uses a Unix-style encoding (the default for
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
+# only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = NO
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = YES
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation.
+
+SHOW_DIRECTORIES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from the
+# version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the progam writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT =
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ../recipes \
+ ../hawki
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
+
+FILE_PATTERNS = *.h \
+ *.c \
+ *.cpp
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = CVS
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS = */CVS/* \
+ */test/* \
+ */tests/* \
+ EXAMPLE_PATH \
+ =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH = .
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 3
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION =
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = NO
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = NO
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that a graph may be further truncated if the graph's
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/hawki/Makefile.am b/hawki/Makefile.am
new file mode 100644
index 0000000..83cdd4a
--- /dev/null
+++ b/hawki/Makefile.am
@@ -0,0 +1,83 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the HAWKI Pipeline
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+#SUBDIRS = tests
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+
+CPPFLAGS = -DCX_LOG_DOMAIN=\"HawkiLib\"
+
+
+#AM_CPPFLAGS = $(GSL_CFLAGS) $(OPENMP_CFLAGS)
+AM_CFLAGS = $(GSL_CFLAGS) $(OPENMP_CFLAGS)
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = hawki_utils.h \
+ hawki_alloc.h \
+ hawki_pfits.h \
+ hawki_dfs.h \
+ hawki_load.h \
+ hawki_save.h \
+ hawki_calib.h \
+ hawki_properties_tel.h \
+ hawki_obj_det.h \
+ hawki_image_stats.h \
+ hawki_bkg.h \
+ hawki_saa.h \
+ hawki_match_cats.h \
+ hawki_mask.h \
+ hawki_combine.h \
+ hawki_distortion.h \
+ hawki_variance.h
+
+pkginclude_HEADERS =
+
+privatelib_LTLIBRARIES = libhawki.la
+
+libhawki_la_SOURCES = hawki_utils.c \
+ hawki_alloc.c \
+ hawki_pfits.c \
+ hawki_dfs.c \
+ hawki_load.c \
+ hawki_save.c \
+ hawki_calib.c \
+ hawki_properties_tel.c \
+ hawki_obj_det.c \
+ hawki_image_stats.c \
+ hawki_bkg.c \
+ hawki_match_cats.c \
+ hawki_mask.c \
+ hawki_saa.c \
+ hawki_combine.c \
+ hawki_distortion.c \
+ hawki_variance.c
+
+libhawki_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+libhawki_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(GSL_LIBS)
+libhawki_la_DEPENDENCIES = $(LIBIRPLIB)
diff --git a/hawki/Makefile.in b/hawki/Makefile.in
new file mode 100644
index 0000000..f613867
--- /dev/null
+++ b/hawki/Makefile.in
@@ -0,0 +1,670 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = hawki
+DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(privatelibdir)" \
+ "$(DESTDIR)$(pkgincludedir)"
+LTLIBRARIES = $(privatelib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am_libhawki_la_OBJECTS = hawki_utils.lo hawki_alloc.lo hawki_pfits.lo \
+ hawki_dfs.lo hawki_load.lo hawki_save.lo hawki_calib.lo \
+ hawki_properties_tel.lo hawki_obj_det.lo hawki_image_stats.lo \
+ hawki_bkg.lo hawki_match_cats.lo hawki_mask.lo hawki_saa.lo \
+ hawki_combine.lo hawki_distortion.lo hawki_variance.lo
+libhawki_la_OBJECTS = $(am_libhawki_la_OBJECTS)
+libhawki_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libhawki_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libhawki_la_SOURCES)
+DIST_SOURCES = $(libhawki_la_SOURCES)
+HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = -DCX_LOG_DOMAIN=\"HawkiLib\"
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+DISTCLEANFILES = *~
+
+#SUBDIRS = tests
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
+
+#AM_CPPFLAGS = $(GSL_CFLAGS) $(OPENMP_CFLAGS)
+AM_CFLAGS = $(GSL_CFLAGS) $(OPENMP_CFLAGS)
+INCLUDES = $(all_includes)
+noinst_HEADERS = hawki_utils.h \
+ hawki_alloc.h \
+ hawki_pfits.h \
+ hawki_dfs.h \
+ hawki_load.h \
+ hawki_save.h \
+ hawki_calib.h \
+ hawki_properties_tel.h \
+ hawki_obj_det.h \
+ hawki_image_stats.h \
+ hawki_bkg.h \
+ hawki_saa.h \
+ hawki_match_cats.h \
+ hawki_mask.h \
+ hawki_combine.h \
+ hawki_distortion.h \
+ hawki_variance.h
+
+pkginclude_HEADERS =
+privatelib_LTLIBRARIES = libhawki.la
+libhawki_la_SOURCES = hawki_utils.c \
+ hawki_alloc.c \
+ hawki_pfits.c \
+ hawki_dfs.c \
+ hawki_load.c \
+ hawki_save.c \
+ hawki_calib.c \
+ hawki_properties_tel.c \
+ hawki_obj_det.c \
+ hawki_image_stats.c \
+ hawki_bkg.c \
+ hawki_match_cats.c \
+ hawki_mask.c \
+ hawki_saa.c \
+ hawki_combine.c \
+ hawki_distortion.c \
+ hawki_variance.c
+
+libhawki_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+libhawki_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(GSL_LIBS)
+libhawki_la_DEPENDENCIES = $(LIBIRPLIB)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hawki/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hawki/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-privatelibLTLIBRARIES: $(privatelib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(privatelibdir)" || $(MKDIR_P) "$(DESTDIR)$(privatelibdir)"
+ @list='$(privatelib_LTLIBRARIES)'; test -n "$(privatelibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(privatelibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(privatelibdir)"; \
+ }
+
+uninstall-privatelibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(privatelib_LTLIBRARIES)'; test -n "$(privatelibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(privatelibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(privatelibdir)/$$f"; \
+ done
+
+clean-privatelibLTLIBRARIES:
+ -test -z "$(privatelib_LTLIBRARIES)" || rm -f $(privatelib_LTLIBRARIES)
+ @list='$(privatelib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libhawki.la: $(libhawki_la_OBJECTS) $(libhawki_la_DEPENDENCIES)
+ $(libhawki_la_LINK) -rpath $(privatelibdir) $(libhawki_la_OBJECTS) $(libhawki_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_alloc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_bkg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_calib.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_combine.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_dfs.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_distortion.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_image_stats.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_load.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_mask.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_match_cats.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_obj_det.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_pfits.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_properties_tel.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_saa.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_save.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_utils.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_variance.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(privatelibdir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-privatelibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS \
+ install-privatelibLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkgincludeHEADERS \
+ uninstall-privatelibLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-privatelibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pkgincludeHEADERS \
+ install-privatelibLTLIBRARIES install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-pkgincludeHEADERS uninstall-privatelibLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hawki/hawki_alloc.c b/hawki/hawki_alloc.c
new file mode 100644
index 0000000..793afc4
--- /dev/null
+++ b/hawki/hawki_alloc.c
@@ -0,0 +1,86 @@
+/* $Id: hawki_alloc.c,v 1.1 2008/11/26 09:53:31 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2008/11/26 09:53:31 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+#include "hawki_utils.h"
+#include "hawki_alloc.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_alloc Allocation rutines
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/**
+ @brief Deallocates a set of four tables
+ @param tables The tables to deallocate
+ @return 0 if everything is ok, -1 otherwise
+
+ */
+int hawki_table_delete(cpl_table ** table)
+{
+ int idet;
+
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_table_delete(table[idet]);
+ cpl_free(table);
+ if(cpl_errorstate_get() != CPL_ERROR_NONE)
+ return -1;
+ return 0;
+}
+
+/**
+ @brief Allocates a set of four tables
+ @param nrow The number of rows of each table
+ @return The allocated tables
+
+ */
+cpl_table ** hawki_table_new(int nrow)
+{
+ int idet;
+ cpl_table ** tables;
+
+ tables = cpl_malloc(sizeof(cpl_table *) * HAWKI_NB_DETECTORS);
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ tables[idet] = cpl_table_new(nrow);
+
+ if(cpl_errorstate_get() != CPL_ERROR_NONE)
+ return NULL;
+ return tables;
+}
+
+/**@}*/
diff --git a/hawki/hawki_alloc.h b/hawki/hawki_alloc.h
new file mode 100644
index 0000000..e3ceed8
--- /dev/null
+++ b/hawki/hawki_alloc.h
@@ -0,0 +1,40 @@
+/* $Id: hawki_alloc.h,v 1.1 2008/11/26 09:53:21 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2008/11/26 09:53:21 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_ALLOC_H
+#define HAWKI_ALLOC_H
+
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+int hawki_table_delete(cpl_table **);
+
+cpl_table ** hawki_table_new(int nrow);
+
+#endif
diff --git a/hawki/hawki_bkg.c b/hawki/hawki_bkg.c
new file mode 100644
index 0000000..39f00dc
--- /dev/null
+++ b/hawki/hawki_bkg.c
@@ -0,0 +1,371 @@
+/* $Id: hawki_bkg.c,v 1.15 2009/10/23 15:13:06 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/10/23 15:13:06 $
+ * $Revision: 1.15 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <cpl.h>
+
+#include "hawki_distortion.h"
+#include "hawki_bkg.h"
+#include "hawki_pfits.h"
+#include "hawki_load.h"
+#include "hawki_utils.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_image_stats Compute several statistics on images
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Fill a propertylist with the association between objects and bkg
+ @param objframes The objframes associated to the background
+ @param proplist The list of keywords to store the association
+ information to
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input a set of object frames.
+ For EACH input object frames it creates in the given propertylist a
+ keyword "pointing" to the ARCFILE of that frame.
+ This propertylist can later be stored in the background image to establish
+ the association between this background and the object frames.
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_bkg_fill_assoc(cpl_frameset * objframes, cpl_propertylist * proplist)
+{
+ int iframe;
+ int nframes;
+
+ /* Loop on the frames */
+ nframes = cpl_frameset_get_size(objframes);
+ for(iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ cpl_frame * this_frame;
+ cpl_propertylist * this_proplist;
+ const char * arcfile;
+ char keystr[256];
+
+ /* Getting the proplist for this frame */
+ this_frame = cpl_frameset_get_frame(objframes, iframe);
+ this_proplist = cpl_propertylist_load
+ (cpl_frame_get_filename(this_frame),0);
+ arcfile = hawki_pfits_get_arcfile(proplist);
+ snprintf(keystr, 256, "ESO QC BKG ASSOC RAW%d",iframe+1);
+ cpl_propertylist_append_string(proplist, keystr, arcfile);
+ cpl_propertylist_delete(this_proplist);
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Computes the median of the object frames
+ @param objframes The objframes to get the background from
+ @param bkg The background image
+ @param proplist The list of keywords to store the association
+ information to
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input a set of object frames and computes
+ the background using a median of these frames.
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_bkg_from_objects_median
+(const cpl_frameset * objframes, cpl_imagelist * bkg)
+{
+ int idet;
+
+ /* Error state variables */
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ /* Loop on detectors */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ cpl_imagelist * img_serie;
+ cpl_image * this_bkg_image;
+
+ /* Loading the object frame */
+ img_serie = hawki_load_detector(objframes, idet + 1, CPL_TYPE_FLOAT);
+ if(img_serie== NULL)
+ {
+ cpl_msg_error(__func__, "Error reading object image") ;
+ return -1;
+ }
+
+ /* Averaging */
+ /* TODO: Comprobar que cpl_imagelist_collapse_median_create
+ * admite las mascaras, para que cuando implemente lo de la mascara
+ * de objetos siga funcionando */
+ if ((this_bkg_image = cpl_imagelist_collapse_median_create(img_serie))
+ == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot compute the median of obj images");
+ cpl_imagelist_delete(img_serie);
+ return -1;
+ }
+
+ /* Fill the corresponding chip */
+ cpl_imagelist_set(bkg, this_bkg_image, idet);
+
+ /* Freeing */
+ cpl_imagelist_delete(img_serie);
+ }
+
+ /* Check error status and exit */
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Computes the median of the sky frames
+ @param skyframes The skyframes to get the background from
+ @param objframes The objframes to which the association is made
+ @param bkg The background image
+ @param proplist The list of keywords to store the association
+ information to
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input a set of sky frames and computes
+ the background using a median of these frames.
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_bkg_from_sky_median
+(const cpl_frameset * skyframes,
+ cpl_imagelist * bkg)
+{
+ int idet;
+
+ /* Error state variables */
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ /* Loop on detectors */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ cpl_imagelist * img_serie;
+ cpl_image * this_bkg_image;
+
+ /* Loading the object frame */
+ img_serie = hawki_load_detector(skyframes, idet + 1, CPL_TYPE_FLOAT);
+ if(img_serie== NULL)
+ {
+ cpl_msg_error(__func__, "Error reading object image") ;
+ return -1;
+ }
+
+ /* Averaging */
+ if ((this_bkg_image = cpl_imagelist_collapse_median_create(img_serie))
+ == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot compute the median of obj images");
+ cpl_imagelist_delete(img_serie);
+ return -1;
+ }
+ /* Fill the corresponding chip */
+ cpl_imagelist_set(bkg, this_bkg_image, idet);
+
+ /* Freeing */
+ cpl_imagelist_delete(img_serie);
+ }
+
+ /* Check error status and exit */
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Computes the running mean for a set of object images using their masks
+ @param objimages The serie of object images
+ @param medians A vector with the medians of each image
+ @param bkg The background image (OUT)
+ @param proplist The list of keywords to store the association
+ information to
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input a set of sky frames and computes
+ the background using a median of these frames. The bad pixels from the
+ bpm masks are taking into account. It also sets the association
+ between the object images and the final background produced
+ (calling hawki_bkg_fill_assoc).
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_bkg_from_running_mean_detector
+(cpl_imagelist * objimages,
+ const cpl_vector * medians,
+ int i_target,
+ int half_width,
+ int rejlow,
+ int rejhigh,
+ cpl_image * bkg)
+{
+ float * bkg_p;
+ float * curima_p;
+ cpl_binary * curmask_p;
+ float ** objimages_p;
+ cpl_binary ** maskimages_p;
+ const double * medians_p;
+ double out;
+ int from_ima;
+ int to_ima;
+ int nima;
+ int nuse;
+ int nx;
+ int ny;
+
+ int pos_x;
+ int pos_y;
+ int pos;
+ int i_ima;
+ int i_win;
+ int n_win;
+
+ cpl_vector * localwin;
+
+ /* Get the pointer to the background image */
+ bkg_p = cpl_image_get_data_float(bkg);
+
+ /* Compute border indices */
+ nima = cpl_imagelist_get_size(objimages);
+ from_ima = i_target - half_width;
+ to_ima = i_target + half_width;
+ if (from_ima<0) from_ima = 0 ;
+ if (to_ima>(nima-1)) to_ima=nima-1 ;
+
+ /* Number of valid planes to consider after edge effects */
+ nuse = to_ima - from_ima ;
+
+ /* Get the size of images */
+ nx = cpl_image_get_size_x(bkg);
+ ny = cpl_image_get_size_y(bkg);
+
+ /* Get the pointers for better performance */
+ medians_p = cpl_vector_get_data_const(medians);
+
+ /* Allocate local window with the maximum number of possible used values*/
+ localwin = cpl_vector_new(nuse) ;
+
+ /* Get fast accesors to input image pointers */
+ objimages_p = cpl_malloc(nima * sizeof(float *));
+ maskimages_p = cpl_malloc(nima * sizeof(cpl_binary *));
+ for(i_ima=from_ima ; i_ima<=to_ima ; i_ima++)
+ {
+ objimages_p[i_ima] = cpl_image_get_data_float
+ (cpl_imagelist_get(objimages, i_ima));
+ maskimages_p[i_ima] = cpl_mask_get_data
+ (cpl_image_get_bpm(cpl_imagelist_get(objimages, i_ima)));
+ }
+
+ /* Initialize the bad pixel mask */
+ cpl_image_accept_all(bkg);
+
+ /* Loop over all pixels */
+ for (pos_x=0 ; pos_x<nx ; pos_x++)
+ {
+ for (pos_y=0 ; pos_y<ny ; pos_y++)
+ {
+ /* Get the position in the array */
+ pos = pos_x + pos_y * nx;
+
+ /* Resize again to maximum number of elements */
+ cpl_vector_set_size(localwin, nuse);
+
+ /* Fill up local window */
+ i_win=0;
+ for (i_ima=from_ima ; i_ima<=to_ima ; i_ima++)
+ {
+ if (i_ima != i_target)
+ {
+ curima_p = objimages_p[i_ima];
+ curmask_p = maskimages_p[i_ima];
+ if(!curmask_p[pos])
+ {
+ cpl_vector_set(localwin, i_win,
+ (double)curima_p[pos]-medians_p[i_ima]);
+ i_win++;
+ }
+ }
+ }
+ n_win = i_win;
+ if(n_win - rejlow - rejhigh < 1)
+ {
+ /* Add it to the bad pixel mask */
+ cpl_msg_debug(__func__,"Pixel %d %d added to the sky bpm",
+ pos_x, pos_y);
+ if(cpl_image_reject(bkg, pos_x + 1, pos_y + 1) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Cannot add pixel to sky bpm");
+ cpl_vector_delete(localwin) ;
+ cpl_free(objimages_p);
+ cpl_free(maskimages_p);
+ return(-1);
+ }
+ }
+ else
+ {
+ /* Resize to current number of elements */
+ cpl_vector_set_size(localwin, n_win);
+ /* Sort window */
+ cpl_vector_sort(localwin, 1);
+ /* Reject min and max, accumulate other pixels */
+ out = 0.0 ;
+ for (i_win=rejlow ; i_win<n_win - rejhigh; i_win++)
+ {
+ out += cpl_vector_get(localwin, i_win);
+ }
+ /* Take the mean */
+ out /= (double)(n_win - rejlow - rejhigh);
+
+ /* Assign value */
+ bkg_p[pos] = (out+medians_p[i_target]);
+ }
+ }
+ }
+
+ /* Free */
+ cpl_vector_delete(localwin) ;
+ cpl_free(objimages_p);
+ cpl_free(maskimages_p);
+
+ return 0;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_bkg.h b/hawki/hawki_bkg.h
new file mode 100644
index 0000000..0bbf8a1
--- /dev/null
+++ b/hawki/hawki_bkg.h
@@ -0,0 +1,55 @@
+/* $Id: hawki_bkg.h,v 1.7 2010/03/08 13:59:16 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/03/08 13:59:16 $
+ * $Revision: 1.7 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_BKG_H
+#define HAWKI_BKG_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+int hawki_bkg_fill_assoc(cpl_frameset * objframes, cpl_propertylist * proplist);
+
+int hawki_bkg_from_objects_median
+(const cpl_frameset * objframes, cpl_imagelist * bkg);
+
+int hawki_bkg_from_sky_median
+(const cpl_frameset * skyframes,
+ cpl_imagelist * bkg);
+
+int hawki_bkg_from_running_mean_detector
+(cpl_imagelist * objimages,
+ const cpl_vector * medians,
+ int i_target,
+ int half_width,
+ int rejlow,
+ int rejhigh,
+ cpl_image * bkg);
+
+#endif
diff --git a/hawki/hawki_calib.c b/hawki/hawki_calib.c
new file mode 100644
index 0000000..e7ab6ae
--- /dev/null
+++ b/hawki/hawki_calib.c
@@ -0,0 +1,492 @@
+/* $Id: hawki_calib.c,v 1.6 2010/11/03 18:50:38 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/11/03 18:50:38 $
+ * $Revision: 1.6 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_pfits.h"
+#include "hawki_load.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_calib Basic calibration Utilities
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the calibration to the images
+ @param ilist the input image list
+ @param flat the flat field
+ @param dark the dark (scaled to exp time of the science images)
+ @param bpm the bad pixels map
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input an image list that contains four images,
+ one for each HAWK-I detector and the same for the flat, dark and bpm.
+ It applies the 3 corrections (if images are not null) to each detector.
+ Take into account that the dark is just subtracted, no scaling is done.
+ For dark and flat corrections the formula is as follows:
+ \f[ bc = \frac{(raw-dark)}{flat}\f]
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_flat_dark_bpm_imglist_calib
+(cpl_imagelist * ilist,
+ cpl_imagelist * flat,
+ cpl_imagelist * dark,
+ cpl_imagelist * bpm)
+{
+ int idet;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+
+ /* Dark correction */
+ if (dark != NULL)
+ {
+ cpl_msg_info(cpl_func, "Subtracting the dark to each chip image") ;
+ /* Apply the dark correction to the images */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ if (cpl_image_subtract(cpl_imagelist_get(ilist, idet),
+ cpl_imagelist_get(dark, idet))!=CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot apply the dark to chip %d",
+ idet+1);
+ return -1 ;
+ }
+ }
+ }
+
+ /* Flat-field correction */
+ if (flat != NULL)
+ {
+ cpl_msg_info(cpl_func, "Dividing the flat to each chip image") ;
+ /* Apply the flat correction to the images */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ if (cpl_image_divide(cpl_imagelist_get(ilist, idet),
+ cpl_imagelist_get(flat, idet))!=CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Cannot apply the flatfield to chip %d",
+ idet+1);
+ return -1 ;
+ }
+ }
+ }
+
+ /* Correct the bad pixels if requested */
+ if (bpm != NULL)
+ {
+ cpl_msg_info(cpl_func, "Correct the bad pixels to each chip image");
+ /* Apply the flat correction to the images */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ cpl_mask * bpm_im_bin ;
+ /* Convert the map from integer to binary */
+ bpm_im_bin = cpl_mask_threshold_image_create
+ (cpl_imagelist_get(bpm, idet), -0.5, 0.5) ;
+ cpl_mask_not(bpm_im_bin) ;
+ cpl_image_reject_from_mask(cpl_imagelist_get(ilist, idet), bpm_im_bin);
+ if (cpl_detector_interpolate_rejected
+ (cpl_imagelist_get(ilist, idet)) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error
+ (cpl_func, "Cannot clean the bad pixels in chip %d",
+ idet+1);
+ cpl_mask_delete(bpm_im_bin) ;
+ return -1 ;
+ }
+ cpl_mask_delete(bpm_im_bin) ;
+ }
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the calibration to the images
+ @param ilist the input image list
+ @param flat the flat field
+ @param bpm the bad pixels map
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input an image list that contains four images,
+ one for each HAWK-I detector and the same for the flat and bpm.
+ It applies the 2 corrections (if images are not null) to each detector.
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_flat_bpm_imglist_calib(
+ cpl_imagelist * ilist,
+ cpl_imagelist * flat,
+ cpl_imagelist * bpm)
+{
+ int idet;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+
+ /* Flat-field correction */
+ if (flat != NULL)
+ {
+ cpl_msg_info(cpl_func, "Divide the images by the flatfield") ;
+ /* Apply the flat correction to the images */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ if (cpl_image_divide(cpl_imagelist_get(ilist, idet),
+ cpl_imagelist_get(flat, idet))!=CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot apply the flatfield to the images");
+ return -1 ;
+ }
+ }
+ }
+
+ /* Correct the bad pixels if requested */
+ if (bpm != NULL)
+ {
+ cpl_msg_info(cpl_func, "Correct the bad pixels in the images") ;
+ /* Apply the flat correction to the images */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ cpl_mask * bpm_im_bin ;
+ /* Convert the map from integer to binary */
+ bpm_im_bin = cpl_mask_threshold_image_create
+ (cpl_imagelist_get(bpm, idet), -0.5, 0.5) ;
+ cpl_mask_not(bpm_im_bin) ;
+ cpl_image_reject_from_mask(cpl_imagelist_get(ilist, idet), bpm_im_bin);
+ if (cpl_detector_interpolate_rejected
+ (cpl_imagelist_get(ilist, idet)) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error
+ (cpl_func, "Cannot clean the bad pixels in detector %d",
+ idet+1);
+ cpl_mask_delete(bpm_im_bin) ;
+ return -1 ;
+ }
+ cpl_mask_delete(bpm_im_bin) ;
+ }
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the background subtraction to the images
+ @param ilist the input image list
+ @param bkg the background images
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_bkg_imglist_calib
+(cpl_imagelist * ilist,
+ cpl_imagelist * bkg)
+{
+ int idet;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+
+ /* Background correction */
+ if (bkg != NULL)
+ {
+ cpl_msg_info(cpl_func, "Subtract the images by the bkg") ;
+ /* Apply the bkg correction to the images */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ if (cpl_image_subtract(cpl_imagelist_get(ilist, idet),
+ cpl_imagelist_get(bkg, idet))!=CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot apply the bkg to the images");
+ return -1 ;
+ }
+ }
+ }
+
+ /* Return */
+ return 0 ;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the calibration to the images
+ @param ilist the input image list
+ @param flat the flat field
+ @param dark the dark (scaled to exp time of the science images)
+ @param bpm the bad pixels map
+ @param idet the detector id.
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input a list of images which in principle
+ should belong to the same HAWK-I detector. It also takes as an input
+ an image for the flat, the dark and bpm for that detector. It is the
+ responsibility of the caller to ensure that the detector of all these
+ inputs is the same.
+ Take into account that the dark is just subtracted, no scaling is done.
+ For dark and flat corrections the formula is as follows:
+ \f[ bc = \frac{(raw-dark)}{flat}\f]
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_flat_dark_bpm_detector_calib(
+ cpl_imagelist * ilist,
+ cpl_image * flat,
+ cpl_image * dark,
+ cpl_image * bpm)
+{
+ cpl_mask * bpm_im_bin ;
+ int i ;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+
+ /* Dark correction */
+ if (dark != NULL)
+ {
+ cpl_msg_info(cpl_func, "Subtract the images by the dark") ;
+ if (cpl_imagelist_subtract_image(ilist, dark)!=CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot apply the dark to the images");
+ return -1 ;
+ }
+ }
+
+ /* Flat-field correction */
+ if (flat != NULL) {
+ cpl_msg_info(cpl_func, "Divide the images by the flatfield") ;
+
+ /* Apply the flatfield correction to the images */
+ if (cpl_imagelist_divide_image(ilist, flat)!=CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func,"Cannot apply the flatfield to the images");
+ return -1 ;
+ }
+ }
+
+ /* Correct the bad pixels if requested */
+ if (bpm != NULL) {
+ cpl_msg_info(cpl_func, "Correct the bad pixels in the images") ;
+
+ /* Convert the map from integer to binary */
+ bpm_im_bin = cpl_mask_threshold_image_create(bpm, -0.5, 0.5) ;
+ cpl_mask_not(bpm_im_bin) ;
+ /* Apply the bad pixels cleaning */
+ for (i=0 ; i<cpl_imagelist_get_size(ilist) ; i++) {
+ cpl_image_reject_from_mask(cpl_imagelist_get(ilist, i), bpm_im_bin);
+ if (cpl_detector_interpolate_rejected(
+ cpl_imagelist_get(ilist, i)) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot clean the bad pixels in obj %d",
+ i+1);
+ cpl_mask_delete(bpm_im_bin) ;
+ return -1 ;
+ }
+ }
+ cpl_mask_delete(bpm_im_bin) ;
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the calibration to the images
+ @param ilist the input image list
+ @param flat the flat field
+ @param bpm the bad pixels map
+ @param idet the detector id
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes as an input a list of images which in principle
+ should belong to the same HAWK-I detector. It also takes as an input
+ an image for the flat, the dark and bpm for that detector. It is the
+ responsability of the caller to ensure that the detector of all these
+ inputs is the same.
+ For dark and flat corrections the formula is as follows:
+ \f[ bc = \frac{(raw-dark)}{flat}\f]
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_flat_bpm_detector_calib(
+ cpl_imagelist * ilist,
+ cpl_image * flat,
+ cpl_image * bpm)
+{
+ cpl_mask * bpm_im_bin ;
+ int i ;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+
+ /* Flat-field correction */
+ if (flat != NULL) {
+ cpl_msg_info(cpl_func, "Divide the images by the flatfield") ;
+
+ /* Apply the flatfield correction to the images */
+ if (cpl_imagelist_divide_image(ilist, flat)!=CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func,"Cannot apply the flatfield to the images");
+ return -1 ;
+ }
+ }
+
+ /* Correct the bad pixels if requested */
+ if (bpm != NULL) {
+ cpl_msg_info(cpl_func, "Correct the bad pixels in the images") ;
+
+ /* Convert the map from integer to binary */
+ bpm_im_bin = cpl_mask_threshold_image_create(bpm, -0.5, 0.5) ;
+ cpl_mask_not(bpm_im_bin) ;
+ /* Apply the bad pixels cleaning */
+ for (i=0 ; i<cpl_imagelist_get_size(ilist) ; i++) {
+ cpl_image_reject_from_mask(cpl_imagelist_get(ilist, i), bpm_im_bin);
+ if (cpl_detector_interpolate_rejected(
+ cpl_imagelist_get(ilist, i)) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot clean the bad pixels in obj %d",
+ i+1);
+ cpl_mask_delete(bpm_im_bin) ;
+ return -1 ;
+ }
+ }
+ cpl_mask_delete(bpm_im_bin) ;
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Trim a list of hawki images (usually from one detector)
+ @param ilist The image list
+ @param nborder The number of pixels to trim in each border
+ @return The trimmed images. NULL otherwise
+
+ Not that the original ilist is emptied, but the user is still responsible
+ to deallocate it with cpl_imagelist_delete()
+
+ */
+cpl_imagelist * hawki_trim_detector_calib
+(cpl_imagelist * imalist,
+ int nborder)
+{
+ int i = 0;
+ /* Discard the pixels on the sides */
+ cpl_imagelist * trimmed_images = cpl_imagelist_new();
+ while(cpl_imagelist_get_size(imalist) > 0)
+ {
+ cpl_image * non_trimmed;
+ cpl_image * trimmed;
+ int nx;
+ int ny;
+
+ non_trimmed = cpl_imagelist_unset(imalist, 0);
+ nx = cpl_image_get_size_x(non_trimmed);
+ ny = cpl_image_get_size_y(non_trimmed);
+ trimmed = cpl_image_extract(non_trimmed,
+ nborder+1, nborder+1,
+ nx-nborder, ny-nborder);
+ cpl_imagelist_set(trimmed_images, trimmed, i);
+ ++i;
+ cpl_image_delete(non_trimmed);
+ }
+
+ return trimmed_images;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the BPM correction to an image
+ @param ima the image to correct
+ @param idet the detector the image comes from
+ @param bpm the bad pixels map
+ @return 0 if everything is ok, -1 otherwise
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_bpm_calib(
+ cpl_image * ima,
+ const char * bpm,
+ int idet)
+{
+ cpl_mask * bpm_im_bin ;
+ cpl_image * bpm_im_int ;
+ int ext_nb ;
+
+ /* Test entries */
+ if (ima == NULL) return -1 ;
+ if (idet < 1 || idet > HAWKI_NB_DETECTORS) return -1 ;
+ if (bpm == NULL) return -1 ;
+
+ /* Get the extension number for this detector */
+ if ((ext_nb = hawki_get_ext_from_detector(bpm, idet)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the extension with detector %d", idet) ;
+ return -1 ;
+ }
+ /* Load the bad pixels image */
+ if ((bpm_im_int = cpl_image_load(bpm, CPL_TYPE_INT, 0, ext_nb)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load the bad pixel map %s", bpm) ;
+ return -1 ;
+ }
+ /* Convert the map from integer to binary */
+ bpm_im_bin = cpl_mask_threshold_image_create(bpm_im_int, -0.5, 0.5) ;
+ cpl_mask_not(bpm_im_bin) ;
+ cpl_image_delete(bpm_im_int) ;
+ /* Apply the bad pixels cleaning */
+ cpl_image_reject_from_mask(ima, bpm_im_bin);
+ if (cpl_detector_interpolate_rejected(ima) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot clean the bad pixels");
+ cpl_mask_delete(bpm_im_bin) ;
+ return -1 ;
+ }
+ cpl_mask_delete(bpm_im_bin) ;
+
+ /* Return */
+ return 0 ;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_calib.h b/hawki/hawki_calib.h
new file mode 100644
index 0000000..3fb04a5
--- /dev/null
+++ b/hawki/hawki_calib.h
@@ -0,0 +1,69 @@
+/* $Id: hawki_calib.h,v 1.6 2010/11/03 18:50:47 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/11/03 18:50:47 $
+ * $Revision: 1.6 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_CALIB_H
+#define HAWKI_CALIB_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Function definitions
+ -----------------------------------------------------------------------------*/
+
+int hawki_bpm_calib
+(cpl_image * ima,
+ const char * bpm,
+ int idet);
+int hawki_flat_bpm_detector_calib
+(cpl_imagelist * ilist,
+ cpl_image * flat,
+ cpl_image * bpm);
+int hawki_flat_dark_bpm_detector_calib
+(cpl_imagelist * ilist,
+ cpl_image * flat,
+ cpl_image * dark,
+ cpl_image * bpm);
+cpl_imagelist * hawki_trim_detector_calib
+(cpl_imagelist * ilist,
+ int nborder);
+int hawki_flat_dark_bpm_imglist_calib
+(cpl_imagelist * ilist,
+ cpl_imagelist * flat,
+ cpl_imagelist * dark,
+ cpl_imagelist * bpm);
+int hawki_flat_bpm_imglist_calib
+(cpl_imagelist * ilist,
+ cpl_imagelist * flat,
+ cpl_imagelist * bpm);
+int hawki_bkg_imglist_calib
+(cpl_imagelist * ilist,
+ cpl_imagelist * bkg);
+#endif
diff --git a/hawki/hawki_combine.c b/hawki/hawki_combine.c
new file mode 100644
index 0000000..2e664c9
--- /dev/null
+++ b/hawki/hawki_combine.c
@@ -0,0 +1,55 @@
+/* $Id: hawki_combine.c,v 1.1.1.1 2007/02/13 16:03:30 yjung Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: yjung $
+ * $Date: 2007/02/13 16:03:30 $
+ * $Revision: 1.1.1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_combine.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_combine Images combination routines
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/**@}*/
+
diff --git a/hawki/hawki_combine.h b/hawki/hawki_combine.h
new file mode 100644
index 0000000..7e73610
--- /dev/null
+++ b/hawki/hawki_combine.h
@@ -0,0 +1,35 @@
+/* $Id: hawki_combine.h,v 1.1.1.1 2007/02/13 16:03:30 yjung Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: yjung $
+ * $Date: 2007/02/13 16:03:30 $
+ * $Revision: 1.1.1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_COMBINE_H
+#define HAWKI_COMBINE_H
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+#endif
diff --git a/hawki/hawki_dfs.c b/hawki/hawki_dfs.c
new file mode 100644
index 0000000..b6f9265
--- /dev/null
+++ b/hawki/hawki_dfs.c
@@ -0,0 +1,113 @@
+/* $Id: hawki_dfs.c,v 1.28 2010/11/29 03:32:41 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/11/29 03:32:41 $
+ * $Revision: 1.28 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+
+#include <cpl.h>
+
+#include "hawki_dfs.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_dfs DFS related functions
+ *
+ * TBD
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Set the group as RAW or CALIB in a frameset
+ @param set the input frameset
+ @return 0 if ok, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_dfs_set_groups(cpl_frameset * set)
+{
+ cpl_frame * cur_frame ;
+ const char * tag ;
+ int nframes ;
+ int i ;
+
+ /* Check entries */
+ if (set == NULL) return -1 ;
+
+ /* Initialize */
+ nframes = cpl_frameset_get_size(set) ;
+
+ /* Loop on frames */
+ for (i=0 ; i<nframes ; i++) {
+ cur_frame = cpl_frameset_get_frame(set, i) ;
+ tag = cpl_frame_get_tag(cur_frame) ;
+
+ /* RAW frames */
+ if (!strcmp(tag, HAWKI_COMMAND_LINE) ||
+ !strcmp(tag, HAWKI_CAL_DARK_RAW) ||
+ !strcmp(tag, HAWKI_TEC_FLAT_RAW) ||
+ !strcmp(tag, HAWKI_CAL_FLAT_RAW) ||
+ !strcmp(tag, HAWKI_CAL_ZPOINT_RAW) ||
+ !strcmp(tag, HAWKI_CAL_ILLUM_RAW) ||
+ !strcmp(tag, HAWKI_CAL_DISTOR_RAW) ||
+ !strcmp(tag, HAWKI_IMG_JITTER_SKY_RAW) ||
+ !strcmp(tag, HAWKI_IMG_JITTER_RAW) ||
+ !strcmp(tag, HAWKI_CAL_LINGAIN_LAMP_RAW) ||
+ !strcmp(tag, HAWKI_CAL_LINGAIN_DARK_RAW) ||
+ !strcmp(tag, HAWKI_CALPRO_BASICCALIBRATED) ||
+ !strcmp(tag, HAWKI_CALPRO_SKY_BASICCALIBRATED) ||
+ !strcmp(tag, HAWKI_CALPRO_BKGIMAGE) ||
+ !strcmp(tag, HAWKI_CALPRO_BKG_SUBTRACTED) ||
+ !strcmp(tag, HAWKI_CALPRO_DIST_CORRECTED) ||
+ !strcmp(tag, HAWKI_CALPRO_COMBINED) ||
+ !strcmp(tag, HAWKI_CALPRO_ZPOINT_TAB))
+ cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW) ;
+ /* CALIB frames */
+ else if (!strcmp(tag, HAWKI_CALPRO_BPM) ||
+ !strcmp(tag, HAWKI_UTIL_STDSTARS_RAW) ||
+ !strcmp(tag, HAWKI_UTIL_DISTMAP_RAW) ||
+ !strcmp(tag, HAWKI_CALPRO_BPM_HOT) ||
+ !strcmp(tag, HAWKI_CALPRO_BPM_COLD) ||
+ !strcmp(tag, HAWKI_CALPRO_FLAT) ||
+ !strcmp(tag, HAWKI_CALPRO_DARK) ||
+ !strcmp(tag, HAWKI_CALPRO_STDSTARS) ||
+ !strcmp(tag, HAWKI_CALPRO_DISTORTION))
+ cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ;
+ }
+ return 0 ;
+}
+
+/**@}*/
diff --git a/hawki/hawki_dfs.h b/hawki/hawki_dfs.h
new file mode 100644
index 0000000..b97f928
--- /dev/null
+++ b/hawki/hawki_dfs.h
@@ -0,0 +1,507 @@
+/* $Id: hawki_dfs.h,v 1.56 2011/02/09 17:16:23 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/02/09 17:16:23 $
+ * $Revision: 1.56 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_DFS_H
+#define HAWKI_DFS_H
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+/******************************************/
+/* DEFINE HERE THE DIFFERENT COLUMN NAMES */
+/******************************************/
+#define HAWKI_COL_RAW_JITTER_QC_TEL_ALT "TEL_ALT"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AZ "TEL_AZ"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM "TEL_AMBI_RHUM"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0 "TEL_AMBI_TAU0"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP "TEL_AMBI_TEMP"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR "TEL_AMBI_WINDDIR"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP "TEL_AMBI_WINDSP"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM "TEL_IA_FWHM"
+#define HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START "ADA_ABSROT_START"
+#define HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END "ADA_ABSROT_END"
+#define HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA "ADA_ABSROT_DELTA"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START "TEL_AIRM_START"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END "TEL_AIRM_END"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AIRM "TEL_AIRM"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START "TEL_AMBI_FWHM_START"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END "TEL_AMBI_FWHM_END"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM "TEL_AMBI_FWHM"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START "TEL_AMBI_PRES_START"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END "TEL_AMBI_PRES_END"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES "TEL_AMBI_PRES"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START "TEL_PARANG_START"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END "TEL_PARANG_END"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG "TEL_PARANG"
+#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA "TEL_PARANG_DELTA"
+#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA "SEQ_CUMOFFSETA"
+#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD "SEQ_CUMOFFSETD"
+#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX "SEQ_CUMOFFSETX"
+#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY "SEQ_CUMOFFSETY"
+
+#define HAWKI_COL_STAT_MIN "MINIMUM"
+#define HAWKI_COL_STAT_MAX "MAXIMUM"
+#define HAWKI_COL_STAT_MED "MEDIAN"
+#define HAWKI_COL_STAT_MEAN "MEAN"
+#define HAWKI_COL_STAT_RMS "RMS"
+#define HAWKI_COL_STAT_USED "USED"
+
+#define HAWKI_COL_ZPOINT_MAG "MAG"
+#define HAWKI_COL_ZPOINT_STARNAME "STARNAME"
+#define HAWKI_COL_ZPOINT_CHIP "CHIP"
+#define HAWKI_COL_ZPOINT_ERRMAG "MAG_ERR"
+#define HAWKI_COL_ZPOINT_FILTER "FILTER"
+#define HAWKI_COL_ZPOINT_AIRMASS "AIRMASS"
+#define HAWKI_COL_ZPOINT_POSX "POSX"
+#define HAWKI_COL_ZPOINT_POSY "POSY"
+#define HAWKI_COL_ZPOINT_ZPOINT "ZPOINT"
+#define HAWKI_COL_ZPOINT_ZPOINT_ERR "ZPOINT_ERR"
+#define HAWKI_COL_ZPOINT_ATX0 "ATX0"
+#define HAWKI_COL_ZPOINT_FLUX "FLUX"
+#define HAWKI_COL_ZPOINT_FLUX_ERR "FLUX_ERR"
+#define HAWKI_COL_ZPOINT_INSTRMAG "INSTRMAG"
+#define HAWKI_COL_ZPOINT_INSTRMAG_ERR "INSTRMAG_ERR"
+#define HAWKI_COL_ZPOINT_PEAK "PEAK"
+#define HAWKI_COL_ZPOINT_BGD "BGD"
+#define HAWKI_COL_ZPOINT_FWHMX "FWHMX"
+#define HAWKI_COL_ZPOINT_FWHMY "FWHMY"
+#define HAWKI_COL_ZPOINT_FWHM "FWHM"
+#define HAWKI_COL_ZPOINT_FWHMX_AS "FWHMX_AS"
+#define HAWKI_COL_ZPOINT_FWHMY_AS "FWHMY_AS"
+#define HAWKI_COL_ZPOINT_FWHM_AS "FWHM_AS"
+#define HAWKI_COL_ZPOINT_STARMAG "STAR_CAT_MAG"
+
+#define HAWKI_COL_PHOT_FILTER "FILTER"
+#define HAWKI_COL_PHOT_EXTCOEFF "EXT"
+#define HAWKI_COL_PHOT_DEXTCOEFF "DEXT"
+#define HAWKI_COL_PHOT_ZEROPOINT "ZPOINT"
+#define HAWKI_COL_PHOT_DZEROPOINT "DZPOINT"
+#define HAWKI_COL_PHOT_COLORTERM "COL"
+#define HAWKI_COL_PHOT_DCOLORTERM "DCOL"
+
+#define HAWKI_COL_OBJ_POSX "POS_X"
+#define HAWKI_COL_OBJ_POSY "POS_Y"
+#define HAWKI_COL_OBJ_FWHM_MAJAX "FWHM_MAJAX"
+#define HAWKI_COL_OBJ_FWHM_MINAX "FWHM_MINAX"
+#define HAWKI_COL_OBJ_ELLIP "ELLIP"
+#define HAWKI_COL_OBJ_ANGLE "ANGLE"
+#define HAWKI_COL_OBJ_FLUX "FLUX"
+
+#define HAWKI_COL_ILLUM_POSX "POSX"
+#define HAWKI_COL_ILLUM_POSY "POSY"
+#define HAWKI_COL_ILLUM_FLUX "FLUX"
+
+#define HAWKI_COL_DIST_DXGC "DXGC"
+#define HAWKI_COL_DIST_DYGC "DYGC"
+#define HAWKI_COL_DIST_I "I"
+#define HAWKI_COL_DIST_J "J"
+
+#define HAWKI_COL_OFFSET_X "X_OFFSET"
+#define HAWKI_COL_OFFSET_Y "Y_OFFSET"
+#define HAWKI_COL_CORRELATION "CORRELATION"
+
+#define HAWKI_COL_2MASS_RA "RA"
+#define HAWKI_COL_2MASS_DEC "Dec"
+#define HAWKI_COL_2MASS_J_MAG "j_m"
+#define HAWKI_COL_2MASS_J_MAGSIG "j_msig"
+#define HAWKI_COL_2MASS_H_MAG "h_m"
+#define HAWKI_COL_2MASS_H_MAGSIG "h_msig"
+#define HAWKI_COL_2MASS_K_MAG "k_m"
+#define HAWKI_COL_2MASS_K_MAGSIG "k_msig"
+#define HAWKI_COL_2MASS_XPREDICT "xpredict"
+#define HAWKI_COL_2MASS_YPREDICT "ypredict"
+
+#define HAWKI_COL_MATCHING_SETS "MATCHING_SETS"
+
+/*************************************/
+/* DEFINE HERE THE PRO.CATG KEYWORDS */
+
+/* Type HAWKI_PROTYPE_COMBINED */
+#define HAWKI_CALPRO_COMBINED "COMBINED"
+
+/* Type HAWKI_PROTYPE_COMB_CONTRIB_MAP */
+#define HAWKI_CALPRO_COMB_CONTRIB_MAP "COMBINED_CONTRIB_MAP"
+
+/* Type HAWKI_PROTYPE_STITCHED */
+#define HAWKI_CALPRO_STITCHED "STITCHED"
+
+/* Type HAWKI_PROTYPE_DIST_CORRECTED */
+#define HAWKI_CALPRO_DIST_CORRECTED "DIST_CORRECTED"
+
+/* Type HAWKI_PROTYPE_ILLUM */
+#define HAWKI_CALPRO_ILLUM "ILLUM"
+
+/* Type HAWKI_PROTYPE_BKGIMAGE */
+#define HAWKI_CALPRO_BKGIMAGE "BKG_IM"
+
+/* Type HAWKI_PROTYPE_BKGBPM */
+#define HAWKI_CALPRO_BKGBPM "BKG_BPM"
+
+/* Type HAWKI_PROTYPE_OBJ_PARAM */
+#define HAWKI_CALPRO_OBJ_PARAM "OBJ_PARAM"
+
+/* Type HAWKI_PROTYPE_OBJ_MASK */
+#define HAWKI_CALPRO_OBJ_MASK "OBJ_MASK"
+
+/* Type HAWKI_PROTYPE_SCIENCE_PCS */
+#define HAWKI_CALPRO_SCIENCE_PCS "SCIENCE_PCS"
+
+/* Type HAWKI_PROTYPE_ERRMAP */
+#define HAWKI_CALPRO_FLAT_ERRMAP "FLAT_ERRMAP"
+
+/* Type HAWKI_PROTYPE_BPM */
+#define HAWKI_CALPRO_BPM "BPM"
+#define HAWKI_CALPRO_BPM_HOT "BPM_HOT"
+#define HAWKI_CALPRO_BPM_COLD "BPM_COLD"
+
+/* Type HAWKI_PROTYPE_FLAT */
+#define HAWKI_CALPRO_FLAT "FLAT_IM"
+#define HAWKI_CALPRO_FLAT_ERR "FLAT_ERR"
+#define HAWKI_CALPRO_FLAT_RECOMPUTED "FLAT_RECOMPUTED"
+
+/* Type HAWKI_PROTYPE_DARK */
+#define HAWKI_CALPRO_DARK "DARK_IM"
+
+/* Type HAWKI_PROTYPE_DARK_ERR */
+#define HAWKI_CALPRO_DARK_ERR "DARK_ERR"
+
+/* Type HAWKI_PROTYPE_ILLUM_PHOTOM */
+#define HAWKI_CALPRO_ILLUM_PHOTOM "ILLUM_PHOTOM"
+
+/* Type HAWKI_PROTYPE_FLAT_STATS */
+#define HAWKI_CALPRO_FLAT_STATS "FLAT_STATS"
+
+/* Type HAWKI_PROTYPE_FLAT_STATS_EVEN_COL */
+#define HAWKI_CALPRO_FLAT_STATS_EVEN_COL "FLAT_STATS_EVEN_COL"
+
+/* Type HAWKI_PROTYPE_FLAT_STATS_ODD_COL */
+#define HAWKI_CALPRO_FLAT_STATS_ODD_COL "FLAT_STATS_ODD_COL"
+
+/* Type HAWKI_PROTYPE_FLAT_STATS_EVEN_ROW */
+#define HAWKI_CALPRO_FLAT_STATS_EVEN_ROW "FLAT_STATS_EVEN_ROW"
+
+/* Type HAWKI_PROTYPE_FLAT_STATS_ODD_ROW */
+#define HAWKI_CALPRO_FLAT_STATS_ODD_ROW "FLAT_STATS_ODD_ROW"
+
+/* Type HAWKI_PROTYPE_DARK_STATS */
+#define HAWKI_CALPRO_DARK_STATS "DARK_STATS"
+
+/* Type HAWKI_PROTYPE_ZPOINT_STATS */
+#define HAWKI_CALPRO_ZPOINT_STATS "ZPOINT_STATS"
+
+/* Type HAWKI_PROTYPE_JITTER_STATS */
+#define HAWKI_CALPRO_JITTER_STATS "JITTER_STATS"
+
+/* Type HAWKI_PROTYPE_JITTER_BKG_STATS */
+#define HAWKI_CALPRO_JITTER_BKG_STATS "BKG_STATS"
+
+/* Type HAWKI_PROTYPE_STDSTARS */
+#define HAWKI_CALPRO_STDSTARS "STDSTARS_CATS"
+
+/* Type HAWKI_PROTYPE_DISTORTION */
+#define HAWKI_CALPRO_DISTORTION "DISTORTION"
+
+/* Type HAWKI_PROTYPE_DISTORTION_X */
+#define HAWKI_CALPRO_DISTORTION_X "DISTORTION_X"
+
+/* Type HAWKI_PROTYPE_DISTORTION_Y */
+#define HAWKI_CALPRO_DISTORTION_Y "DISTORTION_Y"
+
+/* Type HAWKI_PROTYPE_ZPOINT_TAB */
+#define HAWKI_CALPRO_ZPOINT_TAB "ZPOINT_RES"
+
+/* Type HAWKI_PROTYPE_PHOT_TAB */
+#define HAWKI_CALPRO_PHOT_TAB "PHOT_COEFF"
+
+/* Type HAWKI_PROTYPE_ZPOINT_IMA */
+#define HAWKI_CALPRO_ZPOINT_IMA "ZPOINT_IMA"
+
+/* Type HAWKI_PROTYPE_COEFFS */
+#define HAWKI_CALPRO_LINGAIN_LIN "LINGAIN_LIN"
+#define HAWKI_CALPRO_LINGAIN_GAIN "LINGAIN_GAIN"
+#define HAWKI_CALPRO_LINGAIN_COEFFS "LINGAIN_COEFFS"
+#define HAWKI_CALPRO_LINGAIN_BPM "LINGAIN_BPM"
+#define HAWKI_CALPRO_LINGAIN_CORR "LINGAIN_CORR"
+#define HAWKI_CALPRO_LINGAIN_DIFF "LINGAIN_DIFF"
+
+/* Type HAWKI_PROTYPE_BETSFOCUS */
+#define HAWKI_CALPRO_BESTFOCUS "BEST_FOCUS"
+
+/* Type HAWKI_PROTYPE_BASICCALIBRATED */
+#define HAWKI_CALPRO_BASICCALIBRATED "BASIC_CALIBRATED"
+
+
+/* Type HAWKI_PROTYPE_SKY_BASICCALIBRATED */
+#define HAWKI_CALPRO_SKY_BASICCALIBRATED "SKY_BASIC_CALIBRATED"
+
+/* Type HAWKI_PROTYPE_BKG_SUBTRACTED */
+#define HAWKI_CALPRO_BKG_SUBTRACTED "BKG_SUBTRACTED"
+
+/* Type HAWKI_PROTYPE_FILTERPOSCHECK_STATS */
+#define HAWKI_CALPRO_FILTERPOSCHECK_STATS "FILTERPOS_CHECK_STATS"
+
+/* Type HAWKI_PROTYPE_OFFSETS */
+#define HAWKI_CALPRO_OFFSETS "OFFSETS_REFINED"
+
+/*************************************/
+
+/*************************************/
+/* DEFINE HERE THE PRO.TYPE KEYWORDS */
+/* Images */
+#define HAWKI_PROTYPE_BPM "BPM"
+#define HAWKI_PROTYPE_DARK "DARK"
+#define HAWKI_PROTYPE_DARK_ERR "DARK_ERR"
+#define HAWKI_PROTYPE_FLAT "FLAT"
+#define HAWKI_PROTYPE_ZPOINT_IMA "ZPOINT_IMA"
+#define HAWKI_PROTYPE_COMBINED "COMBINED"
+#define HAWKI_PROTYPE_COMB_CONTRIB_MAP "COMBINED_CONTRIB_MAP"
+#define HAWKI_PROTYPE_STITCHED "STITCHED"
+#define HAWKI_PROTYPE_ILLUM "ILLUM"
+#define HAWKI_PROTYPE_DIST_CORRECTED "DIST_CORRECTED"
+#define HAWKI_PROTYPE_BKGIMAGE "BKG_IM"
+#define HAWKI_PROTYPE_BKGBPM "BKG_BPM"
+#define HAWKI_PROTYPE_ERRMAP "ERRMAP"
+#define HAWKI_PROTYPE_BESTFOCUS "BEST_FOCUS"
+#define HAWKI_PROTYPE_BASICCALIBRATED "BASIC_CALIBRATED"
+#define HAWKI_PROTYPE_SKY_BASICCALIBRATED "SKY_BASIC_CALIBRATED"
+#define HAWKI_PROTYPE_BKG_SUBTRACTED "BKG_SUBTRACTED"
+#define HAWKI_PROTYPE_OBJ_MASK "OBJ_MASK"
+#define HAWKI_PROTYPE_DISTORTION_X "DISTORTION_X"
+#define HAWKI_PROTYPE_DISTORTION_Y "DISTORTION_Y"
+
+
+/* Tables */
+/* Col: HAWKI_COL_OBJ_POSX */
+/* HAWKI_COL_OBJ_POSY */
+/* HAWKI_COL_OBJ_FWHMX */
+/* HAWKI_COL_OBJ_FWHMY */
+/* HAWKI_COL_OBJ_ANGLE */
+/* HAWKI_COL_OBJ_FLUX */
+#define HAWKI_PROTYPE_OBJ_PARAM "OBJ_PARAM"
+
+/* Col: HAWKI_COL_ILLUM_POSX */
+/* HAWKI_COL_ILLUM_POSY */
+/* HAWKI_COL_ILLUM_FLUX */
+#define HAWKI_PROTYPE_ILLUM_PHOTOM "ILLUM_PHOTOM"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_FLAT_STATS "FLAT_STATS"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_FLAT_STATS_EVEN_COL "FLAT_STATS_EVEN_COL"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_FLAT_STATS_ODD_COL "FLAT_STATS_ODD_COL"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_FLAT_STATS_EVEN_ROW "FLAT_STATS_EVEN_ROW"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_FLAT_STATS_ODD_ROW "FLAT_STATS_ODD_ROW"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_DARK_STATS "DARK_STATS"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_ZPOINT_STATS "ZPOINT_STATS"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_JITTER_STATS "JITTER_STATS"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_JITTER_BKG_STATS "BKG_STATS"
+
+/* Col: HAWKI_COL_STAT_MIN */
+/* HAWKI_COL_STAT_MAX */
+/* HAWKI_COL_STAT_MED */
+/* HAWKI_COL_STAT_RMS */
+/* HAWKI_COL_STAT_MEAN */
+/* HAWKI_COL_STAT_USED */
+#define HAWKI_PROTYPE_FILTERPOSCHECK_STATS "FILTERPOS_CHECK_STATS"
+
+/* Col: IRPLIB_STDSTAR_STAR_COL */
+/* IRPLIB_STDSTAR_TYPE_COL */
+/* IRPLIB_STDSTAR_RA_COL */
+/* IRPLIB_STDSTAR_DEC_COL */
+/* Filters .... */
+#define HAWKI_PROTYPE_STDSTARS "STDSTARS"
+
+/* Col: HAWKI_COL_DIST_DXGC */
+/* HAWKI_COL_DIST_DYGC */
+/* HAWKI_COL_DIST_I */
+/* HAWKI_COL_DIST_J */
+#define HAWKI_PROTYPE_DISTORTION "DISTORTION"
+
+/* Col: HAWKI_COL_ZPOINT_CHIP */
+/* HAWKI_COL_ZPOINT_POSX */
+/* HAWKI_COL_ZPOINT_POSY */
+/* HAWKI_COL_ZPOINT_ZPOINT */
+/* HAWKI_COL_ZPOINT_ATX0 */
+/* HAWKI_COL_ZPOINT_FLUX */
+/* HAWKI_COL_ZPOINT_PEAK */
+/* HAWKI_COL_ZPOINT_BGD */
+/* HAWKI_COL_ZPOINT_FWHMX */
+/* HAWKI_COL_ZPOINT_FWHMY */
+/* HAWKI_COL_ZPOINT_FWHM */
+/* HAWKI_COL_ZPOINT_FWHMX_AS */
+/* HAWKI_COL_ZPOINT_FWHMY_AS */
+/* HAWKI_COL_ZPOINT_FWHM_AS */
+#define HAWKI_PROTYPE_ZPOINT_TAB "ZPOINT_TAB"
+
+/* Col: HAWKI_COL_PHOT_FILTER */
+/* HAWKI_COL_PHOT_EXTCOEFF */
+/* HAWKI_COL_PHOT_DEXTCOEFF */
+/* HAWKI_COL_PHOT_ZEROPOINT */
+/* HAWKI_COL_PHOT_DZEROPOINT */
+/* HAWKI_COL_PHOT_COLORTERM */
+/* HAWKI_COL_PHOT_DCOLORTERM */
+#define HAWKI_PROTYPE_PHOT_TAB "PHOT_COEFF"
+
+/* Col: HAWKI_COL_RAW_JITTER_QC_TEL_ALT */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AZ */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0 */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM */
+/* HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START */
+/* HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END */
+/* HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AIRM */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG */
+/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA */
+/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA */
+/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD */
+/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX */
+/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY */
+#define HAWKI_PROTYPE_SCIENCE_PCS "SCIENCE_PCS"
+
+/* HAWKI_COL_OFFSET_X */
+/* HAWKI_COL_OFFSET_Y */
+/* HAWKI_COL_CORRELATION */
+#define HAWKI_PROTYPE_OFFSETS "OFFSETS_REFINED"
+
+/* TODO: This is to be deprecated */
+#define HAWKI_PROTYPE_COEFFS "COEFFS"
+
+#define HAWKI_PROTYPE_LIN_STATS "LIN_STATS"
+#define HAWKI_PROTYPE_LIN_COEFFS "LIN_COEFFS"
+#define HAWKI_PROTYPE_GAIN_STATS "GAIN_STATS"
+#define HAWKI_PROTYPE_BPM_LEVELS "BPM_LEVELS"
+#define HAWKI_PROTYPE_LINGAIN_CORR "LINGAIN_CORR"
+#define HAWKI_PROTYPE_LINGAIN_DIFF "LINGAIN_DIFF"
+
+
+
+/************************************/
+
+/************************************/
+/* Define here the DO.CATG keywords */
+#define HAWKI_COMMAND_LINE "COMMAND_LINE"
+
+#define HAWKI_CAL_DARK_RAW "DARK"
+#define HAWKI_TEC_FLAT_RAW "TEC_FLAT"
+#define HAWKI_CAL_FLAT_RAW "FLAT"
+#define HAWKI_CAL_FOCUS_RAW "FOCUS"
+#define HAWKI_CAL_ZPOINT_RAW "ZPOINT"
+#define HAWKI_CAL_ILLUM_RAW "TEC_STD"
+#define HAWKI_IMG_JITTER_RAW "JITTER_OBS"
+#define HAWKI_IMG_JITTER_SKY_RAW "JITTER_SKY"
+#define HAWKI_CAL_LINGAIN_LAMP_RAW "DETLIN_LAMP"
+#define HAWKI_CAL_LINGAIN_DARK_RAW "DETLIN_DARK"
+#define HAWKI_CAL_DISTOR_RAW "DISTOR_OBS"
+#define HAWKI_CAL_DISTOR_SKY_RAW "DISTOR_SKY"
+
+#define HAWKI_UTIL_STDSTARS_RAW "STDSTAR_CAT"
+#define HAWKI_UTIL_DISTMAP_RAW "DIST_MAP"
+#define HAWKI_UTIL_CAT_2MASS "CAT_2MASS"
+/************************************/
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+int hawki_dfs_set_groups(cpl_frameset *) ;
+
+#endif
diff --git a/hawki/hawki_distortion.c b/hawki/hawki_distortion.c
new file mode 100644
index 0000000..cd860d3
--- /dev/null
+++ b/hawki/hawki_distortion.c
@@ -0,0 +1,1228 @@
+/* $Id: hawki_distortion.c,v 1.32 2011/02/23 11:49:37 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/02/23 11:49:37 $
+ * $Revision: 1.32 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+//Minimization algorithm hard-coded constants
+#define HAWKI_DISTORTION_MAX_ITER 10000
+#define HAWKI_DISTORTION_TOLERANCE 0.001
+#define HAWKI_DISTORTION_MAX_ITER2 100000
+#define HAWKI_DISTORTION_TOLERANCE2 0.0001
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <cxdeque.h>
+#ifdef HAVE_LIBGSL
+#include <gsl/gsl_multimin.h>
+#endif
+
+#include "hawki_distortion.h"
+#include "hawki_dfs.h"
+#include "hawki_utils.h"
+#include "hawki_load.h"
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_distortion Distortion correction
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/**
+ * This private structure allows to pass parameters to the minimization
+ * function used to compute the distortion solution
+ * @see hawki_distortion_compute_solution
+ */
+struct _hawki_distortion_obj_function_args_
+{
+ const cpl_table ** ref_catalogues;
+ const cpl_table * matching_sets;
+ cpl_bivector * offsets;
+ hawki_distortion * distortion;
+ int ncats;
+};
+
+
+//Private functions
+
+int hawki_distortion_interpolate_distortion
+(const hawki_distortion * distortion,
+ double x_pos,
+ double y_pos,
+ double * x_dist,
+ double * y_dist);
+
+double hawki_distortion_compute_rms
+(const cpl_table ** ref_catalogues,
+ const cpl_bivector * cat_offsets,
+ const cpl_table * matching_sets,
+ int ncats,
+ hawki_distortion * distortion);
+
+#ifdef HAVE_LIBGSL
+double hawki_distortion_gsl_obj_function
+(const gsl_vector * dist_param,
+ void * args);
+
+int hawki_distortion_update_solution_from_param
+(hawki_distortion * distortion,
+ const gsl_vector * dist_param);
+
+int hawki_distortion_update_offsets_from_param
+(cpl_bivector * offsets,
+ const gsl_vector * dist_param);
+
+int hawki_distortion_update_param_from_solution
+(gsl_vector * dist_param,
+ const hawki_distortion * distortion);
+
+int hawki_distortion_update_param_from_offsets
+(gsl_vector * dist_param,
+ const cpl_bivector * offsets);
+#endif
+
+void hawki_distortion_get_flag_vars
+(double * x_val, double * y_val, int *pos_flag,
+ int nvals, int *nvalid, double *var_x, double *var_y);
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Allocate a new distortion solution
+ @param detector_nx The dimensions in X of a HAWK-I detector
+ @param detector_nx The dimensions in Y of a HAWK-I detector
+ @param grid_size The number of points in the distortion grid
+ @return The allocated distortion if everything is ok , NULL otherwise
+ */
+/*----------------------------------------------------------------------------*/
+hawki_distortion * hawki_distortion_grid_new
+(int detector_nx,
+ int detector_ny,
+ int grid_size)
+{
+ hawki_distortion * distortion;
+
+ //Allocate the structure
+ distortion = cpl_malloc(sizeof(hawki_distortion));
+
+ //Allocate the images
+ distortion->dist_x = cpl_image_new
+ (grid_size, grid_size, CPL_TYPE_FLOAT);
+ distortion->dist_y = cpl_image_new
+ (grid_size, grid_size, CPL_TYPE_FLOAT);
+
+ //Create the transformation between distortion images and the detector
+ distortion->x_cdelt = detector_nx / (double)grid_size;
+ distortion->y_cdelt = detector_ny / (double)grid_size;
+ distortion->x_crval = 0.5 + 0.5 * distortion->x_cdelt;
+ distortion->y_crval = 0.5 + 0.5 * distortion->y_cdelt;
+
+ return distortion;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Deallocates a hawki_distortion structure
+ @param distortion The distortion to allocate
+ */
+/*----------------------------------------------------------------------------*/
+void hawki_distortion_delete
+(hawki_distortion * distortion)
+{
+ if(distortion == NULL)
+ return;
+ cpl_image_delete(distortion->dist_x);
+ cpl_image_delete(distortion->dist_y);
+ cpl_free(distortion);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Loads the distortion solution for one detector
+ @param dist_x the image with distortion in X
+ @param dist_y the image with distortion in Y
+ @param idet the detector to read.
+ @return The allocated distortion if everything is ok , NULL otherwise
+ */
+/*----------------------------------------------------------------------------*/
+hawki_distortion * hawki_distortion_load
+(const cpl_frame * dist_x,
+ const cpl_frame * dist_y,
+ int idet)
+{
+ const char * file_dist_x;
+ const char * file_dist_y;
+ hawki_distortion * distortion;
+ int iext;
+ cpl_propertylist * plist;
+
+ //Allocate the structure
+ distortion = cpl_malloc(sizeof(hawki_distortion));
+
+ //Read the images
+ file_dist_x = cpl_frame_get_filename(dist_x);
+ file_dist_y = cpl_frame_get_filename(dist_y);
+ distortion->dist_x = hawki_load_frame_detector
+ (dist_x, idet, CPL_TYPE_FLOAT);
+ distortion->dist_y = hawki_load_frame_detector
+ (dist_y, idet, CPL_TYPE_FLOAT);
+
+ //Read the WCS keywords
+ iext = hawki_get_ext_from_detector(file_dist_x, idet);
+ plist = cpl_propertylist_load(file_dist_x, iext);
+ distortion->x_crval = cpl_propertylist_get_double(plist, "CRVAL1");
+ distortion->x_cdelt = cpl_propertylist_get_double(plist, "CDELT1");
+ distortion->y_crval = cpl_propertylist_get_double(plist, "CRVAL2");
+ distortion->y_cdelt = cpl_propertylist_get_double(plist, "CDELT2");
+ if(cpl_propertylist_get_double(plist, "CRPIX1") != 1 ||
+ cpl_propertylist_get_double(plist, "CRPIX2") != 1)
+ {
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__,"Wrong CRPIX? keywords");
+ cpl_image_delete(distortion->dist_x);
+ cpl_image_delete(distortion->dist_y);
+ cpl_propertylist_delete(plist);
+ cpl_free(distortion);
+ return NULL;
+ }
+ cpl_propertylist_delete(plist);
+ //Check that the keywords in X and Y are compatibles;
+ plist = cpl_propertylist_load(file_dist_y, iext);
+ if(distortion->x_crval != cpl_propertylist_get_double(plist, "CRVAL1") ||
+ distortion->x_cdelt != cpl_propertylist_get_double(plist, "CDELT1") ||
+ distortion->y_crval != cpl_propertylist_get_double(plist, "CRVAL2") ||
+ distortion->y_cdelt != cpl_propertylist_get_double(plist, "CDELT2") ||
+ cpl_propertylist_get_double(plist, "CRPIX1") != 1 ||
+ cpl_propertylist_get_double(plist, "CRPIX2") != 1)
+ {
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT, __FILE__,
+ __LINE__,"WCS keywords mismatch in X and Y distortions");
+ cpl_image_delete(distortion->dist_x);
+ cpl_image_delete(distortion->dist_y);
+ cpl_propertylist_delete(plist);
+ cpl_free(distortion);
+ return NULL;
+ }
+ cpl_propertylist_delete(plist);
+
+ return distortion;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Gives the dimension in X of the distortion solution
+ @param dist the distortion solution
+ @return The dimension in X
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_get_size_x
+(const hawki_distortion * distortion)
+{
+ if(distortion == NULL)
+ {
+ cpl_error_set(__func__,CPL_ERROR_ILLEGAL_INPUT);
+ }
+ return cpl_image_get_size_x(distortion->dist_x);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Gives the dimension in Y of the distortion solution
+ @param dist the distortion solution
+ @return The dimension in Y
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_get_size_y
+(const hawki_distortion * distortion)
+{
+ if(distortion == NULL)
+ {
+ cpl_error_set(__func__,CPL_ERROR_ILLEGAL_INPUT);
+ }
+ return cpl_image_get_size_y(distortion->dist_x);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the distortion correction
+ @param ilist the input image list (chips 1 2 3 4)
+ @param dist the distortion file
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_correct_alldetectors
+(cpl_image ** ilist,
+ const cpl_frame * frame_dist_x,
+ const cpl_frame * frame_dist_y)
+{
+ cpl_image * corr[HAWKI_NB_DETECTORS];
+ hawki_distortion * distortion;
+ cpl_image * dist_x;
+ cpl_image * dist_y;
+ int idet, j ;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+ if (frame_dist_x == NULL) return -1 ;
+ if (frame_dist_y == NULL) return -1 ;
+
+ /* Loop on the 4 chips */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ int nx;
+ int ny;
+
+ /* Get the image size */
+ nx = cpl_image_get_size_x(ilist[idet]);
+ ny = cpl_image_get_size_y(ilist[idet]);
+
+ /* Load the distortion */
+ if ((distortion = hawki_distortion_load
+ (frame_dist_x, frame_dist_y, idet + 1)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the distortion for chip %d",
+ idet+1) ;
+ for (j=0 ; j<idet ; j++) cpl_image_delete(corr[j]) ;
+ return -1 ;
+ }
+
+ /* Create the offsets images */
+ dist_x = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+ dist_y = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+ if (hawki_distortion_create_maps_detector
+ (distortion, dist_x, dist_y))
+ {
+ cpl_msg_error(__func__, "Cannot create the distortion maps") ;
+ cpl_image_delete(dist_x);
+ cpl_image_delete(dist_y);
+ for (j=0 ; j<idet ; j++) cpl_image_delete(corr[j]) ;
+ return -1;
+ }
+
+ /* Correct this image */
+ corr[idet] = hawki_distortion_correct_detector(ilist[idet], dist_x, dist_y);
+ if(corr[idet] == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot correct the distortion") ;
+ hawki_distortion_delete(distortion);
+ cpl_image_delete(dist_x);
+ cpl_image_delete(dist_y);
+ for (j=0 ; j<idet; j++) cpl_image_delete(corr[j]) ;
+ return -1 ;
+ }
+ hawki_distortion_delete(distortion);
+ cpl_image_delete(dist_x) ;
+ cpl_image_delete(dist_y);
+ }
+
+ /* Store the results */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_image_delete(ilist[idet]) ;
+ ilist[idet] = corr[idet] ;
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the distortion correction to one chip
+ @param image the input image
+ @param dist the distortion table
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_distortion_correct_detector
+(cpl_image * image,
+ cpl_image * dist_x,
+ cpl_image * dist_y)
+{
+ cpl_image * corr;
+ cpl_vector * profile ;
+
+ /* Test entries */
+ if (image == NULL) return NULL;
+ if (dist_x == NULL) return NULL;
+ if (dist_y == NULL) return NULL;
+
+ /* Create the output image */
+ corr = cpl_image_new(cpl_image_get_size_x(image),
+ cpl_image_get_size_y(image), CPL_TYPE_FLOAT) ;
+
+ /* Create the interpolation profile */
+ profile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES) ;
+ cpl_vector_fill_kernel_profile(profile, CPL_KERNEL_DEFAULT,
+ CPL_KERNEL_DEF_WIDTH) ;
+
+ /* Apply the distortion */
+ if (cpl_image_warp(corr, image, dist_x, dist_y, profile,
+ CPL_KERNEL_DEF_WIDTH, profile,
+ CPL_KERNEL_DEF_WIDTH) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__, "Cannot warp the image") ;
+ cpl_image_delete(corr) ;
+ cpl_vector_delete(profile) ;
+ return NULL;
+ }
+ cpl_vector_delete(profile) ;
+
+ /* Return */
+ return corr;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the distortion correction to one detector position
+ @param distortion the distortion solution
+ @param x_pos the X position in detector that we want to correct.
+ @param y_pos the Y position in detector that we want to correct.
+ @param x_pos_distcorr the X position in detector corrected from distortion
+ @param y_pos_distcorr the Y position in detector corrected from distortion
+ @return 0 if everything is ok, -1 otherwise
+
+ This function will interpolate the distortion solution (given in
+ variable distortion, @see hawki_distortion_new)
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_correct_coords
+(const hawki_distortion * distortion,
+ double x_pos,
+ double y_pos,
+ double * x_pos_distcorr,
+ double * y_pos_distcorr)
+{
+ double x_dist;
+ double y_dist;
+
+ if(distortion == NULL)
+ {
+ cpl_error_set("hawki_distortion_correct_coords", CPL_ERROR_ILLEGAL_INPUT);
+ return -1;
+ }
+
+ hawki_distortion_interpolate_distortion
+ (distortion, x_pos, y_pos, &x_dist, &y_dist);
+
+ *x_pos_distcorr = x_pos - x_dist;
+ *y_pos_distcorr = y_pos - y_dist;
+
+ return 0;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the inverse distortion correction to one detector position
+ @param distortion the distortion solution
+ @param x_pos the X position in detector that we want to decorrect.
+ @param y_pos the Y position in detector that we want to decorrect.
+ @param x_pos_distcorr the X position in detector decorrected from distortion
+ @param y_pos_distcorr the Y position in detector decorrected from distortion
+ @return 0 if everything is ok, -1 otherwise
+
+ This function is the inverse function of hawki_distortion_correct_coords.
+ WARNING: Although this is the "inverse" of hawki_distortion_correct_coords,
+ applying this function to positions delivered by
+ hawki_distortion_correct_coords will not provide the original positions back.
+ We are simply not using the same position to interpolate the distortion table.
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_inverse_correct_coords
+(const hawki_distortion * distortion,
+ double x_pos,
+ double y_pos,
+ double * x_pos_distinvcorr,
+ double * y_pos_distinvcorr)
+{
+ double x_dist = 0;
+ double y_dist = 0;
+ int i;
+ int niter = 3;
+
+ if(distortion == NULL)
+ {
+ cpl_error_set("hawki_distortion_inverse_correct_coords", CPL_ERROR_ILLEGAL_INPUT);
+ return -1;
+ }
+ for(i = 0; i < niter; ++i)
+ {
+ hawki_distortion_interpolate_distortion
+ (distortion, x_pos + x_dist, y_pos + y_dist, &x_dist, &y_dist);
+ }
+
+
+ /* Apply the correction in the inverse direction */
+ *x_pos_distinvcorr = x_pos + x_dist;
+ *y_pos_distinvcorr = y_pos + y_dist;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Interpolates the distortion solution at a given position
+ @param distortion the distortion solution
+ @param x_pos the X position in detector that we want to correct.
+ @param y_pos the Y position in detector that we want to correct.
+ @param x_dist the distortion in X at position x_pos, y_pos
+ @param y_dist the distortion in Y at position x_pos, y_pos
+ @return 0 if everything is ok, -1 otherwise
+
+ This private function uses the four reference points found in distortion
+ closer to x_pos, y_pos. Then it weights each point with the 3rd power of the
+ distance to the target pixel and uses a linear interpolation.
+
+ If this function is used in a multithread environment with a CPL version not
+ thread-safe, there is no risk as long as these two premises are hold:
+ -The caller must check if distortion->dist_x and distortion->dist_y are not
+ null before calling this function, because this is check by
+ cpl_image_get_size_x and cpl_image_get.
+ -The caller must check in advance that the mask has all the points valid,
+ because cpl_image_get checks for the validity of the pixel in the mask,
+ if it is not valid, enters the error handling of CPL, which is not
+ thread-safe, at least before CPL 5.2.
+ The rest of the calls are read-only, so it should be safe.
+
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_interpolate_distortion
+(const hawki_distortion * distortion,
+ double x_pos,
+ double y_pos,
+ double * x_dist,
+ double * y_dist)
+{
+ int ix1;
+ int ix2;
+ int iy1;
+ int iy2;
+ int nx;
+ int ny;
+ double x1_pos;
+ double x2_pos;
+ double y1_pos;
+ double y2_pos;
+ double dx11;
+ double dx12;
+ double dx21;
+ double dx22;
+ double dy11;
+ double dy12;
+ double dy21;
+ double dy22;
+ int isnull;
+
+ /* Get the size of the distortion images */
+ nx = cpl_image_get_size_x(distortion->dist_x);
+ ny = cpl_image_get_size_y(distortion->dist_x);
+
+ //This uses bilinear interpolation
+ //Get lower left corner. This assumes CRPIX? =1 and ix, iy start with 0
+ ix1 = (int)floor((x_pos - distortion->x_crval)/distortion->x_cdelt);
+ iy1 = (int)floor((y_pos - distortion->y_crval)/distortion->y_cdelt);
+ //Handle extrapolation
+ if(ix1 < 0)
+ ix1 = 0;
+ if(ix1 >= nx - 1)
+ ix1 = nx - 2;
+ if(iy1 < 0)
+ iy1 = 0;
+ if(iy1 >= ny - 1)
+ iy1 = ny - 2;
+ //Get upper right corner
+ ix2 = ix1 + 1;
+ iy2 = iy1 + 1;
+
+ //Get the position values
+ //This implies that CRPIX? = 1 and that ix, iy start at 0.
+ x1_pos = ix1 * distortion->x_cdelt + distortion->x_crval;
+ x2_pos = ix2 * distortion->x_cdelt + distortion->x_crval;
+ y1_pos = iy1 * distortion->y_cdelt + distortion->y_crval;
+ y2_pos = iy2 * distortion->y_cdelt + distortion->y_crval;
+
+ //Get the values used to interpolate
+ //The +1 is because cpl_image_get uses FITS convention
+ dx11 = cpl_image_get(distortion->dist_x, ix1 + 1, iy1 + 1, &isnull);
+ dx21 = cpl_image_get(distortion->dist_x, ix2 + 1, iy1 + 1, &isnull);
+ dx12 = cpl_image_get(distortion->dist_x, ix1 + 1, iy2 + 1, &isnull);
+ dx22 = cpl_image_get(distortion->dist_x, ix2 + 1, iy2 + 1, &isnull);
+ dy11 = cpl_image_get(distortion->dist_y, ix1 + 1, iy1 + 1, &isnull);
+ dy21 = cpl_image_get(distortion->dist_y, ix2 + 1, iy1 + 1, &isnull);
+ dy12 = cpl_image_get(distortion->dist_y, ix1 + 1, iy2 + 1, &isnull);
+ dy22 = cpl_image_get(distortion->dist_y, ix2 + 1, iy2 + 1, &isnull);
+
+
+ //Compute the final values
+ *x_dist = dx11 * (x2_pos - x_pos) * (y2_pos - y_pos) +
+ dx21 * (x_pos - x1_pos) * (y2_pos - y_pos) +
+ dx12 * (x2_pos - x_pos) * (y_pos - y1_pos) +
+ dx22 * (x_pos - x1_pos) * (y_pos - y1_pos);
+ *x_dist = *x_dist / (x2_pos -x1_pos) / (y2_pos -y1_pos);
+ *y_dist = dy11 * (x2_pos - x_pos) * (y2_pos - y_pos) +
+ dy21 * (x_pos - x1_pos) * (y2_pos - y_pos) +
+ dy12 * (x2_pos - x_pos) * (y_pos - y1_pos) +
+ dy22 * (x_pos - x1_pos) * (y_pos - y1_pos);
+ *y_dist = *y_dist / (x2_pos -x1_pos) / (y2_pos -y1_pos);
+
+ return 0;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the distortion correction
+ @param ilist the input image list (chips 1 2 3 4)
+ @param dist the distortion file
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_apply_maps
+(cpl_imagelist * ilist,
+ cpl_image ** dist_x,
+ cpl_image ** dist_y)
+{
+ cpl_image * corr[HAWKI_NB_DETECTORS] ;
+ int i, j ;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+ if (dist_x == NULL) return -1 ;
+ if (dist_y == NULL) return -1 ;
+
+ /* Loop on the 4 chips */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_image * cur_image;
+
+ /* Get the current image */
+ cur_image = cpl_imagelist_get(ilist, i);
+
+ /* Correct this image */
+ corr[i] = hawki_distortion_correct_detector(cur_image,dist_x[i],dist_y[i]);
+ if(corr[i] == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot correct the distortion") ;
+ for (j=0 ; j<i ; j++) cpl_image_delete(corr[j]) ;
+ return -1 ;
+ }
+ }
+
+ /* Store the results */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_imagelist_set(ilist, corr[i], i);
+
+ /* Return */
+ return 0 ;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the delta x and y maps from the table
+ @param dist_tab the distortion table
+ @param dist_x the distortion image in x
+ @param dist_y the distortion image in y
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_create_maps_detector
+(const hawki_distortion * distortion,
+ cpl_image * dist_x,
+ cpl_image * dist_y)
+{
+ double * pdx;
+ double * pdy;
+ int nx, ny;
+ int pos;
+ int i, j;
+
+ /* Test entries */
+ if (distortion == NULL) return -1 ;
+ if (dist_x == NULL) return -1 ;
+ if (dist_y == NULL) return -1 ;
+
+ /* Initialise */
+ nx = cpl_image_get_size_x(dist_x) ;
+ ny = cpl_image_get_size_y(dist_x) ;
+ if (cpl_image_get_size_x(dist_y) != nx) return -1 ;
+ if (cpl_image_get_size_y(dist_y) != ny) return -1 ;
+
+ /* Access to the data */
+ pdx = cpl_image_get_data_double(dist_x) ;
+ pdy = cpl_image_get_data_double(dist_y) ;
+
+ /* Loop on the pixels */
+ for (j=0 ; j<ny ; j++) {
+ for (i=0 ; i<nx ; i++) {
+ double x_dist;
+ double y_dist;
+
+ pos = i+j*nx ;
+
+ hawki_distortion_interpolate_distortion
+ (distortion, (double)i, (double)j, &x_dist, &y_dist);
+
+ pdx[pos] = x_dist;
+ pdy[pos] = y_dist;
+ }
+ }
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the distortion solution using an autocalibration method
+ @param ref_catalogues the catalogues containing stars to use
+ for autocalibration
+ @param cat_offsets the approximate offsets for each of the catalogues
+ @param matching_sets a table containing the matchings between catalog
+ sources
+ dist_y the distortion image in y
+ @return 0 if everything is ok, -1 otherwise
+
+ This function asumes that the input catalogues (ncats in number) contain
+ columns named X_POS, Y_POS, which are the positions of the stars in each
+ of the ncats images.
+ The matching_sets table contains in the column "MATCHING_SETS" an array of
+ ncats length. Each array represents one matching. The position in the array
+ corresponds to each catalogue, and the value corresponds to the object in
+ the catalogue. If the value is -1 then there is no match for that catalogue.
+ The function uses an iterative approach trying to minimize the distortion
+ corrected residuals for each match.
+
+ TODO: The function has to fit the offsets as well.
+
+ */
+/*----------------------------------------------------------------------------*/
+hawki_distortion * hawki_distortion_compute_solution
+(const cpl_table ** ref_catalogues,
+ const cpl_bivector * initial_offsets,
+ const cpl_table * matching_sets,
+ int ncats,
+ int detector_nx,
+ int detector_ny,
+ int grid_size,
+ const hawki_distortion * initial_guess,
+ double * rms)
+{
+#ifdef HAVE_LIBGSL
+
+ hawki_distortion * distortion;
+ cpl_bivector * offsets;
+ gsl_multimin_fminimizer * minimizer;
+ gsl_vector * step_size;
+ gsl_vector * init_param;
+ gsl_multimin_function minimize_function;
+
+ int nfitparam = 0;
+ int iparam;
+ double tolerance = HAWKI_DISTORTION_TOLERANCE;
+ double tolerance2 = HAWKI_DISTORTION_TOLERANCE2;
+ int minimizer_status;
+ int iter = 0;
+ struct _hawki_distortion_obj_function_args_ args;
+
+ /* Initialize the distortion solution */
+ if(initial_guess == NULL)
+ {
+ distortion = hawki_distortion_grid_new
+ (detector_nx, detector_ny, grid_size);
+ }
+ else
+ {
+ distortion = cpl_malloc(sizeof(hawki_distortion));
+ distortion->dist_x = cpl_image_duplicate(initial_guess->dist_x);
+ distortion->dist_y = cpl_image_duplicate(initial_guess->dist_y);
+ distortion->x_cdelt = initial_guess->x_cdelt;
+ distortion->x_crval = initial_guess->x_crval;
+ distortion->y_cdelt = initial_guess->y_cdelt;
+ distortion->y_crval = initial_guess->y_crval;
+ //We have to fit all the distortion coefficients plus
+ //the offsets of the catalogues
+ }
+ //We have to fit all the distortion coefficients plus
+ //the offsets of the catalogues
+ nfitparam = grid_size * grid_size * 2 + ncats * 2;
+ offsets = cpl_bivector_duplicate(initial_offsets);
+ if(cpl_table_get_nrow(matching_sets) * 2 < nfitparam)
+ {
+ cpl_msg_error(__func__,"Too few matches to compute distortion (< %d)",
+ nfitparam);
+ hawki_distortion_delete(distortion);
+ return NULL;
+ }
+
+ /* Setup function to minimize */
+ args.ref_catalogues = ref_catalogues;
+ args.matching_sets = matching_sets;
+ args.distortion = distortion;
+ args.offsets = offsets;
+ args.ncats = ncats;
+
+ minimize_function.f = hawki_distortion_gsl_obj_function;
+ minimize_function.n = nfitparam;
+ minimize_function.params = &args;
+
+ /* Setup minimizer */
+ minimizer = gsl_multimin_fminimizer_alloc
+ (gsl_multimin_fminimizer_nmsimplex, nfitparam);
+ step_size = gsl_vector_alloc(nfitparam);
+ init_param = gsl_vector_alloc(nfitparam);
+ for(iparam = 0; iparam < grid_size * grid_size * 2; ++iparam)
+ gsl_vector_set(step_size, iparam, 5);
+ for(iparam = grid_size * grid_size * 2;
+ iparam < nfitparam; ++iparam)
+ gsl_vector_set(step_size, iparam, 1);
+ hawki_distortion_update_param_from_solution(init_param, distortion);
+ hawki_distortion_update_param_from_offsets(init_param, offsets);
+ gsl_multimin_fminimizer_set(minimizer, &minimize_function,
+ init_param, step_size);
+
+ do
+ {
+ ++iter;
+ minimizer_status = gsl_multimin_fminimizer_iterate (minimizer);
+ if(minimizer_status)
+ break;
+ minimizer_status = gsl_multimin_test_size
+ (gsl_multimin_fminimizer_size(minimizer), tolerance);
+ cpl_msg_debug(__func__,"Iteration %d Minimum: %g",
+ iter, gsl_multimin_fminimizer_minimum(minimizer));
+ }
+ while (minimizer_status == GSL_CONTINUE && iter < HAWKI_DISTORTION_MAX_ITER);
+
+ cpl_msg_warning(__func__, "rms before computing %f", hawki_distortion_compute_rms(ref_catalogues, offsets,
+ matching_sets, ncats, distortion));
+
+
+ //Do it again to avoid local minimum
+ gsl_multimin_fminimizer_set(minimizer, &minimize_function,
+ gsl_multimin_fminimizer_x(minimizer), step_size);
+ iter = 0;
+ do
+ {
+ ++iter;
+ minimizer_status = gsl_multimin_fminimizer_iterate (minimizer);
+ if(minimizer_status)
+ break;
+ minimizer_status = gsl_multimin_test_size
+ (gsl_multimin_fminimizer_size(minimizer), tolerance2);
+ cpl_msg_debug(__func__,"2nd run Iteration %d Minimum: %g",
+ iter, gsl_multimin_fminimizer_minimum(minimizer));
+ }
+ while (minimizer_status == GSL_CONTINUE && iter < HAWKI_DISTORTION_MAX_ITER2);
+
+ /* Update the distortion solution */
+ hawki_distortion_update_solution_from_param
+ (distortion, gsl_multimin_fminimizer_x(minimizer));
+ hawki_distortion_update_offsets_from_param
+ (offsets, gsl_multimin_fminimizer_x(minimizer));
+
+ *rms = hawki_distortion_compute_rms(ref_catalogues, offsets,
+ matching_sets, ncats, distortion);
+
+ /* Free and return */
+ gsl_multimin_fminimizer_free(minimizer);
+ gsl_vector_free(init_param);
+ gsl_vector_free(step_size);
+ cpl_bivector_delete(offsets);
+
+ return distortion;
+#else
+ cpl_msg_error(__func__,"Not compiled with GSL support.");
+ return NULL;
+#endif
+}
+
+#ifdef HAVE_LIBGSL
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This private function computes the rms, which is the objective
+ function of the minimization algorithm. This function
+ has the needed interface for gsl, so it is a wrapper of
+ @see hawki_distortion_compute_rms
+ @see hawki_distortion_compute_solution
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_distortion_gsl_obj_function
+(const gsl_vector * dist_param,
+ void * args)
+{
+ struct _hawki_distortion_obj_function_args_ args_struct;
+ const cpl_table ** ref_catalogues;
+ const cpl_table * matching_sets;
+ hawki_distortion * distortion;
+ cpl_bivector * offsets;
+ int ncats;
+ double rms;
+ double objective_function;
+
+
+
+ args_struct = *(struct _hawki_distortion_obj_function_args_ * )args;
+ ref_catalogues = args_struct.ref_catalogues;
+ matching_sets = args_struct.matching_sets;
+ distortion = args_struct.distortion;
+ offsets = args_struct.offsets;
+ ncats = args_struct.ncats;
+
+ hawki_distortion_update_solution_from_param(distortion, dist_param);
+ hawki_distortion_update_offsets_from_param(offsets, dist_param);
+
+ rms = hawki_distortion_compute_rms(ref_catalogues, offsets,
+ matching_sets, ncats, distortion);
+
+ objective_function = rms;
+
+
+ cpl_msg_debug(__func__,"Objective function: %g", objective_function);
+ return objective_function;
+}
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This private function computes the rms, which is the objective
+ function of the minimization algorithm.
+ @see hawki_distortion_compute_solution
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_distortion_compute_rms
+(const cpl_table ** ref_catalogues,
+ const cpl_bivector * cat_offsets,
+ const cpl_table * matching_sets,
+ int ncats,
+ hawki_distortion * distortion)
+{
+ int icat;
+ int imatch;
+ int nmatch;
+ double rms = 0;
+ const double * x_cat_offsets;
+ const double * y_cat_offsets;
+ const double ** x_cat_cols;
+ const double ** y_cat_cols;
+ const cpl_array ** match_arrays;
+ double ** x_pos_values;
+ double ** y_pos_values;
+ int ** pos_flag;
+
+
+
+ nmatch = cpl_table_get_nrow(matching_sets);
+
+ x_cat_offsets = cpl_vector_get_data_const
+ (cpl_bivector_get_x_const(cat_offsets));
+ y_cat_offsets = cpl_vector_get_data_const
+ (cpl_bivector_get_y_const(cat_offsets));
+
+ x_cat_cols = cpl_malloc(sizeof(double *) * ncats);
+ y_cat_cols = cpl_malloc(sizeof(double *) * ncats);
+ for(icat = 0; icat < ncats; ++icat)
+ {
+ x_cat_cols[icat] = cpl_table_get_data_double_const(ref_catalogues[icat],
+ HAWKI_COL_OBJ_POSX);
+ y_cat_cols[icat] = cpl_table_get_data_double_const(ref_catalogues[icat],
+ HAWKI_COL_OBJ_POSY);
+ }
+
+ match_arrays = cpl_malloc(sizeof(cpl_array *) * nmatch);
+ x_pos_values = cpl_malloc(sizeof(double *) * nmatch);
+ y_pos_values = cpl_malloc(sizeof(double *) * nmatch);
+ pos_flag = cpl_malloc(sizeof(int *) * nmatch);
+ for(imatch = 0; imatch < nmatch; ++imatch)
+ {
+ match_arrays[imatch] = cpl_table_get_array(matching_sets,
+ HAWKI_COL_MATCHING_SETS, imatch);
+ x_pos_values[imatch] = cpl_malloc(sizeof(double) * ncats);
+ y_pos_values[imatch] = cpl_malloc(sizeof(double) * ncats);
+ pos_flag[imatch] = cpl_malloc(sizeof(int) * ncats);
+ }
+
+#ifdef _OPENMP
+#pragma omp parallel for private(icat,imatch) reduction(+:rms)
+#endif
+ for(imatch = 0; imatch < nmatch; ++imatch)
+ {
+ int nstddev;
+ double var_x;
+ double var_y;
+
+ for(icat = 0; icat < ncats; ++icat)
+ {
+ int iobj;
+ double x_cat_offset;
+ double y_cat_offset;
+
+ x_cat_offset = x_cat_offsets[icat];
+ y_cat_offset = y_cat_offsets[icat];
+
+ if((iobj = cpl_array_get(match_arrays[imatch], icat, NULL)) != -1)
+ {
+ double x_cat;
+ double y_cat;
+ double x_dist_corr;
+ double y_dist_corr;
+ double x_dist;
+ double y_dist;
+ double x_glob;
+ double y_glob;
+
+ x_cat = x_cat_cols[icat][iobj];
+ y_cat = y_cat_cols[icat][iobj];
+
+
+ //These 4 lines of code are from hawki_distortion_correct_coords.
+ //The are repeated here to avoid a cpl call, which is not thread-safe
+ //Two checks to ensure thread-safety:
+ //We have ensured outside the loop that distortion->dist_x and
+ //distortion->dist_y are not null.
+ //We have checked outside the loop the mask has all the points valid
+ hawki_distortion_interpolate_distortion
+ (distortion, x_cat, y_cat, &x_dist, &y_dist);
+ x_dist_corr = x_cat - x_dist;
+ y_dist_corr = y_cat - y_dist;
+
+
+ x_glob = x_dist_corr + x_cat_offset;
+ y_glob = y_dist_corr + y_cat_offset;
+ x_pos_values[imatch][icat] = x_glob;
+ y_pos_values[imatch][icat] = y_glob;
+ pos_flag[imatch][icat] = 1;
+ }
+ else
+ pos_flag[imatch][icat] = 0;
+ }
+
+ hawki_distortion_get_flag_vars(x_pos_values[imatch],
+ y_pos_values[imatch], pos_flag[imatch],
+ ncats, &nstddev, &var_x, &var_y);
+
+ //The rms is counted as many times as this star is the list of catalogs.
+ rms += sqrt(var_x + var_y) * nstddev;
+
+ }
+ cpl_free(x_cat_cols);
+ cpl_free(y_cat_cols);
+ for(imatch = 0; imatch < nmatch; ++imatch)
+ {
+ cpl_free(x_pos_values[imatch]);
+ cpl_free(y_pos_values[imatch]);
+ cpl_free(pos_flag[imatch]);
+ }
+ cpl_free(x_pos_values);
+ cpl_free(y_pos_values);
+ cpl_free(pos_flag);
+ cpl_free(match_arrays);
+
+ return rms;
+}
+
+#ifdef HAVE_LIBGSL
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This private function updates the distortion solution given
+ the gsl structure with the parameters.
+ @see hawki_distortion_compute_solution
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_update_solution_from_param
+(hawki_distortion * distortion,
+ const gsl_vector * dist_param)
+{
+ int ipoint;
+ int ix;
+ int iy;
+ int nx;
+ int ny;
+ double x_dist_mean;
+ double y_dist_mean;
+
+ nx = cpl_image_get_size_x(distortion->dist_x);
+ ny = cpl_image_get_size_y(distortion->dist_x);
+ for(ix = 0; ix < nx; ++ix)
+ for(iy = 0; iy < ny; ++iy)
+ {
+ ipoint = ix + iy * nx;
+ cpl_image_set(distortion->dist_x, ix+1, iy+1,
+ gsl_vector_get(dist_param, ipoint * 2));
+ cpl_image_set(distortion->dist_y, ix+1, iy+1,
+ gsl_vector_get(dist_param, ipoint * 2 + 1));
+ }
+
+ /* Normalize to mean(distorsion) = 0 */
+ x_dist_mean = cpl_image_get_mean(distortion->dist_x);
+ y_dist_mean = cpl_image_get_mean(distortion->dist_y);
+ cpl_image_subtract_scalar(distortion->dist_x, x_dist_mean);
+ cpl_image_subtract_scalar(distortion->dist_y, y_dist_mean);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This private function updates the offsets given
+ the gsl structure with the parameters.
+ @see hawki_distortion_compute_solution
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_update_offsets_from_param
+(cpl_bivector * offsets,
+ const gsl_vector * dist_param)
+{
+ int i;
+ int ncats;
+ int nparam;
+
+ ncats = cpl_bivector_get_size(offsets);
+ nparam = dist_param->size;
+ for(i = 0; i < ncats; ++i)
+ {
+ cpl_vector_set(cpl_bivector_get_x(offsets), i,
+ gsl_vector_get(dist_param, nparam - 2 * ncats + 2 * i));
+ cpl_vector_set(cpl_bivector_get_y(offsets), i,
+ gsl_vector_get(dist_param, nparam - 2 * ncats + 2 * i + 1));
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This private function updates the gsl structure with the parameters
+ to fit given the distortion solution.
+ @see hawki_distortion_compute_solution
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_update_param_from_solution
+(gsl_vector * dist_param,
+ const hawki_distortion * distortion)
+{
+ int ipoint;
+ int ix;
+ int iy;
+ int nx;
+ int ny;
+ int isnull;
+
+ nx = cpl_image_get_size_x(distortion->dist_x);
+ ny = cpl_image_get_size_y(distortion->dist_y);
+ for(ix = 0; ix < nx; ++ix)
+ for(iy = 0; iy < ny; ++iy)
+ {
+ ipoint = ix + iy * nx;
+ gsl_vector_set(dist_param, ipoint * 2,
+ cpl_image_get(distortion->dist_x, ix+1, iy+1, &isnull));
+ gsl_vector_set(dist_param, ipoint * 2 + 1,
+ cpl_image_get(distortion->dist_y, ix+1, iy+1, &isnull));
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This private function updates the gsl structure with the parameters
+ to fit given the offsets. @see hawki_distortion_compute_solution
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_update_param_from_offsets
+(gsl_vector * dist_param,
+ const cpl_bivector * offsets)
+{
+ int i;
+ int ncats;
+ int nparam;
+
+ ncats = cpl_bivector_get_size(offsets);
+ nparam = dist_param->size;
+ for(i = 0; i < ncats; ++i)
+ {
+ gsl_vector_set(dist_param, nparam - 2 * ncats + 2 * i,
+ cpl_vector_get(cpl_bivector_get_x_const(offsets), i));
+ gsl_vector_set(dist_param, nparam - 2 * ncats + 2 * i + 1,
+ cpl_vector_get(cpl_bivector_get_y_const(offsets), i));
+ }
+
+ return 0;
+}
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the standard deviation of two vectors, not using flagged
+ values
+ @return The standard deviation
+ */
+/*----------------------------------------------------------------------------*/
+void hawki_distortion_get_flag_vars
+(double * x_val, double * y_val, int *pos_flag,
+ int nvals, int *nvalid, double *var_x, double *var_y)
+{
+ double varsum_x = 0.0;
+ double varsum_y = 0.0;
+ double mean_x = 0.0;
+ double mean_y = 0.0;
+ int i;
+
+ *nvalid = 0;
+ for (i=0; i < nvals; i++)
+ {
+ if(pos_flag[i] == 1)
+ {
+ const double delta_x = (double)x_val[i] - mean_x;
+ const double delta_y = (double)y_val[i] - mean_y;
+
+ varsum_x += *nvalid * delta_x * delta_x / (*nvalid + 1.0);
+ varsum_y += *nvalid * delta_y * delta_y / (*nvalid + 1.0);
+ mean_x += delta_x / (*nvalid + 1.0);
+ mean_y += delta_y / (*nvalid + 1.0);
+ (*nvalid)++;
+ }
+ }
+
+ /* Compute the bias-corrected standard deviation.
+ - With the recurrence relation rounding can likely not cause
+ the variance to become negative, but check just to be safe */
+ *var_x = varsum_x / (double) (*nvalid - 1);
+ *var_y = varsum_y / (double) (*nvalid - 1);
+}
diff --git a/hawki/hawki_distortion.h b/hawki/hawki_distortion.h
new file mode 100644
index 0000000..b6f19a8
--- /dev/null
+++ b/hawki/hawki_distortion.h
@@ -0,0 +1,127 @@
+/* $Id: hawki_distortion.h,v 1.12 2010/03/12 13:04:44 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/03/12 13:04:44 $
+ * $Revision: 1.12 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_DISTORTION_H
+#define HAWKI_DISTORTION_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Structures and typedefs
+ -----------------------------------------------------------------------------*/
+
+typedef struct _hawki_distortion_ hawki_distortion;
+
+struct _hawki_distortion_
+{
+ cpl_image * dist_x;
+ cpl_image * dist_y;
+ double x_crval;
+ double x_cdelt;
+ double y_crval;
+ double y_cdelt;
+};
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+hawki_distortion * hawki_distortion_grid_new
+(int detector_nx,
+ int detector_ny,
+ int grid_size);
+
+void hawki_distortion_delete
+(hawki_distortion * distortion);
+
+hawki_distortion * hawki_distortion_load
+(const cpl_frame * dist_x,
+ const cpl_frame * dist_y,
+ int idet);
+
+int hawki_distortion_get_size_x
+(const hawki_distortion * distortion);
+
+int hawki_distortion_get_size_y
+(const hawki_distortion * distortion);
+
+int hawki_distortion_correct_alldetectors
+(cpl_image ** alldetectors,
+ const cpl_frame * distortion_x,
+ const cpl_frame * distortion_y) ;
+
+cpl_image * hawki_distortion_correct_detector
+(cpl_image * image,
+ cpl_image * dist_x,
+ cpl_image * dist_y);
+
+int hawki_distortion_correct_coords
+(const hawki_distortion * distortion,
+ double x_pos,
+ double y_pos,
+ double * x_pos_distcorr,
+ double * y_pos_distcorr);
+
+int hawki_distortion_inverse_correct_coords
+(const hawki_distortion * distortion,
+ double x_pos,
+ double y_pos,
+ double * x_pos_distdecorr,
+ double * y_pos_distdecorr);
+
+int hawki_distortion_apply_maps
+(cpl_imagelist * ilist,
+ cpl_image ** dist_x,
+ cpl_image ** dist_y);
+
+int hawki_distortion_create_maps_detector
+(const hawki_distortion * distortion,
+ cpl_image * dist_detector_x,
+ cpl_image * dist_detector_y);
+
+int hawki_distortion_create_maps
+(const hawki_distortion * distortion,
+ cpl_image ** dist_x,
+ cpl_image ** dist_y);
+
+hawki_distortion * hawki_distortion_compute_solution
+(const cpl_table ** ref_catalogues,
+ const cpl_bivector * cat_offsets,
+ const cpl_table * matching_sets,
+ int ncats,
+ int detector_nx,
+ int detector_ny,
+ int grid_size,
+ const hawki_distortion * dist_initguess,
+ double * rms);
+
+
+#endif
diff --git a/hawki/hawki_image_stats.c b/hawki/hawki_image_stats.c
new file mode 100644
index 0000000..88a2d2a
--- /dev/null
+++ b/hawki/hawki_image_stats.c
@@ -0,0 +1,636 @@
+/* $Id: hawki_image_stats.c,v 1.8 2012/05/03 10:42:32 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/05/03 10:42:32 $
+ * $Revision: 1.8 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <cpl.h>
+
+#include "hawki_image_stats.h"
+#include "hawki_dfs.h"
+#include "hawki_utils.h"
+#include "hawki_load.h"
+
+/*----------------------------------------------------------------------------*/
+/* Private functions */
+/*----------------------------------------------------------------------------*/
+float hawki_tools_get_kth_float(float * a,
+ int n,
+ int k);
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_image_stats Compute several statistics on images
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Initialize the table with all the statistics columns
+ @param image_stats Table to fill with the statistics
+ @return 0 if everything is ok, -1 otherwise
+
+ This function creates the following columns in the given table:
+ MINIMUM, MAXIMUM, MEDIAN, MEAN, RMS, USED
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_image_stats_initialize
+(cpl_table ** raw_stats)
+{
+ int idet;
+ /* Error state variables */
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ /* Check inputs */
+ if(raw_stats == NULL)
+ return -1;
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ if(raw_stats[idet] == NULL)
+ return -1;
+ }
+
+ /* Creates the proper columns */
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_table_new_column
+ (raw_stats[idet],HAWKI_COL_STAT_MIN,CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MIN,"ADU");
+ cpl_table_new_column
+ (raw_stats[idet],HAWKI_COL_STAT_MAX,CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MAX,"ADU");
+ cpl_table_new_column
+ (raw_stats[idet],HAWKI_COL_STAT_MED,CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MED,"ADU");
+ cpl_table_new_column
+ (raw_stats[idet],HAWKI_COL_STAT_MEAN,CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MEAN,"ADU");
+ cpl_table_new_column
+ (raw_stats[idet],HAWKI_COL_STAT_RMS,CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_RMS,"ADU");
+ cpl_table_new_column
+ (raw_stats[idet],HAWKI_COL_STAT_USED,CPL_TYPE_INT);
+
+ }
+ /* Check error status and exit */
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Fills a table with the statistics of an image
+ @param image_stats Table to fill with the statistics
+ @param image The target image
+ @param llx Lower left x position (FITS convention)
+ @param lly Lower left y position (FITS convention)
+ @param urx Upper right x position (FITS convention)
+ @param ury Upper right y position (FITS convention)
+ @param idet The id of the table to store the data in
+ (0 to HAWKI_NB_DETECTORS)
+ @param irow The row in the table to store the stats (begins in 0)
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes the rectangle of the image given by llx, lly, urx, ury
+ and computes the image statistics. This statistics are stored in the table
+ image_stats, using the columns MINIMUM, MAXIMUM, MEDIAN, MEAN, RMS, USED.
+ The USED column is set to 1. The table must have already these columns
+ (call hawki_image_stats_initialize before)
+ The table used to store the data is image_stats[idet], in the row irow.
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_image_stats_fill_from_image
+(cpl_table ** image_stats,
+ const cpl_image * image,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ int idet,
+ int irow)
+{
+ /* stats variables */
+ double minval;
+ double maxval;
+ double median;
+ double stdev;
+ double mean;
+ cpl_stats * stats_ima ;
+
+ /* Error state variables */
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ /* Checking input */
+ if(image_stats == NULL || image == NULL)
+ return -1;
+
+ /* Compute statistics */
+ stats_ima = cpl_stats_new_from_image_window
+ (image, CPL_STATS_ALL, llx, lly, urx, ury) ;
+ if(stats_ima == NULL)
+ return -1;
+
+ /* Get the stats from the storage structure */
+ minval = cpl_stats_get_min(stats_ima);
+ maxval = cpl_stats_get_max(stats_ima);
+ median = cpl_stats_get_median(stats_ima);
+ stdev = cpl_stats_get_stdev(stats_ima);
+ mean = cpl_stats_get_mean(stats_ima);
+ cpl_stats_delete(stats_ima);
+
+ /* Store in table */
+ cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MIN,
+ irow, minval);
+ cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MAX,
+ irow, maxval);
+ cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MED,
+ irow, median);
+ cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MEAN,
+ irow, mean);
+ cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_RMS,
+ irow, stdev) ;
+ cpl_table_set_int(image_stats[idet], HAWKI_COL_STAT_USED,
+ irow, 1) ;
+
+ /* Check error status and exit */
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+int hawki_image_stats_odd_even_column_row_fill_from_image
+(cpl_table ** odd_column_stats,
+ cpl_table ** even_column_stats,
+ cpl_table ** odd_row_stats,
+ cpl_table ** even_row_stats,
+ const cpl_image * image,
+ int idet,
+ int irow)
+{
+ /* stats variables */
+ int i;
+ int j;
+ int nx;
+ int ny;
+ double minval;
+ double maxval;
+ double median;
+ double stdev;
+ double mean;
+ cpl_stats * stats_ima;
+ cpl_image * tmp_ima;
+ cpl_mask * mask;
+
+ /* Error state variables */
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ /* Checking input */
+ if(odd_column_stats == NULL ||
+ even_column_stats == NULL ||
+ odd_row_stats == NULL ||
+ even_row_stats == NULL ||
+ image == NULL)
+ return -1;
+
+ /* Copying the target image */
+ tmp_ima = cpl_image_duplicate(image);
+ nx = cpl_image_get_size_x(tmp_ima);
+ ny = cpl_image_get_size_y(tmp_ima);
+
+ /* Compute statistics odd column */
+ mask = cpl_image_get_bpm(tmp_ima);
+ for(i=0 ; i < nx ; ++i)
+ {
+ if((i+1) % 2)
+ for(j=0 ; j < ny ; ++j)
+ {
+ cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+ }
+ }
+ stats_ima = cpl_stats_new_from_image
+ (tmp_ima, CPL_STATS_ALL);
+ if(stats_ima == NULL)
+ {
+ cpl_image_delete(tmp_ima);
+ return -1;
+ }
+
+ /* Get the stats from the storage structure */
+ minval = cpl_stats_get_min(stats_ima);
+ maxval = cpl_stats_get_max(stats_ima);
+ median = cpl_stats_get_median(stats_ima);
+ stdev = cpl_stats_get_stdev(stats_ima);
+ mean = cpl_stats_get_mean(stats_ima);
+ cpl_stats_delete(stats_ima);
+
+ /* Store in table */
+ cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MIN,
+ irow, minval);
+ cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MAX,
+ irow, maxval);
+ cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MED,
+ irow, median);
+ cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MEAN,
+ irow, mean);
+ cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_RMS,
+ irow, stdev) ;
+ cpl_table_set_int(odd_column_stats[idet], HAWKI_COL_STAT_USED,
+ irow, 1) ;
+
+ /* Compute statistics even column */
+ //cpl_image_reject_from_mask();
+ cpl_image_accept_all(tmp_ima);
+ mask = cpl_image_get_bpm(tmp_ima);
+ for(i=0 ; i < nx ; ++i)
+ {
+ if(i % 2)
+ for(j=0 ; j < ny ; ++j)
+ {
+ cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+ }
+ }
+ stats_ima = cpl_stats_new_from_image
+ (tmp_ima, CPL_STATS_ALL);
+ if(stats_ima == NULL)
+ {
+ cpl_image_delete(tmp_ima);
+ return -1;
+ }
+
+ /* Get the stats from the storage structure */
+ minval = cpl_stats_get_min(stats_ima);
+ maxval = cpl_stats_get_max(stats_ima);
+ median = cpl_stats_get_median(stats_ima);
+ stdev = cpl_stats_get_stdev(stats_ima);
+ mean = cpl_stats_get_mean(stats_ima);
+ cpl_stats_delete(stats_ima);
+
+ /* Store in table */
+ cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MIN,
+ irow, minval);
+ cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MAX,
+ irow, maxval);
+ cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MED,
+ irow, median);
+ cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MEAN,
+ irow, mean);
+ cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_RMS,
+ irow, stdev) ;
+ cpl_table_set_int(even_column_stats[idet], HAWKI_COL_STAT_USED,
+ irow, 1) ;
+
+ /* Compute statistics odd rows */
+ cpl_image_accept_all(tmp_ima);
+ mask = cpl_image_get_bpm(tmp_ima);
+ for(j=0 ; j < ny ; ++j)
+ {
+ if((j+1) % 2)
+ for(i=0 ; i < nx ; ++i)
+ {
+ cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+ }
+ }
+ stats_ima = cpl_stats_new_from_image
+ (tmp_ima, CPL_STATS_ALL) ;
+ if(stats_ima == NULL)
+ {
+ cpl_image_delete(tmp_ima);
+ return -1;
+ }
+
+ /* Get the stats from the storage structure */
+ minval = cpl_stats_get_min(stats_ima);
+ maxval = cpl_stats_get_max(stats_ima);
+ median = cpl_stats_get_median(stats_ima);
+ stdev = cpl_stats_get_stdev(stats_ima);
+ mean = cpl_stats_get_mean(stats_ima);
+ cpl_stats_delete(stats_ima);
+
+ /* Store in table */
+ cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MIN,
+ irow, minval);
+ cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MAX,
+ irow, maxval);
+ cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MED,
+ irow, median);
+ cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MEAN,
+ irow, mean);
+ cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_RMS,
+ irow, stdev) ;
+ cpl_table_set_int(odd_row_stats[idet], HAWKI_COL_STAT_USED,
+ irow, 1) ;
+
+ /* Compute statistics even row */
+ cpl_image_accept_all(tmp_ima);
+ mask = cpl_image_get_bpm(tmp_ima);
+ for(j=0 ; j < ny ; ++j)
+ {
+ if(j % 2)
+ for(i=0 ; i < nx ; ++i)
+ {
+ cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+ }
+ }
+ stats_ima = cpl_stats_new_from_image
+ (tmp_ima, CPL_STATS_ALL) ;
+ if(stats_ima == NULL)
+ {
+ cpl_image_delete(tmp_ima);
+ return -1;
+ }
+
+ /* Get the stats from the storage structure */
+ minval = cpl_stats_get_min(stats_ima);
+ maxval = cpl_stats_get_max(stats_ima);
+ median = cpl_stats_get_median(stats_ima);
+ stdev = cpl_stats_get_stdev(stats_ima);
+ mean = cpl_stats_get_mean(stats_ima);
+ cpl_stats_delete(stats_ima);
+
+ /* Store in table */
+ cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MIN,
+ irow, minval);
+ cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MAX,
+ irow, maxval);
+ cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MED,
+ irow, median);
+ cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MEAN,
+ irow, mean);
+ cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_RMS,
+ irow, stdev) ;
+ cpl_table_set_int(even_row_stats[idet], HAWKI_COL_STAT_USED,
+ irow, 1) ;
+
+ /* Free */
+ cpl_image_delete(tmp_ima);
+
+ /* Check error status and exit */
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Fills a table with the statistics of the four detectors of a frame
+ @param image_stats Table to fill with the statistics
+ @param frame The target frame
+ @param llx Lower left x position (FITS convention)
+ @param lly Lower left y position (FITS convention)
+ @param urx Upper right x position (FITS convention)
+ @param ury Upper right y position (FITS convention)
+ @param irow The row in the table to store the stats (begin in 0)
+ @return 0 if everything is ok, -1 otherwise
+
+ This function takes the rectangle of the image given by llx, lly, urx, ury
+ and computes the image statistics. This statistics are stored in the four
+ tables image_stats, one for each detector, using the columns
+ MINIMUM, MAXIMUM, MEDIAN, MEAN, RMS, USED.
+ The USED column is set to 1. The table must have already these columns
+ (call hawki_image_stats_initialize before)
+ The statistics are stored in the row irow.
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_image_stats_fill_from_frame
+(cpl_table ** image_stats,
+ const cpl_frame * frame,
+ int irow)
+{
+ int idet;
+ cpl_imagelist * images;
+
+ /* Loading the four chips */
+ images = hawki_load_frame(frame, CPL_TYPE_FLOAT);
+ if(images == NULL)
+ {
+ cpl_msg_error(__func__,"Could not read file %s",
+ cpl_frame_get_filename(frame));
+ return -1;
+ }
+
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ int nx, ny;
+ nx = cpl_image_get_size_x(cpl_imagelist_get(images,idet));
+ ny = cpl_image_get_size_y(cpl_imagelist_get(images,idet));
+ hawki_image_stats_fill_from_image
+ (image_stats,
+ cpl_imagelist_get(images,idet),
+ 1, 1, nx, ny, idet, irow);
+ }
+
+ /* Free and exit */
+ cpl_imagelist_delete(images);
+ return 0;
+}
+
+int hawki_image_stats_print
+(cpl_table ** table_stats)
+{
+ int idet;
+ int istat;
+
+ /* Print header */
+ cpl_msg_info(__func__, "Stats summary") ;
+
+ /* Loop on detectors */
+ cpl_msg_indent_more();
+ for( idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+
+ /* Chip header */
+ cpl_msg_info(__func__, "Chip number %d", idet+1) ;
+ cpl_msg_info(__func__, "image min max med rms") ;
+ cpl_msg_info(__func__, "--------------------------------------------") ;
+
+ /* Loop on images */
+ for(istat = 0; istat < cpl_table_get_nrow(table_stats[idet]); ++istat)
+ {
+ cpl_msg_info(__func__, "%02d %10.2f %10.2f %10.2f %10.2f",
+ istat+1,
+ cpl_table_get_double(table_stats[idet],
+ HAWKI_COL_STAT_MIN,istat,NULL),
+ cpl_table_get_double(table_stats[idet],
+ HAWKI_COL_STAT_MAX,istat,NULL),
+ cpl_table_get_double(table_stats[idet],
+ HAWKI_COL_STAT_MED,istat,NULL ),
+ cpl_table_get_double(table_stats[idet],
+ HAWKI_COL_STAT_RMS,istat,NULL ));
+ }
+ }
+ cpl_msg_indent_less();
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Make the statistics (over image serie) of the each image statistics
+ @param stats_stats Property list where to store the statistics
+ @return 0 if everything is ok, -1 otherwise
+
+ This function computes the mean, median, minimum, maximum and stdev of
+ each of the columns found in the image_stats table.
+ */
+/*----------------------------------------------------------------------------*/
+
+int hawki_image_stats_stats
+(cpl_table ** image_stats,
+ cpl_propertylist ** stats_stats)
+{
+ cpl_array * col_names;
+ int idet;
+ int icol;
+
+ /* Check entries */
+ if(image_stats == NULL || stats_stats == NULL)
+ return -1;
+
+ /* Fill the name of the interesting columns */
+ col_names = cpl_array_new(5, CPL_TYPE_STRING);
+ cpl_array_set_string(col_names, 0, HAWKI_COL_STAT_MIN);
+ cpl_array_set_string(col_names, 1, HAWKI_COL_STAT_MAX);
+ cpl_array_set_string(col_names, 2, HAWKI_COL_STAT_MED);
+ cpl_array_set_string(col_names, 3, HAWKI_COL_STAT_MEAN);
+ cpl_array_set_string(col_names, 4, HAWKI_COL_STAT_RMS);
+
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; ++idet)
+ {
+ for(icol = 0;icol < 5; ++icol)
+ {
+ const char * this_col_name = cpl_array_get_string(col_names, icol);
+ char mean_col_name[256] = "ESO QC RAW ";
+ char median_col_name[256] = "ESO QC RAW ";
+ char minimum_col_name[256] = "ESO QC RAW ";
+ char maximum_col_name[256] = "ESO QC RAW ";
+ char stdev_col_name[256] = "ESO QC RAW ";
+ strncat(mean_col_name, this_col_name, 244);
+ strncat(mean_col_name, " MEAN", 236);
+ cpl_propertylist_append_double
+ (stats_stats[idet], mean_col_name,
+ cpl_table_get_column_mean(image_stats[idet],this_col_name));
+ strncat(median_col_name, this_col_name, 255);
+ strncat(median_col_name, " MEDIAN", 236);
+ cpl_propertylist_append_double
+ (stats_stats[idet], median_col_name,
+ cpl_table_get_column_median(image_stats[idet],this_col_name));
+ strncat(minimum_col_name, this_col_name, 255);
+ strncat(minimum_col_name, " MINIMUM", 236);
+ cpl_propertylist_append_double
+ (stats_stats[idet], minimum_col_name,
+ cpl_table_get_column_min(image_stats[idet],this_col_name));
+ strncat(maximum_col_name, this_col_name, 255);
+ strncat(maximum_col_name, " MAXIMUM", 236);
+ cpl_propertylist_append_double
+ (stats_stats[idet], maximum_col_name,
+ cpl_table_get_column_max(image_stats[idet],this_col_name));
+ strncat(stdev_col_name, this_col_name, 255);
+ strncat(stdev_col_name, " STDEV", 236);
+ cpl_propertylist_append_double
+ (stats_stats[idet], stdev_col_name,
+ cpl_table_get_column_stdev(image_stats[idet],this_col_name));
+ }
+ }
+
+ /*Free and return */
+ cpl_array_delete(col_names);
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get a robust estimation of the sigma based on the quartiles
+ @param image The image where to compute the statistic
+ @return The sigma
+
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_image_float_get_sigma_from_quartile(cpl_image * image)
+{
+ int npixels;
+ int ipix_0_25;
+ int ipix_0_75;
+ double first_quartil;
+ double third_quartil;
+ double sigma_from_quartile;
+ float * data;
+
+ npixels = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+ data = cpl_image_get_data(image);
+ ipix_0_25 = (int)(npixels * 0.25);
+ ipix_0_75 = (int)(npixels * 0.75);
+
+ first_quartil = hawki_tools_get_kth_float(data, npixels, ipix_0_25);
+ third_quartil = hawki_tools_get_kth_float(data, npixels, ipix_0_75);
+ sigma_from_quartile = (third_quartil - first_quartil) / 1.35;
+ return sigma_from_quartile;
+}
+
+
+/* Swap macro */
+#undef SWAP
+#define SWAP(a,b) { register float t=(a);(a)=(b);(b)=t; }
+
+float hawki_tools_get_kth_float(float * a,
+ int n,
+ int k)
+{
+ register float x;
+ register int i, j, l, m;
+
+ cpl_ensure(a, CPL_ERROR_NULL_INPUT, 0.00);
+
+ l=0; m=n-1;
+ while (l<m) {
+ x=a[k];
+ i=l;
+ j=m;
+ do {
+ while (a[i]<x) i++;
+ while (x<a[j]) j--;
+ if (i<=j) {
+ SWAP(a[i],a[j]);
+ i++; j--;
+ }
+ } while (i<=j);
+ if (j<k) l=i;
+ if (k<i) m=j;
+ }
+ return a[k];
+}
+
+/**@}*/
diff --git a/hawki/hawki_image_stats.h b/hawki/hawki_image_stats.h
new file mode 100644
index 0000000..b396c73
--- /dev/null
+++ b/hawki/hawki_image_stats.h
@@ -0,0 +1,67 @@
+/* $Id: hawki_image_stats.h,v 1.4 2009/11/25 16:24:13 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/11/25 16:24:13 $
+ * $Revision: 1.4 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_IMAGE_STATS_H
+#define HAWKI_IMAGE_STATS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+
+int hawki_image_stats_initialize
+(cpl_table ** raw_stats);
+int hawki_image_stats_fill_from_image
+(cpl_table ** image_stats,
+ const cpl_image * image,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ int idet,
+ int irow);
+int hawki_image_stats_odd_even_column_row_fill_from_image
+(cpl_table ** odd_column_stats,
+ cpl_table ** even_column_stats,
+ cpl_table ** odd_row_stats,
+ cpl_table ** even_row_stats,
+ const cpl_image * image,
+ int idet,
+ int irow);
+int hawki_image_stats_fill_from_frame
+(cpl_table ** image_stats,
+ const cpl_frame * frame,
+ int irow);
+int hawki_image_stats_print
+(cpl_table ** table_stats);
+int hawki_image_stats_stats
+(cpl_table ** image_stats,
+ cpl_propertylist ** stats_stats);
+double hawki_image_float_get_sigma_from_quartile(cpl_image * image);
+#endif
diff --git a/hawki/hawki_load.c b/hawki/hawki_load.c
new file mode 100644
index 0000000..27de58c
--- /dev/null
+++ b/hawki/hawki_load.c
@@ -0,0 +1,916 @@
+/* $Id: hawki_load.c,v 1.40 2009/12/04 10:39:14 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/12/04 10:39:14 $
+ * $Revision: 1.40 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <cpl.h>
+
+#include "hawki_load.h"
+#include "hawki_pfits.h"
+#include "hawki_utils.h"
+#include "hawki_dfs.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_load Loading related functions
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extract the frames with the given tag from a frameset
+ @param in A non-empty frameset
+ @param tag The tag of the requested frames
+ @return The newly created frameset or NULL on error
+
+ The returned frameset must be de allocated with cpl_frameset_delete()
+ */
+/*----------------------------------------------------------------------------*/
+cpl_frameset * hawki_extract_frameset(
+ const cpl_frameset * in,
+ const char * tag)
+{
+ cpl_frameset * out ;
+ const cpl_frame * cur_frame ;
+ cpl_frame * loc_frame ;
+ int nbframes, nbext ;
+ int i ;
+
+ /* Test entries */
+ if (in == NULL) return NULL ;
+ if (tag == NULL) return NULL ;
+
+ /* Initialise */
+ nbframes = cpl_frameset_get_size(in) ;
+
+ /* Count the frames with the tag */
+ if ((nbext = cpl_frameset_count_tags(in, tag)) == 0) return NULL ;
+
+ /* Create the output frameset */
+ out = cpl_frameset_new() ;
+
+ /* Loop on the requested frames and store them in out */
+ nbext = 0 ;
+ for (i=0 ; i<nbframes ; i++) {
+ cur_frame = cpl_frameset_get_frame_const(in, i) ;
+ if (!strcmp(cpl_frame_get_tag(cur_frame), tag)) {
+ loc_frame = cpl_frame_duplicate(cur_frame) ;
+ cpl_frameset_insert(out, loc_frame) ;
+ nbext ++ ;
+ }
+ }
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the quarter of a chip from a frameset in an image
+ @param fset the input set of frames
+ @param fnum the frame to load from (start from 0)
+ @param chip the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param quad the quadrant to load (1 to 4)
+ @param ptype the pixel type
+ @return the image list or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_load_quadrant(
+ const cpl_frameset * fset,
+ int fnum,
+ int chip,
+ int quad,
+ cpl_type ptype)
+{
+ const cpl_frame * frame ;
+ const char * fname ;
+ cpl_image * ima ;
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+ if (chip < 1 || chip > HAWKI_NB_DETECTORS) return NULL ;
+ if (quad < 1 || quad > 4) return NULL ;
+
+ /* Load the fnum frame */
+ frame = cpl_frameset_get_frame_const(fset, fnum) ;
+ fname = cpl_frame_get_filename(frame) ;
+
+ /* Load */
+ if ((ima=hawki_load_quadrant_from_file(fname, chip, quad, ptype)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load %dth frame (chip %d quarter %d)",
+ fnum+1, chip, quad) ;
+ return NULL ;
+ }
+ return ima ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the quarter of a chip from a file in an image
+ @param fname the input file name
+ @param chip the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param quad the quadrant to load (1 to 4)
+ @param ptype the pixel type
+ @return the image list or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_load_quadrant_from_file(
+ const char * fname,
+ int chip,
+ int quad,
+ cpl_type ptype)
+{
+ cpl_image * ima ;
+ int ext_nb ;
+ int llx, lly, urx, ury ;
+
+ /* Test entries */
+ if (fname == NULL) return NULL ;
+ if (chip < 1 || chip > HAWKI_NB_DETECTORS) return NULL ;
+ if (quad < 1 || quad > 4) return NULL ;
+
+ /* Define the window */
+ if (quad == 1) {
+ llx = lly = 1 ;
+ urx = ury = 1024 ;
+ } else if (quad == 2) {
+ llx = 1025 ;
+ lly = 1 ;
+ urx = 2048 ;
+ ury = 1024 ;
+ } else if (quad == 3) {
+ llx = 1 ;
+ lly = 1025 ;
+ urx = 1024 ;
+ ury = 2048 ;
+ } else if (quad == 4) {
+ llx = lly = 1025 ;
+ urx = ury = 2048 ;
+ } else return NULL ;
+
+ /* Get the extension with the wished chip */
+ if ((ext_nb = hawki_get_ext_from_detector(fname, chip)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the extension with chip %d",
+ chip+1) ;
+ return NULL ;
+ }
+
+ /* Load */
+ if ((ima=cpl_image_load_window(fname, ptype, 0, ext_nb, llx, lly, urx,
+ ury)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load chip %d quarter %d from %s",
+ chip, quad, fname) ;
+ return NULL ;
+ }
+ return ima ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the chips of HAWKI frameset in an image list
+ @param fset the input set of frames
+ @param chip the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param ptype the pixel type
+ @return the image list or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * hawki_load_detector(
+ const cpl_frameset * fset,
+ int chip,
+ cpl_type ptype)
+{
+ int nframes ;
+ cpl_imagelist * out ;
+ const cpl_frame * frame ;
+ const char * fname ;
+ cpl_image * ima ;
+ int ext_nb ;
+ int i ;
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+ if (chip < 1 || chip > HAWKI_NB_DETECTORS) return NULL ;
+ nframes = cpl_frameset_get_size(fset) ;
+
+ /* Create the output list */
+ out = cpl_imagelist_new() ;
+
+ /* Loop on the frames */
+ for (i=0 ; i<nframes ; i++) {
+
+ /* Load the ith frame */
+ frame = cpl_frameset_get_frame_const(fset, i) ;
+ fname = cpl_frame_get_filename(frame) ;
+
+ /* Get the extension with the wished chip */
+ if ((ext_nb = hawki_get_ext_from_detector(fname, chip)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the extension with chip %d",
+ chip) ;
+ cpl_imagelist_delete(out);
+ return NULL ;
+ }
+ /* Load */
+ if ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load %dth frame (chip %d)",
+ i+1, chip) ;
+ cpl_imagelist_delete(out) ;
+ return NULL ;
+ }
+ cpl_imagelist_set(out, ima, i) ;
+ }
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Loads a given extension from a HAWKI frameset in an image list
+ @param fset the input set of frames
+ @param ext the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param ptype the pixel type
+ @return the image list or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * hawki_load_extensions
+(const cpl_frameset * fset,
+ int extension,
+ cpl_type ptype)
+{
+ int nframes ;
+ cpl_imagelist * out ;
+ const cpl_frame * frame ;
+ const char * fname ;
+ cpl_image * ima ;
+ int iframe;
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+ nframes = cpl_frameset_get_size(fset) ;
+
+ /* Create the output list */
+ out = cpl_imagelist_new() ;
+
+ /* Loop on the frames */
+ for (iframe=0 ; iframe<nframes ; iframe++) {
+
+ /* Load the ith frame */
+ frame = cpl_frameset_get_frame_const(fset, iframe) ;
+ fname = cpl_frame_get_filename(frame) ;
+
+ /* Load */
+ if ((ima=cpl_image_load(fname, ptype, 0, extension)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load %dth frame (extension %d)",
+ iframe+1, extension) ;
+ cpl_imagelist_delete(out) ;
+ return NULL ;
+ }
+ cpl_imagelist_set(out, ima, iframe) ;
+ }
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the chip of HAWKI image from a frameset in an image
+ @param fset the input set of frames
+ @param fnum the frame to load from (start from 0)
+ @param chip the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param ptype the pixel type
+ @return the image list or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_load_image(
+ const cpl_frameset * fset,
+ int fnum,
+ int chip,
+ cpl_type ptype)
+{
+ const cpl_frame * frame ;
+ const char * fname ;
+ cpl_image * ima ;
+ int ext_nb ;
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+ if (chip < 1 || chip > HAWKI_NB_DETECTORS) return NULL ;
+
+ /* Load the fnum frame */
+ frame = cpl_frameset_get_frame_const(fset, fnum) ;
+ fname = cpl_frame_get_filename(frame) ;
+
+ /* Check that the frame has the right number of extension */
+ if(cpl_frame_get_nextensions(frame) != HAWKI_NB_DETECTORS)
+ {
+ cpl_msg_error(__func__, "File %s contains less than %d extensions",
+ fname, HAWKI_NB_DETECTORS);
+ return NULL ;
+ }
+
+ /* Get the extension with the wished chip */
+ if ((ext_nb = hawki_get_ext_from_detector(fname, chip)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the extension with chip %d",
+ chip+1) ;
+ return NULL ;
+ }
+ /* Load */
+ if ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load %dth frame (chip %d)",
+ fnum+1, chip) ;
+ return NULL ;
+ }
+ return ima ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the quarter of a chip from a frameset in an image list
+ @param fset the input set of frames
+ @param chip the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param quad the quadrant to load (1 to 4)
+ @param ptype the pixel type
+ @return the image list or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * hawki_load_quadrants(
+ const cpl_frameset * fset,
+ int chip,
+ int quad,
+ cpl_type ptype)
+{
+ cpl_imagelist * out ;
+ cpl_image * ima ;
+ int i ;
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+ if (chip < 1 || chip > HAWKI_NB_DETECTORS) return NULL ;
+ if (quad < 1 || quad > 4) return NULL ;
+
+ /* Create the output imagelist */
+ out = cpl_imagelist_new() ;
+
+ /* Loop on the frames */
+ for (i=0 ; i<cpl_frameset_get_size(fset) ; i++) {
+ ima = hawki_load_quadrant(fset, i, chip, quad, ptype) ;
+ if (ima == NULL) {
+ cpl_msg_error(__func__, "Cannot load %dth frame (chip %d, quad %d)",
+ i+1, chip, quad) ;
+ cpl_imagelist_delete(out) ;
+ return NULL ;
+ }
+ cpl_imagelist_set(out, ima, i) ;
+ }
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the chip of HAWKI images from a frameset in an image list
+ @param fset the input set of frames
+ @param chip the chip to load (1 to HAWKI_NB_DETECTORS)
+ @param ptype the pixel type
+ @return the image list (image chip 1 to chip HAWKI_NB_DETECTORS) or NULL
+ in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * hawki_load_frameset(
+ const cpl_frameset * fset,
+ int chip,
+ cpl_type ptype)
+{
+ cpl_imagelist * out ;
+ cpl_image * ima ;
+ int i ;
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+ if (chip < 1 || chip > HAWKI_NB_DETECTORS) return NULL ;
+
+ /* Create the output imagelist */
+ out = cpl_imagelist_new() ;
+
+ /* Loop on the frames */
+ for (i=0 ; i<cpl_frameset_get_size(fset) ; i++) {
+ ima = hawki_load_image(fset, i, chip, ptype) ;
+ if (ima == NULL) {
+ cpl_msg_error(__func__, "Cannot load %dth frame (chip %d)",
+ i+1, chip) ;
+ cpl_imagelist_delete(out) ;
+ return NULL ;
+ }
+ cpl_imagelist_set(out, ima, i) ;
+ }
+ return out ;
+}
+
+/**
+ @brief Load all the chips of HAWKI images from a frame into an image list
+ @param frame the input set of frames
+ @param ptype the pixel type
+ @return the image list (image chip 1 to chip HAWKI_NB_DETECTORS) or NULL
+ in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * hawki_load_frame(
+ const cpl_frame * frame,
+ cpl_type ptype)
+{
+ cpl_imagelist * out;
+ cpl_image * ima;
+ const char * fname;
+ int idet;
+ int ext_nb;
+ int * ext_chip_mapping;
+
+ /* Test entries */
+ if (frame == NULL) return NULL ;
+
+ /* Create the output imagelist */
+ out = cpl_imagelist_new() ;
+
+ /* Get the filename */
+ fname = cpl_frame_get_filename(frame);
+
+ /* Check that the frame has the right number of extension */
+ if(cpl_frame_get_nextensions(frame) != HAWKI_NB_DETECTORS)
+ {
+ cpl_msg_error(__func__, "File %s contains less than %d extensions",
+ fname, HAWKI_NB_DETECTORS);
+ cpl_imagelist_delete(out);
+ return NULL ;
+ }
+
+ /* Get the extension-chip mapping */
+ ext_chip_mapping = hawki_get_ext_detector_mapping(fname);
+ if (ext_chip_mapping == NULL)
+ {
+ cpl_msg_error(__func__,"Cannot get mapping between extension and chip");
+ cpl_imagelist_delete(out);
+ return NULL;
+ }
+
+ /* Loop on the chips */
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ {
+ /* Get the extension */
+ ext_nb = ext_chip_mapping[idet];
+
+ /* Load */
+ if ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load frame (detector %d)",
+ idet);
+ cpl_imagelist_delete(out);
+ return NULL;
+ }
+ cpl_imagelist_set(out, ima, idet);
+ }
+
+ /* Free */
+ cpl_free(ext_chip_mapping);
+ return out;
+}
+
+/**
+ @brief Load one the extensions of HAWKI images from a frame into an image
+ @param frame the input frame
+ @param extension the extension to load (1 to HAWKI_NB_DETECTORS)
+ @param ptype the pixel type
+ @return the image or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_load_frame_extension(
+ const cpl_frame * frame,
+ int iextension,
+ cpl_type ptype)
+{
+ cpl_image * ima;
+ const char * fname;
+
+ /* Test entries */
+ if (frame == NULL) return NULL ;
+
+ /* Get filename */
+ fname = cpl_frame_get_filename(frame);
+
+ /* Load */
+ if ((ima=cpl_image_load(fname, ptype, 0, iextension)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load frame (extension %d)",
+ iextension) ;
+ return NULL ;
+ }
+
+ /* Return */
+ return ima;
+}
+
+/**
+ @brief Load one the chips of HAWKI images from a frame into an image
+ @param frame the input frame
+ @param idet the detector to load (1 to HAWKI_NB_DETECTORS)
+ @param ptype the pixel type
+ @return the image or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_load_frame_detector(
+ const cpl_frame * frame,
+ int idet,
+ cpl_type ptype)
+{
+ cpl_image * ima;
+ const char * fname;
+ int ext_nb;
+
+ /* Test entries */
+ if (frame == NULL) return NULL ;
+
+ /* Get filename */
+ fname = cpl_frame_get_filename(frame);
+
+ /* Get the extension with the wished chip */
+ if ((ext_nb = hawki_get_ext_from_detector(fname, idet)) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot get the extension with chip %d",
+ idet) ;
+ return NULL ;
+ }
+ /* Load */
+ if ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load frame (chip %d)",
+ idet) ;
+ return NULL ;
+ }
+
+ /* Return */
+ return ima;
+}
+
+/**
+ @brief Load a table with four extensions, one for each chip
+ @param frame the input set of frames
+ @param ptype the pixel type
+ @return the image list (image chip 1 to chip HAWKI_NB_DETECTORS) or NULL
+ in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_table ** hawki_load_tables(const cpl_frame * frame)
+{
+ cpl_table ** tables;
+ const char * filename;
+ int idet;
+ int j;
+ int ext_nb;
+
+ /* Allocate the set of tables */
+ tables = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+
+ /* Get the filename */
+ filename = cpl_frame_get_filename(frame);
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ {
+ /* Get the extension with the wished chip */
+ if ((ext_nb = hawki_get_ext_from_detector(filename, idet+1)) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot get the extension with detector %d",
+ idet+1) ;
+ return NULL ;
+ }
+ /* Load the table */
+ if((tables[idet] = cpl_table_load(filename, ext_nb, 0) ) == NULL)
+ {
+ for (j=0 ; j< idet ; j++)
+ {
+ cpl_table_delete(tables[j]);
+ }
+ cpl_free(tables);
+ return NULL;
+ }
+ }
+
+ return tables;
+}
+
+/**
+ @brief Load a table containing refined offsets
+ @param offsets_frame the frame containing the offests.
+ @return the offsets bivector. It must be deallocated afterwards. NULL if
+ in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_bivector ** hawki_load_refined_offsets(const cpl_frame * offsets_frame)
+{
+ cpl_errorstate previous_state;
+ cpl_table ** offsets_tables;
+ cpl_bivector ** offsets;
+ int idet;
+
+ /* Get the error state */
+ previous_state = cpl_errorstate_get();
+
+ /* Read the offsets table */
+ if((offsets_tables = hawki_load_tables(offsets_frame)) == NULL)
+ return NULL;
+
+ /* Convert the table to offsets bivectors */
+ offsets = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_bivector *));
+ if(offsets == NULL)
+ {
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_table_delete(offsets_tables[idet]);
+ return NULL;
+ }
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_vector * off_x;
+ cpl_vector * off_y;
+ int noff;
+ int ioff;
+ int jdet;
+
+ noff = cpl_table_get_nrow(offsets_tables[idet]);
+ offsets[idet] = cpl_bivector_new(noff);
+ if(offsets[idet] == NULL)
+ {
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_table_delete(offsets_tables[idet]);
+ for(jdet = 0; jdet < idet; ++jdet)
+ cpl_bivector_delete(offsets[jdet]);
+ cpl_free(offsets[jdet]);
+ return NULL;
+ }
+ off_x = cpl_bivector_get_x(offsets[idet]);
+ off_y = cpl_bivector_get_y(offsets[idet]);
+ for(ioff = 0; ioff < noff; ++ioff)
+ {
+ double xoffset, yoffset;
+ xoffset = cpl_table_get
+ (offsets_tables[idet], HAWKI_COL_OFFSET_X, ioff, NULL);
+ yoffset = cpl_table_get
+ (offsets_tables[idet], HAWKI_COL_OFFSET_Y, ioff, NULL);
+ cpl_vector_set(off_x, ioff, xoffset);
+ cpl_vector_set(off_y, ioff, yoffset);
+ }
+ }
+
+ /* Check error state */
+ if(cpl_errorstate_get() != previous_state)
+ {
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_table_delete(offsets_tables[idet]);
+ cpl_bivector_delete(offsets[idet]);
+ }
+ cpl_free(offsets);
+ return NULL;
+ }
+
+ /* Free and exit */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_table_delete(offsets_tables[idet]);
+ cpl_free(offsets_tables);
+
+ return offsets;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Rebuild the 4 chips
+ @param ima1 the first chip
+ @param ima2 the second chip
+ @param ima3 the third chip
+ @param ima4 the fourth chip
+ @return the image or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_rebuild_detectors(
+ const cpl_image * ima1,
+ const cpl_image * ima2,
+ const cpl_image * ima3,
+ const cpl_image * ima4)
+{
+ cpl_image * ima ;
+
+ /* Test entries */
+ if (ima1 == NULL) return NULL ;
+ if (ima2 == NULL) return NULL ;
+ if (ima3 == NULL) return NULL ;
+ if (ima4 == NULL) return NULL ;
+ if (cpl_image_get_type(ima1)!=cpl_image_get_type(ima2)) return NULL ;
+ if (cpl_image_get_type(ima1)!=cpl_image_get_type(ima3)) return NULL ;
+ if (cpl_image_get_type(ima1)!=cpl_image_get_type(ima4)) return NULL ;
+
+ /* Create the image */
+ ima = cpl_image_new(4096, 4096, cpl_image_get_type(ima1)) ;
+
+ /* Paste the input images */
+ if (cpl_image_copy(ima, ima1, 1, 1) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ if (cpl_image_copy(ima, ima2, 2049, 1) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ if (cpl_image_copy(ima, ima3, 2049, 2049) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ if (cpl_image_copy(ima, ima4, 1, 2049) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ return ima ;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Rebuild the 4 quadrants
+ @param ima1 the first quadrant
+ @param ima2 the second quadrant
+ @param ima3 the third quadrant
+ @param ima4 the fourth quadrant
+ @return the image or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_rebuild_quadrants(
+ const cpl_image * ima1,
+ const cpl_image * ima2,
+ const cpl_image * ima3,
+ const cpl_image * ima4)
+{
+ cpl_image * ima ;
+
+ /* Test entries */
+ if (ima1 == NULL) return NULL ;
+ if (ima2 == NULL) return NULL ;
+ if (ima3 == NULL) return NULL ;
+ if (ima4 == NULL) return NULL ;
+ if (cpl_image_get_type(ima1)!=cpl_image_get_type(ima2)) return NULL ;
+ if (cpl_image_get_type(ima1)!=cpl_image_get_type(ima3)) return NULL ;
+ if (cpl_image_get_type(ima1)!=cpl_image_get_type(ima4)) return NULL ;
+
+ /* Create the image */
+ ima = cpl_image_new(2048, 2048, cpl_image_get_type(ima1)) ;
+
+ /* Paste the input images */
+ if (cpl_image_copy(ima, ima1, 1, 1) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ if (cpl_image_copy(ima, ima2, 1025, 1) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ if (cpl_image_copy(ima, ima3, 1, 1025) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ if (cpl_image_copy(ima, ima4, 1025, 1025) != CPL_ERROR_NONE) {
+ cpl_image_delete(ima) ;
+ return NULL ;
+ }
+ return ima ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the chip to store in the wished extension
+ @param fname The input frame name
+ @param ext the extension number (1 to HAWKI_NB_DETECTORS)
+ @return The chip number (1 to HAWKI_NB_DETECTORS) or -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_get_detector_from_ext(
+ const char * fname,
+ int ext)
+{
+ cpl_propertylist * plist ;
+ const char * sval ;
+ int chip ;
+
+ /* Test entries */
+ if (ext <= 0 || ext > HAWKI_NB_DETECTORS) return -1 ;
+
+ /* Load the extension */
+ plist=cpl_propertylist_load(fname, ext) ;
+ if (plist == NULL) return -1 ;
+ sval = hawki_pfits_get_extname(plist) ;
+ if (sscanf(sval, "CHIP%d.INT1", &chip) != 1) chip = -1 ;
+ cpl_propertylist_delete(plist) ;
+
+ return chip ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the extension corresponding to the wished chip
+ @param fname The input frame name
+ @param chip The chip number (1 to HAWKI_NB_DETECTORS)
+ @return the extension number (1 to HAWKI_NB_DETECTORS)
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_get_ext_from_detector(
+ const char * fname,
+ int chip)
+{
+ cpl_propertylist * plist ;
+ const char * sval ;
+ char chipval[512] ;
+ int ext_nb ;
+ int iext;
+
+ /* Test entries */
+ if (fname == NULL) return -1;
+ if (chip <= 0 || chip > HAWKI_NB_DETECTORS) return -1 ;
+
+ /* Initialise */
+ ext_nb = -1 ;
+
+ /* Create the wished chipval */
+ snprintf(chipval, 512, "CHIP%d.INT1", chip) ;
+
+ /* Loop on the HAWKI_NB_DETECTORS extensions */
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+ /* Load the propertylist of the current extension */
+ if ((plist = cpl_propertylist_load(fname, iext+1)) == NULL) {
+ cpl_msg_error(__func__, "Cannot read the Extname keyword") ;
+ return -1 ;
+ }
+ if ((sval = hawki_pfits_get_extname(plist)) == NULL) {
+ cpl_msg_error(__func__, "Cannot read the Extname keyword") ;
+ cpl_propertylist_delete(plist) ;
+ return -1 ;
+ }
+ /* Check if the chip is found */
+ if (!strcmp(chipval, sval)) {
+ ext_nb = iext+1 ;
+ cpl_propertylist_delete(plist) ;
+ break;
+ }
+ cpl_propertylist_delete(plist) ;
+ }
+ return ext_nb ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the mapping between extensions and detectors
+ @param fname The input frame name
+ @return the mapping if everything goes well, NULL otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int * hawki_get_ext_detector_mapping
+(const char * fname)
+{
+ int iext;
+ int * ext_chip_mapping;
+
+
+ /* Test entries */
+ if (fname == NULL) return NULL;
+
+ /* Initialise */
+ ext_chip_mapping = cpl_malloc(sizeof(int) * HAWKI_NB_DETECTORS);
+
+ /* Loop on the HAWKI_NB_DETECTORS extensions */
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+ int ichip = hawki_get_detector_from_ext(fname, iext + 1);
+ ext_chip_mapping[ichip-1] = iext + 1;
+ }
+ return ext_chip_mapping;
+}
+/**@}*/
diff --git a/hawki/hawki_load.h b/hawki/hawki_load.h
new file mode 100644
index 0000000..f5ac648
--- /dev/null
+++ b/hawki/hawki_load.h
@@ -0,0 +1,57 @@
+/* $Id: hawki_load.h,v 1.21 2009/10/12 16:59:22 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/10/12 16:59:22 $
+ * $Revision: 1.21 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_LOAD_H
+#define HAWKI_LOAD_H
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_frameset * hawki_extract_frameset(const cpl_frameset *, const char *) ;
+cpl_imagelist * hawki_load_frameset(const cpl_frameset *, int, cpl_type) ;
+cpl_imagelist * hawki_load_frame(const cpl_frame *, cpl_type) ;
+cpl_image * hawki_load_frame_detector(const cpl_frame *, int, cpl_type) ;
+cpl_image * hawki_load_frame_extension(const cpl_frame *, int, cpl_type) ;
+cpl_image * hawki_load_image(const cpl_frameset *, int, int, cpl_type) ;
+cpl_imagelist * hawki_load_detector(const cpl_frameset *, int, cpl_type) ;
+cpl_imagelist * hawki_load_extensions(const cpl_frameset *, int, cpl_type) ;
+cpl_imagelist * hawki_load_quadrants(const cpl_frameset *, int, int, cpl_type) ;
+cpl_image * hawki_load_quadrant(const cpl_frameset *, int, int, int, cpl_type) ;
+cpl_image * hawki_load_quadrant_from_file(const char *, int, int, cpl_type) ;
+cpl_table ** hawki_load_tables(const cpl_frame * frame);
+cpl_bivector ** hawki_load_refined_offsets(const cpl_frame * offsets_frame);
+cpl_image * hawki_rebuild_quadrants(const cpl_image *, const cpl_image *,
+ const cpl_image *, const cpl_image *) ;
+cpl_image * hawki_rebuild_detectors(const cpl_image *, const cpl_image *,
+ const cpl_image *, const cpl_image *) ;
+int hawki_get_detector_from_ext(const char *, int) ;
+int hawki_get_ext_from_detector(const char *, int) ;
+int * hawki_get_ext_detector_mapping
+(const char * fname);
+
+#endif
diff --git a/hawki/hawki_mask.c b/hawki/hawki_mask.c
new file mode 100644
index 0000000..4e5283a
--- /dev/null
+++ b/hawki/hawki_mask.c
@@ -0,0 +1,133 @@
+/* $Id: hawki_mask.c,v 1.3 2010/03/12 12:55:17 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/03/12 12:55:17 $
+ * $Revision: 1.3 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <string.h>
+#include <cpl.h>
+#include <cpl_mask.h>
+#include <cpl_matrix.h>
+
+#include "hawki_mask.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_mask Mask manipulation
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/**
+ * FIXME: documentation
+ */
+cpl_error_code hawki_mask_convolve(
+ cpl_mask * in,
+ const cpl_matrix * ker)
+{
+ cpl_mask * out;
+ const double * ker_arr;
+ int nc, nr;
+ int hsx, hsy;
+ int curr_pos, im_pos, filt_pos;
+ int i, j, k, l;
+ double sum;
+ int nx;
+ int ny;
+ cpl_binary * in_data;
+ cpl_binary * out_data;
+
+ /* Test entries */
+ cpl_ensure_code(in && ker, CPL_ERROR_NULL_INPUT);
+
+ /* Get kernel informations */
+ nr = cpl_matrix_get_nrow(ker);
+ nc = cpl_matrix_get_ncol(ker);
+ ker_arr = cpl_matrix_get_data_const(ker);
+
+ /* Test the kernel validity */
+ cpl_ensure_code(nc%2 && nr%2, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(nc<=31 && nr<=31, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Initialise */
+ hsx = (nc-1) / 2;
+ hsy = (nr-1) / 2;
+
+ /* Create a tmp binary image */
+ nx = cpl_mask_get_size_x(in);
+ ny = cpl_mask_get_size_y(in);
+ out = cpl_mask_new(nx, ny);
+ in_data = cpl_mask_get_data(in);
+ out_data = cpl_mask_get_data(out);
+
+ /* Main filter loop */
+ for (j=0; j<ny; j++) {
+ for (i=0; i<nx; i++) {
+ /* Curent pixel position */
+ curr_pos = i + j*nx;
+ /* Edges are not computed */
+ if ((i<hsx) || (i>=nx-hsx) || (j<hsy) || (j>=ny-hsy)) {
+ (out_data)[curr_pos] = CPL_BINARY_0;
+ } else {
+ /* Initialise */
+ (out_data)[curr_pos] = CPL_BINARY_0;
+ /* Go into upper left corner of current pixel */
+ im_pos = curr_pos - hsx + hsy*nx;
+ filt_pos = 0;
+ sum = 0;
+ for (k=0; k<nr; k++) {
+ for (l=0; l<nc; l++) {
+ if (((in_data)[im_pos] == CPL_BINARY_1) &&
+ (fabs(ker_arr[filt_pos]) > FLT_MIN))
+ sum+=fabs(ker_arr[filt_pos]);
+ /* Next col */
+ filt_pos++;
+ im_pos++;
+ }
+ /* Next row */
+ im_pos -= nx + nc;
+ }
+ if(sum>0.5)
+ (out_data)[curr_pos] = CPL_BINARY_1;
+ }
+ }
+ }
+ memcpy(in_data, out_data, nx * ny * sizeof(cpl_binary));
+ cpl_mask_delete(out);
+ return CPL_ERROR_NONE;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_mask.h b/hawki/hawki_mask.h
new file mode 100644
index 0000000..07fd602
--- /dev/null
+++ b/hawki/hawki_mask.h
@@ -0,0 +1,43 @@
+/* $Id: hawki_mask.h,v 1.1 2009/11/26 09:51:54 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/11/26 09:51:54 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_MASK_H
+#define HAWKI_MASK_H
+
+#include "cpl.h"
+#include "cpl_mask.h"
+#include "cpl_matrix.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_error_code hawki_mask_convolve(
+ cpl_mask * in,
+ const cpl_matrix * ker);
+
+#endif
diff --git a/hawki/hawki_match_cats.c b/hawki/hawki_match_cats.c
new file mode 100644
index 0000000..25b15bc
--- /dev/null
+++ b/hawki/hawki_match_cats.c
@@ -0,0 +1,107 @@
+/* $Id: hawki_match_cats.c,v 1.1 2009/11/26 09:52:32 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/11/26 09:52:32 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_dfs.h"
+#include "hawki_utils.h"
+#include "hawki_pfits.h"
+#include "hawki_match_cats.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_obj_det Functionality related to catalogue matching
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compare two objects positions and determine whetherthey are within
+ a 5 pix tolerance
+ @param catalogue1 The table with catalogue1
+ @param catalogue2 The table with catalogue2
+ @param iobj1 The position in table catalogue1 of the object to compare
+ @param iobj2 The position in table catalogue2 of the object to compare
+
+ @return 1 if they match, 0 if they do not.
+
+ Both tables have to have the columns POS_X and POS_Y, which give the
+ position in the detector in pixels.
+ The distance between both objects is the euclidean distance in pixels.
+ The object indexes start from 0.
+
+ WARNING: Since this function will be called many times, there is no error
+ checking. The caller has to ensure that the catalogues are well constructed
+ and that the indexes are not out of bounds.
+
+ */
+int hawki_match_condition_5_pix
+(cpl_table * catalogue1,
+ cpl_table * catalogue2,
+ int iobj1,
+ int iobj2)
+{
+ static const double max_dist2 = 25;
+
+ int null;
+ double posx1;
+ double posy1;
+ double posx2;
+ double posy2;
+ double dist2;
+
+ posx1 =
+ cpl_table_get_double(catalogue1, HAWKI_COL_OBJ_POSX, iobj1, &null);
+ posy1 =
+ cpl_table_get_double(catalogue1, HAWKI_COL_OBJ_POSY, iobj1, &null);
+ posx2 =
+ cpl_table_get_double(catalogue2, HAWKI_COL_OBJ_POSX, iobj2, &null);
+ posy2 =
+ cpl_table_get_double(catalogue2, HAWKI_COL_OBJ_POSY, iobj2, &null);
+
+ dist2 = (posx1 - posx2) * (posx1 - posx2) + (posy1 - posy2) * (posy1 - posy2);
+ if(dist2 <= max_dist2)
+ return 1;
+
+ return 0;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_match_cats.h b/hawki/hawki_match_cats.h
new file mode 100644
index 0000000..f6f1557
--- /dev/null
+++ b/hawki/hawki_match_cats.h
@@ -0,0 +1,43 @@
+/* $Id: hawki_match_cats.h,v 1.1 2009/11/26 09:52:32 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/11/26 09:52:32 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_MATCH_CATS_H
+#define HAWKI_MATCH_CATS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+int hawki_match_condition_5_pix
+(cpl_table * catalogue1,
+ cpl_table * catalogue2,
+ int iobj1,
+ int iobj2);
+
+#endif
diff --git a/hawki/hawki_obj_det.c b/hawki/hawki_obj_det.c
new file mode 100644
index 0000000..33b1266
--- /dev/null
+++ b/hawki/hawki_obj_det.c
@@ -0,0 +1,122 @@
+/* $Id: hawki_obj_det.c,v 1.2 2009/09/29 09:13:00 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/09/29 09:13:00 $
+ * $Revision: 1.2 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_dfs.h"
+#include "hawki_utils.h"
+#include "hawki_pfits.h"
+#include "hawki_obj_det.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_obj_det Functionality related to object detection
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute statistics on the object properties
+ @param objs_prop the table with the properties of the objects (IN)
+ @param objs_prop_stats the property lists containing statistics on
+ the previous table (OUT)
+ @return 0 if ok, -1 in error case
+
+ The statistics computed are the mean, median, minimum, maximum and stdev.
+ Currently, the statistics ar ecomputed upon the angle of the object and
+ the ellipticity.
+
+ */
+int hawki_obj_prop_stats
+(cpl_table ** objs_prop, cpl_propertylist ** objs_prop_stats)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ int idet;
+
+ /* Checking input */
+ if(objs_prop == NULL || objs_prop_stats == NULL)
+ {
+ cpl_msg_error(__func__, "The property list or the tel table is null");
+ return -1;
+ }
+
+ /* Compute the statistics */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ANGLE MEAN",
+ cpl_table_get_column_mean(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ANGLE MED",
+ cpl_table_get_column_median(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ANGLE MIN",
+ cpl_table_get_column_min(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ANGLE MAX",
+ cpl_table_get_column_max(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ANGLE STDEV",
+ cpl_table_get_column_stdev(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ELLIP MEAN",
+ cpl_table_get_column_mean(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ELLIP MED",
+ cpl_table_get_column_median(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ELLIP MIN",
+ cpl_table_get_column_min(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ELLIP MAX",
+ cpl_table_get_column_max(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+ cpl_propertylist_append_double
+ (objs_prop_stats[idet], "ESO QC OBJ ELLIP STDEV",
+ cpl_table_get_column_stdev(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+ }
+
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_obj_det.h b/hawki/hawki_obj_det.h
new file mode 100644
index 0000000..9069295
--- /dev/null
+++ b/hawki/hawki_obj_det.h
@@ -0,0 +1,40 @@
+/* $Id: hawki_obj_det.h,v 1.1 2008/10/22 10:42:04 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2008/10/22 10:42:04 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_OBJ_DET_H
+#define HAWKI_OBJ_DET_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+int hawki_obj_prop_stats
+(cpl_table ** objs_prop, cpl_propertylist ** objs_prop_stats);
+
+#endif
diff --git a/hawki/hawki_pfits.c b/hawki/hawki_pfits.c
new file mode 100644
index 0000000..75fc1b5
--- /dev/null
+++ b/hawki/hawki_pfits.c
@@ -0,0 +1,723 @@
+/* $Id: hawki_pfits.c,v 1.18 2010/02/23 10:58:44 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/02/23 10:58:44 $
+ * $Revision: 1.18 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <cpl.h>
+
+#include "hawki_pfits.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_pfits FITS header protected access
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*-----------------------------------------------------------------------------
+ Function codes
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out airmass start
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_airmass_start(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AIRM START") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out airmass end
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_airmass_end(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AIRM END") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the humidity level
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_humidity_level(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the PRO.CATG
+ @param plist property list to read from
+ @return pointer to statically allocated character string
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_pfits_get_procatg(const cpl_propertylist * plist)
+{
+ return (const char *) cpl_propertylist_get_string(plist, "ESO PRO CATG");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the target RA
+ @param plist property list to read from
+ @return the requested value in degrees
+
+ This function decodifies the returned value, since it is in HHMMSS.SS
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_targ_alpha(const cpl_propertylist * plist)
+{
+ double alpha_coded;
+ double ra_hh, ra_mm, ra_ss;
+ double ra_deg;
+ alpha_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG ALPHA");
+ ra_hh = (int)(alpha_coded / 10000);
+ ra_mm = (int)((alpha_coded - ra_hh * 10000) / 100);
+ ra_ss = alpha_coded - ra_hh * 10000 - ra_mm * 100;
+ ra_deg = ra_hh * 15. + ra_mm / 4. + ra_ss / 240.;
+ return ra_deg;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the target DEC
+ @param plist property list to read from
+ @return the requested value in degrees
+
+ This function decodifies the returned value, since it is in DDMMSS.SS
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_targ_delta(const cpl_propertylist * plist)
+{
+ double delta_coded;
+ double dec_dd, dec_mm, dec_ss;
+ double dec_deg;
+ delta_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG DELTA");
+ dec_dd = (int)(delta_coded / 10000);
+ dec_mm = (int)((delta_coded - dec_dd * 10000) / 100);
+ dec_ss = delta_coded - dec_dd * 10000 - dec_mm * 100;
+ dec_deg = dec_dd + dec_mm / 60. + dec_ss / 3600.;
+ return dec_deg;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the target equinox
+ @param plist property list to read from
+ @return the requested value in years
+
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_targ_equinox(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL TARG EQUINOX") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the target epoch
+ @param plist property list to read from
+ @return the requested value in years
+
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_targ_epoch(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL TARG EPOCH") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the RA
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_ra(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "RA") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the DEC
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_dec(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "DEC") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the extname
+ @param plist property list to read from
+ @return pointer to statically allocated character string
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_pfits_get_extname(const cpl_propertylist * plist)
+{
+ return (const char *) cpl_propertylist_get_string(plist, "EXTNAME");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the arcfile
+ @param plist property list to read from
+ @return pointer to statically allocated character string
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_pfits_get_arcfile(const cpl_propertylist * plist)
+{
+ return (const char *) cpl_propertylist_get_string(plist, "ARCFILE");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the date of observation
+ @param plist property list to read from
+ @return pointer to statically allocated character string
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_pfits_get_date_obs(const cpl_propertylist * plist)
+{
+ return (const char *) cpl_propertylist_get_string(plist, "DATE-OBS") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the NEXP value
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_pfits_get_nexp(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_int(plist, "ESO TPL NEXP") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the DIT value
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_dit(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO DET DIT") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the NDIT value
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_pfits_get_ndit(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_int(plist, "ESO DET NDIT") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the NDSAMPLES value
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_pfits_get_ndsamples(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_int(plist, "ESO DET NDSAMPLES") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the pixel scale
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_pixscale(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO INS PIXSCALE") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the number of pixels in axis 1
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_pfits_get_naxis1(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_int(plist, "NAXIS1") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the number of pixels in axis 2
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_pfits_get_naxis2(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_int(plist, "NAXIS2") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the value in WCS coordinates of the reference pixel (axe 1)
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_crval1(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "CRVAL1") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the value in WCS coordinates of the reference pixel (axe 2)
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_crval2(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "CRVAL2") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the reference pixel in axe 1
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_crpix1(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "CRPIX1") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the reference pixel in axe 1
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_crpix2(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "CRPIX2") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the increment of coordinate in one pixel (axe 1)
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_cdelta1(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "CDELTA1") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the increment of coordinate in one pixel (axe 2)
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_cdelta2(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "CDELTA2") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the cumulative offset in alpha
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_cumoffseta(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETA") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the cumulative offset in delta
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_cumoffsetd(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETD") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the cumulative offset in X
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_cumoffsetx(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETX") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the cumulative offset in Y
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_cumoffsety(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETY") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the position angle
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_posangle(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO ADA POSANG") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out which wave band is active
+ @param plist property list to read from
+ @return pointer to statically allocated character string
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_pfits_get_filter(const cpl_propertylist * plist)
+{
+ const char * val ;
+
+ val = cpl_propertylist_get_string(plist, "ESO INS FILT1 NAME") ;
+ if (val == NULL) return NULL ;
+ /* If FILT1 is not open, return its value */
+ if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
+ /* FILT1 is open, return value from FILT2 */
+ val = cpl_propertylist_get_string(plist, "ESO INS FILT2 NAME") ;
+ if (val == NULL) return NULL ;
+ if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
+ return NULL ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the focus position of M2
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_focus(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL FOCU VALUE") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the telescope altitude
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_elevation(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL ALT") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the telescope azimut
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_azimut(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AZ") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the relative humidity
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_relhum(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the average coherence time
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_tau0(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI TAU0") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the ambient temperatur
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_obs_temp(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI TEMP") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the wind direction
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_wind_dir(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDDIR") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the wind speed
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_wind_speed(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDSP") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the fwhm from the AO system
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_ao_fwhm(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL IA FWHM") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the absolute rotator position at start
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_rotator_start(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO ADA ABSROT START") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the absolute rotator position at end
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_rotator_end(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO ADA ABSROT END") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the observatory seeing at start
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_obs_seeing_start(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM START") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the observatory seeing at end
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_obs_seeing_end(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM END") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the observatory atmospheric pressure at start
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_pressure_start(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES START") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the observatory atmospheric pressure at end
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_pressure_end(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES END") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the paralactic angle at start
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_parangle_start(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL PARANG START") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the paralactic angle at start
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_parangle_end(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO TEL PARANG END") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the cumulative X offset of the combined image
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+
+double hawki_pfits_get_comb_cumoffsetx(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETX");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the cumulative Y offset of the combined image
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_comb_cumoffsety(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETY");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the relative X offset of the combined image wrt first image
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_comb_posx(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSX");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief find out the relative Y offset of the combined image wrt first image
+ @param plist property list to read from
+ @return the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_pfits_get_comb_posy(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSY");
+}
+
+/**@}*/
diff --git a/hawki/hawki_pfits.h b/hawki/hawki_pfits.h
new file mode 100644
index 0000000..f1cdffc
--- /dev/null
+++ b/hawki/hawki_pfits.h
@@ -0,0 +1,95 @@
+/* $Id: hawki_pfits.h,v 1.14 2010/02/23 10:58:49 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/02/23 10:58:49 $
+ * $Revision: 1.14 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_PFITS_H
+#define HAWKI_PFITS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+const char * hawki_pfits_get_extname(const cpl_propertylist * plist) ;
+double hawki_pfits_get_airmass_start(const cpl_propertylist * plist) ;
+double hawki_pfits_get_airmass_end(const cpl_propertylist * plist) ;
+double hawki_pfits_get_humidity_level(const cpl_propertylist * plist) ;
+double hawki_pfits_get_targ_alpha(const cpl_propertylist * plist) ;
+double hawki_pfits_get_targ_delta(const cpl_propertylist * plist) ;
+double hawki_pfits_get_targ_equinox(const cpl_propertylist * plist);
+double hawki_pfits_get_targ_epoch(const cpl_propertylist * plist);
+double hawki_pfits_get_ra(const cpl_propertylist * plist) ;
+double hawki_pfits_get_dec(const cpl_propertylist * plist) ;
+const char * hawki_pfits_get_arcfile(const cpl_propertylist * plist) ;
+const char * hawki_pfits_get_procatg(const cpl_propertylist * plist) ;
+const char * hawki_pfits_get_date_obs(const cpl_propertylist * plist) ;
+int hawki_pfits_get_naxis1(const cpl_propertylist * plist) ;
+int hawki_pfits_get_naxis2(const cpl_propertylist * plist) ;
+double hawki_pfits_get_crval1(const cpl_propertylist * plist) ;
+double hawki_pfits_get_crval2(const cpl_propertylist * plist) ;
+double hawki_pfits_get_crpix1(const cpl_propertylist * plist) ;
+double hawki_pfits_get_crpix2(const cpl_propertylist * plist) ;
+double hawki_pfits_get_cdelta1(const cpl_propertylist * plist) ;
+double hawki_pfits_get_cdelta2(const cpl_propertylist * plist) ;
+double hawki_pfits_get_pixscale(const cpl_propertylist * plist) ;
+double hawki_pfits_get_cumoffseta(const cpl_propertylist * plist);
+double hawki_pfits_get_cumoffsetd(const cpl_propertylist * plist);
+double hawki_pfits_get_cumoffsetx(const cpl_propertylist * plist);
+double hawki_pfits_get_cumoffsety(const cpl_propertylist * plist);
+double hawki_pfits_get_posangle(const cpl_propertylist * plist) ;
+int hawki_pfits_get_nexp(const cpl_propertylist * plist) ;
+int hawki_pfits_get_ndit(const cpl_propertylist * plist) ;
+int hawki_pfits_get_ndsamples(const cpl_propertylist * plist);
+double hawki_pfits_get_dit(const cpl_propertylist * plist) ;
+const char * hawki_pfits_get_filter(const cpl_propertylist * plist) ;
+double hawki_pfits_get_focus(const cpl_propertylist * plist) ;
+double hawki_pfits_get_elevation(const cpl_propertylist * plist);
+double hawki_pfits_get_azimut(const cpl_propertylist * plist);
+double hawki_pfits_get_relhum(const cpl_propertylist * plist);
+double hawki_pfits_get_tau0(const cpl_propertylist * plist);
+double hawki_pfits_get_obs_temp(const cpl_propertylist * plist);
+double hawki_pfits_get_wind_dir(const cpl_propertylist * plist);
+double hawki_pfits_get_wind_speed(const cpl_propertylist * plist);
+double hawki_pfits_get_ao_fwhm(const cpl_propertylist * plist);
+double hawki_pfits_get_rotator_start(const cpl_propertylist * plist);
+double hawki_pfits_get_rotator_end(const cpl_propertylist * plist);
+double hawki_pfits_get_obs_seeing_start(const cpl_propertylist * plist);
+double hawki_pfits_get_obs_seeing_end(const cpl_propertylist * plist);
+double hawki_pfits_get_pressure_start(const cpl_propertylist * plist);
+double hawki_pfits_get_pressure_end(const cpl_propertylist * plist);
+double hawki_pfits_get_parangle_start(const cpl_propertylist * plist);
+double hawki_pfits_get_parangle_end(const cpl_propertylist * plist);
+double hawki_pfits_get_comb_cumoffsetx(const cpl_propertylist * plist);
+double hawki_pfits_get_comb_cumoffsety(const cpl_propertylist * plist);
+double hawki_pfits_get_comb_posx(const cpl_propertylist * plist);
+double hawki_pfits_get_comb_posy(const cpl_propertylist * plist);
+
+#endif
diff --git a/hawki/hawki_properties_tel.c b/hawki/hawki_properties_tel.c
new file mode 100644
index 0000000..979b51c
--- /dev/null
+++ b/hawki/hawki_properties_tel.c
@@ -0,0 +1,836 @@
+/* $Id: hawki_properties_tel.c,v 1.2 2008/07/08 14:23:18 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2008/07/08 14:23:18 $
+ * $Revision: 1.2 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_dfs.h"
+#include "hawki_pfits.h"
+#include "hawki_properties_tel.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_properties_tel Manipulates QC keywords from the telescope
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Initialize the table with all the telescope data columns
+ @param telescope_prop Table with the telescope QC data.
+ @return 0 if everything is ok, -1 otherwise
+
+ This function creates the following columns in the given table:
+ TEL.ALT, TEL.AZ, TEL.AMBI.RHUM, TEl.AMBI.TAU0, TEL.AMBI.TEMP,
+ TEL.AMBI.WINDDIR, TEL.AMBI.WINDSP, TEL.IA.FWHM,
+ SEQ.CUMOFFSETA, SEQ.CUMOFFSETD, SEQ.CUMOFFSETX, SEQ.CUMOFFSETY
+ ADA.ABSROT.DELTA, ADA.ABSROT.END, ADA.ABSROT.START
+ TEL.AIRM, TEL.AIRM.START, TEL.AIRM.END
+ TEL AMBI FWHM, TEL.AMBI.FHWM.START, TEL.AMBI.FWHM.END
+ TEL.AMBI.PRES, TEL.AMBI.PRES.START, TEL.AMBI.PRES.END
+ TEL.PARANG, TEL.PARANG.START, TEL.PARANG.END
+ TEL.PARANG.DELTA, TEL.PARANG.END, TEL.PARANG.START
+ */
+/*----------------------------------------------------------------------------*/
+
+int hawki_prop_tel_initialize(cpl_table * telescope_prop)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_ALT,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AZ,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY,
+ CPL_TYPE_DOUBLE);
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extracts all the QC keywords and append them to the table
+ @param all_property_list The list of all the properties from the header
+ @param telescope_prop Table with the telescope QC data.
+ @return 0 if everything is ok, -1 otherwise
+
+ The function gets the following keywords from the propertylist:
+ TEL.ALT, TEL.AZ, TEL.AMBI.RHUM, TEl.AMBI.TAU0, TEL.AMBI.TEMP,
+ TEL.AMBI.WINDDIR, TEL.AMBI.WINDSP, TEL.IA.FWHM,
+ SEQ.CUMOFFSETA, SEQ.CUMOFFSETD, SEQ.CUMOFFSETX, SEQ.CUMOFFSETY
+ It also computes the following extra keywords:
+ ADA.ABSROT.DELTA = ADA.ABSROT.END - ADA.ABSROT.START
+ TEL.AIRM = (TEL.AIRM.START + TEL.AIRM.END) / 2.0
+ TEL AMBI FWHM = (TEL.AMBI.FHWM.START + TEL.AMBI.FWHM.END) / 2.0
+ TEL.AMBI.PRES = (TEL.AMBI.PRES.START + TEL.AMBI.PRES.END) / 2.0
+ TEL.PARANG = (TEL.PARANG.START + TEL.PARANG.END) / 2.0
+ TEL.PARANG.DELTA = TEL.PARANG.END - TEL.PARANG.START
+
+ All these keywords (including the *.START and *.END) are appended in the
+ telescope_prop table, using the column names stated in hawki_dfs.h
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_extract_prop_tel_qc
+(const cpl_propertylist * all_property_list,
+ cpl_table * telescope_prop,
+ int irow)
+{
+ int ncol;
+ int nused;
+ double temp_val;
+ double temp_start;
+ double temp_end;
+ cpl_errorstate prestate;
+
+ /* Error check */
+ prestate = cpl_errorstate_get();
+
+ /* Checking input */
+ if(all_property_list == NULL || telescope_prop == NULL)
+ {
+ cpl_msg_error(__func__, "The property list or the tel table is null");
+ return -1;
+ }
+
+ /* Checking columns in the table */
+ ncol = 0;
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_ALT);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AZ);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX);
+ ncol += cpl_table_has_column(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY);
+ if(ncol != 28)
+ {
+ cpl_msg_error(__func__,"Table does not have the proper format");
+ return -1;
+ }
+
+
+ /* Getting and saving the keywords */
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_ALT,
+ irow,
+ hawki_pfits_get_elevation(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AZ,
+ irow,
+ hawki_pfits_get_azimut(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM,
+ irow,
+ hawki_pfits_get_relhum(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0,
+ irow,
+ hawki_pfits_get_tau0(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP,
+ irow,
+ hawki_pfits_get_obs_temp(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR,
+ irow,
+ hawki_pfits_get_wind_dir(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP,
+ irow,
+ hawki_pfits_get_wind_speed(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM,
+ irow,
+ hawki_pfits_get_ao_fwhm(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START,
+ irow,
+ hawki_pfits_get_rotator_start(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END,
+ irow,
+ hawki_pfits_get_rotator_end(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START,
+ irow,
+ hawki_pfits_get_airmass_start(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END,
+ irow,
+ hawki_pfits_get_airmass_end(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START,
+ irow,
+ hawki_pfits_get_obs_seeing_start(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END,
+ irow,
+ hawki_pfits_get_obs_seeing_end(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START,
+ irow,
+ hawki_pfits_get_pressure_start(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END,
+ irow,
+ hawki_pfits_get_pressure_end(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START,
+ irow,
+ hawki_pfits_get_parangle_start(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END,
+ irow,
+ hawki_pfits_get_parangle_end(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA,
+ irow,
+ hawki_pfits_get_cumoffseta(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD,
+ irow,
+ hawki_pfits_get_cumoffsetd(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX,
+ irow,
+ hawki_pfits_get_cumoffsetx(all_property_list));
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY,
+ irow,
+ hawki_pfits_get_cumoffsety(all_property_list));
+
+
+ /* Compute and write derived quantities */
+ temp_val = hawki_pfits_get_rotator_end(all_property_list) -
+ hawki_pfits_get_rotator_start(all_property_list);
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA,
+ irow,
+ temp_val);
+
+ temp_val = (hawki_pfits_get_airmass_start(all_property_list) +
+ hawki_pfits_get_airmass_end(all_property_list) ) / 2.0;
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AIRM,
+ irow,
+ temp_val);
+
+ //The "mean" FWHM is computed rejecting one of the values if
+ //is equal to -1. If both are -1, the mean FWHM is -1.
+ temp_start = hawki_pfits_get_obs_seeing_start(all_property_list);
+ temp_end = hawki_pfits_get_obs_seeing_end(all_property_list);
+ temp_val = 0;
+ nused = 0;
+ if(temp_start != -1)
+ {
+ temp_val += temp_start;
+ nused++;
+ }
+ if(temp_end != -1)
+ {
+ temp_val += temp_end;
+ nused++;
+ }
+ if(nused != 0)
+ temp_val = temp_val / nused;
+ else
+ temp_val = -1;
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM,
+ irow,
+ temp_val);
+
+ temp_val = (hawki_pfits_get_pressure_start(all_property_list) +
+ hawki_pfits_get_pressure_end(all_property_list) ) / 2.0;
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES,
+ irow,
+ temp_val);
+
+ temp_val = (hawki_pfits_get_parangle_start(all_property_list) +
+ hawki_pfits_get_parangle_end(all_property_list) ) / 2.0;
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG,
+ irow,
+ temp_val);
+
+ temp_val = hawki_pfits_get_rotator_end(all_property_list) -
+ hawki_pfits_get_rotator_start(all_property_list);
+ cpl_table_set_double(telescope_prop,
+ HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA,
+ irow,
+ temp_val);
+
+
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+
+ return 0;
+}
+
+int hawki_compute_prop_tel_qc_stats
+(const cpl_table * telescope_prop,
+ cpl_propertylist * stats_prop)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ /* Checking input */
+ if(telescope_prop == NULL || stats_prop == NULL)
+ {
+ cpl_msg_error(__func__, "The property list or the tel table is null");
+ return -1;
+ }
+
+ /* Compute the statistics */
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL ALT MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL ALT MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL ALT MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL ALT MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL ALT STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AZ MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AZ MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AZ MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AZ MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AZ STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI RHUM MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI RHUM MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI RHUM MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI RHUM MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI RHUM STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TAU0 MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TAU0 MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TAU0 MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TAU0 MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TAU0 STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TEMP MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TEMP MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TEMP MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TEMP MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI TEMP STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDDIR MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDDIR MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDDIR MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDDIR MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDDIR STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDSP MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDSP MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDSP MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDSP MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI WINDSP STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL IA FWHM MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL IA FWHM MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL IA FWHM MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL IA FWHM MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL IA FWHM STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT DELTA MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT DELTA MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT DELTA MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT DELTA MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT DELTA STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT START MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT START MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT START MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT START MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT START STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT END MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT END MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT END MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT END MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC ADA ABSROT END STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM START MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM START MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM START MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM START MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM START STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM END MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM END MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM END MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM END MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AIRM END STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM START MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM START MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM START MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM START MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM START STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM END MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM END MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM END MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM END MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI FWHM END STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES START MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES START MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES START MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES START MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES START STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES END MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES END MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES END MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES END MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL AMBI PRES END STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG START MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG START MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG START MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG START MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG START STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG END MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG END MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG END MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG END MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG END STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG DELTA MEAN",cpl_table_get_column_mean
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG DELTA MED",cpl_table_get_column_median
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG DELTA MIN",cpl_table_get_column_min
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG DELTA MAX",cpl_table_get_column_max
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+ cpl_propertylist_append_double
+ (stats_prop, "ESO QC TEL PARANG DELTA STDEV",cpl_table_get_column_stdev
+ (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+
+ if(!cpl_errorstate_is_equal(prestate))
+ return -1;
+ return 0;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_properties_tel.h b/hawki/hawki_properties_tel.h
new file mode 100644
index 0000000..978324d
--- /dev/null
+++ b/hawki/hawki_properties_tel.h
@@ -0,0 +1,48 @@
+/* $Id: hawki_properties_tel.h,v 1.1 2008/06/25 13:04:25 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2008/06/25 13:04:25 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_PROPERTIES_TEL_H
+#define HAWKI_PROPERTIES_TEL_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+
+int hawki_prop_tel_initialize
+(cpl_table * telescope_prop);
+int hawki_extract_prop_tel_qc
+(const cpl_propertylist * all_property_list,
+ cpl_table * telescope_prop,
+ int irow);
+int hawki_compute_prop_tel_qc_stats
+(const cpl_table * telescope_prop,
+ cpl_propertylist * stats_prop);
+
+#endif
diff --git a/hawki/hawki_saa.c b/hawki/hawki_saa.c
new file mode 100644
index 0000000..405ba19
--- /dev/null
+++ b/hawki/hawki_saa.c
@@ -0,0 +1,127 @@
+/* $Id: hawki_saa.c,v 1.10 2010/03/08 16:20:54 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/03/08 16:20:54 $
+ * $Revision: 1.10 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_saa.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Refine the offsets using cross-correlation of images.
+ @param in the images with the objects
+ @param approx_offsets the approximated offsets
+ @param reference_objects the positions of the objects to cross-correlate
+ @param refined_offsets the result of the refinement.
+ @return 0 if everything OK. != 0 elsewhere.
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_geom_refine_images_offsets
+(cpl_imagelist * in,
+ cpl_bivector * approx_offsets,
+ cpl_bivector * reference_objects,
+ int s_hx,
+ int s_hy,
+ int m_hx,
+ int m_hy,
+ cpl_bivector * refined_offsets,
+ cpl_vector * correl)
+{
+ cpl_bivector * offs_ref ;
+ double * offs_ref_x ;
+ double * offs_ref_y ;
+ double * correl_data ;
+ int nimages;
+ int ngood;
+ int i;
+
+ /* Check entries */
+ if (approx_offsets == NULL) return -1;
+ if (refined_offsets == NULL) return -1;
+
+ /* Get the number of images */
+ nimages = cpl_imagelist_get_size(in) ;
+ if (cpl_bivector_get_size(approx_offsets) != nimages)
+ {
+ cpl_msg_error(__func__, "Invalid input objects sizes") ;
+ return -1;
+ }
+
+ /* Refine the offsets */
+ cpl_msg_info(__func__, "Refine the offsets") ;
+ cpl_msg_indent_more() ;
+ if ((offs_ref = cpl_geom_img_offset_fine
+ (in, approx_offsets, reference_objects,
+ s_hx, s_hy, m_hx, m_hy, correl)) == NULL)
+ {
+ cpl_msg_error(cpl_func, "Cannot refine the offsets");
+ cpl_vector_delete(correl) ;
+ return -1;
+ }
+
+ /* Display the results */
+ offs_ref_x = cpl_bivector_get_x_data(offs_ref) ;
+ offs_ref_y = cpl_bivector_get_y_data(offs_ref) ;
+ correl_data = cpl_vector_get_data(correl) ;
+ cpl_msg_info(cpl_func, "Refined relative offsets [correlation factor]") ;
+ ngood = 0 ;
+ for (i=0 ; i<nimages ; i++)
+ {
+ cpl_msg_info(cpl_func, "#%02d: %8.2f %8.2f [%12.2f]",
+ i+1, offs_ref_x[i], offs_ref_y[i], correl_data[i]) ;
+ if (correl_data[i] > -0.5) ngood++ ;
+ }
+ if (ngood == 0)
+ {
+ cpl_msg_error(__func__, "No frame correctly correlated") ;
+ cpl_bivector_delete(offs_ref) ;
+ cpl_vector_delete(correl) ;
+ return -1;
+ }
+ cpl_msg_indent_less();
+
+ /* Copy the result */
+ cpl_vector_copy(cpl_bivector_get_x(refined_offsets),
+ cpl_bivector_get_x(offs_ref));
+ cpl_vector_copy(cpl_bivector_get_y(refined_offsets),
+ cpl_bivector_get_y(offs_ref));
+
+ /* Free and return */
+ cpl_bivector_delete(offs_ref);
+ cpl_msg_indent_less() ;
+ return 0;
+}
diff --git a/hawki/hawki_saa.h b/hawki/hawki_saa.h
new file mode 100644
index 0000000..c9e7680
--- /dev/null
+++ b/hawki/hawki_saa.h
@@ -0,0 +1,52 @@
+/* $Id: hawki_saa.h,v 1.5 2009/02/05 12:51:14 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/02/05 12:51:14 $
+ * $Revision: 1.5 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_SAA_H
+#define HAWKI_SAA_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+int hawki_geom_refine_images_offsets
+(cpl_imagelist * in,
+ cpl_bivector * approx_offsets,
+ cpl_bivector * reference_objects,
+ int s_hx,
+ int s_hy,
+ int m_hx,
+ int m_hy,
+ cpl_bivector * refined_offsets,
+ cpl_vector * correl);
+
+#endif
diff --git a/hawki/hawki_save.c b/hawki/hawki_save.c
new file mode 100644
index 0000000..c67a28c
--- /dev/null
+++ b/hawki/hawki_save.c
@@ -0,0 +1,702 @@
+/* $Id: hawki_save.c,v 1.11 2010/11/29 03:37:15 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2010/11/29 03:37:15 $
+ * $Revision: 1.11 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <cpl.h>
+
+#include "hawki_distortion.h"
+#include "hawki_save.h"
+#include "hawki_load.h"
+#include "hawki_pfits.h"
+#include "hawki_utils.h"
+#include "hawki_dfs.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_save Saving related functions
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a HAWKI_NB_DETECTORS extensions HAWKI image
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param images The image list to be saved
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param protype The product type tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param applists Optional propertylists to append to ext headers or NULL
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename
+ @return 0 if ok, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_imagelist_save(
+ cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_imagelist * images,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename)
+{
+ const char * fname;
+ cpl_propertylist * pro_list;
+ cpl_type_bpp pixeltype;
+ char sval[16];
+ int chip_nb;
+ int iext;
+
+ /* Test entries */
+ if (allframes == NULL) return -1 ;
+
+ /* Get a suitable reference frame */
+ if((fname = hawki_get_extref_file(allframes)) == NULL)
+ {
+ cpl_msg_error(__func__, "Could not find a suitable reference frame");
+ return -1;
+ }
+
+ /* Add the PRO keys */
+ if (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+ else pro_list = cpl_propertylist_new() ;
+ if (protype != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+ if (procat != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+
+ /* File with extensions */
+ if (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+ CPL_BPP_IEEE_FLOAT, recipe, pro_list, NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ filename) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot save the empty primary HDU of file %s",
+ filename);
+ cpl_propertylist_delete(pro_list);
+ return -1 ;
+ }
+
+ /* Delete PRO LIST */
+ cpl_propertylist_delete(pro_list);
+
+ /* Get the file type */
+ if (cpl_image_get_type(cpl_imagelist_get_const(images, 0)) == CPL_TYPE_INT)
+ pixeltype = CPL_BPP_32_SIGNED ;
+ else
+ pixeltype = CPL_BPP_IEEE_FLOAT ;
+
+ /* Save the extensions */
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+ cpl_propertylist * qc_ext_list;
+
+ /* Get the chip number to store in this extension */
+ if ((chip_nb = hawki_get_detector_from_ext(fname, iext+1)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the chip for extension %d when "
+ "writing file %s", iext+1, filename);
+ return -1 ;
+ }
+ if ((applists != NULL) && (applists[chip_nb-1] != NULL))
+ qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+ else
+ qc_ext_list = cpl_propertylist_new() ;
+
+ snprintf(sval, 16, "CHIP%d.INT1", chip_nb) ;
+ cpl_propertylist_prepend_string(qc_ext_list, "EXTNAME", sval) ;
+ if(cpl_image_save(cpl_imagelist_get_const(images, chip_nb-1), filename,
+ pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__, "Cannot save extension %d of file %s",
+ iext+1, filename);
+ cpl_propertylist_delete(qc_ext_list) ;
+ return -1;
+ }
+ cpl_propertylist_delete(qc_ext_list) ;
+ }
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a main header and prepare it to store additional data
+ units later on
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param images The image list to be saved
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param protype The product type tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename
+ @return 0 if ok, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_main_header_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const char * filename)
+{
+ cpl_propertylist * pro_list;
+
+ /* Test entries */
+ if (allframes == NULL) return -1 ;
+
+ /* Add the PRO keys */
+ if (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+ else pro_list = cpl_propertylist_new() ;
+ if (protype != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+ if (procat != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+
+ /* File with extensions */
+ if (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+ CPL_BPP_IEEE_FLOAT, recipe, pro_list, NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ filename) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot save the empty primary HDU of file %s",
+ filename);
+ cpl_propertylist_delete(pro_list);
+ return -1 ;
+ }
+
+ /* Delete PRO LIST */
+ cpl_propertylist_delete(pro_list);
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save an image into a given extension
+ @return 1 if ok. -1 otherwise
+
+ Extension iext means the main extension.
+ For HAWK-I, iext should run from 1 to HAWKI_NB_DETECTORS
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_image_ext_save
+(const cpl_frameset * allframes,
+ const cpl_image * image,
+ int iext,
+ const cpl_propertylist * ext_prop_list,
+ const char * filename)
+{
+ const char * fname;
+ cpl_type_bpp pixeltype;
+ cpl_propertylist * ext_prop;
+ char sval[16];
+ int idet;
+
+ /* Test entries */
+ if (allframes == NULL) return -1 ;
+
+ /* Get a suitable reference frame */
+ if((fname = hawki_get_extref_file(allframes)) == NULL)
+ {
+ cpl_msg_error(__func__, "Could not find a suitable reference frame");
+ return -1;
+ }
+
+ /* Get the file type */
+ if (cpl_image_get_type(image) == CPL_TYPE_INT)
+ pixeltype = CPL_BPP_32_SIGNED ;
+ else
+ pixeltype = CPL_BPP_IEEE_FLOAT ;
+
+ /* Save the extension */
+ /* Get the chip number to store in this extension */
+ if ((idet = hawki_get_detector_from_ext(fname, iext)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the chip id for extension %d "
+ "when saving %s", iext, filename);
+ return -1;
+ }
+ if (ext_prop_list != NULL)
+ ext_prop = cpl_propertylist_duplicate(ext_prop_list) ;
+ else
+ ext_prop = cpl_propertylist_new() ;
+
+ snprintf(sval, 16, "CHIP%d.INT1", idet) ;
+ cpl_propertylist_prepend_string(ext_prop, "EXTNAME", sval) ;
+ if(cpl_image_save(image, filename,
+ pixeltype, ext_prop, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Could not save extension %d of file %s",
+ iext, filename);
+ cpl_propertylist_delete(ext_prop);
+ return -1;
+ }
+ cpl_propertylist_delete(ext_prop) ;
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a HAWKI_NB_DETECTORS extensions HAWKI image
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param images The images to be saved
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param protype The product type tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param applists Optional propertylists to append to ext headers or NULL
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename
+ @return 0 if ok, -1 in error case
+
+ This function allows to store images of different sizes in the
+ extensions
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_images_save(
+ cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_image ** images,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename)
+{
+ const char * fname ;
+ cpl_propertylist * pro_list ;
+ cpl_type_bpp pixeltype ;
+ cpl_propertylist * qc_ext_list ;
+ char sval[16] ;
+ int chip_nb ;
+ int iext;
+
+ /* Test entries */
+ if (allframes == NULL) return -1 ;
+
+ /* Get a suitable reference frame */
+ if((fname = hawki_get_extref_file(allframes)) == NULL)
+ {
+ cpl_msg_error(__func__, "Could not find a suitable reference frame");
+ return -1;
+ }
+
+ /* Add the PRO keys */
+ if (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+ else pro_list = cpl_propertylist_new() ;
+ if (protype != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+ if (procat != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+
+ /* File with extensions */
+ if (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+ CPL_BPP_IEEE_FLOAT, recipe, pro_list, NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ filename) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot save the empty primary HDU of file %s",
+ filename);
+ cpl_propertylist_delete(pro_list) ;
+ return -1 ;
+ }
+
+ /* Delete PRO LIST */
+ cpl_propertylist_delete(pro_list) ;
+
+ /* Get the file type */
+ if (cpl_image_get_type(images[0]) == CPL_TYPE_INT)
+ pixeltype = CPL_BPP_32_SIGNED ;
+ else
+ pixeltype = CPL_BPP_IEEE_FLOAT ;
+
+ /* Save the extensions */
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+ /* Get the chip number to store in this extension */
+ if ((chip_nb = hawki_get_detector_from_ext(fname, iext+1)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the chip for extension %d "
+ "when saving file %s", iext+1, filename);
+ return -1 ;
+ }
+ /* Get the QC list */
+ if ((applists != NULL) && (applists[chip_nb-1] != NULL))
+ qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+ else
+ qc_ext_list = cpl_propertylist_new() ;
+
+ snprintf(sval, 16, "CHIP%d.INT1", chip_nb) ;
+ cpl_propertylist_prepend_string(qc_ext_list, "EXTNAME", sval) ;
+ if(cpl_image_save(images[chip_nb-1], filename,
+ pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Cannot save extension %d of file %s",
+ iext+1, filename);
+ cpl_propertylist_delete(qc_ext_list);
+ return -1;
+ }
+ cpl_propertylist_delete(qc_ext_list) ;
+ }
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a HAWKI_NB_DETECTORS extensions HAWKI table
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param tables The table list to be saved
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param protype The product type tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param applists Optional propertylists to append to ext headers or NULL
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename
+ @return 0 if ok, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_tables_save(
+ cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_table ** tables,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename)
+{
+ cpl_propertylist * qc_ext_list ;
+ cpl_propertylist * pro_list ;
+ const char * fname ;
+ char sval[16] ;
+ int chip_nb ;
+ int iext;
+
+ /* Test entries */
+ if (allframes == NULL) return -1 ;
+
+ /* Get a suitable reference frame */
+ if((fname = hawki_get_extref_file(allframes)) == NULL)
+ {
+ cpl_msg_error(__func__, "Could not find a suitable reference frame");
+ return -1;
+ }
+
+ /* Add the PRO keys */
+ if (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+ else pro_list = cpl_propertylist_new() ;
+ if (protype != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+ if (procat != NULL)
+ cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+
+ /* File with extensions */
+ if ((applists != NULL) && (applists[0] != NULL))
+ qc_ext_list = cpl_propertylist_duplicate(applists[0]) ;
+ else
+ qc_ext_list = cpl_propertylist_new() ;
+ cpl_propertylist_prepend_string(qc_ext_list, "EXTNAME", "CHIP1.INT1") ;
+ if (cpl_dfs_save_table(allframes, NULL, parlist, usedframes, NULL, tables[0],
+ qc_ext_list, recipe, pro_list, NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ filename) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__,
+ "Cannot save the first extension table of file %s", filename);
+ cpl_propertylist_delete(qc_ext_list) ;
+ cpl_propertylist_delete(pro_list) ;
+ return -1 ;
+ }
+ cpl_propertylist_delete(qc_ext_list) ;
+ cpl_propertylist_delete(pro_list) ;
+
+ /* Save the extensions */
+ for (iext=1 ; iext<HAWKI_NB_DETECTORS; iext++) {
+ /* Get the chip number to store in this extension */
+ if ((chip_nb = hawki_get_detector_from_ext(fname, iext+1)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the chip for extension %d "
+ "when writing file %s", iext+1, filename);
+ return -1 ;
+ }
+ if ((applists != NULL) && (applists[chip_nb-1] != NULL))
+ qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+ else
+ qc_ext_list = cpl_propertylist_new() ;
+
+ snprintf(sval, 16, "CHIP%d.INT1", chip_nb) ;
+ cpl_propertylist_prepend_string(qc_ext_list, "EXTNAME", sval) ;
+ if(cpl_table_save(tables[chip_nb-1], NULL, qc_ext_list, filename,
+ CPL_IO_EXTEND) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__, "Cannot save extension %d of table %s",
+ iext+1, filename);
+ cpl_propertylist_delete(qc_ext_list) ;
+ return -1;
+ }
+
+ cpl_propertylist_delete(qc_ext_list) ;
+ }
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a HAWKI_NB_DETECTORS extensions HAWKI distortion images
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param distortion The distortion to save
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param protype The product type tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param applists Optional propertylists to append to ext headers or NULL
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename_x Filename for distortion image in X
+ @param filename_y Filename for distortion image in Y
+ @return 0 if ok, -1 in error case
+
+ This function allows to store images of different sizes in the
+ extensions
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_distortion_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const hawki_distortion ** distortion,
+ const char * recipe,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename_x,
+ const char * filename_y)
+{
+ const char * fname ;
+ cpl_propertylist * pro_list_x;
+ cpl_propertylist * pro_list_y;
+ cpl_type_bpp pixeltype ;
+ cpl_propertylist * qc_ext_list ;
+ char sval[16] ;
+ int chip_nb ;
+ int iext;
+
+ /* Test entries */
+ if (allframes == NULL) return -1 ;
+
+ /* Get a suitable reference frame */
+ if((fname = hawki_get_extref_file(allframes)) == NULL)
+ {
+ cpl_msg_error(__func__, "Could not find a suitable reference frame");
+ return -1;
+ }
+
+ /* Add the PRO keys */
+ if(applist != NULL)
+ pro_list_x = cpl_propertylist_duplicate(applist);
+ else
+ pro_list_x = cpl_propertylist_new();
+ if(applist != NULL)
+ pro_list_y = cpl_propertylist_duplicate(applist);
+ else
+ pro_list_y = cpl_propertylist_new();
+
+ cpl_propertylist_append_string(pro_list_x, CPL_DFS_PRO_TYPE,
+ HAWKI_PROTYPE_DISTORTION_X);
+ cpl_propertylist_append_string(pro_list_y, CPL_DFS_PRO_TYPE,
+ HAWKI_PROTYPE_DISTORTION_Y);
+ cpl_propertylist_append_string(pro_list_x, CPL_DFS_PRO_CATG,
+ HAWKI_CALPRO_DISTORTION_X);
+ cpl_propertylist_append_string(pro_list_y, CPL_DFS_PRO_CATG,
+ HAWKI_CALPRO_DISTORTION_Y);
+
+ /* File with extensions */
+ if (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+ CPL_BPP_IEEE_FLOAT, recipe, pro_list_x, NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ filename_x) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot save the empty primary HDU of file %s",
+ filename_x);
+ cpl_propertylist_delete(pro_list_x);
+ cpl_propertylist_delete(pro_list_y);
+ return -1 ;
+ }
+ if (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+ CPL_BPP_IEEE_FLOAT, recipe, pro_list_y, NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ filename_y) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot save the empty primary HDU of file %s",
+ filename_y);
+ cpl_propertylist_delete(pro_list_x);
+ cpl_propertylist_delete(pro_list_y);
+ return -1 ;
+ }
+
+ /* Delete PRO LIST */
+ cpl_propertylist_delete(pro_list_x);
+ cpl_propertylist_delete(pro_list_y);
+
+ /* Get the file type */
+ if (cpl_image_get_type(distortion[0]->dist_x) == CPL_TYPE_INT)
+ pixeltype = CPL_BPP_32_SIGNED ;
+ else
+ pixeltype = CPL_BPP_IEEE_FLOAT ;
+
+ /* Save the extensions */
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+ /* Get the chip number to store in this extension */
+ if ((chip_nb = hawki_get_detector_from_ext(fname, iext+1)) == -1) {
+ cpl_msg_error(__func__, "Cannot get the chip for extension %d "
+ "when saving %s and %s", iext+1, filename_x, filename_y);
+ return -1 ;
+ }
+ /* Get the QC list */
+ if ((applists != NULL) && (applists[chip_nb-1] != NULL))
+ qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+ else
+ qc_ext_list = cpl_propertylist_new() ;
+
+ /* Add the CR* keywords */
+ cpl_propertylist_prepend_double(qc_ext_list, "CRPIX2", 1);
+ cpl_propertylist_prepend_double(qc_ext_list, "CDELT2",
+ distortion[chip_nb-1]->y_cdelt);
+ cpl_propertylist_prepend_double(qc_ext_list, "CRVAL2",
+ distortion[chip_nb-1]->y_crval);
+ cpl_propertylist_prepend_double(qc_ext_list, "CRPIX1", 1);
+ cpl_propertylist_prepend_double(qc_ext_list, "CDELT1",
+ distortion[chip_nb-1]->x_cdelt);
+ cpl_propertylist_prepend_double(qc_ext_list, "CRVAL1",
+ distortion[chip_nb-1]->x_crval);
+
+ snprintf(sval, 16, "CHIP%d.INT1", chip_nb) ;
+ cpl_propertylist_prepend_string(qc_ext_list, "EXTNAME", sval) ;
+ if(cpl_image_save(distortion[chip_nb-1]->dist_x, filename_x,
+ pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Cannot save extension %d of file %s",
+ iext+1, filename_x);
+ cpl_propertylist_delete(qc_ext_list);
+ return -1;
+ }
+ if(cpl_image_save(distortion[chip_nb-1]->dist_y, filename_y,
+ pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Cannot save extension %d of file %s",
+ iext+1, filename_y);
+ cpl_propertylist_delete(qc_ext_list);
+ return -1;
+ }
+ cpl_propertylist_delete(qc_ext_list) ;
+ }
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Locate a filename where the extension <--> chip id relation
+ can be derived
+ @param frameset A frameset where a suitable frame can be extracted.
+ @return The filename if ok. NULL otherwise
+
+ This function will get the first frame with four extensions that is part
+ of the RAW group.
+ */
+/*----------------------------------------------------------------------------*/
+
+const char * hawki_get_extref_file(const cpl_frameset * frameset)
+{
+ int iframe;
+ const char * fname = NULL;
+
+ for(iframe = 0 ; iframe < cpl_frameset_get_size(frameset); ++iframe)
+ {
+ const cpl_frame * frame;
+
+ frame = cpl_frameset_get_frame_const(frameset, iframe);
+ /* Check that it belongs to the raw frames
+ * and then check if there are 4 extensions
+ */
+ if(cpl_frame_get_group(frame) == CPL_FRAME_GROUP_RAW &&
+ cpl_frame_get_nextensions(frame) == HAWKI_NB_DETECTORS)
+ {
+ fname = cpl_frame_get_filename(frame);
+ return fname;
+ }
+ }
+ //Now look into the products, in case that there is no actual raw
+ //reference frame. This is kind of a hack for hawki_util_gendist,
+ //which allows to save the distortion images using the distortion
+ //table as a reference
+ for(iframe = 0 ; iframe < cpl_frameset_get_size(frameset); ++iframe)
+ {
+ const cpl_frame * frame;
+
+ frame = cpl_frameset_get_frame_const(frameset, iframe);
+ /* Check that it belongs to the raw frames
+ * and then check if there are 4 extensions
+ */
+ if(cpl_frame_get_group(frame) == CPL_FRAME_GROUP_PRODUCT &&
+ cpl_frame_get_nextensions(frame) == HAWKI_NB_DETECTORS)
+ {
+ fname = cpl_frame_get_filename(frame);
+ return fname;
+ }
+ }
+ //And if it didn't suceed, use the first frame:
+ fname = cpl_frame_get_filename(cpl_frameset_get_first_const(frameset));
+
+ return fname;
+}
+
+
+/**@}*/
diff --git a/hawki/hawki_save.h b/hawki/hawki_save.h
new file mode 100644
index 0000000..a8b01e1
--- /dev/null
+++ b/hawki/hawki_save.h
@@ -0,0 +1,101 @@
+/* $Id: hawki_save.h,v 1.4 2009/11/25 16:25:08 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/11/25 16:25:08 $
+ * $Revision: 1.4 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_SAVE_H
+#define HAWKI_SAVE_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include "hawki_distortion.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+int hawki_imagelist_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_imagelist * images,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename);
+int hawki_images_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_image ** images,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename);
+int hawki_tables_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_table ** tables,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename);
+int hawki_distortion_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const hawki_distortion ** distortion,
+ const char * recipe,
+ const cpl_propertylist * applist,
+ const cpl_propertylist ** applists,
+ const char * filename_x,
+ const char * filename_y);
+int hawki_main_header_save
+(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const char * recipe,
+ const char * procat,
+ const char * protype,
+ const cpl_propertylist * applist,
+ const char * filename);
+int hawki_image_ext_save
+(const cpl_frameset * allframes,
+ const cpl_image * image,
+ int iext,
+ const cpl_propertylist * ext_prop_list,
+ const char * filename);
+const char * hawki_get_extref_file(const cpl_frameset *);
+
+#endif
diff --git a/hawki/hawki_utils.c b/hawki/hawki_utils.c
new file mode 100644
index 0000000..e173155
--- /dev/null
+++ b/hawki/hawki_utils.c
@@ -0,0 +1,1268 @@
+/* $Id: hawki_utils.c,v 1.53 2012/04/26 15:18:04 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/04/26 15:18:04 $
+ * $Revision: 1.53 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_cat.h"
+#include "irplib_wcs.h"
+
+#include "hawki_utils.h"
+#include "hawki_pfits.h"
+#include "hawki_load.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_utils Miscellaneous Utilities
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the pipeline copyright and license
+ @return The copyright and license string
+
+ The function returns a pointer to the statically allocated license string.
+ This string should not be modified using the returned pointer.
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_get_license(void)
+{
+ const char * hawki_license =
+ "This file is part of the HAWKI Instrument Pipeline\n"
+ "Copyright (C) 2002,2011 European Southern Observatory\n"
+ "\n"
+ "This program is free software; you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation; either version 2 of the License, or\n"
+ "(at your option) any later version.\n"
+ "\n"
+ "This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n"
+ "\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with this program; if not, write to the Free Software\n"
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, \n"
+ "MA 02111-1307 USA" ;
+ return hawki_license ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Issue a banner with the pipeline version
+ */
+/*----------------------------------------------------------------------------*/
+void hawki_print_banner(void)
+{
+ cpl_msg_info(__func__, "*****************************************");
+ cpl_msg_info(__func__, "Welcome to HAWK-I Pipeline release %s",
+ hawki_get_version());
+ cpl_msg_info(__func__, "*****************************************");
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Returns the version of the pipeline
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_get_version(void)
+{
+ return PACKAGE_VERSION;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the bpm from the dark (hot pixels)
+ @param in the input image
+ @param sigma the sigma for the threshold
+ @return The bad pixels map
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_compute_darkbpm(
+ const cpl_image * in,
+ double sigma)
+{
+ double med, stdev, threshold ;
+ cpl_image * bpm ;
+ cpl_image * bpm_int ;
+
+ /* Test entries */
+ if (in == NULL) return NULL ;
+ if (sigma <= 0) return NULL ;
+
+ bpm = cpl_image_duplicate(in);
+
+ /* Compute the threshold */
+ med = cpl_image_get_median_dev(bpm, &stdev) ;
+ threshold = med + sigma*stdev ;
+ cpl_msg_info(__func__, "Threshold : %g = %g + %g * %g",
+ threshold, med, sigma, stdev) ;
+
+ /* Compute the bpm */
+ cpl_image_threshold(bpm, threshold, threshold, 0.0, 1.0) ;
+
+ /* Convert */
+ bpm_int = cpl_image_cast(bpm, CPL_TYPE_INT) ;
+ cpl_image_delete(bpm) ;
+
+ return bpm_int ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the bpm from the flat (aka cold pixels mask)
+ @param in the input image
+ @param sigma the sigma for the threshold
+ @param lowval the lower value for the threshold
+ @param highval the upper value for the threshold
+ @return The bad pixels map
+
+ This function creates a mask of pixels below and above a certain limit
+ (lowval, highval) and pixels a certain number of sigmas (sigma) above the
+ background (which is obtained smoothing with a 3x3 kernel the input image).
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_compute_flatbpm
+(const cpl_image * in,
+ double sigma,
+ double lowval,
+ double highval)
+{
+ cpl_mask * kernel ;
+ cpl_image * filtered ;
+ double med, stdev, threshold ;
+ cpl_image * bpm_sigma;
+ cpl_image * bpm_lowhigh;
+ cpl_image * bpm;
+ cpl_image * bpm_int ;
+
+ /* Test entries */
+ if (in == NULL) return NULL ;
+ if (sigma <= 0) return NULL ;
+
+ /* Filter the input image */
+ kernel = cpl_mask_new(3, 3) ;
+ cpl_mask_not(kernel) ;
+ filtered = cpl_image_new(cpl_image_get_size_x(in), cpl_image_get_size_y(in),
+ cpl_image_get_type(in));
+ cpl_image_filter_mask(filtered, in, kernel, CPL_FILTER_MEDIAN,
+ CPL_BORDER_FILTER);
+ cpl_mask_delete(kernel) ;
+
+ /* Remove the low freq signal */
+ bpm_sigma = cpl_image_subtract_create(in, filtered) ;
+ cpl_image_delete(filtered) ;
+
+ /* Compute the threshold */
+ med = cpl_image_get_median_dev(bpm_sigma, &stdev) ;
+ threshold = med + sigma*stdev ;
+ cpl_msg_info(__func__, "Threshold : %g = %g + %g * %g",
+ threshold, med, sigma, stdev) ;
+
+ /* Compute the bpm with the sigma values */
+ cpl_image_threshold(bpm_sigma, threshold, threshold, 0.0, 1.0) ;
+
+ /* Count the pixels below and above the lowval and highval */
+ bpm_lowhigh = cpl_image_duplicate(in);
+ hawki_image_inverse_threshold(bpm_lowhigh, lowval, highval, 0.0, 1.0);
+
+ /* Merge both masks */
+ bpm = cpl_image_add_create(bpm_sigma, bpm_lowhigh);
+ cpl_image_threshold(bpm, 0.0, 1.0, 0.0, 1.0);
+
+ /* Convert */
+ bpm_int = cpl_image_cast(bpm, CPL_TYPE_INT) ;
+ cpl_image_delete(bpm) ;
+ cpl_image_delete(bpm_sigma);
+ cpl_image_delete(bpm_lowhigh);
+
+ return bpm_int ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create an image with a given value for pixels within a range
+ and another value for pixels outside that range
+ @param image_in Image to threshold.
+ @param lo_valid Lower bound of the valid range
+ @param hi_valid Higher bound of the valid range
+ @param assign_in_range Value to assign to pixels within valid range
+ @param assign_out_range Value to assign to pixels outside valid range
+ @return the #_cpl_error_code_ or CPL_ERROR_NONE
+
+ Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
+ lo_cut must be smaller than or equal to hi_cut.
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
+ - CPL_ERROR_INVALID_TYPE if the passed image type is not supported
+ - CPL_ERROR_ILLEGAL_INPUT if lo_valid is greater than hi_valid
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code hawki_image_inverse_threshold
+(cpl_image * image_in,
+ double lo_valid,
+ double hi_valid,
+ double assign_in_range,
+ double assign_out_range)
+{
+ int i;
+ int npix;
+
+ cpl_ensure_code(image_in != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(lo_valid <= hi_valid, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Get number of pixels of image */
+ npix = cpl_image_get_size_x(image_in) * cpl_image_get_size_y(image_in);
+
+ /* Switch on image type */
+ switch (cpl_image_get_type(image_in))
+ {
+ case CPL_TYPE_DOUBLE: {
+ double * pdi = cpl_image_get_data_double(image_in);
+ for (i=0; i<npix; i++) {
+ if ((pdi[i]>lo_valid) && (pdi[i]<hi_valid))
+ pdi[i] = (double)assign_in_range;
+ else
+ pdi[i] = (double)assign_out_range;
+ }
+ break;
+ }
+ case CPL_TYPE_FLOAT: {
+ float * pdi = cpl_image_get_data_float(image_in);
+ for (i=0; i<npix; i++) {
+ if ((pdi[i]>lo_valid) && (pdi[i]<hi_valid))
+ pdi[i] = (float)assign_in_range;
+ else
+ pdi[i] = (float)assign_out_range;
+ }
+ break;
+ }
+ case CPL_TYPE_INT: {
+ int * pdi = cpl_image_get_data_int(image_in);
+ for (i=0; i<npix; i++) {
+ if (((double)pdi[i]>lo_valid) && ((double)pdi[i]<hi_valid))
+ pdi[i] = (int)assign_in_range;
+ else
+ pdi[i] = (int)assign_out_range;
+ }
+ break;
+ }
+ default:
+ cpl_ensure_code(0, CPL_ERROR_INVALID_TYPE);
+ }
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the stitching
+ @param ima The HAWKI_NB_DETECTORS input images
+ @param x The HAWKI_NB_DETECTORS x positions
+ @param y The HAWKI_NB_DETECTORS y positions
+ @return The stitched image or NULL in error case.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_images_stitch
+(cpl_image ** ima,
+ double * x,
+ double * y)
+{
+ int lx, ly ;
+ cpl_image * ima_ext[HAWKI_NB_DETECTORS] ;
+ cpl_imagelist * in ;
+ cpl_bivector * offsets ;
+ double * offsets_x ;
+ double * offsets_y ;
+ cpl_image ** combined ;
+ cpl_image * stitched ;
+ int i ;
+
+ /* Test entries */
+ if (ima == NULL) return NULL ;
+ if (x == NULL) return NULL ;
+ if (y == NULL) return NULL ;
+
+ /* Take the smallest size */
+ lx = cpl_image_get_size_x(ima[0]) ;
+ ly = cpl_image_get_size_y(ima[0]) ;
+ for (i=1 ; i<HAWKI_NB_DETECTORS ; i++) {
+ if (lx > cpl_image_get_size_x(ima[i]))
+ lx = cpl_image_get_size_x(ima[i]) ;
+ if (ly > cpl_image_get_size_y(ima[i]))
+ ly = cpl_image_get_size_y(ima[i]) ;
+ }
+
+ /* Create the image list */
+ in = cpl_imagelist_new() ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ ima_ext[i] = cpl_image_extract(ima[i], 1, 1, lx, ly) ;
+ cpl_imagelist_set(in, ima_ext[i], i) ;
+ }
+
+ /* Create the offsets */
+ offsets = cpl_bivector_new(HAWKI_NB_DETECTORS) ;
+ offsets_x = cpl_bivector_get_x_data(offsets) ;
+ offsets_y = cpl_bivector_get_y_data(offsets) ;
+ offsets_x[0] = HAWKI_DET1_POSX ;
+ offsets_y[0] = HAWKI_DET1_POSY ;
+ offsets_x[1] = x[0] - x[1] + HAWKI_DET2_POSX ;
+ offsets_y[1] = y[0] - y[1] + HAWKI_DET2_POSY ;
+ offsets_x[2] = x[0] - x[2] + HAWKI_DET3_POSX ;
+ offsets_y[2] = y[0] - y[2] + HAWKI_DET3_POSY ;
+ offsets_x[3] = x[0] - x[3] + HAWKI_DET4_POSX ;
+ offsets_y[3] = y[0] - y[3] + HAWKI_DET4_POSY ;
+
+ /* Recombine the images */
+ if ((combined = cpl_geom_img_offset_saa(in, offsets,
+ CPL_KERNEL_DEFAULT, 0, 0, CPL_GEOM_UNION, NULL, NULL)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot recombine the images") ;
+ cpl_bivector_delete(offsets) ;
+ cpl_imagelist_delete(in) ;
+ return NULL ;
+ }
+ cpl_bivector_delete(offsets) ;
+ cpl_imagelist_delete(in) ;
+
+ /* Return */
+ stitched = combined[0] ;
+ cpl_image_delete(combined[1]) ;
+ cpl_free(combined) ;
+ return stitched ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the harmonization
+ @param in the input images
+ @param h1 the factor to apply to chip 1
+ @param h2 the factor to apply to chip 2
+ @param h3 the factor to apply to chip 3
+ @param h4 the factor to apply to chip 4
+ @return 0 if ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_apply_harmonization(
+ cpl_imagelist * in,
+ double h1,
+ double h2,
+ double h3,
+ double h4)
+{
+ /* Test entries */
+ if (in == NULL) return -1 ;
+
+ cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 0), h1) ;
+ cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 1), h2) ;
+ cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 2), h3) ;
+ cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 3), h4) ;
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the harmonization
+ @param in the input images
+ @param h1 the factor to apply to chip 1
+ @param h2 the factor to apply to chip 2
+ @param h3 the factor to apply to chip 3
+ @param h4 the factor to apply to chip 4
+ @param h the general factor
+ @return 0 if ok, -1 otherwise
+
+ chip3 | | chip4
+ ------ ------
+ ------ ------
+ chip1 | |chip2
+
+ the edges averages avgi of all chips i are computed -> h=avg(avgi)
+ hi = h/avgi
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_compute_harmonization(
+ const cpl_imagelist * in,
+ double * h1,
+ double * h2,
+ double * h3,
+ double * h4,
+ double * h)
+{
+ int width = 64 ;
+ int nx, ny ;
+ const cpl_image * ima ;
+ double avg1, avg2, avg3, avg4 ;
+ double val1, val2 ;
+ int llx, lly, urx, ury ;
+
+ /* Test entries */
+ if (in == NULL) return -1 ;
+ if (h1==NULL || h2==NULL || h3==NULL || h4==NULL || h==NULL) return -1 ;
+
+ /* Compute the avg1 */
+ ima = cpl_imagelist_get_const(in, 0) ;
+ nx = cpl_image_get_size_x(ima) ;
+ ny = cpl_image_get_size_y(ima) ;
+ llx = 1 ; lly = ny - width + 1 ; urx = nx ; ury = ny ;
+ val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 1") ;
+ return -1 ;
+ }
+ llx = nx - width + 1 ; lly = 1 ; urx = nx ; ury = ny ;
+ val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 1") ;
+ return -1 ;
+ }
+ avg1 = (val1 + val2) / 2.0 ;
+
+ /* Compute the avg2 */
+ ima = cpl_imagelist_get_const(in, 1) ;
+ nx = cpl_image_get_size_x(ima) ;
+ ny = cpl_image_get_size_y(ima) ;
+ llx = 1 ; lly = 1 ; urx = width ; ury = ny ;
+ val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 2") ;
+ return -1 ;
+ }
+ llx = 1 ; lly = ny - width + 1 ; urx = nx ; ury = ny ;
+ val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 2") ;
+ return -1 ;
+ }
+ avg2 = (val1 + val2) / 2.0 ;
+
+ /* Compute the avg3 */
+ ima = cpl_imagelist_get_const(in, 2) ;
+ nx = cpl_image_get_size_x(ima) ;
+ ny = cpl_image_get_size_y(ima) ;
+ llx = 1 ; lly = 1 ; urx = nx ; ury = width ;
+ val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 3") ;
+ return -1 ;
+ }
+ llx = nx - width + 1 ; lly = 1 ; urx = nx ; ury = ny ;
+ val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 3") ;
+ return -1 ;
+ }
+ avg3 = (val1 + val2) / 2.0 ;
+
+ /* Compute the avg4 */
+ ima = cpl_imagelist_get_const(in, 3) ;
+ nx = cpl_image_get_size_x(ima) ;
+ ny = cpl_image_get_size_y(ima) ;
+ llx = 1 ; lly = 1 ; urx = width ; ury = ny ;
+ val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 4") ;
+ return -1 ;
+ }
+ llx = 1 ; lly = 1 ; urx = nx ; ury = width ;
+ val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot get statistics from chip 4") ;
+ return -1 ;
+ }
+ avg4 = (val1 + val2) / 2.0 ;
+
+ /* Compute h */
+ *h = (avg1 + avg2 + avg3 + avg4) / 4.0 ;
+
+ *h1 = *h / avg1 ;
+ *h2 = *h / avg2 ;
+ *h3 = *h / avg3 ;
+ *h4 = *h / avg4 ;
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the large scale background
+ @param the input image
+ @return The background or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_compute_lsbg(const cpl_image * in)
+{
+ cpl_image * out ;
+ cpl_image * tmp ;
+ cpl_image * filtered ;
+ cpl_image * subsampled ;
+ cpl_mask * kernel ;
+ int nscales ;
+ cpl_polynomial * poly ;
+ cpl_bivector * xy_pos ;
+ cpl_vector * vals ;
+ int quad_sz, nbpoints, lx, ly, nx, ny ;
+ double * pxy_pos_x ;
+ double * pxy_pos_y ;
+ double * pvals ;
+ float * pima ;
+ int i, j ;
+
+ /* Check entries */
+ if (in == NULL) return NULL ;
+ nx = cpl_image_get_size_x(in) ;
+ ny = cpl_image_get_size_y(in) ;
+
+ /* Initialise */
+ nscales = 7 ;
+ tmp = (cpl_image *)in ;
+ subsampled = NULL ;
+
+ /* Check entries */
+ quad_sz = pow(2, (double)nscales) ;
+ lx = nx / quad_sz ;
+ ly = ny / quad_sz ;
+ nbpoints = lx * ly ;
+ if (quad_sz >= nx || quad_sz >= ny) return NULL ;
+
+ /* Create filter kernel */
+ kernel = cpl_mask_new(3, 3) ;
+ cpl_mask_not(kernel) ;
+
+ /* Loop nscales times */
+ for (i=0 ; i<nscales ; i++) {
+
+ /* Filter the image */
+ filtered = cpl_image_new(cpl_image_get_size_x(tmp),
+ cpl_image_get_size_y(tmp),
+ cpl_image_get_type(tmp));
+ cpl_image_filter_mask(filtered, in, kernel, CPL_FILTER_MEDIAN,
+ CPL_BORDER_FILTER);
+ if (i>0) cpl_image_delete(tmp) ;
+
+ /* Subsample the image */
+ subsampled = cpl_image_extract_subsample(filtered, 2, 2) ;
+ cpl_image_delete(filtered) ;
+
+ tmp = subsampled ;
+ }
+ cpl_mask_delete(kernel) ;
+
+ /* Check nbpoints */
+ if (nbpoints !=
+ cpl_image_get_size_x(subsampled)*cpl_image_get_size_y(subsampled)) {
+ cpl_msg_error(__func__, "Invalid size") ;
+ cpl_image_delete(subsampled) ;
+ return NULL ;
+ }
+
+ /* Create anchor points for the fit */
+ xy_pos = cpl_bivector_new(nbpoints) ;
+ vals = cpl_vector_new(nbpoints) ;
+ pxy_pos_x = cpl_bivector_get_x_data(xy_pos) ;
+ pxy_pos_y = cpl_bivector_get_y_data(xy_pos) ;
+ pvals = cpl_vector_get_data(vals) ;
+ pima = cpl_image_get_data_float(subsampled) ;
+ for (j=0 ; j<ly ; j++) {
+ for (i=0 ; i<lx ; i++) {
+ pxy_pos_x[i+j*lx] = i * quad_sz + quad_sz/2 ;
+ pxy_pos_y[i+j*lx] = j * quad_sz + quad_sz/2 ;
+ pvals[i+j*lx] = (double)pima[i+j*lx];
+ }
+ }
+ cpl_image_delete(subsampled) ;
+
+ /* Fit the polynomial */
+ if ((poly = cpl_polynomial_fit_2d_create(xy_pos, vals, 3, NULL)) == NULL) {
+ cpl_msg_error(__func__, "Cannot fit the polynomial") ;
+ cpl_bivector_delete(xy_pos) ;
+ cpl_vector_delete(vals) ;
+ return NULL ;
+ }
+ cpl_bivector_delete(xy_pos) ;
+ cpl_vector_delete(vals) ;
+
+ /* Regenerate the big bgd image */
+ out = cpl_image_duplicate(in) ;
+ cpl_image_fill_polynomial(out, poly, 1.0, 1.0, 1.0, 1.0) ;
+ cpl_polynomial_delete(poly) ;
+
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extract the filename ffor the first frame of the given tag
+ @param in A non-empty frameset
+ @param tag The tag of the requested file
+ @return Pointer to the file
+ */
+/*----------------------------------------------------------------------------*/
+const char * hawki_extract_first_filename(
+ const cpl_frameset * in,
+ const char * tag)
+{
+ const cpl_frame * cur_frame ;
+
+ /* Get the frame */
+ if ((cur_frame = cpl_frameset_find_const(in, tag)) == NULL) return NULL ;
+ return cpl_frame_get_filename(cur_frame) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the band
+ @param f the filter name from the header
+ @return the band
+ */
+/*----------------------------------------------------------------------------*/
+hawki_band hawki_get_band(const char * f)
+{
+ if (!strcmp(f, "J")) return HAWKI_BAND_J ;
+ if (!strcmp(f, "H")) return HAWKI_BAND_H ;
+ if (!strcmp(f, "K")) return HAWKI_BAND_K ;
+ if (!strcmp(f, "Ks")) return HAWKI_BAND_K ;
+ if (!strcmp(f, "Y")) return HAWKI_BAND_Y ;
+ return HAWKI_BAND_UNKNOWN ;
+}
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Return a band name
+ @param band a BB
+ @return 1 pointer to a static band name.
+ */
+/*--------------------------------------------------------------------------*/
+const char * hawki_std_band_name(hawki_band band)
+{
+ switch (band) {
+ case HAWKI_BAND_J: return "J" ;
+ case HAWKI_BAND_H: return "H" ;
+ case HAWKI_BAND_K: return "K" ;
+ case HAWKI_BAND_Y: return "Y" ;
+ default: return "Unknown" ;
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the nominal header offsets from a set of frames
+ @param fset the set of frames
+ @return The offsets in a bivector or NULL in error case
+
+ The offsets returned are the telescope offsets, a mirror transformation must
+ be performed to use them in as the image offsets, which is the cpl convention.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_bivector * hawki_get_header_tel_offsets(const cpl_frameset * fset)
+{
+ cpl_bivector * offsets ;
+ double * offsets_x ;
+ double * offsets_y ;
+ const cpl_frame * frame ;
+ cpl_propertylist * plist ;
+ int nfiles ;
+ int i ;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+ /* Test entries */
+ if (fset == NULL) return NULL ;
+
+ /* Create the offsets bi vector */
+ nfiles = cpl_frameset_get_size(fset) ;
+ offsets = cpl_bivector_new(nfiles) ;
+ offsets_x = cpl_bivector_get_x_data(offsets) ;
+ offsets_y = cpl_bivector_get_y_data(offsets) ;
+ for (i=0 ; i<nfiles ; i++) {
+
+ /* X and Y offsets */
+ frame = cpl_frameset_get_frame_const(fset, i) ;
+ plist=cpl_propertylist_load(cpl_frame_get_filename(frame),0);
+ offsets_x[i] = hawki_pfits_get_cumoffsetx(plist) ;
+ offsets_y[i] = hawki_pfits_get_cumoffsety(plist) ;
+ cpl_propertylist_delete(plist) ;
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "Cannot get offsets from header") ;
+ cpl_bivector_delete(offsets) ;
+ return NULL ;
+ }
+ }
+ return offsets ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the mean airmass for a set of frames.
+ @param set the input frame set
+ @return The mean airmass of all the input frames.
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_get_mean_airmass(cpl_frameset * set)
+{
+ int nframes;
+ cpl_frame * cur_frame;
+ cpl_propertylist * plist;
+ int iframe;
+ double mean_airmass = 0.0;
+
+ /* Test inputs */
+ if (set == NULL) return -1;
+
+ /* Initialize */
+ nframes = cpl_frameset_get_size(set);
+
+ for (iframe=0 ; iframe<nframes ; iframe++)
+ {
+ cur_frame = cpl_frameset_get_frame(set, iframe);
+ plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0);
+ mean_airmass += hawki_pfits_get_airmass_start(plist) +
+ hawki_pfits_get_airmass_end(plist);
+ cpl_propertylist_delete(plist);
+ }
+ mean_airmass /= 2. * nframes;
+
+ /* Free and return */
+ return mean_airmass;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the frames in which the star is for a given chip
+ @param in the input frameset
+ @return The newly allocated frameset
+
+ The signs of the header offsets in x and y are used:
+ - and - -> chip 1
+ + and - -> chip 2
+ + and + -> chip 3
+ - and + -> chip 4
+ */
+/*----------------------------------------------------------------------------*/
+int * hawki_detectors_labelise
+(const cpl_frameset * in)
+{
+ int * labels ;
+ cpl_bivector * offsets ;
+ int nframes ;
+ double * poff_x ;
+ double * poff_y ;
+ double off_x_mean;
+ double off_y_mean;
+ int i ;
+
+ /* Check entries */
+ if (in == NULL) return NULL ;
+
+ /* Initialise */
+ nframes = cpl_frameset_get_size(in) ;
+
+ /* Get the offsets */
+ if ((offsets = hawki_get_header_tel_offsets((cpl_frameset *)in)) == NULL) {
+ cpl_msg_error(__func__, "Cannot read the offsets") ;
+ return NULL ;
+ }
+ poff_x = cpl_bivector_get_x_data(offsets) ;
+ poff_y = cpl_bivector_get_y_data(offsets) ;
+
+ /* Get the mean offsets */
+ off_x_mean = cpl_vector_get_mean(cpl_bivector_get_x(offsets));
+ off_y_mean = cpl_vector_get_mean(cpl_bivector_get_y(offsets));
+
+ /* Allocate labels */
+ labels = cpl_malloc(nframes * sizeof(int)) ;
+ for (i=0 ; i<nframes ; i++) {
+ if (poff_x[i] - off_x_mean <= 0 && poff_y[i] - off_y_mean <= 0)
+ labels[i] = 1 ;
+ else if (poff_x[i] - off_x_mean >= 0 && poff_y[i] - off_y_mean <= 0)
+ labels[i] = 2 ;
+ else if (poff_x[i] - off_x_mean >= 0 && poff_y[i] - off_y_mean >= 0)
+ labels[i] = 3 ;
+ else if (poff_x[i] - off_x_mean <= 0 && poff_y[i] - off_y_mean >= 0)
+ labels[i] = 4 ;
+ else labels[i] = 0 ;
+ }
+ cpl_bivector_delete(offsets) ;
+ return labels ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the frames in which the star is for a given chip
+ @param in the input frameset
+ @return The newly allocated frameset
+
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_detectors_locate_star
+(const cpl_frameset * in,
+ double star_ra,
+ double star_dec,
+ int * labels)
+{
+ int nframes;
+ int idet, iframe;
+
+ /* Check entries */
+ if (in == NULL) return -1;
+
+ /* Initialise */
+ nframes = cpl_frameset_get_size(in) ;
+
+ /* Allocate labels */
+ for (iframe=0 ; iframe<nframes ; iframe++)
+ {
+ const char * filename;
+ filename = cpl_frame_get_filename
+ (cpl_frameset_get_frame_const(in, iframe));
+
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_propertylist * main_header;
+ cpl_propertylist * ext_header;
+ cpl_wcs * wcs;
+ double naxis1, naxis2;
+ double star_x, star_y;
+
+ /* Get the headers */
+ main_header = cpl_propertylist_load(filename, 0);
+ ext_header = cpl_propertylist_load
+ (filename, hawki_get_ext_from_detector(filename,idet + 1));
+
+ /* Get the position of the star in pixels */
+ wcs = cpl_wcs_new_from_propertylist(ext_header);
+ if(wcs == NULL)
+ {
+ cpl_msg_error(__func__, "Could not get WCS info");
+ cpl_propertylist_delete(ext_header);
+ cpl_propertylist_delete(main_header);
+ return -1;
+ }
+ if(irplib_wcs_radectoxy(wcs, star_ra, star_dec, &star_x, &star_y)
+ != CPL_ERROR_NONE)
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ }
+
+ /* Check for the limits */
+ naxis1 = (double)hawki_pfits_get_naxis1(ext_header);
+ naxis2 = (double)hawki_pfits_get_naxis2(ext_header);
+ if(star_x > 0 && star_x < naxis1 && star_y > 0 && star_y < naxis2)
+ {
+ labels[iframe] = idet + 1;
+ }
+
+ /* Free */
+ cpl_propertylist_delete(ext_header);
+ cpl_propertylist_delete(main_header);
+ cpl_wcs_delete(wcs);
+ }
+ if(labels[iframe] == 0)
+ {
+ cpl_msg_error(__func__,"Frame %d does not contain the star in any "
+ "detector", iframe + 1);
+ }
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Gets the maximum value of a vector according to an array of flags.
+ @param self The input vector with the values
+ @param valid Vector of flags (>=-0.5: valid, <-0.5: invalid)
+ @return The minimum value.
+
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_vector_get_max_select
+(const cpl_vector * self, const cpl_vector * valid)
+{
+ double max_val = DBL_MIN;
+ int initialized = 0;
+ int ival;
+ int nvals;
+
+ nvals = cpl_vector_get_size(self);
+ for(ival = 0; ival < nvals; ++ival)
+ {
+ if(cpl_vector_get(valid, ival) >= -0.5)
+ {
+ if(!initialized)
+ {
+ max_val = cpl_vector_get(self, ival);
+ initialized = 1;
+ }
+ if(cpl_vector_get(self, ival) > max_val)
+ max_val = cpl_vector_get(self, ival);
+ }
+ }
+ return max_val;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Gets the minimum value of a vector according to an array of flags.
+ @param self The input vector with the values
+ @param valid Vector of flags (>=-0.5: valid, <-0.5: invalid)
+ @return The minimum value.
+
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_vector_get_min_select
+(const cpl_vector * self, const cpl_vector * valid)
+{
+ double min_val = DBL_MAX;
+ int initialized = 0;
+ int ival;
+ int nvals;
+
+ nvals = cpl_vector_get_size(self);
+ for(ival = 0; ival < nvals; ++ival)
+ {
+ if(cpl_vector_get(valid, ival) >= -0.5)
+ {
+ if(!initialized)
+ {
+ min_val = cpl_vector_get(self, ival);
+ initialized = 1;
+ }
+ if(cpl_vector_get(self, ival) < min_val)
+ min_val = cpl_vector_get(self, ival);
+ }
+ }
+ return min_val;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the histogram mode
+ @param vec the vector
+ @return the mode or -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+double hawki_vector_get_mode(cpl_vector * vec)
+{
+ int nb ;
+ int nbins ;
+ double min, max ;
+ double bin_size ;
+ cpl_bivector * hist ;
+ cpl_vector * hist_x ;
+ cpl_vector * hist_y ;
+ double cur_val ;
+ int cur_bin ;
+ double max_val ;
+ int max_bin ;
+ double mode ;
+ int i ;
+
+ /* Test entries */
+ if (vec == NULL) return -1.0 ;
+
+ /* Initialise */
+ nb = cpl_vector_get_size(vec) ;
+
+ /* Create the histogram */
+ nbins = 10 ;
+ min = cpl_vector_get_min(vec) ;
+ max = cpl_vector_get_max(vec) ;
+ bin_size = (max-min)/nbins ;
+ hist = cpl_bivector_new(nbins) ;
+ hist_x = cpl_bivector_get_x(hist) ;
+ hist_y = cpl_bivector_get_y(hist) ;
+ cpl_vector_fill(hist_x, 0.0) ;
+ cpl_vector_fill(hist_y, 0.0) ;
+ for (i=0 ; i<nbins ; i++) {
+ cpl_vector_set(hist_x, i, min + i * bin_size) ;
+ }
+ for (i=0 ; i<nb ; i++) {
+ cur_val = cpl_vector_get(vec, i) ;
+ cur_bin = (int)((cur_val - min) / bin_size) ;
+ if (cur_bin >= nbins) cur_bin -= 1.0 ;
+ cur_val = cpl_vector_get(hist_y, cur_bin) ;
+ cur_val += 1.0 ;
+ cpl_vector_set(hist_y, cur_bin, cur_val) ;
+ }
+
+ /* Get the mode of the histogram */
+ max_val = cpl_vector_get(hist_y, 0) ;
+ max_bin = 0 ;
+ for (i=0 ; i<nbins ; i++) {
+ cur_val = cpl_vector_get(hist_y, i) ;
+ if (cur_val > max_val) {
+ max_val = cur_val ;
+ max_bin = i ;
+ }
+ }
+ mode = cpl_vector_get(hist_x, max_bin) ;
+ cpl_bivector_delete(hist) ;
+ return mode ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Check that all the frames share the same value of a given keyword
+ @param frames the framset
+ @param func the function which returns the value of the kwd,
+ given the propertylist
+ @return 1 if all the frames have the same values. 0 elsewhere.
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_utils_check_equal_double_keys
+(cpl_frameset * frames, double (*func)(const cpl_propertylist *))
+{
+ int iframe;
+ double value = 0;
+
+ if(cpl_frameset_get_size(frames) < 2)
+ return 1;
+
+ for(iframe = 0; iframe < cpl_frameset_get_size(frames); ++iframe)
+ {
+ cpl_propertylist * header;
+ header = cpl_propertylist_load(
+ cpl_frame_get_filename(
+ cpl_frameset_get_frame_const(frames, iframe)),0);
+ if(iframe == 0)
+ value = (func)(header);
+ else
+ if(value != (func)(header))
+ {
+ cpl_propertylist_delete(header);
+ return 0;
+ }
+ cpl_propertylist_delete(header);
+ }
+ return 1;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Check that all the frames share the same value of a given keyword
+ @param frames the framset
+ @param func the function which returns the value of the kwd,
+ given the propertylist
+ @return 1 if all the frames have the same values. 0 elsewhere.
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_utils_check_equal_int_keys
+(cpl_frameset * frames, int (*func)(const cpl_propertylist *))
+{
+ int iframe;
+ int value = 0;
+
+ if(cpl_frameset_get_size(frames) < 2)
+ return 1;
+
+ for(iframe = 0; iframe < cpl_frameset_get_size(frames); ++iframe)
+ {
+ cpl_propertylist * header;
+ header = cpl_propertylist_load(
+ cpl_frame_get_filename(
+ cpl_frameset_get_frame_const(frames, iframe)),0);
+ if(iframe == 0)
+ value = (func)(header);
+ else
+ if(value != (func)(header))
+ {
+ cpl_propertylist_delete(header);
+ return 0;
+ }
+ cpl_propertylist_delete(header);
+ }
+ return 1;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This functions formats a right ascension in degrees to a string
+ of the form HH:MM:SS.
+ It is based on ra2str from file libwcs/ang2str.c in wcstools library
+ (http://tdc-www.harvard.edu/wcstools/)
+ @param str The string to write to
+ @param length_str The maximum lenght to write
+ @param ra The right ascension in degrees
+ */
+/*----------------------------------------------------------------------------*/
+void hawki_utils_ra2str(char * str, int length_str, double ra)
+{
+ double a,b;
+ double seconds;
+ char tstring[64];
+ int hours;
+ int minutes;
+ int ltstr;
+ double dsgn;
+
+ /* Keep RA between 0 and 360 */
+ if (ra < 0.0 )
+ {
+ ra = -ra;
+ dsgn = -1.0;
+ }
+ else
+ dsgn = 1.0;
+ ra = fmod(ra, 360.0);
+ ra *= dsgn;
+ if (ra < 0.0)
+ ra = ra + 360.0;
+
+ a = ra / 15.0;
+
+ /* Convert to hours */
+ hours = (int) a;
+
+ /* Compute minutes */
+ b = (a - (double)hours) * 60.0;
+ minutes = (int) b;
+
+ /* Compute seconds */
+ seconds = (b - (double)minutes) * 60.0;
+
+ if (seconds > 59.99)
+ {
+ seconds = 0.0;
+ minutes = minutes + 1;
+ }
+ if (minutes > 59)
+ {
+ minutes = 0;
+ hours = hours + 1;
+ }
+ hours = hours % 24;
+ (void) sprintf (tstring,"%02d:%02d:%05.2f",hours,minutes,seconds);
+
+ /* Move formatted string to returned string */
+ ltstr = (int) strlen (tstring);
+ if (ltstr < length_str-1)
+ strcpy (str, tstring);
+ else
+ {
+ strncpy (str, tstring, length_str-1);
+ str[length_str-1] = 0;
+ }
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This functions formats a declination in degrees to a string
+ of the form DD:MM:SS.
+ It is based on dec2str from file libwcs/ang2str.c in wcstools library
+ (http://tdc-www.harvard.edu/wcstools/)
+ @param str The string to write to
+ @param length_str The maximum lenght to write
+ @param dec The declination in degrees
+ */
+/*----------------------------------------------------------------------------*/
+void hawki_utils_dec2str(char * str, int length_str, double dec)
+{
+ double a, b, dsgn, deg1;
+ double seconds;
+ char sign;
+ int degrees;
+ int minutes;
+ int ltstr;
+ char tstring[64];
+
+ /* Keep angle between -180 and 360 degrees */
+ deg1 = dec;
+ if (deg1 < 0.0 )
+ {
+ deg1 = -deg1;
+ dsgn = -1.0;
+ }
+ else
+ dsgn = 1.0;
+ deg1 = fmod(deg1, 360.0);
+ deg1 *= dsgn;
+ if (deg1 <= -180.0)
+ deg1 = deg1 + 360.0;
+
+ a = deg1;
+
+ /* Set sign and do all the rest with a positive */
+ if (a < 0)
+ {
+ sign = '-';
+ a = -a;
+ }
+ else
+ sign = '+';
+
+ /* Convert to degrees */
+ degrees = (int) a;
+
+ /* Compute minutes */
+ b = (a - (double)degrees) * 60.0;
+ minutes = (int) b;
+
+ /* Compute seconds */
+ seconds = (b - (double)minutes) * 60.0;
+
+ if (seconds > 59.99)
+ {
+ seconds = 0.0;
+ minutes = minutes + 1;
+ }
+ if (minutes > 59)
+ {
+ minutes = 0;
+ degrees = degrees + 1;
+ }
+ (void) sprintf (tstring,"%c%02d:%02d:%05.2f",sign,degrees,minutes,seconds);
+
+ /* Move formatted string to returned string */
+ ltstr = (int) strlen (tstring);
+ if (ltstr < length_str-1)
+ strcpy (str, tstring);
+ else
+ {
+ strncpy (str, tstring, length_str-1);
+ str[length_str-1] = 0;
+ }
+ return;
+}
+
+/**@}*/
+
diff --git a/hawki/hawki_utils.h b/hawki/hawki_utils.h
new file mode 100644
index 0000000..ba41c4c
--- /dev/null
+++ b/hawki/hawki_utils.h
@@ -0,0 +1,149 @@
+/* $Id: hawki_utils.h,v 1.41 2011/09/16 15:18:04 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/09/16 15:18:04 $
+ * $Revision: 1.41 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_UTILS_H
+#define HAWKI_UTILS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ New types
+ -----------------------------------------------------------------------------*/
+
+typedef enum _HAWKI_BAND_ {
+ HAWKI_BAND_J,
+ HAWKI_BAND_H,
+ HAWKI_BAND_K,
+ HAWKI_BAND_Y,
+ HAWKI_BAND_UNKNOWN
+} hawki_band ;
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define HAWKI_NB_DETECTORS 4
+#define HAWKI_PHOT_STAR_RADIUS 30.0
+#define HAWKI_DET_NPIX_X 2048
+#define HAWKI_DET_NPIX_Y 2048
+
+/* Input from commissionning 1 report */
+#define HAWKI_DET1_POSX 0
+#define HAWKI_DET1_POSY 0
+#define HAWKI_DET2_POSX 2048 + 153
+#define HAWKI_DET2_POSY 0 + 3
+#define HAWKI_DET3_POSX 2048 + 157
+#define HAWKI_DET3_POSY 2048 + 144
+#define HAWKI_DET4_POSX 0 + 5
+#define HAWKI_DET4_POSY 2048 + 142
+
+#define HAWKI_NB_VC 32
+
+#define HAWKI_HEADER_EXT_FORWARD "DET CHIP|DET WIN NX|DET WIN NY|DET WIN STARTX|DET WIN STARTY"
+
+#define HAWKI_HEADER_WCS "CTYPE1|CTYPE2|CRVAL1|CRVAL2|CRPIX1|CRPIX2|CD1_1|CD1_2|CD2_1|CD2_2"
+
+#define HAWKI_HEADER_COMB_OFFSETS "ESO QC COMBINED"
+
+#define HAWKI_HEADER_PRI_TOPAF "^(ARCFILE|MJD-OBS|INSTRUME|ESO TPL ID|ESO TPL NEXP|ESO DPR CATG|ESO DPR TECH|ESO DPR TYPE|DATE-OBS|ESO INS GRAT NAME|ESO INS GRAT WLEN|ESO INS OPTI1 ID|ESO OBS ID|ESO DET MINDIT|ESO DET RSPEED|ESO DET DIT|ESO DET NDIT|ESO DET NCORRS NAME|ESO INS FILT1 NAME|ESO INS FILT2 NAME|ESO MODE NAME|ESO NDSAMPLES)$"
+
+#define HAWKI_HEADER_EXT_TOPAF "ESO DET CHIP ID|ESO DET CHIP NO|ESO DET CHIP LIVE"
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+void hawki_print_banner(void);
+const char * hawki_get_license(void);
+const char * hawki_get_version(void);
+
+cpl_image * hawki_compute_lsbg
+(const cpl_image * in);
+cpl_image * hawki_compute_darkbpm
+(const cpl_image * in,
+ double sigma);
+cpl_image * hawki_compute_flatbpm
+(const cpl_image * in,
+ double sigma,
+ double lowval,
+ double highval);
+cpl_error_code hawki_image_inverse_threshold
+(cpl_image * image_in,
+ double lo_valid,
+ double hi_valid,
+ double assign_in_range,
+ double assign_out_range);
+int hawki_apply_harmonization
+(cpl_imagelist * in,
+ double h1,
+ double h2,
+ double h3,
+ double h4);
+int hawki_compute_harmonization
+(const cpl_imagelist * in,
+ double * h1,
+ double * h2,
+ double * h3,
+ double * h4,
+ double * h);
+const char * hawki_extract_first_filename
+(const cpl_frameset * in,
+ const char * tag);
+hawki_band hawki_get_band
+(const char * band);
+const char * hawki_std_band_name
+(hawki_band band);
+cpl_image * hawki_images_stitch
+(cpl_image ** ima,
+ double * x,
+ double * y);
+cpl_bivector * hawki_get_header_tel_offsets
+(const cpl_frameset * frameset);
+double hawki_get_mean_airmass(cpl_frameset * set);
+int * hawki_detectors_labelise
+(const cpl_frameset * frameset);
+int hawki_detectors_locate_star
+(const cpl_frameset * in,
+ double star_ra,
+ double star_dec,
+ int * labels);
+double hawki_vector_get_min_select
+(const cpl_vector * self, const cpl_vector * valid);
+double hawki_vector_get_max_select
+(const cpl_vector * self, const cpl_vector * valid);
+double hawki_vector_get_mode(cpl_vector * vec);
+int hawki_utils_check_equal_double_keys
+(cpl_frameset * frames, double (*func)(const cpl_propertylist *));
+int hawki_utils_check_equal_int_keys
+(cpl_frameset * frames, int (*func)(const cpl_propertylist *));
+void hawki_utils_ra2str(char * str, int length_str, double ra);
+void hawki_utils_dec2str(char * str, int length_str, double dec);
+#endif
diff --git a/hawki/hawki_variance.c b/hawki/hawki_variance.c
new file mode 100644
index 0000000..b28a102
--- /dev/null
+++ b/hawki/hawki_variance.c
@@ -0,0 +1,183 @@
+/* $Id: hawki_variance.c,v 1.2 2009/03/13 11:52:06 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/03/13 11:52:06 $
+ * $Revision: 1.2 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_variance.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup hawki_variance Variance estimation for raw images.
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create the associated variance of a raw image
+ @param image the raw image
+ @param gain the gain of the detector (e-/ADU)
+ @param ron the ron for one read of the detector (ADU)
+ @param ndit the number of total integrations.
+ @param ndsamples the number of non-destructive readouts.
+ @return The variance image if suceed. NULL elsewhere.
+
+ The variance is computed with the following
+ equation:
+ \f[ \sigma^{2}(i,j) = \frac{6 S(i,j)}{5 g n_{nds} n_{dit}} (\frac{n_{nds}^{2} + 1}{n_{nds} + 1}) + \frac{12 RON^{2}(i,j)}{g^{2} n_{nds} n_{dit}} (\frac{n_{nds}-1}{n_{nds}+1})\f]
+ where: \f$\sigma^{2}(i,j)\f$ is the total variance in (ADU\f$^{2}\f$),
+ \f$S(i,j)\f$ is the signal in ADU of electrons in the pixel potencial
+ well, so to the measured ADU we must first remove the bias,
+ \f$g\f$ is the gain of the detector (in electrons/ADU),
+ \f$n_{nds}\f$ is the number of non-denstructive reads (<i>ndsamples</i>),
+ \f$n_{ndit}\f$ is the number of total integrations (<i>ndit</i>)
+ and \f$RON(i,j)\f$ is the readout noise of a single readout of the
+ detector (in ADU).
+ Note that the dimensional inconsistency of the previous
+ expression is only apparent.
+ The expression used, however is only approximate, and is valid for
+ RON << S(i,j). For low signal levels there may be significant
+ deviations
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * hawki_image_create_variance
+(const cpl_image * image,
+ double gain,
+ double ron,
+ int ndit,
+ int ndsamples)
+{
+ cpl_image * variance;
+ float * variance_p;
+ const float * image_p;
+ int pix;
+ int npix;
+ double poisson_contrib;
+ double poisson_factor;
+ double ron_contrib;
+
+
+ /* Test entries */
+ if (image == NULL) return NULL;
+
+ /* Create new image */
+ variance = cpl_image_duplicate(image);
+
+ /* Loop on pixels */
+ variance_p = cpl_image_get_data(variance);
+ image_p = cpl_image_get_data_const(image);
+ npix = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+ /* TODO: There is a Delta_t factor that appears in the Vacca article
+ * that is not reflexed here! */
+ ron_contrib = 12 * ron * ron / (gain * gain * ndsamples * ndit) *
+ (ndsamples - 1) / (ndsamples + 1);
+ poisson_factor = 6. / (5. * gain * ndsamples * ndit) *
+ (ndsamples * ndsamples + 1) / (ndsamples + 1);
+ for(pix = 0; pix < npix; ++pix)
+ {
+ /* TODO: Include the effect of saturation in the TLI mode used by HAWK-I */
+ poisson_contrib = poisson_factor * fabs(image_p[pix]);
+ variance_p[pix] = poisson_contrib + ron_contrib;
+ }
+
+ /* Return */
+ return variance;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create the associated variance of raw imagelist
+ @param imagelist_raw the raw imagelist
+ @param gain the gain of the detector (e-/ADU)
+ @param ron the ron for one read of the detector (ADU)
+ @param ndit the number of total integrations.
+ @param ndsamples the number of non-destructive readouts.
+ @return The variance imagelist if suceed. NULL elsewhere.
+
+ The original imagelist_raw is empty after the process. This is so in order
+ not to duplicate the amount of memory needed. However it will still have to
+ be deleted with cpl_imagelist_delete. Also the returned pointer have
+ to be deleted with cpl_imagelist_delete, of course.
+
+ The variance is computed with the following
+ equation:
+ \f[ \sigma^{2}(i,j) = \frac{6 S(i,j)}{5 g n_{nds} n_{dit}} (\frac{n_{nds}^{2} + 1}{n_{nds} + 1}) + \frac{12 RON^{2}(i,j)}{g^{2} n_{nds} n_{dit}} (\frac{n_{nds}-1}{n_{nds}+1})\f]
+ where: \f$\sigma^{2}(i,j)\f$ is the total variance in (ADU\f$^{2}\f$),
+ \f$S(i,j)\f$ is the signal in ADU of electrons in the pixel potencial
+ well, so to the measured ADU we must first remove the bias,
+ \f$g\f$ is the gain of the detector (in electrons/ADU),
+ \f$n_{nds}\f$ is the number of non-denstructive reads (<i>ndsamples</i>),
+ \f$n_{ndit}\f$ is the number of total integrations (<i>ndit</i>)
+ and \f$RON(i,j)\f$ is the readout noise of a single readout of the
+ detector (in ADU).
+ Note that the dimensional inconsistency of the previous
+ expression is only apparent.
+ The expression used, however is only approximate, and is valid for
+ RON << S(i,j). For low signal levels there may be significant
+ deviations.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * hawki_imglist_create_variances_and_delete
+(cpl_imagelist * imagelist_raw,
+ double gain,
+ double ron,
+ int ndit,
+ int ndsamples)
+{
+ cpl_imagelist * variances;
+
+ variances = cpl_imagelist_new();
+ /* Loop on the frames */
+ while(cpl_imagelist_get_size(imagelist_raw) > 0)
+ {
+ cpl_image * variance;
+
+ variance = hawki_image_create_variance
+ (cpl_imagelist_get(imagelist_raw, 0), gain, ron, ndit, ndsamples);
+ cpl_imagelist_set(variances, variance,
+ cpl_imagelist_get_size(variances));
+ cpl_image_delete(cpl_imagelist_unset(imagelist_raw, 0));
+ }
+ return variances;
+}
+
+
+/**@}*/
diff --git a/hawki/hawki_variance.h b/hawki/hawki_variance.h
new file mode 100644
index 0000000..fd3ae54
--- /dev/null
+++ b/hawki/hawki_variance.h
@@ -0,0 +1,55 @@
+/* $Id: hawki_variance.h,v 1.2 2009/03/13 11:52:14 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2009/03/13 11:52:14 $
+ * $Revision: 1.2 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef HAWKI_VARIANCE_H
+#define HAWKI_VARIANCE_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_image * hawki_image_create_variance
+(const cpl_image * image,
+ double gain,
+ double ron,
+ int ndit,
+ int ndsamples);
+
+cpl_imagelist * hawki_imglist_create_variances_and_delete
+(cpl_imagelist * imagelist_raw,
+ double gain,
+ double ron,
+ int ndit,
+ int ndsamples);
+
+#endif
diff --git a/html/annotated.html b/html/annotated.html
new file mode 100644
index 0000000..5aa7165
--- /dev/null
+++ b/html/annotated.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Data Structures</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Data Structures</div> </div>
+</div>
+<div class="contents">
+<div class="textblock">Here are the data structures with brief descriptions:</div><table>
+ <tr><td class="indexkey"><a class="el" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a></td><td class="indexvalue"></td></tr>
+</table>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/bc_s.png b/html/bc_s.png
new file mode 100644
index 0000000..e401862
Binary files /dev/null and b/html/bc_s.png differ
diff --git a/html/classes.html b/html/classes.html
new file mode 100644
index 0000000..1c2f152
--- /dev/null
+++ b/html/classes.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Data Structure Index</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="classes.html"><span>Data Structure Index</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Data Structure Index</div> </div>
+</div>
+<div class="contents">
+<div class="qindex"><a class="qindex" href="#letter__">_</a></div>
+<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
+<tr><td><a name="letter__"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah"> _ </div></td></tr></table>
+</td><td><a class="el" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a> </td></tr></table><div class="qindex"><a class="qindex" href="#letter__">_</a></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/closed.png b/html/closed.png
new file mode 100644
index 0000000..b7d4bd9
Binary files /dev/null and b/html/closed.png differ
diff --git a/html/dir_61a4ab009ead72bcdcfcf8e0d997aa51.html b/html/dir_61a4ab009ead72bcdcfcf8e0d997aa51.html
new file mode 100644
index 0000000..81de5d4
--- /dev/null
+++ b/html/dir_61a4ab009ead72bcdcfcf8e0d997aa51.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: /home/cgarcia/SDD/tmp/1.8.9/hawkip/hawki/ Directory Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki Directory Reference</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="files"></a>
+Files</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_alloc.c</b> <a href="hawki__alloc_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_alloc.h</b> <a href="hawki__alloc_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_bkg.c</b> <a href="hawki__bkg_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_bkg.h</b> <a href="hawki__bkg_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_calib.c</b> <a href="hawki__calib_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_calib.h</b> <a href="hawki__calib_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_combine.c</b> <a href="hawki__combine_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_combine.h</b> <a href="hawki__combine_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_dfs.c</b> <a href="hawki__dfs_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_dfs.h</b> <a href="hawki__dfs_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_distortion.c</b> <a href="hawki__distortion_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_distortion.h</b> <a href="hawki__distortion_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_image_stats.c</b> <a href="hawki__image__stats_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_image_stats.h</b> <a href="hawki__image__stats_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_load.c</b> <a href="hawki__load_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_load.h</b> <a href="hawki__load_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_mask.c</b> <a href="hawki__mask_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_mask.h</b> <a href="hawki__mask_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_match_cats.c</b> <a href="hawki__match__cats_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_match_cats.h</b> <a href="hawki__match__cats_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_obj_det.c</b> <a href="hawki__obj__det_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_obj_det.h</b> <a href="hawki__obj__det_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_pfits.c</b> <a href="hawki__pfits_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_pfits.h</b> <a href="hawki__pfits_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_properties_tel.c</b> <a href="hawki__properties__tel_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_properties_tel.h</b> <a href="hawki__properties__tel_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_saa.c</b> <a href="hawki__saa_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_saa.h</b> <a href="hawki__saa_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_save.c</b> <a href="hawki__save_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_save.h</b> <a href="hawki__save_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_utils.c</b> <a href="hawki__utils_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_utils.h</b> <a href="hawki__utils_8h_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_variance.c</b> <a href="hawki__variance_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_variance.h</b> <a href="hawki__variance_8h_source.html">[code]</a></td></tr>
+</table>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/dir_dd1f22bf73a30aa083e3126f80060e44.html b/html/dir_dd1f22bf73a30aa083e3126f80060e44.html
new file mode 100644
index 0000000..956c374
--- /dev/null
+++ b/html/dir_dd1f22bf73a30aa083e3126f80060e44.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: /home/cgarcia/SDD/tmp/1.8.9/hawkip/recipes/ Directory Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">recipes Directory Reference</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="files"></a>
+Files</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_cal_dark.c</b> <a href="hawki__cal__dark_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_cal_distortion.c</b> <a href="hawki__cal__distortion_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_cal_flat.c</b> <a href="hawki__cal__flat_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_cal_illum.c</b> <a href="hawki__cal__illum_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_cal_lingain.c</b> <a href="hawki__cal__lingain_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_cal_zpoint.c</b> <a href="hawki__cal__zpoint_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_sci_jitter.c</b> <a href="hawki__sci__jitter_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_apply_dist.c</b> <a href="hawki__step__apply__dist_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_basic_calib.c</b> <a href="hawki__step__basic__calib_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_combine.c</b> <a href="hawki__step__combine_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_compute_bkg.c</b> <a href="hawki__step__compute__bkg_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_detect_obj.c</b> <a href="hawki__step__detect__obj_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_photom_2mass.c</b> <a href="hawki__step__photom__2mass_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_refine_offsets.c</b> <a href="hawki__step__refine__offsets_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_stats.c</b> <a href="hawki__step__stats_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_stitch.c</b> <a href="hawki__step__stitch_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_step_subtract_bkg.c</b> <a href="hawki__step__subtract__bkg_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_tec_filtchk.c</b> <a href="hawki__tec__filtchk_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_util_extinction.c</b> <a href="hawki__util__extinction_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_util_gendist.c</b> <a href="hawki__util__gendist_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>hawki_util_stdstars.c</b> <a href="hawki__util__stdstars_8c_source.html">[code]</a></td></tr>
+</table>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/dirs.html b/html/dirs.html
new file mode 100644
index 0000000..11a2466
--- /dev/null
+++ b/html/dirs.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Directories</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li class="current"><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Directories</div> </div>
+</div>
+<div class="contents">
+<div class="textblock">This directory hierarchy is sorted roughly, but not completely, alphabetically:</div><ul>
+<li><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a></li>
+<li><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a></li>
+</ul>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/doxygen.css b/html/doxygen.css
new file mode 100644
index 0000000..74445fe
--- /dev/null
+++ b/html/doxygen.css
@@ -0,0 +1,835 @@
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 12px;
+}
+
+/* @group Heading Levels */
+
+h1 {
+ font-size: 150%;
+}
+
+.title {
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+}
+
+h2 {
+ font-size: 120%;
+}
+
+h3 {
+ font-size: 100%;
+}
+
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
+}
+
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+ font-weight: bold;
+}
+
+span.legend {
+ font-size: 70%;
+ text-align: center;
+}
+
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+}
+
+div.qindex, div.navpath {
+ width: 100%;
+ line-height: 140%;
+}
+
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.contents a:visited {
+ color: #4665A2;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
+ color: #ffffff;
+ border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code {
+ color: #4665A2;
+}
+
+a.codeRef {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
+
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+}
+
+div.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
+}
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
+
+body {
+ background: white;
+ color: black;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 10px;
+ margin-right: 5px;
+}
+
+td.indexkey {
+ background-color: #EBEFF6;
+ font-weight: bold;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
+}
+
+td.indexvalue {
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
+}
+
+tr.memlist {
+ background-color: #EEF1F7;
+}
+
+p.formulaDsp {
+ text-align: center;
+}
+
+img.formulaDsp {
+
+}
+
+img.formulaInl {
+ vertical-align: middle;
+}
+
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+
+div.center img {
+ border: 0px;
+}
+
+address.footer {
+ text-align: right;
+ padding-right: 12px;
+}
+
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+ background: #EBEFF6;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memItemLeft, .memItemRight, .memTemplParams {
+ border-top: 1px solid #C4CFE5;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memItemRight {
+ width: 100%;
+}
+
+.memTemplParams {
+ color: #4665A2;
+ white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtemplate {
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 9px;
+}
+
+.memnav {
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+
+.mempage {
+ width: 100%;
+}
+
+.memitem {
+ padding: 0;
+ margin-bottom: 10px;
+ margin-right: 5px;
+}
+
+.memname {
+ white-space: nowrap;
+ font-weight: bold;
+ margin-left: 6px;
+}
+
+.memproto {
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 8px;
+ border-top-left-radius: 8px;
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 8px;
+ -moz-border-radius-topleft: 8px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 8px;
+ -webkit-border-top-left-radius: 8px;
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
+
+}
+
+.memdoc {
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 2px 5px;
+ background-color: #FBFCFD;
+ border-top-width: 0;
+ /* opera specific markup */
+ border-bottom-left-radius: 8px;
+ border-bottom-right-radius: 8px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 8px;
+ -moz-border-radius-bottomright: 8px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 8px;
+ -webkit-border-bottom-right-radius: 8px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
+}
+
+.paramkey {
+ text-align: right;
+}
+
+.paramtype {
+ white-space: nowrap;
+}
+
+.paramname {
+ color: #602020;
+ white-space: nowrap;
+}
+.paramname em {
+ font-style: normal;
+}
+
+.params, .retval, .exception, .tparams {
+ border-spacing: 6px 2px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+
+
+
+/* @end */
+
+/* @group Directory (tree) */
+
+/* for the tree view */
+
+.ftvtree {
+ font-family: sans-serif;
+ margin: 0px;
+}
+
+/* these are for tree view when used as main index */
+
+.directory {
+ font-size: 9pt;
+ font-weight: bold;
+ margin: 5px;
+}
+
+.directory h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+/*
+The following two styles can be used to replace the root node title
+with an image of your choice. Simply uncomment the next two styles,
+specify the name of your image and be sure to set 'height' to the
+proper pixel height of your image.
+*/
+
+/*
+.directory h3.swap {
+ height: 61px;
+ background-repeat: no-repeat;
+ background-image: url("yourimage.gif");
+}
+.directory h3.swap span {
+ display: none;
+}
+*/
+
+.directory > h3 {
+ margin-top: 0;
+}
+
+.directory p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory div {
+ display: none;
+ margin: 0px;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+/* these are for tree view when not used as main index */
+
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
+}
+
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+.directory-alt > h3 {
+ margin-top: 0;
+}
+
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+.directory-alt img {
+ vertical-align: -30%;
+}
+
+/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+}
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath li.navelem a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath li.navelem a:hover
+{
+ color:#6884BD;
+}
+
+.navpath li.footer
+{
+ list-style-type:none;
+ float:right;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:none;
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+ font-size: 8pt;
+}
+
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+div.ingroups
+{
+ font-size: 8pt;
+ padding-left: 5px;
+ width: 50%;
+ text-align: left;
+}
+
+div.ingroups a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+dl
+{
+ padding: 0 0 0 10px;
+}
+
+dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug
+{
+ border-left:4px solid;
+ padding: 0 0 0 6px;
+}
+
+dl.note
+{
+ border-color: #D0C000;
+}
+
+dl.warning, dl.attention
+{
+ border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+ border-color: #00D000;
+}
+
+dl.deprecated
+{
+ border-color: #505050;
+}
+
+dl.todo
+{
+ border-color: #00C0E0;
+}
+
+dl.test
+{
+ border-color: #3030E0;
+}
+
+dl.bug
+{
+ border-color: #C08050;
+}
+
+#projectlogo
+{
+ text-align: center;
+ vertical-align: bottom;
+ border-collapse: separate;
+}
+
+#projectlogo img
+{
+ border: 0px none;
+}
+
+#projectname
+{
+ font: 300% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 2px 0px;
+}
+
+#projectbrief
+{
+ font: 120% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectnumber
+{
+ font: 50% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#titlearea
+{
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ border-bottom: 1px solid #5373B4;
+}
+
+.image
+{
+ text-align: center;
+}
+
+.dotgraph
+{
+ text-align: center;
+}
+
+.mscgraph
+{
+ text-align: center;
+}
+
+.caption
+{
+ font-weight: bold;
+}
+
diff --git a/html/doxygen.png b/html/doxygen.png
new file mode 100644
index 0000000..635ed52
Binary files /dev/null and b/html/doxygen.png differ
diff --git a/html/files.html b/html/files.html
new file mode 100644
index 0000000..38bb700
--- /dev/null
+++ b/html/files.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: File List</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li class="current"><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">File List</div> </div>
+</div>
+<div class="contents">
+<div class="textblock">Here is a list of all documented files with brief descriptions:</div><table>
+ <tr><td class="indexkey"><b>hawki_alloc.c</b> <a href="hawki__alloc_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_alloc.h</b> <a href="hawki__alloc_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_bkg.c</b> <a href="hawki__bkg_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_bkg.h</b> <a href="hawki__bkg_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_cal_dark.c</b> <a href="hawki__cal__dark_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_cal_distortion.c</b> <a href="hawki__cal__distortion_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_cal_flat.c</b> <a href="hawki__cal__flat_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_cal_illum.c</b> <a href="hawki__cal__illum_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_cal_lingain.c</b> <a href="hawki__cal__lingain_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_cal_zpoint.c</b> <a href="hawki__cal__zpoint_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_calib.c</b> <a href="hawki__calib_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_calib.h</b> <a href="hawki__calib_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_combine.c</b> <a href="hawki__combine_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_combine.h</b> <a href="hawki__combine_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_dfs.c</b> <a href="hawki__dfs_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_dfs.h</b> <a href="hawki__dfs_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_distortion.c</b> <a href="hawki__distortion_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_distortion.h</b> <a href="hawki__distortion_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_image_stats.c</b> <a href="hawki__image__stats_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_image_stats.h</b> <a href="hawki__image__stats_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_load.c</b> <a href="hawki__load_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_load.h</b> <a href="hawki__load_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_mask.c</b> <a href="hawki__mask_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_mask.h</b> <a href="hawki__mask_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_match_cats.c</b> <a href="hawki__match__cats_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_match_cats.h</b> <a href="hawki__match__cats_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_obj_det.c</b> <a href="hawki__obj__det_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_obj_det.h</b> <a href="hawki__obj__det_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_pfits.c</b> <a href="hawki__pfits_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_pfits.h</b> <a href="hawki__pfits_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_properties_tel.c</b> <a href="hawki__properties__tel_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_properties_tel.h</b> <a href="hawki__properties__tel_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_saa.c</b> <a href="hawki__saa_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_saa.h</b> <a href="hawki__saa_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_save.c</b> <a href="hawki__save_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_save.h</b> <a href="hawki__save_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_sci_jitter.c</b> <a href="hawki__sci__jitter_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_apply_dist.c</b> <a href="hawki__step__apply__dist_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_basic_calib.c</b> <a href="hawki__step__basic__calib_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_combine.c</b> <a href="hawki__step__combine_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_compute_bkg.c</b> <a href="hawki__step__compute__bkg_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_detect_obj.c</b> <a href="hawki__step__detect__obj_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_photom_2mass.c</b> <a href="hawki__step__photom__2mass_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_refine_offsets.c</b> <a href="hawki__step__refine__offsets_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_stats.c</b> <a href="hawki__step__stats_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_stitch.c</b> <a href="hawki__step__stitch_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_step_subtract_bkg.c</b> <a href="hawki__step__subtract__bkg_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_tec_filtchk.c</b> <a href="hawki__tec__filtchk_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_util_extinction.c</b> <a href="hawki__util__extinction_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_util_gendist.c</b> <a href="hawki__util__gendist_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_util_stdstars.c</b> <a href="hawki__util__stdstars_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_utils.c</b> <a href="hawki__utils_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_utils.h</b> <a href="hawki__utils_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_variance.c</b> <a href="hawki__variance_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>hawki_variance.h</b> <a href="hawki__variance_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+</table>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/form_0.png b/html/form_0.png
new file mode 100644
index 0000000..28e622a
Binary files /dev/null and b/html/form_0.png differ
diff --git a/html/form_1.png b/html/form_1.png
new file mode 100644
index 0000000..cbb3673
Binary files /dev/null and b/html/form_1.png differ
diff --git a/html/form_2.png b/html/form_2.png
new file mode 100644
index 0000000..07fffae
Binary files /dev/null and b/html/form_2.png differ
diff --git a/html/form_3.png b/html/form_3.png
new file mode 100644
index 0000000..fdc4c01
Binary files /dev/null and b/html/form_3.png differ
diff --git a/html/form_4.png b/html/form_4.png
new file mode 100644
index 0000000..b609c5c
Binary files /dev/null and b/html/form_4.png differ
diff --git a/html/form_5.png b/html/form_5.png
new file mode 100644
index 0000000..c8f0517
Binary files /dev/null and b/html/form_5.png differ
diff --git a/html/form_6.png b/html/form_6.png
new file mode 100644
index 0000000..29e3343
Binary files /dev/null and b/html/form_6.png differ
diff --git a/html/form_7.png b/html/form_7.png
new file mode 100644
index 0000000..2edd18b
Binary files /dev/null and b/html/form_7.png differ
diff --git a/html/form_8.png b/html/form_8.png
new file mode 100644
index 0000000..c6e01ed
Binary files /dev/null and b/html/form_8.png differ
diff --git a/html/formula.repository b/html/formula.repository
new file mode 100644
index 0000000..728f2b4
--- /dev/null
+++ b/html/formula.repository
@@ -0,0 +1,9 @@
+\form#0:\[ bc = \frac{(raw-dark)}{flat}\]
+\form#1:\[ \sigma^{2}(i,j) = \frac{6 S(i,j)}{5 g n_{nds} n_{dit}} (\frac{n_{nds}^{2} + 1}{n_{nds} + 1}) + \frac{12 RON^{2}(i,j)}{g^{2} n_{nds} n_{dit}} (\frac{n_{nds}-1}{n_{nds}+1})\]
+\form#2:$\sigma^{2}(i,j)$
+\form#3:$^{2}$
+\form#4:$S(i,j)$
+\form#5:$g$
+\form#6:$n_{nds}$
+\form#7:$n_{ndit}$
+\form#8:$RON(i,j)$
diff --git a/html/group__hawki__alloc.html b/html/group__hawki__alloc.html
new file mode 100644
index 0000000..325e7bd
--- /dev/null
+++ b/html/group__hawki__alloc.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Allocation rutines</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Allocation rutines</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd">hawki_table_delete</a> (cpl_table **table)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Deallocates a set of four tables. <a href="#ga2c7746115db289a6cea907e2025d93bd"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_table ** </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__alloc.html#gad7e4f1acdafde6f40fac069f727c9080">hawki_table_new</a> (int nrow)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Allocates a set of four tables. <a href="#gad7e4f1acdafde6f40fac069f727c9080"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga2c7746115db289a6cea907e2025d93bd"></a><!-- doxytag: member="hawki_alloc.c::hawki_table_delete" ref="ga2c7746115db289a6cea907e2025d93bd" args="(cpl_table **table)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_table_delete </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table ** </td>
+ <td class="paramname"><em>table</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Deallocates a set of four tables. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">tables</td><td>The tables to deallocate </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__alloc_8c_source.html#l00054">54</a> of file <a class="el" href="hawki__alloc_8c_source.html">hawki_alloc.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gad7e4f1acdafde6f40fac069f727c9080"></a><!-- doxytag: member="hawki_alloc.c::hawki_table_new" ref="gad7e4f1acdafde6f40fac069f727c9080" args="(int nrow)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_table** hawki_table_new </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>nrow</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Allocates a set of four tables. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">nrow</td><td>The number of rows of each table </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The allocated tables </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__alloc_8c_source.html#l00072">72</a> of file <a class="el" href="hawki__alloc_8c_source.html">hawki_alloc.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__calib.html b/html/group__hawki__calib.html
new file mode 100644
index 0000000..ac7f529
--- /dev/null
+++ b/html/group__hawki__calib.html
@@ -0,0 +1,404 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Basic calibration Utilities</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Basic calibration Utilities</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#ga648180245b7cace291a654d5b31e5f75">hawki_bkg_imglist_calib</a> (cpl_imagelist *ilist, cpl_imagelist *bkg)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the background subtraction to the images. <a href="#ga648180245b7cace291a654d5b31e5f75"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#gacab5ec7e7db02bd1f46661c443a6c16b">hawki_bpm_calib</a> (cpl_image *ima, const char *bpm, int idet)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the BPM correction to an image. <a href="#gacab5ec7e7db02bd1f46661c443a6c16b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#ga07a2392c998d129862af73b06e1d0571">hawki_flat_bpm_detector_calib</a> (cpl_imagelist *ilist, cpl_image *flat, cpl_image *bpm)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the calibration to the images. <a href="#ga07a2392c998d129862af73b06e1d0571"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#gabf25546801362d0be3ac42779e8fb29c">hawki_flat_bpm_imglist_calib</a> (cpl_imagelist *ilist, cpl_imagelist *flat, cpl_imagelist *bpm)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the calibration to the images. <a href="#gabf25546801362d0be3ac42779e8fb29c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d">hawki_flat_dark_bpm_detector_calib</a> (cpl_imagelist *ilist, cpl_image *flat, cpl_image *dark, cpl_image *bpm)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the calibration to the images. <a href="#ga5602d5f6a5703dff30afa41235c9686d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#gaa722d4147127c2af3088266c63d79489">hawki_flat_dark_bpm_imglist_calib</a> (cpl_imagelist *ilist, cpl_imagelist *flat, cpl_imagelist *dark, cpl_imagelist *bpm)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the calibration to the images. <a href="#gaa722d4147127c2af3088266c63d79489"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__calib.html#ga5013786f602800e5899b011b21f9547f">hawki_trim_detector_calib</a> (cpl_imagelist *imalist, int nborder)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Trim a list of hawki images (usually from one detector) <a href="#ga5013786f602800e5899b011b21f9547f"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga648180245b7cace291a654d5b31e5f75"></a><!-- doxytag: member="hawki_calib.c::hawki_bkg_imglist_calib" ref="ga648180245b7cace291a654d5b31e5f75" args="(cpl_imagelist *ilist, cpl_imagelist *bkg)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_bkg_imglist_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>bkg</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the background subtraction to the images. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list </td></tr>
+ <tr><td class="paramname">bkg</td><td>the background images </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00226">226</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gacab5ec7e7db02bd1f46661c443a6c16b"></a><!-- doxytag: member="hawki_calib.c::hawki_bpm_calib" ref="gacab5ec7e7db02bd1f46661c443a6c16b" args="(cpl_image *ima, const char *bpm, int idet)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_bpm_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>ima</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>bpm</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>idet</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the BPM correction to an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ima</td><td>the image to correct </td></tr>
+ <tr><td class="paramname">idet</td><td>the detector the image comes from </td></tr>
+ <tr><td class="paramname">bpm</td><td>the bad pixels map </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00450">450</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga07a2392c998d129862af73b06e1d0571"></a><!-- doxytag: member="hawki_calib.c::hawki_flat_bpm_detector_calib" ref="ga07a2392c998d129862af73b06e1d0571" args="(cpl_imagelist *ilist, cpl_image *flat, cpl_image *bpm)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_flat_bpm_detector_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>flat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>bpm</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the calibration to the images. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list </td></tr>
+ <tr><td class="paramname">flat</td><td>the flat field </td></tr>
+ <tr><td class="paramname">bpm</td><td>the bad pixels map </td></tr>
+ <tr><td class="paramname">idet</td><td>the detector id </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input a list of images which in principle should belong to the same HAWK-I detector. It also takes as an input an image for the flat, the dark and bpm for that detector. It is the responsability of the caller to ensure that the detector of all these inputs is the same. For dark and flat corrections the formula is as follows: </p>
+<p class="formulaDsp">
+<img class="formulaDsp" alt="\[ bc = \frac{(raw-dark)}{flat}\]" src="form_0.png"/>
+</p>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00354">354</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gabf25546801362d0be3ac42779e8fb29c"></a><!-- doxytag: member="hawki_calib.c::hawki_flat_bpm_imglist_calib" ref="gabf25546801362d0be3ac42779e8fb29c" args="(cpl_imagelist *ilist, cpl_imagelist *flat, cpl_imagelist *bpm)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_flat_bpm_imglist_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>flat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>bpm</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the calibration to the images. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list </td></tr>
+ <tr><td class="paramname">flat</td><td>the flat field </td></tr>
+ <tr><td class="paramname">bpm</td><td>the bad pixels map </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input an image list that contains four images, one for each HAWK-I detector and the same for the flat and bpm. It applies the 2 corrections (if images are not null) to each detector. </p>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00161">161</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5602d5f6a5703dff30afa41235c9686d"></a><!-- doxytag: member="hawki_calib.c::hawki_flat_dark_bpm_detector_calib" ref="ga5602d5f6a5703dff30afa41235c9686d" args="(cpl_imagelist *ilist, cpl_image *flat, cpl_image *dark, cpl_image *bpm)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_flat_dark_bpm_detector_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>flat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>dark</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>bpm</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the calibration to the images. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list </td></tr>
+ <tr><td class="paramname">flat</td><td>the flat field </td></tr>
+ <tr><td class="paramname">dark</td><td>the dark (scaled to exp time of the science images) </td></tr>
+ <tr><td class="paramname">bpm</td><td>the bad pixels map </td></tr>
+ <tr><td class="paramname">idet</td><td>the detector id. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input a list of images which in principle should belong to the same HAWK-I detector. It also takes as an input an image for the flat, the dark and bpm for that detector. It is the responsibility of the caller to ensure that the detector of all these inputs is the same. Take into account that the dark is just subtracted, no scaling is done. For dark and flat corrections the formula is as follows: </p>
+<p class="formulaDsp">
+<img class="formulaDsp" alt="\[ bc = \frac{(raw-dark)}{flat}\]" src="form_0.png"/>
+</p>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00276">276</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaa722d4147127c2af3088266c63d79489"></a><!-- doxytag: member="hawki_calib.c::hawki_flat_dark_bpm_imglist_calib" ref="gaa722d4147127c2af3088266c63d79489" args="(cpl_imagelist *ilist, cpl_imagelist *flat, cpl_imagelist *dark, cpl_imagelist *bpm)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_flat_dark_bpm_imglist_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>flat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>dark</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>bpm</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the calibration to the images. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list </td></tr>
+ <tr><td class="paramname">flat</td><td>the flat field </td></tr>
+ <tr><td class="paramname">dark</td><td>the dark (scaled to exp time of the science images) </td></tr>
+ <tr><td class="paramname">bpm</td><td>the bad pixels map </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input an image list that contains four images, one for each HAWK-I detector and the same for the flat, dark and bpm. It applies the 3 corrections (if images are not null) to each detector. Take into account that the dark is just subtracted, no scaling is done. For dark and flat corrections the formula is as follows: </p>
+<p class="formulaDsp">
+<img class="formulaDsp" alt="\[ bc = \frac{(raw-dark)}{flat}\]" src="form_0.png"/>
+</p>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00073">73</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5013786f602800e5899b011b21f9547f"></a><!-- doxytag: member="hawki_calib.c::hawki_trim_detector_calib" ref="ga5013786f602800e5899b011b21f9547f" args="(cpl_imagelist *imalist, int nborder)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_trim_detector_calib </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>imalist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>nborder</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Trim a list of hawki images (usually from one detector) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>The image list </td></tr>
+ <tr><td class="paramname">nborder</td><td>The number of pixels to trim in each border </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The trimmed images. NULL otherwise</dd></dl>
+<p>Not that the original ilist is emptied, but the user is still responsible to deallocate it with cpl_imagelist_delete() </p>
+
+<p>Definition at line <a class="el" href="hawki__calib_8c_source.html#l00413">413</a> of file <a class="el" href="hawki__calib_8c_source.html">hawki_calib.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__combine.html b/html/group__hawki__combine.html
new file mode 100644
index 0000000..59c182a
--- /dev/null
+++ b/html/group__hawki__combine.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Images combination routines</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Images combination routines</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+</table>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__dfs.html b/html/group__hawki__dfs.html
new file mode 100644
index 0000000..f5834e7
--- /dev/null
+++ b/html/group__hawki__dfs.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: DFS related functions</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">DFS related functions</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b">hawki_dfs_set_groups</a> (cpl_frameset *set)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the group as RAW or CALIB in a frameset. <a href="#ga6d79b77b5f9d13aa0ceeb461410bb03b"></a><br/></td></tr>
+</table>
+<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<p>TBD </p>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga6d79b77b5f9d13aa0ceeb461410bb03b"></a><!-- doxytag: member="hawki_dfs.c::hawki_dfs_set_groups" ref="ga6d79b77b5f9d13aa0ceeb461410bb03b" args="(cpl_frameset *set)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_dfs_set_groups </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>set</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Set the group as RAW or CALIB in a frameset. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">set</td><td>the input frameset </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__dfs_8c_source.html#l00060">60</a> of file <a class="el" href="hawki__dfs_8c_source.html">hawki_dfs.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__distortion.html b/html/group__hawki__distortion.html
new file mode 100644
index 0000000..ca3a3de
--- /dev/null
+++ b/html/group__hawki__distortion.html
@@ -0,0 +1,709 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Distortion correction</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#nested-classes">Data Structures</a> |
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Distortion correction</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="nested-classes"></a>
+Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a></td></tr>
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga4ad09d8cbb7f3ed8fddeb451f3b2056f">hawki_distortion_apply_maps</a> (cpl_imagelist *ilist, cpl_image **dist_x, cpl_image **dist_y)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the distortion correction. <a href="#ga4ad09d8cbb7f3ed8fddeb451f3b2056f"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea">hawki_distortion_compute_rms</a> (const cpl_table **ref_catalogues, const cpl_bivector *cat_offsets, const cpl_table *matching_sets, int ncats, hawki_distortion *distortion)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This private function computes the rms, which is the objective function of the minimization algorithm. <a href="#ga8a38c008060d64d9e62198505617e5ea"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga52da9acfab98a1592e65df9c6bfba484">hawki_distortion_correct_alldetectors</a> (cpl_image **ilist, const cpl_frame *frame_dist_x, const cpl_frame *frame_dist_y)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the distortion correction. <a href="#ga52da9acfab98a1592e65df9c6bfba484"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e">hawki_distortion_correct_coords</a> (const hawki_distortion *distortion, double x_pos, double y_pos, double *x_pos_distcorr, double *y_pos_distcorr)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the distortion correction to one detector position. <a href="#ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c">hawki_distortion_correct_detector</a> (cpl_image *image, cpl_image *dist_x, cpl_image *dist_y)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the distortion correction to one chip. <a href="#ga872e536210e467ff47f70959f5390b7c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712">hawki_distortion_delete</a> (hawki_distortion *distortion)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Deallocates a hawki_distortion structure. <a href="#ga12a902f30ad5f4a6012b9df508d06712"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#gaa7dc1bd3e8cd954c453ecfdf2b0fe968">hawki_distortion_get_flag_vars</a> (double *x_val, double *y_val, int *pos_flag, int nvals, int *nvalid, double *var_x, double *var_y)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the standard deviation of two vectors, not using flagged values. <a href="#gaa7dc1bd3e8cd954c453ecfdf2b0fe968"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#gaaeaf96920122f1d4f64c164289588345">hawki_distortion_get_size_x</a> (const hawki_distortion *distortion)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Gives the dimension in X of the distortion solution. <a href="#gaaeaf96920122f1d4f64c164289588345"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga990c10037636042cfcc0b40332821e9c">hawki_distortion_get_size_y</a> (const hawki_distortion *distortion)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Gives the dimension in Y of the distortion solution. <a href="#ga990c10037636042cfcc0b40332821e9c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">hawki_distortion * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#gae37defaaf5c0bd86686df3285b89763d">hawki_distortion_grid_new</a> (int detector_nx, int detector_ny, int grid_size)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a new distortion solution. <a href="#gae37defaaf5c0bd86686df3285b89763d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d">hawki_distortion_interpolate_distortion</a> (const hawki_distortion *distortion, double x_pos, double y_pos, double *x_dist, double *y_dist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolates the distortion solution at a given position. <a href="#ga27bd7baaf0df89d1d58b69968638b14d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#ga9462a4c3d7e6d3cac66f7bef27f6cbe3">hawki_distortion_inverse_correct_coords</a> (const hawki_distortion *distortion, double x_pos, double y_pos, double *x_pos_distinvcorr, double *y_pos_distinvcorr)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the inverse distortion correction to one detector position. <a href="#ga9462a4c3d7e6d3cac66f7bef27f6cbe3"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">hawki_distortion * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7">hawki_distortion_load</a> (const cpl_frame *dist_x, const cpl_frame *dist_y, int idet)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Loads the distortion solution for one detector. <a href="#gab9c3ebd02585f319d08b5149b44528e7"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga4ad09d8cbb7f3ed8fddeb451f3b2056f"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_apply_maps" ref="ga4ad09d8cbb7f3ed8fddeb451f3b2056f" args="(cpl_imagelist *ilist, cpl_image **dist_x, cpl_image **dist_y)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_apply_maps </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image ** </td>
+ <td class="paramname"><em>dist_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image ** </td>
+ <td class="paramname"><em>dist_y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the distortion correction. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list (chips 1 2 3 4) </td></tr>
+ <tr><td class="paramname">dist</td><td>the distortion file </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00617">617</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>References <a class="el" href="hawki__distortion_8c_source.html#l00371">hawki_distortion_correct_detector()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga8a38c008060d64d9e62198505617e5ea"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_compute_rms" ref="ga8a38c008060d64d9e62198505617e5ea" args="(const cpl_table **ref_catalogues, const cpl_bivector *cat_offsets, const cpl_table *matching_sets, int ncats, hawki_distortion *distortion)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_distortion_compute_rms </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_table ** </td>
+ <td class="paramname"><em>ref_catalogues</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_bivector * </td>
+ <td class="paramname"><em>cat_offsets</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_table * </td>
+ <td class="paramname"><em>matching_sets</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ncats</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This private function computes the rms, which is the objective function of the minimization algorithm. </p>
+<dl class="see"><dt><b>See also:</b></dt><dd>hawki_distortion_compute_solution </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00930">930</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>References <a class="el" href="hawki__distortion_8c_source.html#l01198">hawki_distortion_get_flag_vars()</a>, and <a class="el" href="hawki__distortion_8c_source.html#l00526">hawki_distortion_interpolate_distortion()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga52da9acfab98a1592e65df9c6bfba484"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_correct_alldetectors" ref="ga52da9acfab98a1592e65df9c6bfba484" args="(cpl_image **ilist, const cpl_frame *frame_dist_x, const cpl_frame *frame_dist_y)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_correct_alldetectors </td>
+ <td>(</td>
+ <td class="paramtype">cpl_image ** </td>
+ <td class="paramname"><em>ilist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame_dist_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame_dist_y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the distortion correction. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ilist</td><td>the input image list (chips 1 2 3 4) </td></tr>
+ <tr><td class="paramname">dist</td><td>the distortion file </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00287">287</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>References <a class="el" href="hawki__distortion_8c_source.html#l00371">hawki_distortion_correct_detector()</a>, <a class="el" href="hawki__distortion_8c_source.html#l00163">hawki_distortion_delete()</a>, and <a class="el" href="hawki__distortion_8c_source.html#l00182">hawki_distortion_load()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_correct_coords" ref="ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e" args="(const hawki_distortion *distortion, double x_pos, double y_pos, double *x_pos_distcorr, double *y_pos_distcorr)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_correct_coords </td>
+ <td>(</td>
+ <td class="paramtype">const hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>x_pos</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>y_pos</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>x_pos_distcorr</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>y_pos_distcorr</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the distortion correction to one detector position. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">distortion</td><td>the distortion solution </td></tr>
+ <tr><td class="paramname">x_pos</td><td>the X position in detector that we want to correct. </td></tr>
+ <tr><td class="paramname">y_pos</td><td>the Y position in detector that we want to correct. </td></tr>
+ <tr><td class="paramname">x_pos_distcorr</td><td>the X position in detector corrected from distortion </td></tr>
+ <tr><td class="paramname">y_pos_distcorr</td><td>the Y position in detector corrected from distortion </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function will interpolate the distortion solution (given in variable distortion, </p>
+<dl class="see"><dt><b>See also:</b></dt><dd>hawki_distortion_new) </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00423">423</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>References <a class="el" href="hawki__distortion_8c_source.html#l00526">hawki_distortion_interpolate_distortion()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga872e536210e467ff47f70959f5390b7c"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_correct_detector" ref="ga872e536210e467ff47f70959f5390b7c" args="(cpl_image *image, cpl_image *dist_x, cpl_image *dist_y)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_distortion_correct_detector </td>
+ <td>(</td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>image</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>dist_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>dist_y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the distortion correction to one chip. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image</td><td>the input image </td></tr>
+ <tr><td class="paramname">dist</td><td>the distortion table </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00371">371</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__distortion_8c_source.html#l00617">hawki_distortion_apply_maps()</a>, and <a class="el" href="hawki__distortion_8c_source.html#l00287">hawki_distortion_correct_alldetectors()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga12a902f30ad5f4a6012b9df508d06712"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_delete" ref="ga12a902f30ad5f4a6012b9df508d06712" args="(hawki_distortion *distortion)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void hawki_distortion_delete </td>
+ <td>(</td>
+ <td class="paramtype">hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Deallocates a hawki_distortion structure. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">distortion</td><td>The distortion to allocate </td></tr>
+ </table>
+ </dd>
+</dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00163">163</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__distortion_8c_source.html#l00287">hawki_distortion_correct_alldetectors()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaa7dc1bd3e8cd954c453ecfdf2b0fe968"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_get_flag_vars" ref="gaa7dc1bd3e8cd954c453ecfdf2b0fe968" args="(double *x_val, double *y_val, int *pos_flag, int nvals, int *nvalid, double *var_x, double *var_y)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void hawki_distortion_get_flag_vars </td>
+ <td>(</td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>x_val</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>y_val</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>pos_flag</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>nvals</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>nvalid</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>var_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>var_y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the standard deviation of two vectors, not using flagged values. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The standard deviation </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l01198">1198</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__distortion_8c_source.html#l00930">hawki_distortion_compute_rms()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaaeaf96920122f1d4f64c164289588345"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_get_size_x" ref="gaaeaf96920122f1d4f64c164289588345" args="(const hawki_distortion *distortion)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_get_size_x </td>
+ <td>(</td>
+ <td class="paramtype">const hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Gives the dimension in X of the distortion solution. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">dist</td><td>the distortion solution </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The dimension in X </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00252">252</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga990c10037636042cfcc0b40332821e9c"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_get_size_y" ref="ga990c10037636042cfcc0b40332821e9c" args="(const hawki_distortion *distortion)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_get_size_y </td>
+ <td>(</td>
+ <td class="paramtype">const hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Gives the dimension in Y of the distortion solution. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">dist</td><td>the distortion solution </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The dimension in Y </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00269">269</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gae37defaaf5c0bd86686df3285b89763d"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_grid_new" ref="gae37defaaf5c0bd86686df3285b89763d" args="(int detector_nx, int detector_ny, int grid_size)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">hawki_distortion* hawki_distortion_grid_new </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>detector_nx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>detector_ny</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>grid_size</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Allocate a new distortion solution. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">detector_nx</td><td>The dimensions in X of a HAWK-I detector </td></tr>
+ <tr><td class="paramname">detector_nx</td><td>The dimensions in Y of a HAWK-I detector </td></tr>
+ <tr><td class="paramname">grid_size</td><td>The number of points in the distortion grid </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The allocated distortion if everything is ok , NULL otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00132">132</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga27bd7baaf0df89d1d58b69968638b14d"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_interpolate_distortion" ref="ga27bd7baaf0df89d1d58b69968638b14d" args="(const hawki_distortion *distortion, double x_pos, double y_pos, double *x_dist, double *y_dist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_interpolate_distortion </td>
+ <td>(</td>
+ <td class="paramtype">const hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>x_pos</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>y_pos</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>x_dist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>y_dist</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Interpolates the distortion solution at a given position. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">distortion</td><td>the distortion solution </td></tr>
+ <tr><td class="paramname">x_pos</td><td>the X position in detector that we want to correct. </td></tr>
+ <tr><td class="paramname">y_pos</td><td>the Y position in detector that we want to correct. </td></tr>
+ <tr><td class="paramname">x_dist</td><td>the distortion in X at position x_pos, y_pos </td></tr>
+ <tr><td class="paramname">y_dist</td><td>the distortion in Y at position x_pos, y_pos </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This private function uses the four reference points found in distortion closer to x_pos, y_pos. Then it weights each point with the 3rd power of the distance to the target pixel and uses a linear interpolation.</p>
+<p>If this function is used in a multithread environment with a CPL version not thread-safe, there is no risk as long as these two premises are hold: -The caller must check if distortion->dist_x and distortion->dist_y are not null before calling this function, because this is check by cpl_image_get_size_x and cpl_image_get. -The caller must check in advance that the mask has all the points valid, because cpl_image_get checks for the validity of the pixel in the mask, if it is not v [...]
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00526">526</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__distortion_8c_source.html#l00930">hawki_distortion_compute_rms()</a>, <a class="el" href="hawki__distortion_8c_source.html#l00423">hawki_distortion_correct_coords()</a>, and <a class="el" href="hawki__distortion_8c_source.html#l00467">hawki_distortion_inverse_correct_coords()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga9462a4c3d7e6d3cac66f7bef27f6cbe3"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_inverse_correct_coords" ref="ga9462a4c3d7e6d3cac66f7bef27f6cbe3" args="(const hawki_distortion *distortion, double x_pos, double y_pos, double *x_pos_distinvcorr, double *y_pos_distinvcorr)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_inverse_correct_coords </td>
+ <td>(</td>
+ <td class="paramtype">const hawki_distortion * </td>
+ <td class="paramname"><em>distortion</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>x_pos</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>y_pos</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>x_pos_distinvcorr</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>y_pos_distinvcorr</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the inverse distortion correction to one detector position. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">distortion</td><td>the distortion solution </td></tr>
+ <tr><td class="paramname">x_pos</td><td>the X position in detector that we want to decorrect. </td></tr>
+ <tr><td class="paramname">y_pos</td><td>the Y position in detector that we want to decorrect. </td></tr>
+ <tr><td class="paramname">x_pos_distcorr</td><td>the X position in detector decorrected from distortion </td></tr>
+ <tr><td class="paramname">y_pos_distcorr</td><td>the Y position in detector decorrected from distortion </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function is the inverse function of hawki_distortion_correct_coords. WARNING: Although this is the "inverse" of hawki_distortion_correct_coords, applying this function to positions delivered by hawki_distortion_correct_coords will not provide the original positions back. We are simply not using the same position to interpolate the distortion table. </p>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00467">467</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>References <a class="el" href="hawki__distortion_8c_source.html#l00526">hawki_distortion_interpolate_distortion()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gab9c3ebd02585f319d08b5149b44528e7"></a><!-- doxytag: member="hawki_distortion.c::hawki_distortion_load" ref="gab9c3ebd02585f319d08b5149b44528e7" args="(const cpl_frame *dist_x, const cpl_frame *dist_y, int idet)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">hawki_distortion* hawki_distortion_load </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>dist_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>dist_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>idet</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Loads the distortion solution for one detector. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">dist_x</td><td>the image with distortion in X </td></tr>
+ <tr><td class="paramname">dist_y</td><td>the image with distortion in Y </td></tr>
+ <tr><td class="paramname">idet</td><td>the detector to read. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The allocated distortion if everything is ok , NULL otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00182">182</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>, and <a class="el" href="hawki__load_8c_source.html#l00547">hawki_load_frame_detector()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__distortion_8c_source.html#l00287">hawki_distortion_correct_alldetectors()</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__image__stats.html b/html/group__hawki__image__stats.html
new file mode 100644
index 0000000..f7794e0
--- /dev/null
+++ b/html/group__hawki__image__stats.html
@@ -0,0 +1,502 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Compute several statistics on images</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Compute several statistics on images</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#ga6cf0d3c3733489bb4c8a869b35cc6d59">hawki_bkg_fill_assoc</a> (cpl_frameset *objframes, cpl_propertylist *proplist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Fill a propertylist with the association between objects and bkg. <a href="#ga6cf0d3c3733489bb4c8a869b35cc6d59"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#ga364c91d30c968e6a15e403c11a5d281e">hawki_bkg_from_objects_median</a> (const cpl_frameset *objframes, cpl_imagelist *bkg)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Computes the median of the object frames. <a href="#ga364c91d30c968e6a15e403c11a5d281e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af">hawki_bkg_from_running_mean_detector</a> (cpl_imagelist *objimages, const cpl_vector *medians, int i_target, int half_width, int rejlow, int rejhigh, cpl_image *bkg)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Computes the running mean for a set of object images using their masks. <a href="#ga5c5f3ead9c1f168f90e1b8bd42dd07af"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#ga01f0d4c0177325b9a5d33f83be498097">hawki_bkg_from_sky_median</a> (const cpl_frameset *skyframes, cpl_imagelist *bkg)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Computes the median of the sky frames. <a href="#ga01f0d4c0177325b9a5d33f83be498097"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#gade5ca3e76e59c9ab510cb85bc02dd651">hawki_image_float_get_sigma_from_quartile</a> (cpl_image *image)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get a robust estimation of the sigma based on the quartiles. <a href="#gade5ca3e76e59c9ab510cb85bc02dd651"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836">hawki_image_stats_fill_from_frame</a> (cpl_table **image_stats, const cpl_frame *frame, int irow)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Fills a table with the statistics of the four detectors of a frame. <a href="#ga07a4f45b2ba4af9420f7d8600dbbe836"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f">hawki_image_stats_fill_from_image</a> (cpl_table **image_stats, const cpl_image *image, int llx, int lly, int urx, int ury, int idet, int irow)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Fills a table with the statistics of an image. <a href="#gaddd6e9623519487c0775de8c3a0aee0f"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6">hawki_image_stats_initialize</a> (cpl_table **raw_stats)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize the table with all the statistics columns. <a href="#ga788a4b7f6fba705eddcebd1f2fe26fd6"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928">hawki_image_stats_stats</a> (cpl_table **image_stats, cpl_propertylist **stats_stats)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Make the statistics (over image serie) of the each image statistics. <a href="#gaaf82f2c0930f1c2bfcbc5cbef16b3928"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga6cf0d3c3733489bb4c8a869b35cc6d59"></a><!-- doxytag: member="hawki_bkg.c::hawki_bkg_fill_assoc" ref="ga6cf0d3c3733489bb4c8a869b35cc6d59" args="(cpl_frameset *objframes, cpl_propertylist *proplist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_bkg_fill_assoc </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>objframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_propertylist * </td>
+ <td class="paramname"><em>proplist</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Fill a propertylist with the association between objects and bkg. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">objframes</td><td>The objframes associated to the background </td></tr>
+ <tr><td class="paramname">proplist</td><td>The list of keywords to store the association information to </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input a set of object frames. For EACH input object frames it creates in the given propertylist a keyword "pointing" to the ARCFILE of that frame. This propertylist can later be stored in the background image to establish the association between this background and the object frames. </p>
+
+<p>Definition at line <a class="el" href="hawki__bkg_8c_source.html#l00068">68</a> of file <a class="el" href="hawki__bkg_8c_source.html">hawki_bkg.c</a>.</p>
+
+<p>References <a class="el" href="hawki__pfits_8c_source.html#l00215">hawki_pfits_get_arcfile()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga364c91d30c968e6a15e403c11a5d281e"></a><!-- doxytag: member="hawki_bkg.c::hawki_bkg_from_objects_median" ref="ga364c91d30c968e6a15e403c11a5d281e" args="(const cpl_frameset *objframes, cpl_imagelist *bkg)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_bkg_from_objects_median </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>objframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>bkg</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Computes the median of the object frames. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">objframes</td><td>The objframes to get the background from </td></tr>
+ <tr><td class="paramname">bkg</td><td>The background image </td></tr>
+ <tr><td class="paramname">proplist</td><td>The list of keywords to store the association information to </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input a set of object frames and computes the background using a median of these frames. </p>
+
+<p>Definition at line <a class="el" href="hawki__bkg_8c_source.html#l00109">109</a> of file <a class="el" href="hawki__bkg_8c_source.html">hawki_bkg.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00209">hawki_load_detector()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5c5f3ead9c1f168f90e1b8bd42dd07af"></a><!-- doxytag: member="hawki_bkg.c::hawki_bkg_from_running_mean_detector" ref="ga5c5f3ead9c1f168f90e1b8bd42dd07af" args="(cpl_imagelist *objimages, const cpl_vector *medians, int i_target, int half_width, int rejlow, int rejhigh, cpl_image *bkg)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_bkg_from_running_mean_detector </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>objimages</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_vector * </td>
+ <td class="paramname"><em>medians</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>i_target</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>half_width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>rejlow</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>rejhigh</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>bkg</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Computes the running mean for a set of object images using their masks. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">objimages</td><td>The serie of object images </td></tr>
+ <tr><td class="paramname">medians</td><td>A vector with the medians of each image </td></tr>
+ <tr><td class="paramname">bkg</td><td>The background image (OUT) </td></tr>
+ <tr><td class="paramname">proplist</td><td>The list of keywords to store the association information to </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input a set of sky frames and computes the background using a median of these frames. The bad pixels from the bpm masks are taking into account. It also sets the association between the object images and the final background produced (calling hawki_bkg_fill_assoc). </p>
+
+<p>Definition at line <a class="el" href="hawki__bkg_8c_source.html#l00231">231</a> of file <a class="el" href="hawki__bkg_8c_source.html">hawki_bkg.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga01f0d4c0177325b9a5d33f83be498097"></a><!-- doxytag: member="hawki_bkg.c::hawki_bkg_from_sky_median" ref="ga01f0d4c0177325b9a5d33f83be498097" args="(const cpl_frameset *skyframes, cpl_imagelist *bkg)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_bkg_from_sky_median </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>skyframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>bkg</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Computes the median of the sky frames. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">skyframes</td><td>The skyframes to get the background from </td></tr>
+ <tr><td class="paramname">objframes</td><td>The objframes to which the association is made </td></tr>
+ <tr><td class="paramname">bkg</td><td>The background image </td></tr>
+ <tr><td class="paramname">proplist</td><td>The list of keywords to store the association information to </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes as an input a set of sky frames and computes the background using a median of these frames. </p>
+
+<p>Definition at line <a class="el" href="hawki__bkg_8c_source.html#l00170">170</a> of file <a class="el" href="hawki__bkg_8c_source.html">hawki_bkg.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00209">hawki_load_detector()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gade5ca3e76e59c9ab510cb85bc02dd651"></a><!-- doxytag: member="hawki_image_stats.c::hawki_image_float_get_sigma_from_quartile" ref="gade5ca3e76e59c9ab510cb85bc02dd651" args="(cpl_image *image)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_image_float_get_sigma_from_quartile </td>
+ <td>(</td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>image</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get a robust estimation of the sigma based on the quartiles. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image</td><td>The image where to compute the statistic </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The sigma </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__image__stats_8c_source.html#l00582">582</a> of file <a class="el" href="hawki__image__stats_8c_source.html">hawki_image_stats.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga07a4f45b2ba4af9420f7d8600dbbe836"></a><!-- doxytag: member="hawki_image_stats.c::hawki_image_stats_fill_from_frame" ref="ga07a4f45b2ba4af9420f7d8600dbbe836" args="(cpl_table **image_stats, const cpl_frame *frame, int irow)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_image_stats_fill_from_frame </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table ** </td>
+ <td class="paramname"><em>image_stats</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>irow</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Fills a table with the statistics of the four detectors of a frame. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image_stats</td><td>Table to fill with the statistics </td></tr>
+ <tr><td class="paramname">frame</td><td>The target frame </td></tr>
+ <tr><td class="paramname">llx</td><td>Lower left x position (FITS convention) </td></tr>
+ <tr><td class="paramname">lly</td><td>Lower left y position (FITS convention) </td></tr>
+ <tr><td class="paramname">urx</td><td>Upper right x position (FITS convention) </td></tr>
+ <tr><td class="paramname">ury</td><td>Upper right y position (FITS convention) </td></tr>
+ <tr><td class="paramname">irow</td><td>The row in the table to store the stats (begin in 0) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes the rectangle of the image given by llx, lly, urx, ury and computes the image statistics. This statistics are stored in the four tables image_stats, one for each detector, using the columns MINIMUM, MAXIMUM, MEDIAN, MEAN, RMS, USED. The USED column is set to 1. The table must have already these columns (call hawki_image_stats_initialize before) The statistics are stored in the row irow. </p>
+
+<p>Definition at line <a class="el" href="hawki__image__stats_8c_source.html#l00430">430</a> of file <a class="el" href="hawki__image__stats_8c_source.html">hawki_image_stats.c</a>.</p>
+
+<p>References <a class="el" href="hawki__image__stats_8c_source.html#l00137">hawki_image_stats_fill_from_image()</a>, and <a class="el" href="hawki__load_8c_source.html#l00445">hawki_load_frame()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaddd6e9623519487c0775de8c3a0aee0f"></a><!-- doxytag: member="hawki_image_stats.c::hawki_image_stats_fill_from_image" ref="gaddd6e9623519487c0775de8c3a0aee0f" args="(cpl_table **image_stats, const cpl_image *image, int llx, int lly, int urx, int ury, int idet, int irow)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_image_stats_fill_from_image </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table ** </td>
+ <td class="paramname"><em>image_stats</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>image</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>llx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>lly</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>urx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ury</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>idet</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>irow</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Fills a table with the statistics of an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image_stats</td><td>Table to fill with the statistics </td></tr>
+ <tr><td class="paramname">image</td><td>The target image </td></tr>
+ <tr><td class="paramname">llx</td><td>Lower left x position (FITS convention) </td></tr>
+ <tr><td class="paramname">lly</td><td>Lower left y position (FITS convention) </td></tr>
+ <tr><td class="paramname">urx</td><td>Upper right x position (FITS convention) </td></tr>
+ <tr><td class="paramname">ury</td><td>Upper right y position (FITS convention) </td></tr>
+ <tr><td class="paramname">idet</td><td>The id of the table to store the data in (0 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">irow</td><td>The row in the table to store the stats (begins in 0) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function takes the rectangle of the image given by llx, lly, urx, ury and computes the image statistics. This statistics are stored in the table image_stats, using the columns MINIMUM, MAXIMUM, MEDIAN, MEAN, RMS, USED. The USED column is set to 1. The table must have already these columns (call hawki_image_stats_initialize before) The table used to store the data is image_stats[idet], in the row irow. </p>
+
+<p>Definition at line <a class="el" href="hawki__image__stats_8c_source.html#l00137">137</a> of file <a class="el" href="hawki__image__stats_8c_source.html">hawki_image_stats.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__image__stats_8c_source.html#l00430">hawki_image_stats_fill_from_frame()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga788a4b7f6fba705eddcebd1f2fe26fd6"></a><!-- doxytag: member="hawki_image_stats.c::hawki_image_stats_initialize" ref="ga788a4b7f6fba705eddcebd1f2fe26fd6" args="(cpl_table **raw_stats)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_image_stats_initialize </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table ** </td>
+ <td class="paramname"><em>raw_stats</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Initialize the table with all the statistics columns. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image_stats</td><td>Table to fill with the statistics </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function creates the following columns in the given table: MINIMUM, MAXIMUM, MEDIAN, MEAN, RMS, USED </p>
+
+<p>Definition at line <a class="el" href="hawki__image__stats_8c_source.html#l00070">70</a> of file <a class="el" href="hawki__image__stats_8c_source.html">hawki_image_stats.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaaf82f2c0930f1c2bfcbc5cbef16b3928"></a><!-- doxytag: member="hawki_image_stats.c::hawki_image_stats_stats" ref="gaaf82f2c0930f1c2bfcbc5cbef16b3928" args="(cpl_table **image_stats, cpl_propertylist **stats_stats)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_image_stats_stats </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table ** </td>
+ <td class="paramname"><em>image_stats</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_propertylist ** </td>
+ <td class="paramname"><em>stats_stats</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Make the statistics (over image serie) of the each image statistics. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">stats_stats</td><td>Property list where to store the statistics </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function computes the mean, median, minimum, maximum and stdev of each of the columns found in the image_stats table. </p>
+
+<p>Definition at line <a class="el" href="hawki__image__stats_8c_source.html#l00512">512</a> of file <a class="el" href="hawki__image__stats_8c_source.html">hawki_image_stats.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__load.html b/html/group__hawki__load.html
new file mode 100644
index 0000000..6ac1c33
--- /dev/null
+++ b/html/group__hawki__load.html
@@ -0,0 +1,929 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Loading related functions</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Loading related functions</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_frameset * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a">hawki_extract_frameset</a> (const cpl_frameset *in, const char *tag)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extract the frames with the given tag from a frameset. <a href="#ga080ffcf787c686caacf741989e6e796a"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756">hawki_get_detector_from_ext</a> (const char *fname, int ext)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the chip to store in the wished extension. <a href="#gac57166de157def8422f2e7e2d12dd756"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga509bd22f6e838f82f7b2c6bc97ccc3a9">hawki_get_ext_detector_mapping</a> (const char *fname)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the mapping between extensions and detectors. <a href="#ga509bd22f6e838f82f7b2c6bc97ccc3a9"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1">hawki_get_ext_from_detector</a> (const char *fname, int chip)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the extension corresponding to the wished chip. <a href="#gac0cd4814dd4a106963bb5e639132aac1"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895">hawki_load_detector</a> (const cpl_frameset *fset, int chip, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load the chips of HAWKI frameset in an image list. <a href="#gad4d9d26496599a54ebc31e2a43814895"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga1cf51c1b905de7941d7fcf3e249e536d">hawki_load_extensions</a> (const cpl_frameset *fset, int extension, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Loads a given extension from a HAWKI frameset in an image list. <a href="#ga1cf51c1b905de7941d7fcf3e249e536d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751">hawki_load_frame</a> (const cpl_frame *frame, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load all the chips of HAWKI images from a frame into an image list. <a href="#gaa83706a01275860daf2d743f315e1751"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gada33a0608b91dc44f69f821e6f40b8d1">hawki_load_frame_detector</a> (const cpl_frame *frame, int idet, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load one the chips of HAWKI images from a frame into an image. <a href="#gada33a0608b91dc44f69f821e6f40b8d1"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga43ebac74ab2f9da7a452f23ec76803ef">hawki_load_frame_extension</a> (const cpl_frame *frame, int iextension, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load one the extensions of HAWKI images from a frame into an image. <a href="#ga43ebac74ab2f9da7a452f23ec76803ef"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gacfb4bdd556642042208b93924ee13a32">hawki_load_frameset</a> (const cpl_frameset *fset, int chip, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load the chip of HAWKI images from a frameset in an image list. <a href="#gacfb4bdd556642042208b93924ee13a32"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed">hawki_load_image</a> (const cpl_frameset *fset, int fnum, int chip, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load the chip of HAWKI image from a frameset in an image. <a href="#ga5b9129188e69306c15cec2d4568ddeed"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gaf2bd8a92a7abfe4adc8eb7b6b917739a">hawki_load_quadrant</a> (const cpl_frameset *fset, int fnum, int chip, int quad, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load the quarter of a chip from a frameset in an image. <a href="#gaf2bd8a92a7abfe4adc8eb7b6b917739a"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga686f0c5897e92abd1b6aff98636f56c7">hawki_load_quadrant_from_file</a> (const char *fname, int chip, int quad, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load the quarter of a chip from a file in an image. <a href="#ga686f0c5897e92abd1b6aff98636f56c7"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gad5cbc1d866e88c8776ed605e5afa9438">hawki_load_quadrants</a> (const cpl_frameset *fset, int chip, int quad, cpl_type ptype)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load the quarter of a chip from a frameset in an image list. <a href="#gad5cbc1d866e88c8776ed605e5afa9438"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_bivector ** </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#gaf91b09d357b426f387123767e4a4fec1">hawki_load_refined_offsets</a> (const cpl_frame *offsets_frame)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load a table containing refined offsets. <a href="#gaf91b09d357b426f387123767e4a4fec1"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_table ** </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0">hawki_load_tables</a> (const cpl_frame *frame)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Load a table with four extensions, one for each chip. <a href="#ga8ad708e19bdb35ac89abc2d9ba3932f0"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga0ee685ab967af593a9fd9f5f90cc7dd0">hawki_rebuild_detectors</a> (const cpl_image *ima1, const cpl_image *ima2, const cpl_image *ima3, const cpl_image *ima4)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Rebuild the 4 chips. <a href="#ga0ee685ab967af593a9fd9f5f90cc7dd0"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df">hawki_rebuild_quadrants</a> (const cpl_image *ima1, const cpl_image *ima2, const cpl_image *ima3, const cpl_image *ima4)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Rebuild the 4 quadrants. <a href="#ga2e96e882a8e61743837030dcc2db02df"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga080ffcf787c686caacf741989e6e796a"></a><!-- doxytag: member="hawki_load.c::hawki_extract_frameset" ref="ga080ffcf787c686caacf741989e6e796a" args="(const cpl_frameset *in, const char *tag)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_frameset* hawki_extract_frameset </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>tag</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Extract the frames with the given tag from a frameset. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>A non-empty frameset </td></tr>
+ <tr><td class="paramname">tag</td><td>The tag of the requested frames </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The newly created frameset or NULL on error</dd></dl>
+<p>The returned frameset must be de allocated with cpl_frameset_delete() </p>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00063">63</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gac57166de157def8422f2e7e2d12dd756"></a><!-- doxytag: member="hawki_load.c::hawki_get_detector_from_ext" ref="gac57166de157def8422f2e7e2d12dd756" args="(const char *fname, int ext)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_get_detector_from_ext </td>
+ <td>(</td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>fname</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ext</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the chip to store in the wished extension. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fname</td><td>The input frame name </td></tr>
+ <tr><td class="paramname">ext</td><td>the extension number (1 to HAWKI_NB_DETECTORS) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The chip number (1 to HAWKI_NB_DETECTORS) or -1 in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00817">817</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__pfits_8c_source.html#l00203">hawki_pfits_get_extname()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__save_8c_source.html#l00514">hawki_distortion_save()</a>, <a class="el" href="hawki__load_8c_source.html#l00897">hawki_get_ext_detector_mapping()</a>, <a class="el" href="hawki__save_8c_source.html#l00227">hawki_image_ext_save()</a>, <a class="el" href="hawki__save_8c_source.html#l00072">hawki_imagelist_save()</a>, <a class="el" href="hawki__save_8c_source.html#l00302">hawki_images_save()</a>, and <a class="el" href="hawki__save_8c_source.html#l [...]
+
+</div>
+</div>
+<a class="anchor" id="ga509bd22f6e838f82f7b2c6bc97ccc3a9"></a><!-- doxytag: member="hawki_load.c::hawki_get_ext_detector_mapping" ref="ga509bd22f6e838f82f7b2c6bc97ccc3a9" args="(const char *fname)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int* hawki_get_ext_detector_mapping </td>
+ <td>(</td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>fname</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the mapping between extensions and detectors. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fname</td><td>The input frame name </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the mapping if everything goes well, NULL otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00897">897</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__load_8c_source.html#l00445">hawki_load_frame()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gac0cd4814dd4a106963bb5e639132aac1"></a><!-- doxytag: member="hawki_load.c::hawki_get_ext_from_detector" ref="gac0cd4814dd4a106963bb5e639132aac1" args="(const char *fname, int chip)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_get_ext_from_detector </td>
+ <td>(</td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>fname</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the extension corresponding to the wished chip. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fname</td><td>The input frame name </td></tr>
+ <tr><td class="paramname">chip</td><td>The chip number (1 to HAWKI_NB_DETECTORS) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the extension number (1 to HAWKI_NB_DETECTORS) </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00846">846</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__pfits_8c_source.html#l00203">hawki_pfits_get_extname()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__calib_8c_source.html#l00450">hawki_bpm_calib()</a>, <a class="el" href="hawki__utils_8c_source.html#l00837">hawki_detectors_locate_star()</a>, <a class="el" href="hawki__distortion_8c_source.html#l00182">hawki_distortion_load()</a>, <a class="el" href="hawki__load_8c_source.html#l00209">hawki_load_detector()</a>, <a class="el" href="hawki__load_8c_source.html#l00547">hawki_load_frame_detector()</a>, <a class="el" href="hawki__load_8c_source.htm [...]
+
+</div>
+</div>
+<a class="anchor" id="gad4d9d26496599a54ebc31e2a43814895"></a><!-- doxytag: member="hawki_load.c::hawki_load_detector" ref="gad4d9d26496599a54ebc31e2a43814895" args="(const cpl_frameset *fset, int chip, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_load_detector </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load the chips of HAWKI frameset in an image list. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">chip</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00209">209</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__bkg_8c_source.html#l00109">hawki_bkg_from_objects_median()</a>, and <a class="el" href="hawki__bkg_8c_source.html#l00170">hawki_bkg_from_sky_median()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga1cf51c1b905de7941d7fcf3e249e536d"></a><!-- doxytag: member="hawki_load.c::hawki_load_extensions" ref="ga1cf51c1b905de7941d7fcf3e249e536d" args="(const cpl_frameset *fset, int extension, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_load_extensions </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>extension</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Loads a given extension from a HAWKI frameset in an image list. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">ext</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00266">266</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaa83706a01275860daf2d743f315e1751"></a><!-- doxytag: member="hawki_load.c::hawki_load_frame" ref="gaa83706a01275860daf2d743f315e1751" args="(const cpl_frame *frame, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_load_frame </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load all the chips of HAWKI images from a frame into an image list. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frame</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list (image chip 1 to chip HAWKI_NB_DETECTORS) or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00445">445</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00897">hawki_get_ext_detector_mapping()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__image__stats_8c_source.html#l00430">hawki_image_stats_fill_from_frame()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gada33a0608b91dc44f69f821e6f40b8d1"></a><!-- doxytag: member="hawki_load.c::hawki_load_frame_detector" ref="gada33a0608b91dc44f69f821e6f40b8d1" args="(const cpl_frame *frame, int idet, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_load_frame_detector </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>idet</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load one the chips of HAWKI images from a frame into an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frame</td><td>the input frame </td></tr>
+ <tr><td class="paramname">idet</td><td>the detector to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00547">547</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__distortion_8c_source.html#l00182">hawki_distortion_load()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga43ebac74ab2f9da7a452f23ec76803ef"></a><!-- doxytag: member="hawki_load.c::hawki_load_frame_extension" ref="ga43ebac74ab2f9da7a452f23ec76803ef" args="(const cpl_frame *frame, int iextension, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_load_frame_extension </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>iextension</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load one the extensions of HAWKI images from a frame into an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frame</td><td>the input frame </td></tr>
+ <tr><td class="paramname">extension</td><td>the extension to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00513">513</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gacfb4bdd556642042208b93924ee13a32"></a><!-- doxytag: member="hawki_load.c::hawki_load_frameset" ref="gacfb4bdd556642042208b93924ee13a32" args="(const cpl_frameset *fset, int chip, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_load_frameset </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load the chip of HAWKI images from a frameset in an image list. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">chip</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list (image chip 1 to chip HAWKI_NB_DETECTORS) or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00407">407</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00313">hawki_load_image()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5b9129188e69306c15cec2d4568ddeed"></a><!-- doxytag: member="hawki_load.c::hawki_load_image" ref="ga5b9129188e69306c15cec2d4568ddeed" args="(const cpl_frameset *fset, int fnum, int chip, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_load_image </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>fnum</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load the chip of HAWKI image from a frameset in an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">fnum</td><td>the frame to load from (start from 0) </td></tr>
+ <tr><td class="paramname">chip</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00313">313</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__load_8c_source.html#l00407">hawki_load_frameset()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaf2bd8a92a7abfe4adc8eb7b6b917739a"></a><!-- doxytag: member="hawki_load.c::hawki_load_quadrant" ref="gaf2bd8a92a7abfe4adc8eb7b6b917739a" args="(const cpl_frameset *fset, int fnum, int chip, int quad, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_load_quadrant </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>fnum</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>quad</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load the quarter of a chip from a frameset in an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">fnum</td><td>the frame to load from (start from 0) </td></tr>
+ <tr><td class="paramname">chip</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">quad</td><td>the quadrant to load (1 to 4) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00110">110</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00149">hawki_load_quadrant_from_file()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__load_8c_source.html#l00365">hawki_load_quadrants()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga686f0c5897e92abd1b6aff98636f56c7"></a><!-- doxytag: member="hawki_load.c::hawki_load_quadrant_from_file" ref="ga686f0c5897e92abd1b6aff98636f56c7" args="(const char *fname, int chip, int quad, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_load_quadrant_from_file </td>
+ <td>(</td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>fname</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>quad</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load the quarter of a chip from a file in an image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fname</td><td>the input file name </td></tr>
+ <tr><td class="paramname">chip</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">quad</td><td>the quadrant to load (1 to 4) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00149">149</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__load_8c_source.html#l00110">hawki_load_quadrant()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gad5cbc1d866e88c8776ed605e5afa9438"></a><!-- doxytag: member="hawki_load.c::hawki_load_quadrants" ref="gad5cbc1d866e88c8776ed605e5afa9438" args="(const cpl_frameset *fset, int chip, int quad, cpl_type ptype)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_load_quadrants </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>chip</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>quad</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_type </td>
+ <td class="paramname"><em>ptype</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load the quarter of a chip from a frameset in an image list. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">chip</td><td>the chip to load (1 to HAWKI_NB_DETECTORS) </td></tr>
+ <tr><td class="paramname">quad</td><td>the quadrant to load (1 to 4) </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00365">365</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00110">hawki_load_quadrant()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaf91b09d357b426f387123767e4a4fec1"></a><!-- doxytag: member="hawki_load.c::hawki_load_refined_offsets" ref="gaf91b09d357b426f387123767e4a4fec1" args="(const cpl_frame *offsets_frame)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_bivector** hawki_load_refined_offsets </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>offsets_frame</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load a table containing refined offsets. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">offsets_frame</td><td>the frame containing the offests. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the offsets bivector. It must be deallocated afterwards. NULL if in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00633">633</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00589">hawki_load_tables()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga8ad708e19bdb35ac89abc2d9ba3932f0"></a><!-- doxytag: member="hawki_load.c::hawki_load_tables" ref="ga8ad708e19bdb35ac89abc2d9ba3932f0" args="(const cpl_frame *frame)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_table** hawki_load_tables </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frame * </td>
+ <td class="paramname"><em>frame</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Load a table with four extensions, one for each chip. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frame</td><td>the input set of frames </td></tr>
+ <tr><td class="paramname">ptype</td><td>the pixel type </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image list (image chip 1 to chip HAWKI_NB_DETECTORS) or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00589">589</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__load_8c_source.html#l00633">hawki_load_refined_offsets()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga0ee685ab967af593a9fd9f5f90cc7dd0"></a><!-- doxytag: member="hawki_load.c::hawki_rebuild_detectors" ref="ga0ee685ab967af593a9fd9f5f90cc7dd0" args="(const cpl_image *ima1, const cpl_image *ima2, const cpl_image *ima3, const cpl_image *ima4)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_rebuild_detectors </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima3</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima4</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Rebuild the 4 chips. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ima1</td><td>the first chip </td></tr>
+ <tr><td class="paramname">ima2</td><td>the second chip </td></tr>
+ <tr><td class="paramname">ima3</td><td>the third chip </td></tr>
+ <tr><td class="paramname">ima4</td><td>the fourth chip </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00718">718</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga2e96e882a8e61743837030dcc2db02df"></a><!-- doxytag: member="hawki_load.c::hawki_rebuild_quadrants" ref="ga2e96e882a8e61743837030dcc2db02df" args="(const cpl_image *ima1, const cpl_image *ima2, const cpl_image *ima3, const cpl_image *ima4)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_rebuild_quadrants </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima3</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>ima4</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Rebuild the 4 quadrants. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ima1</td><td>the first quadrant </td></tr>
+ <tr><td class="paramname">ima2</td><td>the second quadrant </td></tr>
+ <tr><td class="paramname">ima3</td><td>the third quadrant </td></tr>
+ <tr><td class="paramname">ima4</td><td>the fourth quadrant </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the image or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__load_8c_source.html#l00769">769</a> of file <a class="el" href="hawki__load_8c_source.html">hawki_load.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__mask.html b/html/group__hawki__mask.html
new file mode 100644
index 0000000..3422e1f
--- /dev/null
+++ b/html/group__hawki__mask.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Mask manipulation</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Mask manipulation</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_error_code </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__mask.html#ga6154878d3444c3d4204a2a6132719e69">hawki_mask_convolve</a> (cpl_mask *in, const cpl_matrix *ker)</td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga6154878d3444c3d4204a2a6132719e69"></a><!-- doxytag: member="hawki_mask.c::hawki_mask_convolve" ref="ga6154878d3444c3d4204a2a6132719e69" args="(cpl_mask *in, const cpl_matrix *ker)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_error_code hawki_mask_convolve </td>
+ <td>(</td>
+ <td class="paramtype">cpl_mask * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_matrix * </td>
+ <td class="paramname"><em>ker</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+<p>FIXME: documentation </p>
+
+<p>Definition at line <a class="el" href="hawki__mask_8c_source.html#l00056">56</a> of file <a class="el" href="hawki__mask_8c_source.html">hawki_mask.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__obj__det.html b/html/group__hawki__obj__det.html
new file mode 100644
index 0000000..40b6863
--- /dev/null
+++ b/html/group__hawki__obj__det.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Functionality related to catalogue matching</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Functionality related to catalogue matching</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__obj__det.html#ga7255ba5ecf2bd6539c02c1f7d765e593">hawki_match_condition_5_pix</a> (cpl_table *catalogue1, cpl_table *catalogue2, int iobj1, int iobj2)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compare two objects positions and determine whetherthey are within a 5 pix tolerance. <a href="#ga7255ba5ecf2bd6539c02c1f7d765e593"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__obj__det.html#ga0968e63931fcc72c55c4bc0e34f71dbb">hawki_obj_prop_stats</a> (cpl_table **objs_prop, cpl_propertylist **objs_prop_stats)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute statistics on the object properties. <a href="#ga0968e63931fcc72c55c4bc0e34f71dbb"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga7255ba5ecf2bd6539c02c1f7d765e593"></a><!-- doxytag: member="hawki_match_cats.c::hawki_match_condition_5_pix" ref="ga7255ba5ecf2bd6539c02c1f7d765e593" args="(cpl_table *catalogue1, cpl_table *catalogue2, int iobj1, int iobj2)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_match_condition_5_pix </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table * </td>
+ <td class="paramname"><em>catalogue1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_table * </td>
+ <td class="paramname"><em>catalogue2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>iobj1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>iobj2</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compare two objects positions and determine whetherthey are within a 5 pix tolerance. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">catalogue1</td><td>The table with catalogue1 </td></tr>
+ <tr><td class="paramname">catalogue2</td><td>The table with catalogue2 </td></tr>
+ <tr><td class="paramname">iobj1</td><td>The position in table catalogue1 of the object to compare </td></tr>
+ <tr><td class="paramname">iobj2</td><td>The position in table catalogue2 of the object to compare</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>1 if they match, 0 if they do not.</dd></dl>
+<p>Both tables have to have the columns POS_X and POS_Y, which give the position in the detector in pixels. The distance between both objects is the euclidean distance in pixels. The object indexes start from 0.</p>
+<p>WARNING: Since this function will be called many times, there is no error checking. The caller has to ensure that the catalogues are well constructed and that the indexes are not out of bounds. </p>
+
+<p>Definition at line <a class="el" href="hawki__match__cats_8c_source.html#l00076">76</a> of file <a class="el" href="hawki__match__cats_8c_source.html">hawki_match_cats.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga0968e63931fcc72c55c4bc0e34f71dbb"></a><!-- doxytag: member="hawki_obj_det.c::hawki_obj_prop_stats" ref="ga0968e63931fcc72c55c4bc0e34f71dbb" args="(cpl_table **objs_prop, cpl_propertylist **objs_prop_stats)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_obj_prop_stats </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table ** </td>
+ <td class="paramname"><em>objs_prop</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_propertylist ** </td>
+ <td class="paramname"><em>objs_prop_stats</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute statistics on the object properties. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">objs_prop</td><td>the table with the properties of the objects (IN) </td></tr>
+ <tr><td class="paramname">objs_prop_stats</td><td>the property lists containing statistics on the previous table (OUT) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case</dd></dl>
+<p>The statistics computed are the mean, median, minimum, maximum and stdev. Currently, the statistics ar ecomputed upon the angle of the object and the ellipticity. </p>
+
+<p>Definition at line <a class="el" href="hawki__obj__det_8c_source.html#l00068">68</a> of file <a class="el" href="hawki__obj__det_8c_source.html">hawki_obj_det.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__pfits.html b/html/group__hawki__pfits.html
new file mode 100644
index 0000000..c83e40d
--- /dev/null
+++ b/html/group__hawki__pfits.html
@@ -0,0 +1,1694 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: FITS header protected access</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">FITS header protected access</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3">hawki_pfits_get_airmass_end</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out airmass end <a href="#gafccabad8d0fcc65a0ed27d1dff7ae8e3"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df">hawki_pfits_get_airmass_start</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out airmass start <a href="#ga4e7f03745ede13d9d2db3eddccd857df"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gac9b88815381f3f61c10dc88730d77121">hawki_pfits_get_ao_fwhm</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the fwhm from the AO system <a href="#gac9b88815381f3f61c10dc88730d77121"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gae4f45ff97625d37b9354392b0c5e1056">hawki_pfits_get_arcfile</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the arcfile <a href="#gae4f45ff97625d37b9354392b0c5e1056"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaf18030b75b198e924f296cdd13356b58">hawki_pfits_get_azimut</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the telescope azimut <a href="#gaf18030b75b198e924f296cdd13356b58"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga39d06faa1dcc2d3601e07e79064f9e78">hawki_pfits_get_cdelta1</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the increment of coordinate in one pixel (axe 1) <a href="#ga39d06faa1dcc2d3601e07e79064f9e78"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaeea4d2dba260fc663a4aa5d5a616086c">hawki_pfits_get_cdelta2</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the increment of coordinate in one pixel (axe 2) <a href="#gaeea4d2dba260fc663a4aa5d5a616086c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga24483514187ce9bcf0860cc654b8508c">hawki_pfits_get_comb_cumoffsetx</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the cumulative X offset of the combined image <a href="#ga24483514187ce9bcf0860cc654b8508c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gadc1b3f141f5474486b5b32502634b29a">hawki_pfits_get_comb_cumoffsety</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the cumulative Y offset of the combined image <a href="#gadc1b3f141f5474486b5b32502634b29a"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga88f1a9b44888686b6489fba06921f5a1">hawki_pfits_get_comb_posx</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the relative X offset of the combined image wrt first image <a href="#ga88f1a9b44888686b6489fba06921f5a1"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga5408b902329bdad15fd408d73fa6376e">hawki_pfits_get_comb_posy</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the relative Y offset of the combined image wrt first image <a href="#ga5408b902329bdad15fd408d73fa6376e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaaeee5723004e441f48fb8cc804370f80">hawki_pfits_get_crpix1</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the reference pixel in axe 1 <a href="#gaaeee5723004e441f48fb8cc804370f80"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaab4e70f9071230674a49cb8df1975f10">hawki_pfits_get_crpix2</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the reference pixel in axe 1 <a href="#gaab4e70f9071230674a49cb8df1975f10"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga98f777c6f085878ba095b1ccd40ef6ea">hawki_pfits_get_crval1</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the value in WCS coordinates of the reference pixel (axe 1) <a href="#ga98f777c6f085878ba095b1ccd40ef6ea"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga7fbf6de80172c991e4a9d7f427741692">hawki_pfits_get_crval2</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the value in WCS coordinates of the reference pixel (axe 2) <a href="#ga7fbf6de80172c991e4a9d7f427741692"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga62ff6ef5b06d163b64e8eff779e5fb53">hawki_pfits_get_cumoffseta</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the cumulative offset in alpha <a href="#ga62ff6ef5b06d163b64e8eff779e5fb53"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga0f4a0efe2116535b882eddeeb272042d">hawki_pfits_get_cumoffsetd</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the cumulative offset in delta <a href="#ga0f4a0efe2116535b882eddeeb272042d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga8074b7ef4524abfeb10bef68c4cfdf5e">hawki_pfits_get_cumoffsetx</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the cumulative offset in X <a href="#ga8074b7ef4524abfeb10bef68c4cfdf5e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga21f640e98b8f695ac6229e9f15d46aca">hawki_pfits_get_cumoffsety</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the cumulative offset in Y <a href="#ga21f640e98b8f695ac6229e9f15d46aca"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga87aca0d821694845e43e06dca5ace1a0">hawki_pfits_get_date_obs</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the date of observation <a href="#ga87aca0d821694845e43e06dca5ace1a0"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaca47ff94f05c2bb322ea83ce4cf9b4d4">hawki_pfits_get_dec</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the DEC <a href="#gaca47ff94f05c2bb322ea83ce4cf9b4d4"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f">hawki_pfits_get_dit</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the DIT value <a href="#ga1971ab60e27df384b5fd533461e7356f"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga965d40d225307d5a40d697a0a532f246">hawki_pfits_get_elevation</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the telescope altitude <a href="#ga965d40d225307d5a40d697a0a532f246"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga5161743d5b650a637d543959b5bd54ea">hawki_pfits_get_extname</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the extname <a href="#ga5161743d5b650a637d543959b5bd54ea"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501">hawki_pfits_get_filter</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out which wave band is active <a href="#ga3ad06f5c4dea6ec8adcc437e7f9f5501"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga1cd57f592c68d5e084ee049bdbe979a4">hawki_pfits_get_focus</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the focus position of M2 <a href="#ga1cd57f592c68d5e084ee049bdbe979a4"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga643c35f35f7f49a3e1c6bafd022e364a">hawki_pfits_get_humidity_level</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the humidity level <a href="#ga643c35f35f7f49a3e1c6bafd022e364a"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga509576593bbfc282745eae7d29a89102">hawki_pfits_get_naxis1</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of pixels in axis 1. <a href="#ga509576593bbfc282745eae7d29a89102"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaabcefe7bbad8cb43ad652970057d0356">hawki_pfits_get_naxis2</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of pixels in axis 2. <a href="#gaabcefe7bbad8cb43ad652970057d0356"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788">hawki_pfits_get_ndit</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the NDIT value <a href="#ga7c2b338fdf41bdeb1149b60af82c0788"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190">hawki_pfits_get_ndsamples</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the NDSAMPLES value <a href="#ga0d1ccf97334b28566b2bc8fe17786190"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gae157c2c48d5b4e41ffafef1348c939d2">hawki_pfits_get_nexp</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the NEXP value <a href="#gae157c2c48d5b4e41ffafef1348c939d2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaa400a879086340c841865fc6c2a1cc21">hawki_pfits_get_obs_seeing_end</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the observatory seeing at end <a href="#gaa400a879086340c841865fc6c2a1cc21"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gae005518fe79a76ee9b1cea2c3403a259">hawki_pfits_get_obs_seeing_start</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the observatory seeing at start <a href="#gae005518fe79a76ee9b1cea2c3403a259"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gae4c54267b67c5efdcf93afb99ecaeb3b">hawki_pfits_get_obs_temp</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the ambient temperatur <a href="#gae4c54267b67c5efdcf93afb99ecaeb3b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga3465a5cbb9e21e8cbd7680affc75355b">hawki_pfits_get_parangle_end</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the paralactic angle at start <a href="#ga3465a5cbb9e21e8cbd7680affc75355b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga2dc1b31621ecbeec49d3e390ad601274">hawki_pfits_get_parangle_start</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the paralactic angle at start <a href="#ga2dc1b31621ecbeec49d3e390ad601274"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b">hawki_pfits_get_pixscale</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the pixel scale <a href="#ga79c432e5ab5585c45472cfa86b2d146b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga88a2db02738f3881bad0e2bde2768951">hawki_pfits_get_posangle</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the position angle <a href="#ga88a2db02738f3881bad0e2bde2768951"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga11eecff7f4c8031ff6ea929e15c20813">hawki_pfits_get_pressure_end</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the observatory atmospheric pressure at end <a href="#ga11eecff7f4c8031ff6ea929e15c20813"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga87d6ba1cd310181f2eab02fc4688bad4">hawki_pfits_get_pressure_start</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the observatory atmospheric pressure at start <a href="#ga87d6ba1cd310181f2eab02fc4688bad4"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gad9c95c0d3bc75d347bf9acbcb8fe549d">hawki_pfits_get_procatg</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the PRO.CATG <a href="#gad9c95c0d3bc75d347bf9acbcb8fe549d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga6f490d48a329331dc3b1bc48c1e9ed1d">hawki_pfits_get_ra</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the RA <a href="#ga6f490d48a329331dc3b1bc48c1e9ed1d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gafc9299ed697db3ecfd1bb4c7e548cf3b">hawki_pfits_get_relhum</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the relative humidity <a href="#gafc9299ed697db3ecfd1bb4c7e548cf3b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2">hawki_pfits_get_rotator_end</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the absolute rotator position at end <a href="#gac8b9879cdc3c2e82f3b169eef3355ef2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2">hawki_pfits_get_rotator_start</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the absolute rotator position at start <a href="#gaa91a5e47c4661209f97f4399cbceb9d2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga36892dc77006059ba553e9a98c9b55fc">hawki_pfits_get_targ_alpha</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the target RA <a href="#ga36892dc77006059ba553e9a98c9b55fc"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga0330c53376304376257417ea4edbee5c">hawki_pfits_get_targ_delta</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the target DEC <a href="#ga0330c53376304376257417ea4edbee5c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga07110c618d0772882174838d8ce9a168">hawki_pfits_get_targ_epoch</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the target epoch <a href="#ga07110c618d0772882174838d8ce9a168"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga662be8ce410cbfa244f51ec8e5f0baad">hawki_pfits_get_targ_equinox</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the target equinox <a href="#ga662be8ce410cbfa244f51ec8e5f0baad"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#gaab1203aaa32935d1e81db6bb0aeec96b">hawki_pfits_get_tau0</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the average coherence time <a href="#gaab1203aaa32935d1e81db6bb0aeec96b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga7bd674c51f4cd62ce34c208888cea125">hawki_pfits_get_wind_dir</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the wind direction <a href="#ga7bd674c51f4cd62ce34c208888cea125"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__pfits.html#ga45e0b30ba22df26f4d061dee26735708">hawki_pfits_get_wind_speed</a> (const cpl_propertylist *plist)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">find out the wind speed <a href="#ga45e0b30ba22df26f4d061dee26735708"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="gafccabad8d0fcc65a0ed27d1dff7ae8e3"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_airmass_end" ref="gafccabad8d0fcc65a0ed27d1dff7ae8e3" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_airmass_end </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out airmass end </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00073">73</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>, and <a class="el" href="hawki__utils_8c_source.html#l00740">hawki_get_mean_airmass()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga4e7f03745ede13d9d2db3eddccd857df"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_airmass_start" ref="ga4e7f03745ede13d9d2db3eddccd857df" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_airmass_start </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out airmass start </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00061">61</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>, and <a class="el" href="hawki__utils_8c_source.html#l00740">hawki_get_mean_airmass()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gac9b88815381f3f61c10dc88730d77121"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_ao_fwhm" ref="gac9b88815381f3f61c10dc88730d77121" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_ao_fwhm </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the fwhm from the AO system </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00573">573</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gae4f45ff97625d37b9354392b0c5e1056"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_arcfile" ref="gae4f45ff97625d37b9354392b0c5e1056" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_pfits_get_arcfile </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the arcfile </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00215">215</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__bkg_8c_source.html#l00068">hawki_bkg_fill_assoc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaf18030b75b198e924f296cdd13356b58"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_azimut" ref="gaf18030b75b198e924f296cdd13356b58" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_azimut </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the telescope azimut </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00501">501</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga39d06faa1dcc2d3601e07e79064f9e78"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_cdelta1" ref="ga39d06faa1dcc2d3601e07e79064f9e78" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_cdelta1 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the increment of coordinate in one pixel (axe 1) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00371">371</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaeea4d2dba260fc663a4aa5d5a616086c"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_cdelta2" ref="gaeea4d2dba260fc663a4aa5d5a616086c" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_cdelta2 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the increment of coordinate in one pixel (axe 2) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00383">383</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga24483514187ce9bcf0860cc654b8508c"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_comb_cumoffsetx" ref="ga24483514187ce9bcf0860cc654b8508c" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_comb_cumoffsetx </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the cumulative X offset of the combined image </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00682">682</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gadc1b3f141f5474486b5b32502634b29a"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_comb_cumoffsety" ref="gadc1b3f141f5474486b5b32502634b29a" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_comb_cumoffsety </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the cumulative Y offset of the combined image </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00694">694</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga88f1a9b44888686b6489fba06921f5a1"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_comb_posx" ref="ga88f1a9b44888686b6489fba06921f5a1" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_comb_posx </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the relative X offset of the combined image wrt first image </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00706">706</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5408b902329bdad15fd408d73fa6376e"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_comb_posy" ref="ga5408b902329bdad15fd408d73fa6376e" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_comb_posy </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the relative Y offset of the combined image wrt first image </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00718">718</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaaeee5723004e441f48fb8cc804370f80"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_crpix1" ref="gaaeee5723004e441f48fb8cc804370f80" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_crpix1 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the reference pixel in axe 1 </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00347">347</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaab4e70f9071230674a49cb8df1975f10"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_crpix2" ref="gaab4e70f9071230674a49cb8df1975f10" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_crpix2 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the reference pixel in axe 1 </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00359">359</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga98f777c6f085878ba095b1ccd40ef6ea"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_crval1" ref="ga98f777c6f085878ba095b1ccd40ef6ea" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_crval1 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the value in WCS coordinates of the reference pixel (axe 1) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00323">323</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga7fbf6de80172c991e4a9d7f427741692"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_crval2" ref="ga7fbf6de80172c991e4a9d7f427741692" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_crval2 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the value in WCS coordinates of the reference pixel (axe 2) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00335">335</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga62ff6ef5b06d163b64e8eff779e5fb53"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_cumoffseta" ref="ga62ff6ef5b06d163b64e8eff779e5fb53" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_cumoffseta </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the cumulative offset in alpha </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00395">395</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga0f4a0efe2116535b882eddeeb272042d"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_cumoffsetd" ref="ga0f4a0efe2116535b882eddeeb272042d" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_cumoffsetd </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the cumulative offset in delta </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00407">407</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga8074b7ef4524abfeb10bef68c4cfdf5e"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_cumoffsetx" ref="ga8074b7ef4524abfeb10bef68c4cfdf5e" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_cumoffsetx </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the cumulative offset in X </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00419">419</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>, and <a class="el" href="hawki__utils_8c_source.html#l00695">hawki_get_header_tel_offsets()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga21f640e98b8f695ac6229e9f15d46aca"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_cumoffsety" ref="ga21f640e98b8f695ac6229e9f15d46aca" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_cumoffsety </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the cumulative offset in Y </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00431">431</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>, and <a class="el" href="hawki__utils_8c_source.html#l00695">hawki_get_header_tel_offsets()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga87aca0d821694845e43e06dca5ace1a0"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_date_obs" ref="ga87aca0d821694845e43e06dca5ace1a0" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_pfits_get_date_obs </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the date of observation </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00227">227</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaca47ff94f05c2bb322ea83ce4cf9b4d4"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_dec" ref="gaca47ff94f05c2bb322ea83ce4cf9b4d4" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_dec </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the DEC </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00191">191</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga1971ab60e27df384b5fd533461e7356f"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_dit" ref="ga1971ab60e27df384b5fd533461e7356f" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_dit </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the DIT value </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00251">251</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga965d40d225307d5a40d697a0a532f246"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_elevation" ref="ga965d40d225307d5a40d697a0a532f246" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_elevation </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the telescope altitude </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00489">489</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5161743d5b650a637d543959b5bd54ea"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_extname" ref="ga5161743d5b650a637d543959b5bd54ea" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_pfits_get_extname </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the extname </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00203">203</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>, and <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga3ad06f5c4dea6ec8adcc437e7f9f5501"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_filter" ref="ga3ad06f5c4dea6ec8adcc437e7f9f5501" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_pfits_get_filter </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out which wave band is active </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00455">455</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga1cd57f592c68d5e084ee049bdbe979a4"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_focus" ref="ga1cd57f592c68d5e084ee049bdbe979a4" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_focus </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the focus position of M2 </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00477">477</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga643c35f35f7f49a3e1c6bafd022e364a"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_humidity_level" ref="ga643c35f35f7f49a3e1c6bafd022e364a" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_humidity_level </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the humidity level </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00085">85</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga509576593bbfc282745eae7d29a89102"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_naxis1" ref="ga509576593bbfc282745eae7d29a89102" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_pfits_get_naxis1 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the number of pixels in axis 1. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00299">299</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__utils_8c_source.html#l00837">hawki_detectors_locate_star()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaabcefe7bbad8cb43ad652970057d0356"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_naxis2" ref="gaabcefe7bbad8cb43ad652970057d0356" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_pfits_get_naxis2 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the number of pixels in axis 2. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00311">311</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__utils_8c_source.html#l00837">hawki_detectors_locate_star()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga7c2b338fdf41bdeb1149b60af82c0788"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_ndit" ref="ga7c2b338fdf41bdeb1149b60af82c0788" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_pfits_get_ndit </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the NDIT value </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00263">263</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga0d1ccf97334b28566b2bc8fe17786190"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_ndsamples" ref="ga0d1ccf97334b28566b2bc8fe17786190" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_pfits_get_ndsamples </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the NDSAMPLES value </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00275">275</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gae157c2c48d5b4e41ffafef1348c939d2"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_nexp" ref="gae157c2c48d5b4e41ffafef1348c939d2" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_pfits_get_nexp </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the NEXP value </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00239">239</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaa400a879086340c841865fc6c2a1cc21"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_obs_seeing_end" ref="gaa400a879086340c841865fc6c2a1cc21" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_obs_seeing_end </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the observatory seeing at end </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00621">621</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gae005518fe79a76ee9b1cea2c3403a259"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_obs_seeing_start" ref="gae005518fe79a76ee9b1cea2c3403a259" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_obs_seeing_start </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the observatory seeing at start </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00609">609</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gae4c54267b67c5efdcf93afb99ecaeb3b"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_obs_temp" ref="gae4c54267b67c5efdcf93afb99ecaeb3b" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_obs_temp </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the ambient temperatur </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00537">537</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga3465a5cbb9e21e8cbd7680affc75355b"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_parangle_end" ref="ga3465a5cbb9e21e8cbd7680affc75355b" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_parangle_end </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the paralactic angle at start </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00669">669</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga2dc1b31621ecbeec49d3e390ad601274"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_parangle_start" ref="ga2dc1b31621ecbeec49d3e390ad601274" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_parangle_start </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the paralactic angle at start </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00657">657</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga79c432e5ab5585c45472cfa86b2d146b"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_pixscale" ref="ga79c432e5ab5585c45472cfa86b2d146b" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_pixscale </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the pixel scale </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00287">287</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga88a2db02738f3881bad0e2bde2768951"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_posangle" ref="ga88a2db02738f3881bad0e2bde2768951" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_posangle </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the position angle </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00443">443</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga11eecff7f4c8031ff6ea929e15c20813"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_pressure_end" ref="ga11eecff7f4c8031ff6ea929e15c20813" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_pressure_end </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the observatory atmospheric pressure at end </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00645">645</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga87d6ba1cd310181f2eab02fc4688bad4"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_pressure_start" ref="ga87d6ba1cd310181f2eab02fc4688bad4" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_pressure_start </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the observatory atmospheric pressure at start </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00633">633</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gad9c95c0d3bc75d347bf9acbcb8fe549d"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_procatg" ref="gad9c95c0d3bc75d347bf9acbcb8fe549d" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_pfits_get_procatg </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the PRO.CATG </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00097">97</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga6f490d48a329331dc3b1bc48c1e9ed1d"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_ra" ref="ga6f490d48a329331dc3b1bc48c1e9ed1d" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_ra </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the RA </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00179">179</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gafc9299ed697db3ecfd1bb4c7e548cf3b"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_relhum" ref="gafc9299ed697db3ecfd1bb4c7e548cf3b" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_relhum </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the relative humidity </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00513">513</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gac8b9879cdc3c2e82f3b169eef3355ef2"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_rotator_end" ref="gac8b9879cdc3c2e82f3b169eef3355ef2" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_rotator_end </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the absolute rotator position at end </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00597">597</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaa91a5e47c4661209f97f4399cbceb9d2"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_rotator_start" ref="gaa91a5e47c4661209f97f4399cbceb9d2" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_rotator_start </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the absolute rotator position at start </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00585">585</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga36892dc77006059ba553e9a98c9b55fc"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_targ_alpha" ref="ga36892dc77006059ba553e9a98c9b55fc" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_targ_alpha </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the target RA </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value in degrees</dd></dl>
+<p>This function decodifies the returned value, since it is in HHMMSS.SS </p>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00111">111</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga0330c53376304376257417ea4edbee5c"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_targ_delta" ref="ga0330c53376304376257417ea4edbee5c" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_targ_delta </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the target DEC </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value in degrees</dd></dl>
+<p>This function decodifies the returned value, since it is in DDMMSS.SS </p>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00133">133</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga07110c618d0772882174838d8ce9a168"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_targ_epoch" ref="ga07110c618d0772882174838d8ce9a168" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_targ_epoch </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the target epoch </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value in years </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00167">167</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga662be8ce410cbfa244f51ec8e5f0baad"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_targ_equinox" ref="ga662be8ce410cbfa244f51ec8e5f0baad" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_targ_equinox </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the target equinox </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value in years </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00154">154</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaab1203aaa32935d1e81db6bb0aeec96b"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_tau0" ref="gaab1203aaa32935d1e81db6bb0aeec96b" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_tau0 </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the average coherence time </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00525">525</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga7bd674c51f4cd62ce34c208888cea125"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_wind_dir" ref="ga7bd674c51f4cd62ce34c208888cea125" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_wind_dir </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the wind direction </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00549">549</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga45e0b30ba22df26f4d061dee26735708"></a><!-- doxytag: member="hawki_pfits.c::hawki_pfits_get_wind_speed" ref="ga45e0b30ba22df26f4d061dee26735708" args="(const cpl_propertylist *plist)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_pfits_get_wind_speed </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>plist</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>find out the wind speed </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">plist</td><td>property list to read from </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the requested value </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__pfits_8c_source.html#l00561">561</a> of file <a class="el" href="hawki__pfits_8c_source.html">hawki_pfits.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__properties__tel_8c_source.html#l00188">hawki_extract_prop_tel_qc()</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__properties__tel.html b/html/group__hawki__properties__tel.html
new file mode 100644
index 0000000..d5cf6fe
--- /dev/null
+++ b/html/group__hawki__properties__tel.html
@@ -0,0 +1,132 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Manipulates QC keywords from the telescope</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Manipulates QC keywords from the telescope</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__properties__tel.html#gaedbe52365a410453e02d6b36d9d1b612">hawki_extract_prop_tel_qc</a> (const cpl_propertylist *all_property_list, cpl_table *telescope_prop, int irow)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extracts all the QC keywords and append them to the table. <a href="#gaedbe52365a410453e02d6b36d9d1b612"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__properties__tel.html#ga2895d7c995564a2bbbdcab5c195cfac9">hawki_prop_tel_initialize</a> (cpl_table *telescope_prop)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize the table with all the telescope data columns. <a href="#ga2895d7c995564a2bbbdcab5c195cfac9"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="gaedbe52365a410453e02d6b36d9d1b612"></a><!-- doxytag: member="hawki_properties_tel.c::hawki_extract_prop_tel_qc" ref="gaedbe52365a410453e02d6b36d9d1b612" args="(const cpl_propertylist *all_property_list, cpl_table *telescope_prop, int irow)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_extract_prop_tel_qc </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>all_property_list</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">cpl_table * </td>
+ <td class="paramname"><em>telescope_prop</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>irow</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Extracts all the QC keywords and append them to the table. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">all_property_list</td><td>The list of all the properties from the header </td></tr>
+ <tr><td class="paramname">telescope_prop</td><td>Table with the telescope QC data. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>The function gets the following keywords from the propertylist: TEL.ALT, TEL.AZ, TEL.AMBI.RHUM, TEl.AMBI.TAU0, TEL.AMBI.TEMP, TEL.AMBI.WINDDIR, TEL.AMBI.WINDSP, TEL.IA.FWHM, SEQ.CUMOFFSETA, SEQ.CUMOFFSETD, SEQ.CUMOFFSETX, SEQ.CUMOFFSETY It also computes the following extra keywords: ADA.ABSROT.DELTA = ADA.ABSROT.END - ADA.ABSROT.START TEL.AIRM = (TEL.AIRM.START + TEL.AIRM.END) / 2.0 TEL AMBI FWHM = (TEL.AMBI.FHWM.START + TEL.AMBI.FWHM.END) / 2.0 TEL.AMBI.PRES = (TEL.AMBI.PRES.START + [...]
+<p>All these keywords (including the *.START and *.END) are appended in the telescope_prop table, using the column names stated in <a class="el" href="hawki__dfs_8h_source.html">hawki_dfs.h</a> </p>
+
+<p>Definition at line <a class="el" href="hawki__properties__tel_8c_source.html#l00188">188</a> of file <a class="el" href="hawki__properties__tel_8c_source.html">hawki_properties_tel.c</a>.</p>
+
+<p>References <a class="el" href="hawki__pfits_8c_source.html#l00073">hawki_pfits_get_airmass_end()</a>, <a class="el" href="hawki__pfits_8c_source.html#l00061">hawki_pfits_get_airmass_start()</a>, <a class="el" href="hawki__pfits_8c_source.html#l00573">hawki_pfits_get_ao_fwhm()</a>, <a class="el" href="hawki__pfits_8c_source.html#l00501">hawki_pfits_get_azimut()</a>, <a class="el" href="hawki__pfits_8c_source.html#l00395">hawki_pfits_get_cumoffseta()</a>, <a class="el" href="hawki__pfit [...]
+
+</div>
+</div>
+<a class="anchor" id="ga2895d7c995564a2bbbdcab5c195cfac9"></a><!-- doxytag: member="hawki_properties_tel.c::hawki_prop_tel_initialize" ref="ga2895d7c995564a2bbbdcab5c195cfac9" args="(cpl_table *telescope_prop)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_prop_tel_initialize </td>
+ <td>(</td>
+ <td class="paramtype">cpl_table * </td>
+ <td class="paramname"><em>telescope_prop</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Initialize the table with all the telescope data columns. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">telescope_prop</td><td>Table with the telescope QC data. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
+<p>This function creates the following columns in the given table: TEL.ALT, TEL.AZ, TEL.AMBI.RHUM, TEl.AMBI.TAU0, TEL.AMBI.TEMP, TEL.AMBI.WINDDIR, TEL.AMBI.WINDSP, TEL.IA.FWHM, SEQ.CUMOFFSETA, SEQ.CUMOFFSETD, SEQ.CUMOFFSETX, SEQ.CUMOFFSETY ADA.ABSROT.DELTA, ADA.ABSROT.END, ADA.ABSROT.START TEL.AIRM, TEL.AIRM.START, TEL.AIRM.END TEL AMBI FWHM, TEL.AMBI.FHWM.START, TEL.AMBI.FWHM.END TEL.AMBI.PRES, TEL.AMBI.PRES.START, TEL.AMBI.PRES.END TEL.PARANG, TEL.PARANG.START, TEL.PARANG.END TEL.PARAN [...]
+
+<p>Definition at line <a class="el" href="hawki__properties__tel_8c_source.html#l00072">72</a> of file <a class="el" href="hawki__properties__tel_8c_source.html">hawki_properties_tel.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__save.html b/html/group__hawki__save.html
new file mode 100644
index 0000000..cda4ce7
--- /dev/null
+++ b/html/group__hawki__save.html
@@ -0,0 +1,620 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Saving related functions</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Saving related functions</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#ga7dd654e4062ef0cf42274ebf274f0089">hawki_distortion_save</a> (cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const hawki_distortion **distortion, const char *recipe, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename_x, const char *filename_y)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Save a HAWKI_NB_DETECTORS extensions HAWKI distortion images. <a href="#ga7dd654e4062ef0cf42274ebf274f0089"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536">hawki_get_extref_file</a> (const cpl_frameset *frameset)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Locate a filename where the extension <--> chip id relation can be derived. <a href="#gab9a3907dcbad413de986ee2e286a6536"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc">hawki_image_ext_save</a> (const cpl_frameset *allframes, const cpl_image *image, int iext, const cpl_propertylist *ext_prop_list, const char *filename)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Save an image into a given extension. <a href="#gab2873c1ec09ba834aaa284f003bc6acc"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d">hawki_imagelist_save</a> (cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_imagelist *images, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Save a HAWKI_NB_DETECTORS extensions HAWKI image. <a href="#ga98c1ab4685617ddf7ea51d6e1337695d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4">hawki_images_save</a> (cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_image **images, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Save a HAWKI_NB_DETECTORS extensions HAWKI image. <a href="#ga096962e65c0aab2bce1e9b2419789bd4"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54">hawki_main_header_save</a> (cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const char *filename)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Save a main header and prepare it to store additional data units later on. <a href="#gaebd68d7422dd13901e999db3c951bd54"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9">hawki_tables_save</a> (cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_table **tables, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Save a HAWKI_NB_DETECTORS extensions HAWKI table. <a href="#ga6c4661fb9fa1fe2e8335f2ebb4deeab9"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga7dd654e4062ef0cf42274ebf274f0089"></a><!-- doxytag: member="hawki_save.c::hawki_distortion_save" ref="ga7dd654e4062ef0cf42274ebf274f0089" args="(cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const hawki_distortion **distortion, const char *recipe, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename_x, const char *filename_y)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_distortion_save </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>allframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_parameterlist * </td>
+ <td class="paramname"><em>parlist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>usedframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const hawki_distortion ** </td>
+ <td class="paramname"><em>distortion</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>recipe</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>applist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist ** </td>
+ <td class="paramname"><em>applists</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename_y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Save a HAWKI_NB_DETECTORS extensions HAWKI distortion images. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">allframes</td><td>The list of input frames for the recipe </td></tr>
+ <tr><td class="paramname">parlist</td><td>The list of input parameters </td></tr>
+ <tr><td class="paramname">usedframes</td><td>The list of raw/calibration frames used for this product </td></tr>
+ <tr><td class="paramname">distortion</td><td>The distortion to save </td></tr>
+ <tr><td class="paramname">recipe</td><td>The recipe name </td></tr>
+ <tr><td class="paramname">procat</td><td>The product category tag </td></tr>
+ <tr><td class="paramname">protype</td><td>The product type tag </td></tr>
+ <tr><td class="paramname">applist</td><td>Optional propertylist to append to primary header or NULL </td></tr>
+ <tr><td class="paramname">applists</td><td>Optional propertylists to append to ext headers or NULL </td></tr>
+ <tr><td class="paramname">pipe_id</td><td>PACKAGE "/" PACKAGE_VERSION </td></tr>
+ <tr><td class="paramname">filename_x</td><td>Filename for distortion image in X </td></tr>
+ <tr><td class="paramname">filename_y</td><td>Filename for distortion image in Y </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case</dd></dl>
+<p>This function allows to store images of different sizes in the extensions </p>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00514">514</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>, and <a class="el" href="hawki__save_8c_source.html#l00656">hawki_get_extref_file()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gab9a3907dcbad413de986ee2e286a6536"></a><!-- doxytag: member="hawki_save.c::hawki_get_extref_file" ref="gab9a3907dcbad413de986ee2e286a6536" args="(const cpl_frameset *frameset)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_get_extref_file </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>frameset</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Locate a filename where the extension <--> chip id relation can be derived. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frameset</td><td>A frameset where a suitable frame can be extracted. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The filename if ok. NULL otherwise</dd></dl>
+<p>This function will get the first frame with four extensions that is part of the RAW group. </p>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00656">656</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__save_8c_source.html#l00514">hawki_distortion_save()</a>, <a class="el" href="hawki__save_8c_source.html#l00227">hawki_image_ext_save()</a>, <a class="el" href="hawki__save_8c_source.html#l00072">hawki_imagelist_save()</a>, <a class="el" href="hawki__save_8c_source.html#l00302">hawki_images_save()</a>, and <a class="el" href="hawki__save_8c_source.html#l00406">hawki_tables_save()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gab2873c1ec09ba834aaa284f003bc6acc"></a><!-- doxytag: member="hawki_save.c::hawki_image_ext_save" ref="gab2873c1ec09ba834aaa284f003bc6acc" args="(const cpl_frameset *allframes, const cpl_image *image, int iext, const cpl_propertylist *ext_prop_list, const char *filename)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_image_ext_save </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>allframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>image</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>iext</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>ext_prop_list</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Save an image into a given extension. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>1 if ok. -1 otherwise</dd></dl>
+<p>Extension iext means the main extension. For HAWK-I, iext should run from 1 to HAWKI_NB_DETECTORS </p>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00227">227</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>, and <a class="el" href="hawki__save_8c_source.html#l00656">hawki_get_extref_file()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga98c1ab4685617ddf7ea51d6e1337695d"></a><!-- doxytag: member="hawki_save.c::hawki_imagelist_save" ref="ga98c1ab4685617ddf7ea51d6e1337695d" args="(cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_imagelist *images, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_imagelist_save </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>allframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_parameterlist * </td>
+ <td class="paramname"><em>parlist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>usedframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_imagelist * </td>
+ <td class="paramname"><em>images</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>recipe</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>procat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>protype</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>applist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist ** </td>
+ <td class="paramname"><em>applists</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Save a HAWKI_NB_DETECTORS extensions HAWKI image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">allframes</td><td>The list of input frames for the recipe </td></tr>
+ <tr><td class="paramname">parlist</td><td>The list of input parameters </td></tr>
+ <tr><td class="paramname">usedframes</td><td>The list of raw/calibration frames used for this product </td></tr>
+ <tr><td class="paramname">images</td><td>The image list to be saved </td></tr>
+ <tr><td class="paramname">recipe</td><td>The recipe name </td></tr>
+ <tr><td class="paramname">procat</td><td>The product category tag </td></tr>
+ <tr><td class="paramname">protype</td><td>The product type tag </td></tr>
+ <tr><td class="paramname">applist</td><td>Optional propertylist to append to primary header or NULL </td></tr>
+ <tr><td class="paramname">applists</td><td>Optional propertylists to append to ext headers or NULL </td></tr>
+ <tr><td class="paramname">pipe_id</td><td>PACKAGE "/" PACKAGE_VERSION </td></tr>
+ <tr><td class="paramname">filename</td><td>Filename </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00072">72</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>, and <a class="el" href="hawki__save_8c_source.html#l00656">hawki_get_extref_file()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga096962e65c0aab2bce1e9b2419789bd4"></a><!-- doxytag: member="hawki_save.c::hawki_images_save" ref="ga096962e65c0aab2bce1e9b2419789bd4" args="(cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_image **images, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_images_save </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>allframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_parameterlist * </td>
+ <td class="paramname"><em>parlist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>usedframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_image ** </td>
+ <td class="paramname"><em>images</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>recipe</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>procat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>protype</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>applist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist ** </td>
+ <td class="paramname"><em>applists</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Save a HAWKI_NB_DETECTORS extensions HAWKI image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">allframes</td><td>The list of input frames for the recipe </td></tr>
+ <tr><td class="paramname">parlist</td><td>The list of input parameters </td></tr>
+ <tr><td class="paramname">usedframes</td><td>The list of raw/calibration frames used for this product </td></tr>
+ <tr><td class="paramname">images</td><td>The images to be saved </td></tr>
+ <tr><td class="paramname">recipe</td><td>The recipe name </td></tr>
+ <tr><td class="paramname">procat</td><td>The product category tag </td></tr>
+ <tr><td class="paramname">protype</td><td>The product type tag </td></tr>
+ <tr><td class="paramname">applist</td><td>Optional propertylist to append to primary header or NULL </td></tr>
+ <tr><td class="paramname">applists</td><td>Optional propertylists to append to ext headers or NULL </td></tr>
+ <tr><td class="paramname">pipe_id</td><td>PACKAGE "/" PACKAGE_VERSION </td></tr>
+ <tr><td class="paramname">filename</td><td>Filename </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case</dd></dl>
+<p>This function allows to store images of different sizes in the extensions </p>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00302">302</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>, and <a class="el" href="hawki__save_8c_source.html#l00656">hawki_get_extref_file()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaebd68d7422dd13901e999db3c951bd54"></a><!-- doxytag: member="hawki_save.c::hawki_main_header_save" ref="gaebd68d7422dd13901e999db3c951bd54" args="(cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const char *filename)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_main_header_save </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>allframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_parameterlist * </td>
+ <td class="paramname"><em>parlist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>usedframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>recipe</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>procat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>protype</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>applist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Save a main header and prepare it to store additional data units later on. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">allframes</td><td>The list of input frames for the recipe </td></tr>
+ <tr><td class="paramname">parlist</td><td>The list of input parameters </td></tr>
+ <tr><td class="paramname">usedframes</td><td>The list of raw/calibration frames used for this product </td></tr>
+ <tr><td class="paramname">images</td><td>The image list to be saved </td></tr>
+ <tr><td class="paramname">recipe</td><td>The recipe name </td></tr>
+ <tr><td class="paramname">procat</td><td>The product category tag </td></tr>
+ <tr><td class="paramname">protype</td><td>The product type tag </td></tr>
+ <tr><td class="paramname">applist</td><td>Optional propertylist to append to primary header or NULL </td></tr>
+ <tr><td class="paramname">pipe_id</td><td>PACKAGE "/" PACKAGE_VERSION </td></tr>
+ <tr><td class="paramname">filename</td><td>Filename </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00178">178</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga6c4661fb9fa1fe2e8335f2ebb4deeab9"></a><!-- doxytag: member="hawki_save.c::hawki_tables_save" ref="ga6c4661fb9fa1fe2e8335f2ebb4deeab9" args="(cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_table **tables, const char *recipe, const char *procat, const char *protype, const cpl_propertylist *applist, const cpl_propertylist **applists, const char *filename)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_tables_save </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>allframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_parameterlist * </td>
+ <td class="paramname"><em>parlist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>usedframes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_table ** </td>
+ <td class="paramname"><em>tables</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>recipe</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>procat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>protype</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist * </td>
+ <td class="paramname"><em>applist</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_propertylist ** </td>
+ <td class="paramname"><em>applists</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>filename</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Save a HAWKI_NB_DETECTORS extensions HAWKI table. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">allframes</td><td>The list of input frames for the recipe </td></tr>
+ <tr><td class="paramname">parlist</td><td>The list of input parameters </td></tr>
+ <tr><td class="paramname">usedframes</td><td>The list of raw/calibration frames used for this product </td></tr>
+ <tr><td class="paramname">tables</td><td>The table list to be saved </td></tr>
+ <tr><td class="paramname">recipe</td><td>The recipe name </td></tr>
+ <tr><td class="paramname">procat</td><td>The product category tag </td></tr>
+ <tr><td class="paramname">protype</td><td>The product type tag </td></tr>
+ <tr><td class="paramname">applist</td><td>Optional propertylist to append to primary header or NULL </td></tr>
+ <tr><td class="paramname">applists</td><td>Optional propertylists to append to ext headers or NULL </td></tr>
+ <tr><td class="paramname">pipe_id</td><td>PACKAGE "/" PACKAGE_VERSION </td></tr>
+ <tr><td class="paramname">filename</td><td>Filename </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__save_8c_source.html#l00406">406</a> of file <a class="el" href="hawki__save_8c_source.html">hawki_save.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00817">hawki_get_detector_from_ext()</a>, and <a class="el" href="hawki__save_8c_source.html#l00656">hawki_get_extref_file()</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__utils.html b/html/group__hawki__utils.html
new file mode 100644
index 0000000..c7363d5
--- /dev/null
+++ b/html/group__hawki__utils.html
@@ -0,0 +1,1053 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Miscellaneous Utilities</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Miscellaneous Utilities</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gaa24cf39f777ab8389419b3d18a8bec96">hawki_apply_harmonization</a> (cpl_imagelist *in, double h1, double h2, double h3, double h4)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the harmonization. <a href="#gaa24cf39f777ab8389419b3d18a8bec96"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga292d87e3996e9bb4331980a41d8b45bb">hawki_compute_darkbpm</a> (const cpl_image *in, double sigma)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the bpm from the dark (hot pixels) <a href="#ga292d87e3996e9bb4331980a41d8b45bb"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga5d0deca1786f42488784c23e361d0877">hawki_compute_flatbpm</a> (const cpl_image *in, double sigma, double lowval, double highval)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the bpm from the flat (aka cold pixels mask) <a href="#ga5d0deca1786f42488784c23e361d0877"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga367515ebe3345fcd79c2849879633ebf">hawki_compute_harmonization</a> (const cpl_imagelist *in, double *h1, double *h2, double *h3, double *h4, double *h)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the harmonization. <a href="#ga367515ebe3345fcd79c2849879633ebf"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga49279015ecc6c4dcc6a00de6ed6109bd">hawki_compute_lsbg</a> (const cpl_image *in)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the large scale background. <a href="#ga49279015ecc6c4dcc6a00de6ed6109bd"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga024bd2557115d5d7d3265dbcbb3b1884">hawki_detectors_labelise</a> (const cpl_frameset *in)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the frames in which the star is for a given chip. <a href="#ga024bd2557115d5d7d3265dbcbb3b1884"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gabee84f3ed597df9a6ae97f07fc2204a0">hawki_detectors_locate_star</a> (const cpl_frameset *in, double star_ra, double star_dec, int *labels)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the frames in which the star is for a given chip. <a href="#gabee84f3ed597df9a6ae97f07fc2204a0"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9">hawki_extract_first_filename</a> (const cpl_frameset *in, const char *tag)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Extract the filename ffor the first frame of the given tag. <a href="#ga0ee9f37ad441f9fcc16865b34f9459a9"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">hawki_band </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga6d85879fd8b8895544f7787e8a6ddade">hawki_get_band</a> (const char *f)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the band. <a href="#ga6d85879fd8b8895544f7787e8a6ddade"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_bivector * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd">hawki_get_header_tel_offsets</a> (const cpl_frameset *fset)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the nominal header offsets from a set of frames. <a href="#ga4c2e0ffe688ffdfd93f0d61c60ac91fd"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a">hawki_get_license</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the pipeline copyright and license. <a href="#gafde011eb3e31e78d4d01cc9c26e2d33a"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga7b165e9e91b6c6519595109b36d4fb46">hawki_get_mean_airmass</a> (cpl_frameset *set)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the mean airmass for a set of frames. <a href="#ga7b165e9e91b6c6519595109b36d4fb46"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga4e8a1eeb0faaa8793bdb37b7450c33e3">hawki_get_version</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the version of the pipeline. <a href="#ga4e8a1eeb0faaa8793bdb37b7450c33e3"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_error_code </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga8ad7002b08a8f9dff942f46b3f3456f0">hawki_image_inverse_threshold</a> (cpl_image *image_in, double lo_valid, double hi_valid, double assign_in_range, double assign_out_range)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Create an image with a given value for pixels within a range and another value for pixels outside that range. <a href="#ga8ad7002b08a8f9dff942f46b3f3456f0"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga7f6d3694df0e3a441b20267a1e5894db">hawki_images_stitch</a> (cpl_image **ima, double *x, double *y)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the stitching. <a href="#ga7f6d3694df0e3a441b20267a1e5894db"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566">hawki_print_banner</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Issue a banner with the pipeline version. <a href="#gadfbb9f93a998ca86bbe90dbf808e5566"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4">hawki_std_band_name</a> (hawki_band band)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Return a band name. <a href="#ga49b3f45aa7c812c0a90faf073998dbc4"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga4c041169d43f161a8c9d7f23d7fc57a7">hawki_utils_check_equal_double_keys</a> (cpl_frameset *frames, double(*func)(const cpl_propertylist *))</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Check that all the frames share the same value of a given keyword. <a href="#ga4c041169d43f161a8c9d7f23d7fc57a7"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663">hawki_utils_check_equal_int_keys</a> (cpl_frameset *frames, int(*func)(const cpl_propertylist *))</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Check that all the frames share the same value of a given keyword. <a href="#ga8c1508e389b7fd0da8fbda451ffd1663"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6">hawki_utils_dec2str</a> (char *str, int length_str, double dec)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2str from file libwcs/ang2str.c in wcstools library (<a href="http://tdc-www.harvard.edu/wcstools/">http://tdc-www.harvard.edu/wcstools/</a>) <a href="#ga38bbbd4f8537d1cab5cfba056bd8edf6"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3">hawki_utils_ra2str</a> (char *str, int length_str, double ra)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (<a href="http://tdc-www.harvard.edu/wcstools/">http://tdc-www.harvard.edu/wcstools/</a>) <a href="#gaa6f925bb6e5320dcd0f06ad5238813b3"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gaba8fca8aa585fed96efc75545bfc6b04">hawki_vector_get_max_select</a> (const cpl_vector *self, const cpl_vector *valid)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the maximum value of a vector according to an array of flags. <a href="#gaba8fca8aa585fed96efc75545bfc6b04"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#ga29ae7b4052fd284d8b01f33e127c2846">hawki_vector_get_min_select</a> (const cpl_vector *self, const cpl_vector *valid)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the minimum value of a vector according to an array of flags. <a href="#ga29ae7b4052fd284d8b01f33e127c2846"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__utils.html#gac64c154f22c4d25e242833fbe75da886">hawki_vector_get_mode</a> (cpl_vector *vec)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the histogram mode. <a href="#gac64c154f22c4d25e242833fbe75da886"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="gaa24cf39f777ab8389419b3d18a8bec96"></a><!-- doxytag: member="hawki_utils.c::hawki_apply_harmonization" ref="gaa24cf39f777ab8389419b3d18a8bec96" args="(cpl_imagelist *in, double h1, double h2, double h3, double h4)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_apply_harmonization </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>h1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>h2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>h3</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>h4</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the harmonization. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>the input images </td></tr>
+ <tr><td class="paramname">h1</td><td>the factor to apply to chip 1 </td></tr>
+ <tr><td class="paramname">h2</td><td>the factor to apply to chip 2 </td></tr>
+ <tr><td class="paramname">h3</td><td>the factor to apply to chip 3 </td></tr>
+ <tr><td class="paramname">h4</td><td>the factor to apply to chip 4 </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 otherwise </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00384">384</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga292d87e3996e9bb4331980a41d8b45bb"></a><!-- doxytag: member="hawki_utils.c::hawki_compute_darkbpm" ref="ga292d87e3996e9bb4331980a41d8b45bb" args="(const cpl_image *in, double sigma)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_compute_darkbpm </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>sigma</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the bpm from the dark (hot pixels) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>the input image </td></tr>
+ <tr><td class="paramname">sigma</td><td>the sigma for the threshold </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The bad pixels map </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00119">119</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga5d0deca1786f42488784c23e361d0877"></a><!-- doxytag: member="hawki_utils.c::hawki_compute_flatbpm" ref="ga5d0deca1786f42488784c23e361d0877" args="(const cpl_image *in, double sigma, double lowval, double highval)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_compute_flatbpm </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>sigma</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>lowval</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>highval</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the bpm from the flat (aka cold pixels mask) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>the input image </td></tr>
+ <tr><td class="paramname">sigma</td><td>the sigma for the threshold </td></tr>
+ <tr><td class="paramname">lowval</td><td>the lower value for the threshold </td></tr>
+ <tr><td class="paramname">highval</td><td>the upper value for the threshold </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The bad pixels map</dd></dl>
+<p>This function creates a mask of pixels below and above a certain limit (lowval, highval) and pixels a certain number of sigmas (sigma) above the background (which is obtained smoothing with a 3x3 kernel the input image). </p>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00164">164</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>References <a class="el" href="hawki__utils_8c_source.html#l00241">hawki_image_inverse_threshold()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga367515ebe3345fcd79c2849879633ebf"></a><!-- doxytag: member="hawki_utils.c::hawki_compute_harmonization" ref="ga367515ebe3345fcd79c2849879633ebf" args="(const cpl_imagelist *in, double *h1, double *h2, double *h3, double *h4, double *h)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_compute_harmonization </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_imagelist * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>h1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>h2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>h3</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>h4</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>h</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the harmonization. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>the input images </td></tr>
+ <tr><td class="paramname">h1</td><td>the factor to apply to chip 1 </td></tr>
+ <tr><td class="paramname">h2</td><td>the factor to apply to chip 2 </td></tr>
+ <tr><td class="paramname">h3</td><td>the factor to apply to chip 3 </td></tr>
+ <tr><td class="paramname">h4</td><td>the factor to apply to chip 4 </td></tr>
+ <tr><td class="paramname">h</td><td>the general factor </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if ok, -1 otherwise</dd></dl>
+<p>chip3 | | chip4 ------ ------ ------ ------ chip1 | |chip2</p>
+<p>the edges averages avgi of all chips i are computed -> h=avg(avgi) hi = h/avgi </p>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00422">422</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga49279015ecc6c4dcc6a00de6ed6109bd"></a><!-- doxytag: member="hawki_utils.c::hawki_compute_lsbg" ref="ga49279015ecc6c4dcc6a00de6ed6109bd" args="(const cpl_image *in)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_compute_lsbg </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>in</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the large scale background. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">the</td><td>input image </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The background or NULL in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00531">531</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga024bd2557115d5d7d3265dbcbb3b1884"></a><!-- doxytag: member="hawki_utils.c::hawki_detectors_labelise" ref="ga024bd2557115d5d7d3265dbcbb3b1884" args="(const cpl_frameset *in)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int* hawki_detectors_labelise </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>in</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the frames in which the star is for a given chip. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>the input frameset </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The newly allocated frameset</dd></dl>
+<p>The signs of the header offsets in x and y are used:</p>
+<ul>
+<li>and - -> chip 1 + and - -> chip 2 + and + -> chip 3</li>
+<li>and + -> chip 4 </li>
+</ul>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00782">782</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>References <a class="el" href="hawki__utils_8c_source.html#l00695">hawki_get_header_tel_offsets()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gabee84f3ed597df9a6ae97f07fc2204a0"></a><!-- doxytag: member="hawki_utils.c::hawki_detectors_locate_star" ref="gabee84f3ed597df9a6ae97f07fc2204a0" args="(const cpl_frameset *in, double star_ra, double star_dec, int *labels)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_detectors_locate_star </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>star_ra</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>star_dec</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>labels</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the frames in which the star is for a given chip. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>the input frameset </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The newly allocated frameset </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00837">837</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>References <a class="el" href="hawki__load_8c_source.html#l00846">hawki_get_ext_from_detector()</a>, <a class="el" href="hawki__pfits_8c_source.html#l00299">hawki_pfits_get_naxis1()</a>, and <a class="el" href="hawki__pfits_8c_source.html#l00311">hawki_pfits_get_naxis2()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga0ee9f37ad441f9fcc16865b34f9459a9"></a><!-- doxytag: member="hawki_utils.c::hawki_extract_first_filename" ref="ga0ee9f37ad441f9fcc16865b34f9459a9" args="(const cpl_frameset *in, const char *tag)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_extract_first_filename </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>tag</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Extract the filename ffor the first frame of the given tag. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">in</td><td>A non-empty frameset </td></tr>
+ <tr><td class="paramname">tag</td><td>The tag of the requested file </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>Pointer to the file </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00639">639</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga6d85879fd8b8895544f7787e8a6ddade"></a><!-- doxytag: member="hawki_utils.c::hawki_get_band" ref="ga6d85879fd8b8895544f7787e8a6ddade" args="(const char *f)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">hawki_band hawki_get_band </td>
+ <td>(</td>
+ <td class="paramtype">const char * </td>
+ <td class="paramname"><em>f</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the band. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">f</td><td>the filter name from the header </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the band </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00657">657</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga4c2e0ffe688ffdfd93f0d61c60ac91fd"></a><!-- doxytag: member="hawki_utils.c::hawki_get_header_tel_offsets" ref="ga4c2e0ffe688ffdfd93f0d61c60ac91fd" args="(const cpl_frameset *fset)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_bivector* hawki_get_header_tel_offsets </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_frameset * </td>
+ <td class="paramname"><em>fset</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the nominal header offsets from a set of frames. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">fset</td><td>the set of frames </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The offsets in a bivector or NULL in error case</dd></dl>
+<p>The offsets returned are the telescope offsets, a mirror transformation must be performed to use them in as the image offsets, which is the cpl convention. </p>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00695">695</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>References <a class="el" href="hawki__pfits_8c_source.html#l00419">hawki_pfits_get_cumoffsetx()</a>, and <a class="el" href="hawki__pfits_8c_source.html#l00431">hawki_pfits_get_cumoffsety()</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__utils_8c_source.html#l00782">hawki_detectors_labelise()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gafde011eb3e31e78d4d01cc9c26e2d33a"></a><!-- doxytag: member="hawki_utils.c::hawki_get_license" ref="gafde011eb3e31e78d4d01cc9c26e2d33a" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_get_license </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the pipeline copyright and license. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The copyright and license string</dd></dl>
+<p>The function returns a pointer to the statically allocated license string. This string should not be modified using the returned pointer. </p>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00065">65</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga7b165e9e91b6c6519595109b36d4fb46"></a><!-- doxytag: member="hawki_utils.c::hawki_get_mean_airmass" ref="ga7b165e9e91b6c6519595109b36d4fb46" args="(cpl_frameset *set)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_get_mean_airmass </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>set</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Get the mean airmass for a set of frames. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">set</td><td>the input frame set </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The mean airmass of all the input frames. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00740">740</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>References <a class="el" href="hawki__pfits_8c_source.html#l00073">hawki_pfits_get_airmass_end()</a>, and <a class="el" href="hawki__pfits_8c_source.html#l00061">hawki_pfits_get_airmass_start()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga4e8a1eeb0faaa8793bdb37b7450c33e3"></a><!-- doxytag: member="hawki_utils.c::hawki_get_version" ref="ga4e8a1eeb0faaa8793bdb37b7450c33e3" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_get_version </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Returns the version of the pipeline. </p>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00106">106</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__utils_8c_source.html#l00093">hawki_print_banner()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga8ad7002b08a8f9dff942f46b3f3456f0"></a><!-- doxytag: member="hawki_utils.c::hawki_image_inverse_threshold" ref="ga8ad7002b08a8f9dff942f46b3f3456f0" args="(cpl_image *image_in, double lo_valid, double hi_valid, double assign_in_range, double assign_out_range)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_error_code hawki_image_inverse_threshold </td>
+ <td>(</td>
+ <td class="paramtype">cpl_image * </td>
+ <td class="paramname"><em>image_in</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>lo_valid</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>hi_valid</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>assign_in_range</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>assign_out_range</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Create an image with a given value for pixels within a range and another value for pixels outside that range. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image_in</td><td>Image to threshold. </td></tr>
+ <tr><td class="paramname">lo_valid</td><td>Lower bound of the valid range </td></tr>
+ <tr><td class="paramname">hi_valid</td><td>Higher bound of the valid range </td></tr>
+ <tr><td class="paramname">assign_in_range</td><td>Value to assign to pixels within valid range </td></tr>
+ <tr><td class="paramname">assign_out_range</td><td>Value to assign to pixels outside valid range </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the #_cpl_error_code_ or CPL_ERROR_NONE</dd></dl>
+<p>Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. lo_cut must be smaller than or equal to hi_cut.</p>
+<p>Possible #_cpl_error_code_ set in this function:</p>
+<ul>
+<li>CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL</li>
+<li>CPL_ERROR_INVALID_TYPE if the passed image type is not supported</li>
+<li>CPL_ERROR_ILLEGAL_INPUT if lo_valid is greater than hi_valid </li>
+</ul>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00241">241</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__utils_8c_source.html#l00164">hawki_compute_flatbpm()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga7f6d3694df0e3a441b20267a1e5894db"></a><!-- doxytag: member="hawki_utils.c::hawki_images_stitch" ref="ga7f6d3694df0e3a441b20267a1e5894db" args="(cpl_image **ima, double *x, double *y)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_images_stitch </td>
+ <td>(</td>
+ <td class="paramtype">cpl_image ** </td>
+ <td class="paramname"><em>ima</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double * </td>
+ <td class="paramname"><em>y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Apply the stitching. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">ima</td><td>The HAWKI_NB_DETECTORS input images </td></tr>
+ <tr><td class="paramname">x</td><td>The HAWKI_NB_DETECTORS x positions </td></tr>
+ <tr><td class="paramname">y</td><td>The HAWKI_NB_DETECTORS y positions </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The stitched image or NULL in error case. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00305">305</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gadfbb9f93a998ca86bbe90dbf808e5566"></a><!-- doxytag: member="hawki_utils.c::hawki_print_banner" ref="gadfbb9f93a998ca86bbe90dbf808e5566" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void hawki_print_banner </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Issue a banner with the pipeline version. </p>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00093">93</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+<p>References <a class="el" href="hawki__utils_8c_source.html#l00106">hawki_get_version()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga49b3f45aa7c812c0a90faf073998dbc4"></a><!-- doxytag: member="hawki_utils.c::hawki_std_band_name" ref="ga49b3f45aa7c812c0a90faf073998dbc4" args="(hawki_band band)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const char* hawki_std_band_name </td>
+ <td>(</td>
+ <td class="paramtype">hawki_band </td>
+ <td class="paramname"><em>band</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Return a band name. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">band</td><td>a BB </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>1 pointer to a static band name. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00674">674</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga4c041169d43f161a8c9d7f23d7fc57a7"></a><!-- doxytag: member="hawki_utils.c::hawki_utils_check_equal_double_keys" ref="ga4c041169d43f161a8c9d7f23d7fc57a7" args="(cpl_frameset *frames, double(*func)(const cpl_propertylist *))" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_utils_check_equal_double_keys </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>frames</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double(*)(const cpl_propertylist *) </td>
+ <td class="paramname"><em>func</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Check that all the frames share the same value of a given keyword. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frames</td><td>the framset </td></tr>
+ <tr><td class="paramname">func</td><td>the function which returns the value of the kwd, given the propertylist </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>1 if all the frames have the same values. 0 elsewhere. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l01052">1052</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga8c1508e389b7fd0da8fbda451ffd1663"></a><!-- doxytag: member="hawki_utils.c::hawki_utils_check_equal_int_keys" ref="ga8c1508e389b7fd0da8fbda451ffd1663" args="(cpl_frameset *frames, int(*func)(const cpl_propertylist *))" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int hawki_utils_check_equal_int_keys </td>
+ <td>(</td>
+ <td class="paramtype">cpl_frameset * </td>
+ <td class="paramname"><em>frames</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int(*)(const cpl_propertylist *) </td>
+ <td class="paramname"><em>func</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Check that all the frames share the same value of a given keyword. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">frames</td><td>the framset </td></tr>
+ <tr><td class="paramname">func</td><td>the function which returns the value of the kwd, given the propertylist </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>1 if all the frames have the same values. 0 elsewhere. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l01089">1089</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga38bbbd4f8537d1cab5cfba056bd8edf6"></a><!-- doxytag: member="hawki_utils.c::hawki_utils_dec2str" ref="ga38bbbd4f8537d1cab5cfba056bd8edf6" args="(char *str, int length_str, double dec)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void hawki_utils_dec2str </td>
+ <td>(</td>
+ <td class="paramtype">char * </td>
+ <td class="paramname"><em>str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>length_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>dec</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2str from file libwcs/ang2str.c in wcstools library (<a href="http://tdc-www.harvard.edu/wcstools/">http://tdc-www.harvard.edu/wcstools/</a>) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">str</td><td>The string to write to </td></tr>
+ <tr><td class="paramname">length_str</td><td>The maximum lenght to write </td></tr>
+ <tr><td class="paramname">dec</td><td>The declination in degrees </td></tr>
+ </table>
+ </dd>
+</dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l01198">1198</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaa6f925bb6e5320dcd0f06ad5238813b3"></a><!-- doxytag: member="hawki_utils.c::hawki_utils_ra2str" ref="gaa6f925bb6e5320dcd0f06ad5238813b3" args="(char *str, int length_str, double ra)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void hawki_utils_ra2str </td>
+ <td>(</td>
+ <td class="paramtype">char * </td>
+ <td class="paramname"><em>str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>length_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>ra</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (<a href="http://tdc-www.harvard.edu/wcstools/">http://tdc-www.harvard.edu/wcstools/</a>) </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">str</td><td>The string to write to </td></tr>
+ <tr><td class="paramname">length_str</td><td>The maximum lenght to write </td></tr>
+ <tr><td class="paramname">ra</td><td>The right ascension in degrees </td></tr>
+ </table>
+ </dd>
+</dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l01127">1127</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gaba8fca8aa585fed96efc75545bfc6b04"></a><!-- doxytag: member="hawki_utils.c::hawki_vector_get_max_select" ref="gaba8fca8aa585fed96efc75545bfc6b04" args="(const cpl_vector *self, const cpl_vector *valid)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_vector_get_max_select </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_vector * </td>
+ <td class="paramname"><em>self</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_vector * </td>
+ <td class="paramname"><em>valid</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Gets the maximum value of a vector according to an array of flags. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">self</td><td>The input vector with the values </td></tr>
+ <tr><td class="paramname">valid</td><td>Vector of flags (>=-0.5: valid, <-0.5: invalid) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The minimum value. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00918">918</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga29ae7b4052fd284d8b01f33e127c2846"></a><!-- doxytag: member="hawki_utils.c::hawki_vector_get_min_select" ref="ga29ae7b4052fd284d8b01f33e127c2846" args="(const cpl_vector *self, const cpl_vector *valid)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_vector_get_min_select </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_vector * </td>
+ <td class="paramname"><em>self</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const cpl_vector * </td>
+ <td class="paramname"><em>valid</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Gets the minimum value of a vector according to an array of flags. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">self</td><td>The input vector with the values </td></tr>
+ <tr><td class="paramname">valid</td><td>Vector of flags (>=-0.5: valid, <-0.5: invalid) </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The minimum value. </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00952">952</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="gac64c154f22c4d25e242833fbe75da886"></a><!-- doxytag: member="hawki_utils.c::hawki_vector_get_mode" ref="gac64c154f22c4d25e242833fbe75da886" args="(cpl_vector *vec)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">double hawki_vector_get_mode </td>
+ <td>(</td>
+ <td class="paramtype">cpl_vector * </td>
+ <td class="paramname"><em>vec</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the histogram mode. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">vec</td><td>the vector </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the mode or -1 in error case </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__utils_8c_source.html#l00983">983</a> of file <a class="el" href="hawki__utils_8c_source.html">hawki_utils.c</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/group__hawki__variance.html b/html/group__hawki__variance.html
new file mode 100644
index 0000000..1fc7e0d
--- /dev/null
+++ b/html/group__hawki__variance.html
@@ -0,0 +1,189 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Variance estimation for raw images.</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">Variance estimation for raw images.</div> </div>
+</div>
+<div class="contents">
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_image * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__variance.html#ga0de4bc882b19eb5d32599f6ec2c3eecc">hawki_image_create_variance</a> (const cpl_image *image, double gain, double ron, int ndit, int ndsamples)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Create the associated variance of a raw image. <a href="#ga0de4bc882b19eb5d32599f6ec2c3eecc"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">cpl_imagelist * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hawki__variance.html#ga3077d7b2029de0416fabed98bc092818">hawki_imglist_create_variances_and_delete</a> (cpl_imagelist *imagelist_raw, double gain, double ron, int ndit, int ndsamples)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Create the associated variance of raw imagelist. <a href="#ga3077d7b2029de0416fabed98bc092818"></a><br/></td></tr>
+</table>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga0de4bc882b19eb5d32599f6ec2c3eecc"></a><!-- doxytag: member="hawki_variance.c::hawki_image_create_variance" ref="ga0de4bc882b19eb5d32599f6ec2c3eecc" args="(const cpl_image *image, double gain, double ron, int ndit, int ndsamples)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_image* hawki_image_create_variance </td>
+ <td>(</td>
+ <td class="paramtype">const cpl_image * </td>
+ <td class="paramname"><em>image</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>gain</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>ron</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ndit</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ndsamples</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Create the associated variance of a raw image. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">image</td><td>the raw image </td></tr>
+ <tr><td class="paramname">gain</td><td>the gain of the detector (e-/ADU) </td></tr>
+ <tr><td class="paramname">ron</td><td>the ron for one read of the detector (ADU) </td></tr>
+ <tr><td class="paramname">ndit</td><td>the number of total integrations. </td></tr>
+ <tr><td class="paramname">ndsamples</td><td>the number of non-destructive readouts. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The variance image if suceed. NULL elsewhere.</dd></dl>
+<p>The variance is computed with the following equation: </p>
+<p class="formulaDsp">
+<img class="formulaDsp" alt="\[ \sigma^{2}(i,j) = \frac{6 S(i,j)}{5 g n_{nds} n_{dit}} (\frac{n_{nds}^{2} + 1}{n_{nds} + 1}) + \frac{12 RON^{2}(i,j)}{g^{2} n_{nds} n_{dit}} (\frac{n_{nds}-1}{n_{nds}+1})\]" src="form_1.png"/>
+</p>
+<p> where: <img class="formulaInl" alt="$\sigma^{2}(i,j)$" src="form_2.png"/> is the total variance in (ADU <img class="formulaInl" alt="$^{2}$" src="form_3.png"/>), <img class="formulaInl" alt="$S(i,j)$" src="form_4.png"/> is the signal in ADU of electrons in the pixel potencial well, so to the measured ADU we must first remove the bias, <img class="formulaInl" alt="$g$" src="form_5.png"/> is the gain of the detector (in electrons/ADU), <img class="formulaInl" alt="$n_{nds}$" src="form_ [...]
+
+<p>Definition at line <a class="el" href="hawki__variance_8c_source.html#l00081">81</a> of file <a class="el" href="hawki__variance_8c_source.html">hawki_variance.c</a>.</p>
+
+<p>Referenced by <a class="el" href="hawki__variance_8c_source.html#l00159">hawki_imglist_create_variances_and_delete()</a>.</p>
+
+</div>
+</div>
+<a class="anchor" id="ga3077d7b2029de0416fabed98bc092818"></a><!-- doxytag: member="hawki_variance.c::hawki_imglist_create_variances_and_delete" ref="ga3077d7b2029de0416fabed98bc092818" args="(cpl_imagelist *imagelist_raw, double gain, double ron, int ndit, int ndsamples)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">cpl_imagelist* hawki_imglist_create_variances_and_delete </td>
+ <td>(</td>
+ <td class="paramtype">cpl_imagelist * </td>
+ <td class="paramname"><em>imagelist_raw</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>gain</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">double </td>
+ <td class="paramname"><em>ron</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ndit</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>ndsamples</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Create the associated variance of raw imagelist. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">imagelist_raw</td><td>the raw imagelist </td></tr>
+ <tr><td class="paramname">gain</td><td>the gain of the detector (e-/ADU) </td></tr>
+ <tr><td class="paramname">ron</td><td>the ron for one read of the detector (ADU) </td></tr>
+ <tr><td class="paramname">ndit</td><td>the number of total integrations. </td></tr>
+ <tr><td class="paramname">ndsamples</td><td>the number of non-destructive readouts. </td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>The variance imagelist if suceed. NULL elsewhere.</dd></dl>
+<p>The original imagelist_raw is empty after the process. This is so in order not to duplicate the amount of memory needed. However it will still have to be deleted with cpl_imagelist_delete. Also the returned pointer have to be deleted with cpl_imagelist_delete, of course.</p>
+<p>The variance is computed with the following equation: </p>
+<p class="formulaDsp">
+<img class="formulaDsp" alt="\[ \sigma^{2}(i,j) = \frac{6 S(i,j)}{5 g n_{nds} n_{dit}} (\frac{n_{nds}^{2} + 1}{n_{nds} + 1}) + \frac{12 RON^{2}(i,j)}{g^{2} n_{nds} n_{dit}} (\frac{n_{nds}-1}{n_{nds}+1})\]" src="form_1.png"/>
+</p>
+<p> where: <img class="formulaInl" alt="$\sigma^{2}(i,j)$" src="form_2.png"/> is the total variance in (ADU <img class="formulaInl" alt="$^{2}$" src="form_3.png"/>), <img class="formulaInl" alt="$S(i,j)$" src="form_4.png"/> is the signal in ADU of electrons in the pixel potencial well, so to the measured ADU we must first remove the bias, <img class="formulaInl" alt="$g$" src="form_5.png"/> is the gain of the detector (in electrons/ADU), <img class="formulaInl" alt="$n_{nds}$" src="form_ [...]
+
+<p>Definition at line <a class="el" href="hawki__variance_8c_source.html#l00159">159</a> of file <a class="el" href="hawki__variance_8c_source.html">hawki_variance.c</a>.</p>
+
+<p>References <a class="el" href="hawki__variance_8c_source.html#l00081">hawki_image_create_variance()</a>.</p>
+
+</div>
+</div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__alloc_8c_source.html b/html/hawki__alloc_8c_source.html
new file mode 100644
index 0000000..2764e4d
--- /dev/null
+++ b/html/hawki__alloc_8c_source.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_alloc.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_alloc.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_alloc.c,v 1.1 2008/11/26 09:53:31 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2008/11/26 09:53:31 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include "hawki_alloc.h"</span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00044"></a>00044 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00045"></a>00045
+<a name="l00054"></a><a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd">00054</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(cpl_table ** table)
+<a name="l00055"></a>00055 {
+<a name="l00056"></a>00056 <span class="keywordtype">int</span> idet;
+<a name="l00057"></a>00057
+<a name="l00058"></a>00058 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00059"></a>00059 cpl_table_delete(table[idet]);
+<a name="l00060"></a>00060 cpl_free(table);
+<a name="l00061"></a>00061 <span class="keywordflow">if</span>(cpl_errorstate_get() != CPL_ERROR_NONE)
+<a name="l00062"></a>00062 <span class="keywordflow">return</span> -1;
+<a name="l00063"></a>00063 <span class="keywordflow">return</span> 0;
+<a name="l00064"></a>00064 }
+<a name="l00065"></a>00065
+<a name="l00072"></a><a class="code" href="group__hawki__alloc.html#gad7e4f1acdafde6f40fac069f727c9080">00072</a> cpl_table ** <a class="code" href="group__hawki__alloc.html#gad7e4f1acdafde6f40fac069f727c9080" title="Allocates a set of four tables.">hawki_table_new</a>(<span class="keywordtype">int</span> nrow)
+<a name="l00073"></a>00073 {
+<a name="l00074"></a>00074 <span class="keywordtype">int</span> idet;
+<a name="l00075"></a>00075 cpl_table ** tables;
+<a name="l00076"></a>00076
+<a name="l00077"></a>00077 tables = cpl_malloc(<span class="keyword">sizeof</span>(cpl_table *) * HAWKI_NB_DETECTORS);
+<a name="l00078"></a>00078 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00079"></a>00079 tables[idet] = cpl_table_new(nrow);
+<a name="l00080"></a>00080
+<a name="l00081"></a>00081 <span class="keywordflow">if</span>(cpl_errorstate_get() != CPL_ERROR_NONE)
+<a name="l00082"></a>00082 <span class="keywordflow">return</span> NULL;
+<a name="l00083"></a>00083 <span class="keywordflow">return</span> tables;
+<a name="l00084"></a>00084 }
+<a name="l00085"></a>00085
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__alloc_8h_source.html b/html/hawki__alloc_8h_source.html
new file mode 100644
index 0000000..58a0ced
--- /dev/null
+++ b/html/hawki__alloc_8h_source.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_alloc.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_alloc.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_alloc.h,v 1.1 2008/11/26 09:53:21 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2008/11/26 09:53:21 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_ALLOC_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_ALLOC_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Functions prototypes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="keywordtype">int</span> <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(cpl_table **);
+<a name="l00037"></a>00037
+<a name="l00038"></a>00038 cpl_table ** <a class="code" href="group__hawki__alloc.html#gad7e4f1acdafde6f40fac069f727c9080" title="Allocates a set of four tables.">hawki_table_new</a>(<span class="keywordtype">int</span> nrow);
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__bkg_8c_source.html b/html/hawki__bkg_8c_source.html
new file mode 100644
index 0000000..c81bb12
--- /dev/null
+++ b/html/hawki__bkg_8c_source.html
@@ -0,0 +1,367 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_bkg.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_bkg.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_bkg.c,v 1.15 2009/10/23 15:13:06 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/10/23 15:13:06 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.15 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "hawki_bkg.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044
+<a name="l00045"></a>00045 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00049"></a>00049 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050
+<a name="l00053"></a>00053 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00067"></a>00067 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00068"></a><a class="code" href="group__hawki__image__stats.html#ga6cf0d3c3733489bb4c8a869b35cc6d59">00068</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga6cf0d3c3733489bb4c8a869b35cc6d59" title="Fill a propertylist with the association between objects and bkg.">hawki_bkg_fill_assoc</a>(cpl_frameset * objframes, cpl_propertylist * proplist)
+<a name="l00069"></a>00069 {
+<a name="l00070"></a>00070 <span class="keywordtype">int</span> iframe;
+<a name="l00071"></a>00071 <span class="keywordtype">int</span> nframes;
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="comment">/* Loop on the frames */</span>
+<a name="l00074"></a>00074 nframes = cpl_frameset_get_size(objframes);
+<a name="l00075"></a>00075 <span class="keywordflow">for</span>(iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l00076"></a>00076 {
+<a name="l00077"></a>00077 cpl_frame * this_frame;
+<a name="l00078"></a>00078 cpl_propertylist * this_proplist;
+<a name="l00079"></a>00079 <span class="keyword">const</span> <span class="keywordtype">char</span> * arcfile;
+<a name="l00080"></a>00080 <span class="keywordtype">char</span> keystr[256];
+<a name="l00081"></a>00081
+<a name="l00082"></a>00082 <span class="comment">/* Getting the proplist for this frame */</span>
+<a name="l00083"></a>00083 this_frame = cpl_frameset_get_frame(objframes, iframe);
+<a name="l00084"></a>00084 this_proplist = cpl_propertylist_load
+<a name="l00085"></a>00085 (cpl_frame_get_filename(this_frame),0);
+<a name="l00086"></a>00086 arcfile = <a class="code" href="group__hawki__pfits.html#gae4f45ff97625d37b9354392b0c5e1056" title="find out the arcfile">hawki_pfits_get_arcfile</a>(proplist);
+<a name="l00087"></a>00087 snprintf(keystr, 256, <span class="stringliteral">"ESO QC BKG ASSOC RAW%d"</span>,iframe+1);
+<a name="l00088"></a>00088 cpl_propertylist_append_string(proplist, keystr, arcfile);
+<a name="l00089"></a>00089 cpl_propertylist_delete(this_proplist);
+<a name="l00090"></a>00090 }
+<a name="l00091"></a>00091
+<a name="l00092"></a>00092 <span class="keywordflow">return</span> 0;
+<a name="l00093"></a>00093 }
+<a name="l00094"></a>00094
+<a name="l00095"></a>00095 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00107"></a>00107 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00108"></a>00108 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga364c91d30c968e6a15e403c11a5d281e" title="Computes the median of the object frames.">hawki_bkg_from_objects_median</a>
+<a name="l00109"></a><a class="code" href="group__hawki__image__stats.html#ga364c91d30c968e6a15e403c11a5d281e">00109</a> (<span class="keyword">const</span> cpl_frameset * objframes, cpl_imagelist * bkg)
+<a name="l00110"></a>00110 {
+<a name="l00111"></a>00111 <span class="keywordtype">int</span> idet;
+<a name="l00112"></a>00112
+<a name="l00113"></a>00113 <span class="comment">/* Error state variables */</span>
+<a name="l00114"></a>00114 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00115"></a>00115
+<a name="l00116"></a>00116 <span class="comment">/* Loop on detectors */</span>
+<a name="l00117"></a>00117 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00118"></a>00118 {
+<a name="l00119"></a>00119 cpl_imagelist * img_serie;
+<a name="l00120"></a>00120 cpl_image * this_bkg_image;
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="comment">/* Loading the object frame */</span>
+<a name="l00123"></a>00123 img_serie = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(objframes, idet + 1, CPL_TYPE_FLOAT);
+<a name="l00124"></a>00124 <span class="keywordflow">if</span>(img_serie== NULL)
+<a name="l00125"></a>00125 {
+<a name="l00126"></a>00126 cpl_msg_error(__func__, <span class="stringliteral">"Error reading object image"</span>) ;
+<a name="l00127"></a>00127 <span class="keywordflow">return</span> -1;
+<a name="l00128"></a>00128 }
+<a name="l00129"></a>00129
+<a name="l00130"></a>00130 <span class="comment">/* Averaging */</span>
+<a name="l00131"></a>00131 <span class="comment">/* TODO: Comprobar que cpl_imagelist_collapse_median_create</span>
+<a name="l00132"></a>00132 <span class="comment"> * admite las mascaras, para que cuando implemente lo de la mascara </span>
+<a name="l00133"></a>00133 <span class="comment"> * de objetos siga funcionando */</span>
+<a name="l00134"></a>00134 <span class="keywordflow">if</span> ((this_bkg_image = cpl_imagelist_collapse_median_create(img_serie))
+<a name="l00135"></a>00135 == NULL)
+<a name="l00136"></a>00136 {
+<a name="l00137"></a>00137 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute the median of obj images"</span>);
+<a name="l00138"></a>00138 cpl_imagelist_delete(img_serie);
+<a name="l00139"></a>00139 <span class="keywordflow">return</span> -1;
+<a name="l00140"></a>00140 }
+<a name="l00141"></a>00141
+<a name="l00142"></a>00142 <span class="comment">/* Fill the corresponding chip */</span>
+<a name="l00143"></a>00143 cpl_imagelist_set(bkg, this_bkg_image, idet);
+<a name="l00144"></a>00144
+<a name="l00145"></a>00145 <span class="comment">/* Freeing */</span>
+<a name="l00146"></a>00146 cpl_imagelist_delete(img_serie);
+<a name="l00147"></a>00147 }
+<a name="l00148"></a>00148
+<a name="l00149"></a>00149 <span class="comment">/* Check error status and exit */</span>
+<a name="l00150"></a>00150 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00151"></a>00151 <span class="keywordflow">return</span> -1;
+<a name="l00152"></a>00152 <span class="keywordflow">return</span> 0;
+<a name="l00153"></a>00153 }
+<a name="l00154"></a>00154
+<a name="l00155"></a>00155 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00168"></a>00168 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00169"></a>00169 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga01f0d4c0177325b9a5d33f83be498097" title="Computes the median of the sky frames.">hawki_bkg_from_sky_median</a>
+<a name="l00170"></a><a class="code" href="group__hawki__image__stats.html#ga01f0d4c0177325b9a5d33f83be498097">00170</a> (<span class="keyword">const</span> cpl_frameset * skyframes,
+<a name="l00171"></a>00171 cpl_imagelist * bkg)
+<a name="l00172"></a>00172 {
+<a name="l00173"></a>00173 <span class="keywordtype">int</span> idet;
+<a name="l00174"></a>00174
+<a name="l00175"></a>00175 <span class="comment">/* Error state variables */</span>
+<a name="l00176"></a>00176 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00177"></a>00177
+<a name="l00178"></a>00178 <span class="comment">/* Loop on detectors */</span>
+<a name="l00179"></a>00179 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00180"></a>00180 {
+<a name="l00181"></a>00181 cpl_imagelist * img_serie;
+<a name="l00182"></a>00182 cpl_image * this_bkg_image;
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 <span class="comment">/* Loading the object frame */</span>
+<a name="l00185"></a>00185 img_serie = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(skyframes, idet + 1, CPL_TYPE_FLOAT);
+<a name="l00186"></a>00186 <span class="keywordflow">if</span>(img_serie== NULL)
+<a name="l00187"></a>00187 {
+<a name="l00188"></a>00188 cpl_msg_error(__func__, <span class="stringliteral">"Error reading object image"</span>) ;
+<a name="l00189"></a>00189 <span class="keywordflow">return</span> -1;
+<a name="l00190"></a>00190 }
+<a name="l00191"></a>00191
+<a name="l00192"></a>00192 <span class="comment">/* Averaging */</span>
+<a name="l00193"></a>00193 <span class="keywordflow">if</span> ((this_bkg_image = cpl_imagelist_collapse_median_create(img_serie))
+<a name="l00194"></a>00194 == NULL)
+<a name="l00195"></a>00195 {
+<a name="l00196"></a>00196 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute the median of obj images"</span>);
+<a name="l00197"></a>00197 cpl_imagelist_delete(img_serie);
+<a name="l00198"></a>00198 <span class="keywordflow">return</span> -1;
+<a name="l00199"></a>00199 }
+<a name="l00200"></a>00200 <span class="comment">/* Fill the corresponding chip */</span>
+<a name="l00201"></a>00201 cpl_imagelist_set(bkg, this_bkg_image, idet);
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 <span class="comment">/* Freeing */</span>
+<a name="l00204"></a>00204 cpl_imagelist_delete(img_serie);
+<a name="l00205"></a>00205 }
+<a name="l00206"></a>00206
+<a name="l00207"></a>00207 <span class="comment">/* Check error status and exit */</span>
+<a name="l00208"></a>00208 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00209"></a>00209 <span class="keywordflow">return</span> -1;
+<a name="l00210"></a>00210 <span class="keywordflow">return</span> 0;
+<a name="l00211"></a>00211 }
+<a name="l00212"></a>00212
+<a name="l00213"></a>00213 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00229"></a>00229 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00230"></a>00230 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af" title="Computes the running mean for a set of object images using their masks.">hawki_bkg_from_running_mean_detector</a>
+<a name="l00231"></a><a class="code" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af">00231</a> (cpl_imagelist * objimages,
+<a name="l00232"></a>00232 <span class="keyword">const</span> cpl_vector * medians,
+<a name="l00233"></a>00233 <span class="keywordtype">int</span> i_target,
+<a name="l00234"></a>00234 <span class="keywordtype">int</span> half_width,
+<a name="l00235"></a>00235 <span class="keywordtype">int</span> rejlow,
+<a name="l00236"></a>00236 <span class="keywordtype">int</span> rejhigh,
+<a name="l00237"></a>00237 cpl_image * bkg)
+<a name="l00238"></a>00238 {
+<a name="l00239"></a>00239 <span class="keywordtype">float</span> * bkg_p;
+<a name="l00240"></a>00240 <span class="keywordtype">float</span> * curima_p;
+<a name="l00241"></a>00241 cpl_binary * curmask_p;
+<a name="l00242"></a>00242 <span class="keywordtype">float</span> ** objimages_p;
+<a name="l00243"></a>00243 cpl_binary ** maskimages_p;
+<a name="l00244"></a>00244 <span class="keyword">const</span> <span class="keywordtype">double</span> * medians_p;
+<a name="l00245"></a>00245 <span class="keywordtype">double</span> out;
+<a name="l00246"></a>00246 <span class="keywordtype">int</span> from_ima;
+<a name="l00247"></a>00247 <span class="keywordtype">int</span> to_ima;
+<a name="l00248"></a>00248 <span class="keywordtype">int</span> nima;
+<a name="l00249"></a>00249 <span class="keywordtype">int</span> nuse;
+<a name="l00250"></a>00250 <span class="keywordtype">int</span> nx;
+<a name="l00251"></a>00251 <span class="keywordtype">int</span> ny;
+<a name="l00252"></a>00252
+<a name="l00253"></a>00253 <span class="keywordtype">int</span> pos_x;
+<a name="l00254"></a>00254 <span class="keywordtype">int</span> pos_y;
+<a name="l00255"></a>00255 <span class="keywordtype">int</span> pos;
+<a name="l00256"></a>00256 <span class="keywordtype">int</span> i_ima;
+<a name="l00257"></a>00257 <span class="keywordtype">int</span> i_win;
+<a name="l00258"></a>00258 <span class="keywordtype">int</span> n_win;
+<a name="l00259"></a>00259
+<a name="l00260"></a>00260 cpl_vector * localwin;
+<a name="l00261"></a>00261
+<a name="l00262"></a>00262 <span class="comment">/* Get the pointer to the background image */</span>
+<a name="l00263"></a>00263 bkg_p = cpl_image_get_data_float(bkg);
+<a name="l00264"></a>00264
+<a name="l00265"></a>00265 <span class="comment">/* Compute border indices */</span>
+<a name="l00266"></a>00266 nima = cpl_imagelist_get_size(objimages);
+<a name="l00267"></a>00267 from_ima = i_target - half_width;
+<a name="l00268"></a>00268 to_ima = i_target + half_width;
+<a name="l00269"></a>00269 <span class="keywordflow">if</span> (from_ima<0) from_ima = 0 ;
+<a name="l00270"></a>00270 <span class="keywordflow">if</span> (to_ima>(nima-1)) to_ima=nima-1 ;
+<a name="l00271"></a>00271
+<a name="l00272"></a>00272 <span class="comment">/* Number of valid planes to consider after edge effects */</span>
+<a name="l00273"></a>00273 nuse = to_ima - from_ima ;
+<a name="l00274"></a>00274
+<a name="l00275"></a>00275 <span class="comment">/* Get the size of images */</span>
+<a name="l00276"></a>00276 nx = cpl_image_get_size_x(bkg);
+<a name="l00277"></a>00277 ny = cpl_image_get_size_y(bkg);
+<a name="l00278"></a>00278
+<a name="l00279"></a>00279 <span class="comment">/* Get the pointers for better performance */</span>
+<a name="l00280"></a>00280 medians_p = cpl_vector_get_data_const(medians);
+<a name="l00281"></a>00281
+<a name="l00282"></a>00282 <span class="comment">/* Allocate local window with the maximum number of possible used values*/</span>
+<a name="l00283"></a>00283 localwin = cpl_vector_new(nuse) ;
+<a name="l00284"></a>00284
+<a name="l00285"></a>00285 <span class="comment">/* Get fast accesors to input image pointers */</span>
+<a name="l00286"></a>00286 objimages_p = cpl_malloc(nima * <span class="keyword">sizeof</span>(<span class="keywordtype">float</span> *));
+<a name="l00287"></a>00287 maskimages_p = cpl_malloc(nima * <span class="keyword">sizeof</span>(cpl_binary *));
+<a name="l00288"></a>00288 <span class="keywordflow">for</span>(i_ima=from_ima ; i_ima<=to_ima ; i_ima++)
+<a name="l00289"></a>00289 {
+<a name="l00290"></a>00290 objimages_p[i_ima] = cpl_image_get_data_float
+<a name="l00291"></a>00291 (cpl_imagelist_get(objimages, i_ima));
+<a name="l00292"></a>00292 maskimages_p[i_ima] = cpl_mask_get_data
+<a name="l00293"></a>00293 (cpl_image_get_bpm(cpl_imagelist_get(objimages, i_ima)));
+<a name="l00294"></a>00294 }
+<a name="l00295"></a>00295
+<a name="l00296"></a>00296 <span class="comment">/* Initialize the bad pixel mask */</span>
+<a name="l00297"></a>00297 cpl_image_accept_all(bkg);
+<a name="l00298"></a>00298
+<a name="l00299"></a>00299 <span class="comment">/* Loop over all pixels */</span>
+<a name="l00300"></a>00300 <span class="keywordflow">for</span> (pos_x=0 ; pos_x<nx ; pos_x++)
+<a name="l00301"></a>00301 {
+<a name="l00302"></a>00302 <span class="keywordflow">for</span> (pos_y=0 ; pos_y<ny ; pos_y++)
+<a name="l00303"></a>00303 {
+<a name="l00304"></a>00304 <span class="comment">/* Get the position in the array */</span>
+<a name="l00305"></a>00305 pos = pos_x + pos_y * nx;
+<a name="l00306"></a>00306
+<a name="l00307"></a>00307 <span class="comment">/* Resize again to maximum number of elements */</span>
+<a name="l00308"></a>00308 cpl_vector_set_size(localwin, nuse);
+<a name="l00309"></a>00309
+<a name="l00310"></a>00310 <span class="comment">/* Fill up local window */</span>
+<a name="l00311"></a>00311 i_win=0;
+<a name="l00312"></a>00312 <span class="keywordflow">for</span> (i_ima=from_ima ; i_ima<=to_ima ; i_ima++)
+<a name="l00313"></a>00313 {
+<a name="l00314"></a>00314 <span class="keywordflow">if</span> (i_ima != i_target)
+<a name="l00315"></a>00315 {
+<a name="l00316"></a>00316 curima_p = objimages_p[i_ima];
+<a name="l00317"></a>00317 curmask_p = maskimages_p[i_ima];
+<a name="l00318"></a>00318 <span class="keywordflow">if</span>(!curmask_p[pos])
+<a name="l00319"></a>00319 {
+<a name="l00320"></a>00320 cpl_vector_set(localwin, i_win,
+<a name="l00321"></a>00321 (<span class="keywordtype">double</span>)curima_p[pos]-medians_p[i_ima]);
+<a name="l00322"></a>00322 i_win++;
+<a name="l00323"></a>00323 }
+<a name="l00324"></a>00324 }
+<a name="l00325"></a>00325 }
+<a name="l00326"></a>00326 n_win = i_win;
+<a name="l00327"></a>00327 <span class="keywordflow">if</span>(n_win - rejlow - rejhigh < 1)
+<a name="l00328"></a>00328 {
+<a name="l00329"></a>00329 <span class="comment">/* Add it to the bad pixel mask */</span>
+<a name="l00330"></a>00330 cpl_msg_debug(__func__,<span class="stringliteral">"Pixel %d %d added to the sky bpm"</span>,
+<a name="l00331"></a>00331 pos_x, pos_y);
+<a name="l00332"></a>00332 <span class="keywordflow">if</span>(cpl_image_reject(bkg, pos_x + 1, pos_y + 1) != CPL_ERROR_NONE)
+<a name="l00333"></a>00333 {
+<a name="l00334"></a>00334 cpl_msg_error(__func__,<span class="stringliteral">"Cannot add pixel to sky bpm"</span>);
+<a name="l00335"></a>00335 cpl_vector_delete(localwin) ;
+<a name="l00336"></a>00336 cpl_free(objimages_p);
+<a name="l00337"></a>00337 cpl_free(maskimages_p);
+<a name="l00338"></a>00338 <span class="keywordflow">return</span>(-1);
+<a name="l00339"></a>00339 }
+<a name="l00340"></a>00340 }
+<a name="l00341"></a>00341 <span class="keywordflow">else</span>
+<a name="l00342"></a>00342 {
+<a name="l00343"></a>00343 <span class="comment">/* Resize to current number of elements */</span>
+<a name="l00344"></a>00344 cpl_vector_set_size(localwin, n_win);
+<a name="l00345"></a>00345 <span class="comment">/* Sort window */</span>
+<a name="l00346"></a>00346 cpl_vector_sort(localwin, 1);
+<a name="l00347"></a>00347 <span class="comment">/* Reject min and max, accumulate other pixels */</span>
+<a name="l00348"></a>00348 out = 0.0 ;
+<a name="l00349"></a>00349 <span class="keywordflow">for</span> (i_win=rejlow ; i_win<n_win - rejhigh; i_win++)
+<a name="l00350"></a>00350 {
+<a name="l00351"></a>00351 out += cpl_vector_get(localwin, i_win);
+<a name="l00352"></a>00352 }
+<a name="l00353"></a>00353 <span class="comment">/* Take the mean */</span>
+<a name="l00354"></a>00354 out /= (double)(n_win - rejlow - rejhigh);
+<a name="l00355"></a>00355
+<a name="l00356"></a>00356 <span class="comment">/* Assign value */</span>
+<a name="l00357"></a>00357 bkg_p[pos] = (out+medians_p[i_target]);
+<a name="l00358"></a>00358 }
+<a name="l00359"></a>00359 }
+<a name="l00360"></a>00360 }
+<a name="l00361"></a>00361
+<a name="l00362"></a>00362 <span class="comment">/* Free */</span>
+<a name="l00363"></a>00363 cpl_vector_delete(localwin) ;
+<a name="l00364"></a>00364 cpl_free(objimages_p);
+<a name="l00365"></a>00365 cpl_free(maskimages_p);
+<a name="l00366"></a>00366
+<a name="l00367"></a>00367 <span class="keywordflow">return</span> 0;
+<a name="l00368"></a>00368 }
+<a name="l00369"></a>00369
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__bkg_8h_source.html b/html/hawki__bkg_8h_source.html
new file mode 100644
index 0000000..73436ea
--- /dev/null
+++ b/html/hawki__bkg_8h_source.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_bkg.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_bkg.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_bkg.h,v 1.7 2010/03/08 13:59:16 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/03/08 13:59:16 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.7 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_BKG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_BKG_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga6cf0d3c3733489bb4c8a869b35cc6d59" title="Fill a propertylist with the association between objects and bkg.">hawki_bkg_fill_assoc</a>(cpl_frameset * objframes, cpl_propertylist * proplist);
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga364c91d30c968e6a15e403c11a5d281e" title="Computes the median of the object frames.">hawki_bkg_from_objects_median</a>
+<a name="l00040"></a>00040 (<span class="keyword">const</span> cpl_frameset * objframes, cpl_imagelist * bkg);
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga01f0d4c0177325b9a5d33f83be498097" title="Computes the median of the sky frames.">hawki_bkg_from_sky_median</a>
+<a name="l00043"></a>00043 (<span class="keyword">const</span> cpl_frameset * skyframes,
+<a name="l00044"></a>00044 cpl_imagelist * bkg);
+<a name="l00045"></a>00045
+<a name="l00046"></a>00046 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af" title="Computes the running mean for a set of object images using their masks.">hawki_bkg_from_running_mean_detector</a>
+<a name="l00047"></a>00047 (cpl_imagelist * objimages,
+<a name="l00048"></a>00048 <span class="keyword">const</span> cpl_vector * medians,
+<a name="l00049"></a>00049 <span class="keywordtype">int</span> i_target,
+<a name="l00050"></a>00050 <span class="keywordtype">int</span> half_width,
+<a name="l00051"></a>00051 <span class="keywordtype">int</span> rejlow,
+<a name="l00052"></a>00052 <span class="keywordtype">int</span> rejhigh,
+<a name="l00053"></a>00053 cpl_image * bkg);
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__cal__dark_8c_source.html b/html/hawki__cal__dark_8c_source.html
new file mode 100644
index 0000000..b1bdff4
--- /dev/null
+++ b/html/hawki__cal__dark_8c_source.html
@@ -0,0 +1,892 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_cal_dark.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_cal_dark.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_cal_dark.c,v 1.21 2011/02/16 16:33:21 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/02/16 16:33:21 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.21 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_variance.h"</span>
+<a name="l00048"></a>00048
+<a name="l00049"></a>00049 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00050"></a>00050 <span class="comment"> Functions prototypes</span>
+<a name="l00051"></a>00051 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_create(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_exec(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_destroy(cpl_plugin *) ;
+<a name="l00056"></a>00056 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00057"></a>00057
+<a name="l00058"></a>00058 <span class="keywordtype">void</span> hawki_cal_dark_initialise_qc(<span class="keywordtype">void</span>);
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_retrieve_input_param
+<a name="l00060"></a>00060 (cpl_parameterlist * parlist);
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">double</span> hawki_cal_dark_ron(<span class="keyword">const</span> cpl_image *, <span class="keyword">const</span> cpl_image *, <span class="keywordtype">int</span>) ;
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_save
+<a name="l00063"></a>00063 (<span class="keyword">const</span> cpl_imagelist * dark,
+<a name="l00064"></a>00064 <span class="keyword">const</span> cpl_imagelist * master_dark_err,
+<a name="l00065"></a>00065 <span class="keyword">const</span> cpl_imagelist * bpmdark,
+<a name="l00066"></a>00066 cpl_table ** raw_dark_stats,
+<a name="l00067"></a>00067 <span class="keyword">const</span> cpl_vector ** rons,
+<a name="l00068"></a>00068 <span class="keyword">const</span> cpl_frameset * used_frames,
+<a name="l00069"></a>00069 cpl_parameterlist * parlist,
+<a name="l00070"></a>00070 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00071"></a>00071
+<a name="l00072"></a>00072 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00073"></a>00073 <span class="comment"> Static variables</span>
+<a name="l00074"></a>00074 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00075"></a>00075
+<a name="l00076"></a>00076 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00077"></a>00077 <span class="comment">/* Inputs */</span>
+<a name="l00078"></a>00078 <span class="keywordtype">int</span> hsize ;
+<a name="l00079"></a>00079 <span class="keywordtype">int</span> nsamples ;
+<a name="l00080"></a>00080 <span class="keywordtype">double</span> sigma ;
+<a name="l00081"></a>00081 <span class="keywordtype">int</span> llx ;
+<a name="l00082"></a>00082 <span class="keywordtype">int</span> lly ;
+<a name="l00083"></a>00083 <span class="keywordtype">int</span> urx ;
+<a name="l00084"></a>00084 <span class="keywordtype">int</span> ury ;
+<a name="l00085"></a>00085 <span class="keywordtype">double</span> gain;
+<a name="l00086"></a>00086 <span class="keywordtype">double</span> ron;
+<a name="l00087"></a>00087 <span class="keywordtype">int</span> error_tracking;
+<a name="l00088"></a>00088 } hawki_cal_dark_config ;
+<a name="l00089"></a>00089
+<a name="l00090"></a>00090 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00091"></a>00091 <span class="comment">/* Outputs */</span>
+<a name="l00092"></a>00092 <span class="keywordtype">int</span> nb_badpix[HAWKI_NB_DETECTORS] ;
+<a name="l00093"></a>00093 <span class="keywordtype">double</span> master_dark_mean[HAWKI_NB_DETECTORS] ;
+<a name="l00094"></a>00094 <span class="keywordtype">double</span> master_dark_med[HAWKI_NB_DETECTORS] ;
+<a name="l00095"></a>00095 <span class="keywordtype">double</span> master_dark_stdev[HAWKI_NB_DETECTORS] ;
+<a name="l00096"></a>00096 <span class="keywordtype">double</span> master_dark_error_mean[HAWKI_NB_DETECTORS] ;
+<a name="l00097"></a>00097 <span class="keywordtype">double</span> master_dark_error_med[HAWKI_NB_DETECTORS] ;
+<a name="l00098"></a>00098 <span class="keywordtype">double</span> master_dark_error_stdev[HAWKI_NB_DETECTORS] ;
+<a name="l00099"></a>00099 <span class="keywordtype">double</span> vc_mean[HAWKI_NB_DETECTORS][HAWKI_NB_VC] ;
+<a name="l00100"></a>00100 <span class="keywordtype">double</span> vc_med[HAWKI_NB_DETECTORS][HAWKI_NB_VC] ;
+<a name="l00101"></a>00101 <span class="keywordtype">double</span> vc_stdev[HAWKI_NB_DETECTORS][HAWKI_NB_VC] ;
+<a name="l00102"></a>00102 <span class="keywordtype">double</span> dit;
+<a name="l00103"></a>00103 <span class="keywordtype">int</span> ndit;
+<a name="l00104"></a>00104 <span class="keywordtype">int</span> ndsamples;
+<a name="l00105"></a>00105 } hawki_cal_dark_outputs;
+<a name="l00106"></a>00106
+<a name="l00107"></a>00107 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_cal_dark_description[] =
+<a name="l00108"></a>00108 <span class="stringliteral">"hawki_cal_dark -- Dark recipe\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">"raw-file.fits "</span>HAWKI_CAL_DARK_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">"raw-file.fits "</span>HAWKI_TEC_FLAT_RAW<span class="stringliteral">".\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"hawki_cal_dark.fits ("</span>HAWKI_CALPRO_DARK<span class="stringliteral">"): The master dark\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">"hawki_cal_dark_bpmdark.fits("</span>HAWKI_CALPRO_BPM_HOT<span class="stringliteral">"): The bad pixel mask associated to the dark\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">"hawki_cal_dark_stats.fits("</span>HAWKI_CALPRO_DARK_STATS<span class="stringliteral">"): Statistics of the raw darks\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"Optionally it also creates:\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">"hawki_cal_dark_err.fits("</span>HAWKI_CALPRO_DARK_ERR<span class="stringliteral">"): The error in the master dark\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00123"></a>00123 <span class="comment"> Functions code</span>
+<a name="l00124"></a>00124 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00125"></a>00125
+<a name="l00126"></a>00126 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00135"></a>00135 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00136"></a>00136 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00137"></a>00137 {
+<a name="l00138"></a>00138 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe ) ;
+<a name="l00139"></a>00139 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00140"></a>00140
+<a name="l00141"></a>00141 cpl_plugin_init(plugin,
+<a name="l00142"></a>00142 CPL_PLUGIN_API,
+<a name="l00143"></a>00143 HAWKI_BINARY_VERSION,
+<a name="l00144"></a>00144 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00145"></a>00145 <span class="stringliteral">"hawki_cal_dark"</span>,
+<a name="l00146"></a>00146 <span class="stringliteral">"Dark recipe"</span>,
+<a name="l00147"></a>00147 hawki_cal_dark_description,
+<a name="l00148"></a>00148 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00149"></a>00149 PACKAGE_BUGREPORT,
+<a name="l00150"></a>00150 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00151"></a>00151 hawki_cal_dark_create,
+<a name="l00152"></a>00152 hawki_cal_dark_exec,
+<a name="l00153"></a>00153 hawki_cal_dark_destroy) ;
+<a name="l00154"></a>00154
+<a name="l00155"></a>00155 cpl_pluginlist_append(list, plugin) ;
+<a name="l00156"></a>00156
+<a name="l00157"></a>00157 <span class="keywordflow">return</span> 0;
+<a name="l00158"></a>00158 }
+<a name="l00159"></a>00159
+<a name="l00160"></a>00160 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00168"></a>00168 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00169"></a>00169 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_create(cpl_plugin * plugin)
+<a name="l00170"></a>00170 {
+<a name="l00171"></a>00171 cpl_recipe * recipe ;
+<a name="l00172"></a>00172 cpl_parameter * p ;
+<a name="l00173"></a>00173
+<a name="l00174"></a>00174 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00175"></a>00175 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00176"></a>00176 recipe = (cpl_recipe *)plugin ;
+<a name="l00177"></a>00177 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00178"></a>00178
+<a name="l00179"></a>00179 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00180"></a>00180 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00181"></a>00181
+<a name="l00182"></a>00182 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00183"></a>00183 <span class="comment">/* --sigma */</span>
+<a name="l00184"></a>00184 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_dark.sigma"</span>,
+<a name="l00185"></a>00185 CPL_TYPE_DOUBLE, <span class="stringliteral">"sigma for hot bad pixels detection"</span>,
+<a name="l00186"></a>00186 <span class="stringliteral">"hawki.hawki_cal_dark"</span>, 10.0) ;
+<a name="l00187"></a>00187 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sigma"</span>) ;
+<a name="l00188"></a>00188 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00189"></a>00189 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00190"></a>00190 <span class="comment">/* --nsamples */</span>
+<a name="l00191"></a>00191 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_dark.nsamples"</span>,
+<a name="l00192"></a>00192 CPL_TYPE_INT, <span class="stringliteral">"number of samples for RON computation"</span>,
+<a name="l00193"></a>00193 <span class="stringliteral">"hawki.hawki_cal_dark"</span>, 100) ;
+<a name="l00194"></a>00194 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"nsamples"</span>) ;
+<a name="l00195"></a>00195 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00196"></a>00196 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00197"></a>00197 <span class="comment">/* --hsize */</span>
+<a name="l00198"></a>00198 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_dark.hsize"</span>,
+<a name="l00199"></a>00199 CPL_TYPE_INT, <span class="stringliteral">"half size of the window for RON computation"</span>,
+<a name="l00200"></a>00200 <span class="stringliteral">"hawki.hawki_cal_dark"</span>, 6) ;
+<a name="l00201"></a>00201 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"hsize"</span>) ;
+<a name="l00202"></a>00202 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00203"></a>00203 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00204"></a>00204 <span class="comment">/* --zone */</span>
+<a name="l00205"></a>00205 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_dark.zone"</span>,
+<a name="l00206"></a>00206 CPL_TYPE_STRING,
+<a name="l00207"></a>00207 <span class="stringliteral">"Stats zone"</span>,
+<a name="l00208"></a>00208 <span class="stringliteral">"hawki.hawki_cal_dark"</span>,
+<a name="l00209"></a>00209 <span class="stringliteral">"512,512,1536,1536"</span>) ;
+<a name="l00210"></a>00210 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"zone"</span>) ;
+<a name="l00211"></a>00211 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00212"></a>00212 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00213"></a>00213 <span class="comment">/* --gain */</span>
+<a name="l00214"></a>00214 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_dark.gain"</span>,
+<a name="l00215"></a>00215 CPL_TYPE_DOUBLE,
+<a name="l00216"></a>00216 <span class="stringliteral">"Detector nominal gain (e-/ADU)"</span>,
+<a name="l00217"></a>00217 <span class="stringliteral">"hawki.hawki_cal_dark"</span>,
+<a name="l00218"></a>00218 -1.);
+<a name="l00219"></a>00219 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"gain"</span>) ;
+<a name="l00220"></a>00220 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00221"></a>00221 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00222"></a>00222 <span class="comment">/* --ron */</span>
+<a name="l00223"></a>00223 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_dark.ron"</span>,
+<a name="l00224"></a>00224 CPL_TYPE_DOUBLE,
+<a name="l00225"></a>00225 <span class="stringliteral">"Detector nominal RON for a single readout (ADU)"</span>,
+<a name="l00226"></a>00226 <span class="stringliteral">"hawki.hawki_cal_dark"</span>,
+<a name="l00227"></a>00227 -1.);
+<a name="l00228"></a>00228 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ron"</span>) ;
+<a name="l00229"></a>00229 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00230"></a>00230 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00231"></a>00231
+<a name="l00232"></a>00232 <span class="comment">/* Return */</span>
+<a name="l00233"></a>00233 <span class="keywordflow">return</span> 0;
+<a name="l00234"></a>00234 }
+<a name="l00235"></a>00235
+<a name="l00236"></a>00236 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00242"></a>00242 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00243"></a>00243 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_exec(cpl_plugin * plugin)
+<a name="l00244"></a>00244 {
+<a name="l00245"></a>00245 cpl_recipe * recipe ;
+<a name="l00246"></a>00246
+<a name="l00247"></a>00247 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00248"></a>00248 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00249"></a>00249 recipe = (cpl_recipe *)plugin ;
+<a name="l00250"></a>00250 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00251"></a>00251
+<a name="l00252"></a>00252 <span class="comment">/* Issue a banner */</span>
+<a name="l00253"></a>00253 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00254"></a>00254
+<a name="l00255"></a>00255 <span class="keywordflow">return</span> hawki_cal_dark(recipe->parameters, recipe->frames) ;
+<a name="l00256"></a>00256 }
+<a name="l00257"></a>00257
+<a name="l00258"></a>00258 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00264"></a>00264 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00265"></a>00265 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_destroy(cpl_plugin * plugin)
+<a name="l00266"></a>00266 {
+<a name="l00267"></a>00267 cpl_recipe * recipe ;
+<a name="l00268"></a>00268
+<a name="l00269"></a>00269 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00270"></a>00270 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00271"></a>00271 recipe = (cpl_recipe *)plugin ;
+<a name="l00272"></a>00272 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00273"></a>00273
+<a name="l00274"></a>00274 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00275"></a>00275 <span class="keywordflow">return</span> 0 ;
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277
+<a name="l00278"></a>00278 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00285"></a>00285 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00286"></a>00286 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark(
+<a name="l00287"></a>00287 cpl_parameterlist * parlist,
+<a name="l00288"></a>00288 cpl_frameset * frameset)
+<a name="l00289"></a>00289 {
+<a name="l00290"></a>00290 cpl_frameset * rawframes ;
+<a name="l00291"></a>00291 cpl_frame * ref_frame ;
+<a name="l00292"></a>00292 cpl_propertylist * plist ;
+<a name="l00293"></a>00293 cpl_imagelist * darks_raw ;
+<a name="l00294"></a>00294 cpl_imagelist * master_dark;
+<a name="l00295"></a>00295 cpl_imagelist * master_dark_err;
+<a name="l00296"></a>00296 cpl_imagelist * bpmdark;
+<a name="l00297"></a>00297 cpl_image * bpm ;
+<a name="l00298"></a>00298 cpl_image * ima_curr ;
+<a name="l00299"></a>00299 cpl_image * ima_next ;
+<a name="l00300"></a>00300 cpl_image * ima_accu ;
+<a name="l00301"></a>00301 cpl_image * ima_accu_err = NULL;
+<a name="l00302"></a>00302 <span class="keywordtype">int</span> nframes ;
+<a name="l00303"></a>00303 cpl_vector * rons[HAWKI_NB_DETECTORS] ;
+<a name="l00304"></a>00304 cpl_table ** raw_dark_stats;
+<a name="l00305"></a>00305 <span class="keywordtype">double</span> ron ;
+<a name="l00306"></a>00306 <span class="keywordtype">int</span> vc_urx, vc_ury, vc_llx, vc_lly ;
+<a name="l00307"></a>00307 <span class="keywordtype">int</span> j, k ;
+<a name="l00308"></a>00308 <span class="keywordtype">int</span> idet;
+<a name="l00309"></a>00309 cpl_errorstate error_prevstate;
+<a name="l00310"></a>00310
+<a name="l00311"></a>00311 <span class="comment">/* Initialise */</span>
+<a name="l00312"></a>00312 rawframes = NULL ;
+<a name="l00313"></a>00313 ima_accu = NULL ;
+<a name="l00314"></a>00314 ima_next = NULL ;
+<a name="l00315"></a>00315 master_dark_err = NULL;
+<a name="l00316"></a>00316 hawki_cal_dark_initialise_qc();
+<a name="l00317"></a>00317
+<a name="l00318"></a>00318 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00319"></a>00319 <span class="keywordflow">if</span>(hawki_cal_dark_retrieve_input_param(parlist))
+<a name="l00320"></a>00320 {
+<a name="l00321"></a>00321 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00322"></a>00322 <span class="keywordflow">return</span> -1;
+<a name="l00323"></a>00323 }
+<a name="l00324"></a>00324
+<a name="l00325"></a>00325 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00326"></a>00326 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(frameset)) {
+<a name="l00327"></a>00327 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00328"></a>00328 <span class="keywordflow">return</span> -1 ;
+<a name="l00329"></a>00329 }
+<a name="l00330"></a>00330
+<a name="l00331"></a>00331 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00332"></a>00332 rawframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(frameset, HAWKI_CAL_DARK_RAW) ;
+<a name="l00333"></a>00333
+<a name="l00334"></a>00334 <span class="comment">/* Test if raw frames have been found */</span>
+<a name="l00335"></a>00335 <span class="keywordflow">if</span> (rawframes == NULL) {
+<a name="l00336"></a>00336 cpl_msg_error(__func__, <span class="stringliteral">"No raw frame in input (%s)"</span>,HAWKI_CAL_DARK_RAW);
+<a name="l00337"></a>00337 <span class="keywordflow">return</span> -1 ;
+<a name="l00338"></a>00338 }
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/* At least 3 frames */</span>
+<a name="l00341"></a>00341 <span class="keywordflow">if</span> (cpl_frameset_get_size(rawframes) < 3) {
+<a name="l00342"></a>00342 cpl_msg_error(__func__, <span class="stringliteral">"Not enough input frames"</span>);
+<a name="l00343"></a>00343 cpl_frameset_delete(rawframes) ;
+<a name="l00344"></a>00344 <span class="keywordflow">return</span> -1 ;
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346
+<a name="l00347"></a>00347 <span class="comment">/* Get DIT / NDIT from the header */</span>
+<a name="l00348"></a>00348 error_prevstate = cpl_errorstate_get();
+<a name="l00349"></a>00349 ref_frame = cpl_frameset_get_frame(rawframes, 0) ;
+<a name="l00350"></a>00350 <span class="keywordflow">if</span> ((plist=cpl_propertylist_load(cpl_frame_get_filename(ref_frame),
+<a name="l00351"></a>00351 0)) == NULL) {
+<a name="l00352"></a>00352 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get header from frame"</span>);
+<a name="l00353"></a>00353 cpl_msg_indent_less() ;
+<a name="l00354"></a>00354 cpl_frameset_delete(rawframes) ;
+<a name="l00355"></a>00355 <span class="keywordflow">return</span> -1 ;
+<a name="l00356"></a>00356 }
+<a name="l00357"></a>00357 hawki_cal_dark_outputs.dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist) ;
+<a name="l00358"></a>00358 hawki_cal_dark_outputs.ndit = <a class="code" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788" title="find out the NDIT value">hawki_pfits_get_ndit</a>(plist) ;
+<a name="l00359"></a>00359 hawki_cal_dark_outputs.ndsamples = <a class="code" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190" title="find out the NDSAMPLES value">hawki_pfits_get_ndsamples</a>(plist);
+<a name="l00360"></a>00360 cpl_propertylist_delete(plist) ;
+<a name="l00361"></a>00361 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00362"></a>00362 {
+<a name="l00363"></a>00363 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the DIT/NDIT/NDSAMPLES from the header"</span>) ;
+<a name="l00364"></a>00364 cpl_msg_indent_less() ;
+<a name="l00365"></a>00365 cpl_frameset_delete(rawframes) ;
+<a name="l00366"></a>00366 <span class="keywordflow">return</span> -1 ;
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368 cpl_msg_info(__func__, <span class="stringliteral">"DIT value: %g sec."</span>, hawki_cal_dark_outputs.dit);
+<a name="l00369"></a>00369 cpl_msg_info(__func__, <span class="stringliteral">"NDIT value: %d"</span>, hawki_cal_dark_outputs.ndit);
+<a name="l00370"></a>00370 cpl_msg_info(__func__, <span class="stringliteral">"NDSAMPLES value: %d"</span>, hawki_cal_dark_outputs.ndsamples);
+<a name="l00371"></a>00371
+<a name="l00372"></a>00372 <span class="comment">/* Check that DIT/NDIT and NDSAMPLES are the same for all the frames */</span>
+<a name="l00373"></a>00373 <span class="keywordflow">if</span>(!<a class="code" href="group__hawki__utils.html#ga4c041169d43f161a8c9d7f23d7fc57a7" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_double_keys</a>(rawframes, &<a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>) ||
+<a name="l00374"></a>00374 !<a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_int_keys</a>(rawframes, &<a class="code" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788" title="find out the NDIT value">hawki_pfits_get_ndit</a>)||
+<a name="l00375"></a>00375 !<a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_int_keys</a>(rawframes, &<a class="code" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190" title="find out the NDSAMPLES value">hawki_pfits_get_ndsamples</a>))
+<a name="l00376"></a>00376 {
+<a name="l00377"></a>00377 cpl_msg_error(__func__, <span class="stringliteral">"Not all input darks have the same "</span>
+<a name="l00378"></a>00378 <span class="stringliteral">"DIT/NDIT/NDSAMPLES values"</span>);
+<a name="l00379"></a>00379 cpl_msg_indent_less() ;
+<a name="l00380"></a>00380 <span class="keywordflow">return</span> -1 ;
+<a name="l00381"></a>00381 }
+<a name="l00382"></a>00382
+<a name="l00383"></a>00383 <span class="comment">/* Number of frames */</span>
+<a name="l00384"></a>00384 nframes = cpl_frameset_get_size(rawframes) ;
+<a name="l00385"></a>00385
+<a name="l00386"></a>00386 <span class="comment">/* Create the statistics table */</span>
+<a name="l00387"></a>00387 raw_dark_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00388"></a>00388 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00389"></a>00389 {
+<a name="l00390"></a>00390 raw_dark_stats[idet] = cpl_table_new(nframes);
+<a name="l00391"></a>00391 }
+<a name="l00392"></a>00392 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_dark_stats);
+<a name="l00393"></a>00393
+<a name="l00394"></a>00394 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00395"></a>00395 master_dark = cpl_imagelist_new();
+<a name="l00396"></a>00396 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00397"></a>00397 master_dark_err = cpl_imagelist_new();
+<a name="l00398"></a>00398 bpmdark = cpl_imagelist_new();
+<a name="l00399"></a>00399 cpl_msg_info(__func__, <span class="stringliteral">"Dark computation"</span>);
+<a name="l00400"></a>00400 cpl_msg_indent_more() ;
+<a name="l00401"></a>00401 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l00402"></a>00402 cpl_msg_info(__func__, <span class="stringliteral">"Handle chip number %d"</span>, idet+1) ;
+<a name="l00403"></a>00403
+<a name="l00404"></a>00404 <span class="comment">/* Create the rons vectors */</span>
+<a name="l00405"></a>00405 rons[idet] = cpl_vector_new(nframes) ;
+<a name="l00406"></a>00406
+<a name="l00407"></a>00407 <span class="comment">/* Load the input data */</span>
+<a name="l00408"></a>00408 darks_raw = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(rawframes, idet+1, CPL_TYPE_FLOAT) ;
+<a name="l00409"></a>00409
+<a name="l00410"></a>00410 <span class="comment">/* Loop on the frames */</span>
+<a name="l00411"></a>00411 <span class="keywordflow">for</span> (j=0 ; j<nframes ; j++) {
+<a name="l00412"></a>00412 <span class="comment">/* Load the current and next images */</span>
+<a name="l00413"></a>00413 <span class="keywordflow">if</span> (j==nframes-1) {
+<a name="l00414"></a>00414 ima_curr = cpl_imagelist_get(darks_raw, j) ;
+<a name="l00415"></a>00415 ima_next = cpl_imagelist_get(darks_raw, 0) ;
+<a name="l00416"></a>00416 } <span class="keywordflow">else</span> {
+<a name="l00417"></a>00417 ima_curr = cpl_imagelist_get(darks_raw, j) ;
+<a name="l00418"></a>00418 ima_next = cpl_imagelist_get(darks_raw, j+1) ;
+<a name="l00419"></a>00419 }
+<a name="l00420"></a>00420
+<a name="l00421"></a>00421 <span class="comment">/* Compute the dark stats and store in table */</span>
+<a name="l00422"></a>00422 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l00423"></a>00423 (raw_dark_stats,
+<a name="l00424"></a>00424 ima_curr,
+<a name="l00425"></a>00425 hawki_cal_dark_config.llx,
+<a name="l00426"></a>00426 hawki_cal_dark_config.lly,
+<a name="l00427"></a>00427 hawki_cal_dark_config.urx,
+<a name="l00428"></a>00428 hawki_cal_dark_config.ury,
+<a name="l00429"></a>00429 idet,
+<a name="l00430"></a>00430 j) != 0)
+<a name="l00431"></a>00431 {
+<a name="l00432"></a>00432 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute statistics"</span>) ;
+<a name="l00433"></a>00433 cpl_msg_indent_less() ;
+<a name="l00434"></a>00434 cpl_frameset_delete(rawframes) ;
+<a name="l00435"></a>00435 cpl_imagelist_delete(master_dark);
+<a name="l00436"></a>00436 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00437"></a>00437 cpl_imagelist_delete(master_dark_err);
+<a name="l00438"></a>00438 cpl_imagelist_delete(darks_raw);
+<a name="l00439"></a>00439 cpl_imagelist_delete(bpmdark) ;
+<a name="l00440"></a>00440 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++)
+<a name="l00441"></a>00441 cpl_vector_delete(rons[k]) ;
+<a name="l00442"></a>00442 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00443"></a>00443 cpl_table_delete(raw_dark_stats[idet]);
+<a name="l00444"></a>00444 cpl_free(raw_dark_stats);
+<a name="l00445"></a>00445 <span class="keywordflow">return</span> -1 ;
+<a name="l00446"></a>00446 }
+<a name="l00447"></a>00447
+<a name="l00448"></a>00448 <span class="comment">/* Compute the RON */</span>
+<a name="l00449"></a>00449 ron = hawki_cal_dark_ron(ima_curr, ima_next, hawki_cal_dark_outputs.ndit) ;
+<a name="l00450"></a>00450 cpl_vector_set(rons[idet], j, ron);
+<a name="l00451"></a>00451 }
+<a name="l00452"></a>00452
+<a name="l00453"></a>00453 <span class="comment">/* Collapse */</span>
+<a name="l00454"></a>00454 <span class="keywordflow">if</span> (nframes > 2)
+<a name="l00455"></a>00455 {
+<a name="l00456"></a>00456 ima_accu = cpl_imagelist_collapse_minmax_create(darks_raw, 0, 1) ;
+<a name="l00457"></a>00457 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00458"></a>00458 {
+<a name="l00459"></a>00459 cpl_imagelist * variances;
+<a name="l00460"></a>00460 cpl_image * accu_var;
+<a name="l00461"></a>00461 cpl_msg_info(__func__, <span class="stringliteral">"Computing the uncertainty in dark"</span>);
+<a name="l00462"></a>00462 variances = <a class="code" href="group__hawki__variance.html#ga3077d7b2029de0416fabed98bc092818" title="Create the associated variance of raw imagelist.">hawki_imglist_create_variances_and_delete</a>
+<a name="l00463"></a>00463 (darks_raw, hawki_cal_dark_config.gain,
+<a name="l00464"></a>00464 hawki_cal_dark_config.ron, hawki_cal_dark_outputs.ndit,
+<a name="l00465"></a>00465 hawki_cal_dark_outputs.ndsamples);
+<a name="l00466"></a>00466 <span class="comment">/* The variances are collapsed, like the dark_raw. Given that</span>
+<a name="l00467"></a>00467 <span class="comment"> * the variances are a monotically increasing function with</span>
+<a name="l00468"></a>00468 <span class="comment"> * respect to the dark_raw, the minmax algorithm will select</span>
+<a name="l00469"></a>00469 <span class="comment"> * the same values as for the dark_raw </span>
+<a name="l00470"></a>00470 <span class="comment"> * The nframes - 1 is because only one frame is being rejected*/</span>
+<a name="l00471"></a>00471 accu_var = cpl_imagelist_collapse_minmax_create(variances,0,1);
+<a name="l00472"></a>00472 cpl_image_divide_scalar(accu_var, nframes - 1);
+<a name="l00473"></a>00473 ima_accu_err = cpl_image_duplicate(accu_var);
+<a name="l00474"></a>00474 cpl_image_power(ima_accu_err, 0.5);
+<a name="l00475"></a>00475 cpl_imagelist_delete(variances);
+<a name="l00476"></a>00476 cpl_image_delete(accu_var);
+<a name="l00477"></a>00477 }
+<a name="l00478"></a>00478
+<a name="l00479"></a>00479 } <span class="keywordflow">else</span> {
+<a name="l00480"></a>00480 ima_accu = cpl_imagelist_collapse_create(darks_raw) ;
+<a name="l00481"></a>00481 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00482"></a>00482 {
+<a name="l00483"></a>00483 cpl_imagelist * variances;
+<a name="l00484"></a>00484 cpl_image * accu_var;
+<a name="l00485"></a>00485 cpl_msg_info(__func__, <span class="stringliteral">"Computing the uncertainty in dark"</span>);
+<a name="l00486"></a>00486 variances = <a class="code" href="group__hawki__variance.html#ga3077d7b2029de0416fabed98bc092818" title="Create the associated variance of raw imagelist.">hawki_imglist_create_variances_and_delete</a>
+<a name="l00487"></a>00487 (darks_raw, hawki_cal_dark_config.gain,
+<a name="l00488"></a>00488 hawki_cal_dark_config.ron, hawki_cal_dark_outputs.ndit,
+<a name="l00489"></a>00489 hawki_cal_dark_outputs.ndsamples);
+<a name="l00490"></a>00490 accu_var = cpl_imagelist_collapse_create(variances);
+<a name="l00491"></a>00491 cpl_image_divide_scalar(accu_var, nframes);
+<a name="l00492"></a>00492 ima_accu_err = cpl_image_duplicate(accu_var);
+<a name="l00493"></a>00493 cpl_image_power(ima_accu_err, 0.5);
+<a name="l00494"></a>00494 cpl_imagelist_delete(variances);
+<a name="l00495"></a>00495 cpl_image_delete(accu_var);
+<a name="l00496"></a>00496 }
+<a name="l00497"></a>00497 }
+<a name="l00498"></a>00498 <span class="keywordflow">if</span> (ima_accu == NULL) {
+<a name="l00499"></a>00499 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute the average"</span>) ;
+<a name="l00500"></a>00500 cpl_frameset_delete(rawframes) ;
+<a name="l00501"></a>00501 cpl_imagelist_delete(bpmdark) ;
+<a name="l00502"></a>00502 cpl_imagelist_delete(master_dark) ;
+<a name="l00503"></a>00503 <span class="keywordflow">if</span>(ima_accu_err != NULL)
+<a name="l00504"></a>00504 cpl_image_delete(ima_accu_err);
+<a name="l00505"></a>00505 cpl_imagelist_delete(darks_raw);
+<a name="l00506"></a>00506 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00507"></a>00507 cpl_vector_delete(rons[idet]) ;
+<a name="l00508"></a>00508 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00509"></a>00509 cpl_table_delete(raw_dark_stats[idet]);
+<a name="l00510"></a>00510 cpl_free(raw_dark_stats);
+<a name="l00511"></a>00511 <span class="keywordflow">return</span> -1 ;
+<a name="l00512"></a>00512 }
+<a name="l00513"></a>00513 cpl_imagelist_delete(darks_raw) ;
+<a name="l00514"></a>00514
+<a name="l00515"></a>00515 <span class="comment">/* Put the result in the list */</span>
+<a name="l00516"></a>00516 cpl_imagelist_set(master_dark, ima_accu, idet) ;
+<a name="l00517"></a>00517 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00518"></a>00518 cpl_imagelist_set(master_dark_err, ima_accu_err, idet) ;
+<a name="l00519"></a>00519
+<a name="l00520"></a>00520 <span class="comment">/* Compute the dark_med and stdev */</span>
+<a name="l00521"></a>00521 hawki_cal_dark_outputs.master_dark_med[idet]=
+<a name="l00522"></a>00522 cpl_image_get_median(ima_accu) / hawki_cal_dark_outputs.dit;
+<a name="l00523"></a>00523 hawki_cal_dark_outputs.master_dark_mean[idet] =
+<a name="l00524"></a>00524 cpl_image_get_mean(ima_accu) / hawki_cal_dark_outputs.dit;
+<a name="l00525"></a>00525 hawki_cal_dark_outputs.master_dark_stdev[idet] =
+<a name="l00526"></a>00526 cpl_image_get_stdev(ima_accu) / hawki_cal_dark_outputs.dit;
+<a name="l00527"></a>00527 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00528"></a>00528 {
+<a name="l00529"></a>00529 hawki_cal_dark_outputs.master_dark_error_med[idet]=
+<a name="l00530"></a>00530 cpl_image_get_median(ima_accu_err) / hawki_cal_dark_outputs.dit;
+<a name="l00531"></a>00531 hawki_cal_dark_outputs.master_dark_error_mean[idet] =
+<a name="l00532"></a>00532 cpl_image_get_mean(ima_accu_err) / hawki_cal_dark_outputs.dit;
+<a name="l00533"></a>00533 hawki_cal_dark_outputs.master_dark_error_stdev[idet] =
+<a name="l00534"></a>00534 cpl_image_get_stdev(ima_accu_err) / hawki_cal_dark_outputs.dit;
+<a name="l00535"></a>00535 }
+<a name="l00536"></a>00536
+<a name="l00537"></a>00537 <span class="comment">/* Compute the Video Channels stats */</span>
+<a name="l00538"></a>00538 vc_lly = 973 ;
+<a name="l00539"></a>00539 vc_ury = 1036 ;
+<a name="l00540"></a>00540 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_VC ; j++) {
+<a name="l00541"></a>00541 vc_llx = j*(2048/HAWKI_NB_VC) + 1 ;
+<a name="l00542"></a>00542 vc_urx = (j+1)*(2048/HAWKI_NB_VC) ;
+<a name="l00543"></a>00543
+<a name="l00544"></a>00544 hawki_cal_dark_outputs.vc_mean[idet][j] =
+<a name="l00545"></a>00545 cpl_image_get_mean_window(ima_accu, vc_llx, vc_lly,
+<a name="l00546"></a>00546 vc_urx, vc_ury) ;
+<a name="l00547"></a>00547
+<a name="l00548"></a>00548 hawki_cal_dark_outputs.vc_med[idet][j] =
+<a name="l00549"></a>00549 cpl_image_get_median_window(ima_accu, vc_llx, vc_lly,
+<a name="l00550"></a>00550 vc_urx, vc_ury) ;
+<a name="l00551"></a>00551
+<a name="l00552"></a>00552 hawki_cal_dark_outputs.vc_stdev[idet][j] =
+<a name="l00553"></a>00553 cpl_image_get_stdev_window(ima_accu, vc_llx, vc_lly,
+<a name="l00554"></a>00554 vc_urx, vc_ury) ;
+<a name="l00555"></a>00555 }
+<a name="l00556"></a>00556
+<a name="l00557"></a>00557 <span class="comment">/* Compute the HOT pixels map */</span>
+<a name="l00558"></a>00558 cpl_msg_info(__func__, <span class="stringliteral">"Compute the BPM from the dark"</span>) ;
+<a name="l00559"></a>00559 cpl_msg_indent_more() ;
+<a name="l00560"></a>00560 <span class="keywordflow">if</span> ((bpm=<a class="code" href="group__hawki__utils.html#ga292d87e3996e9bb4331980a41d8b45bb" title="Compute the bpm from the dark (hot pixels)">hawki_compute_darkbpm</a>(ima_accu,
+<a name="l00561"></a>00561 hawki_cal_dark_config.sigma)) == NULL) {
+<a name="l00562"></a>00562 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute the hot pixels"</span>) ;
+<a name="l00563"></a>00563 cpl_msg_indent_less() ;
+<a name="l00564"></a>00564 cpl_frameset_delete(rawframes) ;
+<a name="l00565"></a>00565 cpl_imagelist_delete(bpmdark) ;
+<a name="l00566"></a>00566 cpl_imagelist_delete(master_dark);
+<a name="l00567"></a>00567 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00568"></a>00568 cpl_imagelist_delete(master_dark_err);
+<a name="l00569"></a>00569 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00570"></a>00570 cpl_vector_delete(rons[idet]) ;
+<a name="l00571"></a>00571 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00572"></a>00572 cpl_table_delete(raw_dark_stats[idet]);
+<a name="l00573"></a>00573 cpl_free(raw_dark_stats);
+<a name="l00574"></a>00574 <span class="keywordflow">return</span> -1 ;
+<a name="l00575"></a>00575 }
+<a name="l00576"></a>00576 cpl_imagelist_set(bpmdark, bpm, idet) ;
+<a name="l00577"></a>00577 hawki_cal_dark_outputs.nb_badpix[idet]=(int)cpl_image_get_flux(bpm);
+<a name="l00578"></a>00578 cpl_msg_indent_less() ;
+<a name="l00579"></a>00579 }
+<a name="l00580"></a>00580 cpl_msg_indent_less() ;
+<a name="l00581"></a>00581
+<a name="l00582"></a>00582 <span class="comment">/* Divide by DIT */</span>
+<a name="l00583"></a>00583 cpl_msg_info(__func__, <span class="stringliteral">"Division by DIT"</span>) ;
+<a name="l00584"></a>00584 cpl_imagelist_divide_scalar(master_dark, hawki_cal_dark_outputs.dit);
+<a name="l00585"></a>00585 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00586"></a>00586 cpl_imagelist_divide_scalar(master_dark_err, hawki_cal_dark_outputs.dit);
+<a name="l00587"></a>00587
+<a name="l00588"></a>00588 <span class="comment">/* Save the product */</span>
+<a name="l00589"></a>00589 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00590"></a>00590 cpl_msg_indent_more() ;
+<a name="l00591"></a>00591 <span class="keywordflow">if</span> (hawki_cal_dark_save(master_dark, master_dark_err,
+<a name="l00592"></a>00592 bpmdark, raw_dark_stats,
+<a name="l00593"></a>00593 (<span class="keyword">const</span> cpl_vector **)rons,
+<a name="l00594"></a>00594 rawframes,
+<a name="l00595"></a>00595 parlist, frameset))
+<a name="l00596"></a>00596 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00597"></a>00597 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00598"></a>00598
+<a name="l00599"></a>00599 <span class="comment">/* Free */</span>
+<a name="l00600"></a>00600 cpl_frameset_delete(rawframes) ;
+<a name="l00601"></a>00601 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00602"></a>00602 cpl_vector_delete(rons[idet]) ;
+<a name="l00603"></a>00603 cpl_imagelist_delete(master_dark) ;
+<a name="l00604"></a>00604 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00605"></a>00605 cpl_imagelist_delete(master_dark_err);
+<a name="l00606"></a>00606 cpl_imagelist_delete(bpmdark) ;
+<a name="l00607"></a>00607 cpl_msg_indent_less() ;
+<a name="l00608"></a>00608 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00609"></a>00609 cpl_table_delete(raw_dark_stats[idet]);
+<a name="l00610"></a>00610 cpl_free(raw_dark_stats);
+<a name="l00611"></a>00611
+<a name="l00612"></a>00612 <span class="comment">/* Return */</span>
+<a name="l00613"></a>00613 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00614"></a>00614 {
+<a name="l00615"></a>00615 cpl_msg_error(__func__,
+<a name="l00616"></a>00616 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00617"></a>00617 <span class="keywordflow">return</span> -1 ;
+<a name="l00618"></a>00618 }
+<a name="l00619"></a>00619 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00620"></a>00620 }
+<a name="l00621"></a>00621
+<a name="l00622"></a>00622 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00630"></a>00630 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00631"></a>00631 <span class="keyword">static</span> <span class="keywordtype">double</span> hawki_cal_dark_ron(
+<a name="l00632"></a>00632 <span class="keyword">const</span> cpl_image * ima1,
+<a name="l00633"></a>00633 <span class="keyword">const</span> cpl_image * ima2,
+<a name="l00634"></a>00634 <span class="keywordtype">int</span> ndit)
+<a name="l00635"></a>00635 {
+<a name="l00636"></a>00636 cpl_image * ima ;
+<a name="l00637"></a>00637 <span class="keywordtype">double</span> norm ;
+<a name="l00638"></a>00638 <span class="keywordtype">double</span> ron ;
+<a name="l00639"></a>00639
+<a name="l00640"></a>00640 <span class="comment">/* Test entries */</span>
+<a name="l00641"></a>00641 <span class="keywordflow">if</span> (ima1 == NULL) <span class="keywordflow">return</span> -1.0 ;
+<a name="l00642"></a>00642 <span class="keywordflow">if</span> (ima2 == NULL) <span class="keywordflow">return</span> -1.0 ;
+<a name="l00643"></a>00643 <span class="keywordflow">if</span> (ndit < 1) <span class="keywordflow">return</span> -1.0 ;
+<a name="l00644"></a>00644
+<a name="l00645"></a>00645 <span class="comment">/* Compute norm */</span>
+<a name="l00646"></a>00646 norm = 0.5 * ndit ;
+<a name="l00647"></a>00647 norm = sqrt(norm) ;
+<a name="l00648"></a>00648
+<a name="l00649"></a>00649 <span class="comment">/* Subtraction */</span>
+<a name="l00650"></a>00650 <span class="keywordflow">if</span> ((ima = cpl_image_subtract_create(ima2, ima1)) == NULL) <span class="keywordflow">return</span> -1.0 ;
+<a name="l00651"></a>00651
+<a name="l00652"></a>00652 <span class="comment">/* RON measurement */</span>
+<a name="l00653"></a>00653 cpl_flux_get_noise_window(ima, NULL, hawki_cal_dark_config.hsize,
+<a name="l00654"></a>00654 hawki_cal_dark_config.nsamples, &ron, NULL) ;
+<a name="l00655"></a>00655 cpl_image_delete(ima) ;
+<a name="l00656"></a>00656 <span class="keywordflow">return</span> norm*ron ;
+<a name="l00657"></a>00657 }
+<a name="l00658"></a>00658
+<a name="l00659"></a>00659 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00669"></a>00669 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00670"></a>00670 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_save
+<a name="l00671"></a>00671 (<span class="keyword">const</span> cpl_imagelist * master_dark,
+<a name="l00672"></a>00672 <span class="keyword">const</span> cpl_imagelist * master_dark_err,
+<a name="l00673"></a>00673 <span class="keyword">const</span> cpl_imagelist * bpmdark,
+<a name="l00674"></a>00674 cpl_table ** raw_dark_stats,
+<a name="l00675"></a>00675 <span class="keyword">const</span> cpl_vector ** rons,
+<a name="l00676"></a>00676 <span class="keyword">const</span> cpl_frameset * used_frames,
+<a name="l00677"></a>00677 cpl_parameterlist * parlist,
+<a name="l00678"></a>00678 cpl_frameset * <span class="keyword">set</span>)
+<a name="l00679"></a>00679 {
+<a name="l00680"></a>00680 cpl_propertylist ** qclists ;
+<a name="l00681"></a>00681 <span class="keyword">const</span> cpl_frame * ref_frame ;
+<a name="l00682"></a>00682 <span class="keywordtype">char</span> sval[32] ;
+<a name="l00683"></a>00683 cpl_propertylist * inputlist ;
+<a name="l00684"></a>00684 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00685"></a>00685 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_cal_dark"</span> ;
+<a name="l00686"></a>00686 <span class="keywordtype">int</span> i, j ;
+<a name="l00687"></a>00687 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00688"></a>00688
+<a name="l00689"></a>00689
+<a name="l00690"></a>00690 <span class="comment">/* Get the reference frame */</span>
+<a name="l00691"></a>00691 ref_frame = irplib_frameset_get_first_from_group(<span class="keyword">set</span>, CPL_FRAME_GROUP_RAW) ;
+<a name="l00692"></a>00692
+<a name="l00693"></a>00693 <span class="comment">/* Create the QC lists */</span>
+<a name="l00694"></a>00694 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l00695"></a>00695 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00696"></a>00696 qclists[i] = cpl_propertylist_new();
+<a name="l00697"></a>00697 cpl_propertylist_append_int(qclists[i], <span class="stringliteral">"ESO QC DARK NBADPIX"</span>,
+<a name="l00698"></a>00698 hawki_cal_dark_outputs.nb_badpix[i]);
+<a name="l00699"></a>00699 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK MEAN"</span>,
+<a name="l00700"></a>00700 hawki_cal_dark_outputs.master_dark_mean[i]);
+<a name="l00701"></a>00701 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK MED"</span>,
+<a name="l00702"></a>00702 hawki_cal_dark_outputs.master_dark_med[i]);
+<a name="l00703"></a>00703 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK STDEV"</span>,
+<a name="l00704"></a>00704 hawki_cal_dark_outputs.master_dark_stdev[i]);
+<a name="l00705"></a>00705 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK NONORM MEAN"</span>,
+<a name="l00706"></a>00706 hawki_cal_dark_outputs.master_dark_mean[i] * hawki_cal_dark_outputs.dit);
+<a name="l00707"></a>00707 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK NONORM MED"</span>,
+<a name="l00708"></a>00708 hawki_cal_dark_outputs.master_dark_med[i] * hawki_cal_dark_outputs.dit);
+<a name="l00709"></a>00709 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK NONORM STDEV"</span>,
+<a name="l00710"></a>00710 hawki_cal_dark_outputs.master_dark_stdev[i] * hawki_cal_dark_outputs.dit);
+<a name="l00711"></a>00711 <span class="keywordflow">if</span>(hawki_cal_dark_config.error_tracking)
+<a name="l00712"></a>00712 {
+<a name="l00713"></a>00713 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK ERR MEAN"</span>,
+<a name="l00714"></a>00714 hawki_cal_dark_outputs.master_dark_error_mean[i]);
+<a name="l00715"></a>00715 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK ERR MED"</span>,
+<a name="l00716"></a>00716 hawki_cal_dark_outputs.master_dark_error_med[i]);
+<a name="l00717"></a>00717 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK ERR STDEV"</span>,
+<a name="l00718"></a>00718 hawki_cal_dark_outputs.master_dark_error_stdev[i]);
+<a name="l00719"></a>00719 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK ERR NONORM MEAN"</span>,
+<a name="l00720"></a>00720 hawki_cal_dark_outputs.master_dark_error_mean[i] * hawki_cal_dark_outputs.dit);
+<a name="l00721"></a>00721 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK ERR NONORM MED"</span>,
+<a name="l00722"></a>00722 hawki_cal_dark_outputs.master_dark_error_med[i] * hawki_cal_dark_outputs.dit);
+<a name="l00723"></a>00723 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DARK ERR NONORM STDEV"</span>,
+<a name="l00724"></a>00724 hawki_cal_dark_outputs.master_dark_error_stdev[i] * hawki_cal_dark_outputs.dit);
+<a name="l00725"></a>00725 }
+<a name="l00726"></a>00726 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_VC ; j++) {
+<a name="l00727"></a>00727 sprintf(sval, <span class="stringliteral">"ESO QC DARK VC%d MEAN"</span>, j+1) ;
+<a name="l00728"></a>00728 cpl_propertylist_append_double(qclists[i], sval,
+<a name="l00729"></a>00729 hawki_cal_dark_outputs.vc_mean[i][j]) ;
+<a name="l00730"></a>00730 sprintf(sval, <span class="stringliteral">"ESO QC DARK VC%d MED"</span>, j+1) ;
+<a name="l00731"></a>00731 cpl_propertylist_append_double(qclists[i], sval,
+<a name="l00732"></a>00732 hawki_cal_dark_outputs.vc_med[i][j]) ;
+<a name="l00733"></a>00733 sprintf(sval, <span class="stringliteral">"ESO QC DARK VC%d STDEV"</span>, j+1) ;
+<a name="l00734"></a>00734 cpl_propertylist_append_double(qclists[i], sval,
+<a name="l00735"></a>00735 hawki_cal_dark_outputs.vc_stdev[i][j]) ;
+<a name="l00736"></a>00736 }
+<a name="l00737"></a>00737 <span class="keywordflow">for</span> (j=0 ; j<cpl_vector_get_size(rons[i]) ; j++) {
+<a name="l00738"></a>00738 sprintf(sval, <span class="stringliteral">"ESO QC RON%d"</span>, j+1) ;
+<a name="l00739"></a>00739 cpl_propertylist_append_double(qclists[i], sval,
+<a name="l00740"></a>00740 cpl_vector_get(rons[i], j)) ;
+<a name="l00741"></a>00741 }
+<a name="l00742"></a>00742 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC RON MEAN"</span>,
+<a name="l00743"></a>00743 cpl_vector_get_mean(rons[i])) ;
+<a name="l00744"></a>00744 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC RON MED"</span>,
+<a name="l00745"></a>00745 cpl_vector_get_median_const(rons[i])) ;
+<a name="l00746"></a>00746 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC RON STDEV"</span>,
+<a name="l00747"></a>00747 cpl_vector_get_stdev(rons[i])) ;
+<a name="l00748"></a>00748 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DATANCOM"</span>,
+<a name="l00749"></a>00749 cpl_frameset_get_size(<span class="keyword">set</span>)) ;
+<a name="l00750"></a>00750
+<a name="l00751"></a>00751 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00752"></a>00752 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), i+1);
+<a name="l00753"></a>00753 inputlist = cpl_propertylist_load_regexp(
+<a name="l00754"></a>00754 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00755"></a>00755 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l00756"></a>00756 cpl_propertylist_append(qclists[i], inputlist) ;
+<a name="l00757"></a>00757 cpl_propertylist_delete(inputlist) ;
+<a name="l00758"></a>00758 }
+<a name="l00759"></a>00759 <span class="comment">/* Statistics of the raw images in the QC */</span>
+<a name="l00760"></a>00760 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(raw_dark_stats, qclists);
+<a name="l00761"></a>00761
+<a name="l00762"></a>00762 <span class="comment">/* Write the dark image */</span>
+<a name="l00763"></a>00763 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(<span class="keyword">set</span>,
+<a name="l00764"></a>00764 parlist,
+<a name="l00765"></a>00765 used_frames,
+<a name="l00766"></a>00766 master_dark,
+<a name="l00767"></a>00767 recipe_name,
+<a name="l00768"></a>00768 HAWKI_CALPRO_DARK,
+<a name="l00769"></a>00769 HAWKI_PROTYPE_DARK,
+<a name="l00770"></a>00770 NULL,
+<a name="l00771"></a>00771 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l00772"></a>00772 <span class="stringliteral">"hawki_cal_dark.fits"</span>) ;
+<a name="l00773"></a>00773
+<a name="l00774"></a>00774 <span class="comment">/* Write the dark image error */</span>
+<a name="l00775"></a>00775 <span class="keywordflow">if</span>(master_dark_err != NULL)
+<a name="l00776"></a>00776 {
+<a name="l00777"></a>00777 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(<span class="keyword">set</span>,
+<a name="l00778"></a>00778 parlist,
+<a name="l00779"></a>00779 used_frames,
+<a name="l00780"></a>00780 master_dark_err,
+<a name="l00781"></a>00781 recipe_name,
+<a name="l00782"></a>00782 HAWKI_CALPRO_DARK_ERR,
+<a name="l00783"></a>00783 HAWKI_PROTYPE_DARK_ERR,
+<a name="l00784"></a>00784 NULL,
+<a name="l00785"></a>00785 NULL,
+<a name="l00786"></a>00786 <span class="stringliteral">"hawki_cal_dark_err.fits"</span>) ;
+<a name="l00787"></a>00787 }
+<a name="l00788"></a>00788
+<a name="l00789"></a>00789 <span class="comment">/* Write the bpmdark pixels image */</span>
+<a name="l00790"></a>00790 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(<span class="keyword">set</span>,
+<a name="l00791"></a>00791 parlist,
+<a name="l00792"></a>00792 used_frames,
+<a name="l00793"></a>00793 bpmdark,
+<a name="l00794"></a>00794 recipe_name,
+<a name="l00795"></a>00795 HAWKI_CALPRO_BPM_HOT,
+<a name="l00796"></a>00796 HAWKI_PROTYPE_BPM,
+<a name="l00797"></a>00797 NULL,
+<a name="l00798"></a>00798 NULL,
+<a name="l00799"></a>00799 <span class="stringliteral">"hawki_cal_dark_bpmdark.fits"</span>) ;
+<a name="l00800"></a>00800
+<a name="l00801"></a>00801
+<a name="l00802"></a>00802 <span class="comment">/* Write the table with the statistics */</span>
+<a name="l00803"></a>00803 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l00804"></a>00804 parlist,
+<a name="l00805"></a>00805 used_frames,
+<a name="l00806"></a>00806 (<span class="keyword">const</span> cpl_table **)raw_dark_stats,
+<a name="l00807"></a>00807 recipe_name,
+<a name="l00808"></a>00808 HAWKI_CALPRO_DARK_STATS,
+<a name="l00809"></a>00809 HAWKI_PROTYPE_DARK_STATS,
+<a name="l00810"></a>00810 NULL,
+<a name="l00811"></a>00811 NULL,
+<a name="l00812"></a>00812 <span class="stringliteral">"hawki_cal_dark_stats.fits"</span>) ;
+<a name="l00813"></a>00813
+<a name="l00814"></a>00814 <span class="comment">/* Free and return */</span>
+<a name="l00815"></a>00815 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00816"></a>00816 cpl_propertylist_delete(qclists[i]) ;
+<a name="l00817"></a>00817 }
+<a name="l00818"></a>00818 cpl_free(qclists) ;
+<a name="l00819"></a>00819 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00820"></a>00820 {
+<a name="l00821"></a>00821 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00822"></a>00822 <span class="keywordflow">return</span> -1;
+<a name="l00823"></a>00823 }
+<a name="l00824"></a>00824 <span class="keywordflow">return</span> 0;
+<a name="l00825"></a>00825 }
+<a name="l00826"></a>00826
+<a name="l00827"></a>00827 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_dark_retrieve_input_param
+<a name="l00828"></a>00828 (cpl_parameterlist * parlist)
+<a name="l00829"></a>00829 {
+<a name="l00830"></a>00830 cpl_parameter * par ;
+<a name="l00831"></a>00831 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00832"></a>00832 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00833"></a>00833
+<a name="l00834"></a>00834 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00835"></a>00835 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_dark.sigma"</span>) ;
+<a name="l00836"></a>00836 hawki_cal_dark_config.sigma = cpl_parameter_get_double(par) ;
+<a name="l00837"></a>00837 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_dark.hsize"</span>) ;
+<a name="l00838"></a>00838 hawki_cal_dark_config.hsize = cpl_parameter_get_int(par) ;
+<a name="l00839"></a>00839 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_dark.nsamples"</span>) ;
+<a name="l00840"></a>00840 hawki_cal_dark_config.nsamples = cpl_parameter_get_int(par) ;
+<a name="l00841"></a>00841 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_dark.zone"</span>) ;
+<a name="l00842"></a>00842 sval = cpl_parameter_get_string(par) ;
+<a name="l00843"></a>00843 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d,%d,%d"</span>,
+<a name="l00844"></a>00844 &hawki_cal_dark_config.llx,
+<a name="l00845"></a>00845 &hawki_cal_dark_config.lly,
+<a name="l00846"></a>00846 &hawki_cal_dark_config.urx,
+<a name="l00847"></a>00847 &hawki_cal_dark_config.ury)!=4) {
+<a name="l00848"></a>00848 <span class="keywordflow">return</span> -1 ;
+<a name="l00849"></a>00849 }
+<a name="l00850"></a>00850 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_dark.gain"</span>) ;
+<a name="l00851"></a>00851 hawki_cal_dark_config.gain = cpl_parameter_get_double(par);
+<a name="l00852"></a>00852 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_dark.ron"</span>) ;
+<a name="l00853"></a>00853 hawki_cal_dark_config.ron = cpl_parameter_get_double(par);
+<a name="l00854"></a>00854 hawki_cal_dark_config.error_tracking = 0;
+<a name="l00855"></a>00855 <span class="keywordflow">if</span>(hawki_cal_dark_config.gain > 0 && hawki_cal_dark_config.ron > 0)
+<a name="l00856"></a>00856 hawki_cal_dark_config.error_tracking = 1;
+<a name="l00857"></a>00857
+<a name="l00858"></a>00858 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00859"></a>00859 <span class="keywordflow">return</span> -1;
+<a name="l00860"></a>00860
+<a name="l00861"></a>00861 <span class="keywordflow">return</span> 0;
+<a name="l00862"></a>00862 }
+<a name="l00863"></a>00863
+<a name="l00864"></a>00864 <span class="keywordtype">void</span> hawki_cal_dark_initialise_qc(<span class="keywordtype">void</span>)
+<a name="l00865"></a>00865 {
+<a name="l00866"></a>00866 <span class="keywordtype">int</span> idet;
+<a name="l00867"></a>00867 <span class="keywordtype">int</span> j;
+<a name="l00868"></a>00868
+<a name="l00869"></a>00869 <span class="keywordflow">for</span>(idet=0; idet<HAWKI_NB_DETECTORS; idet++)
+<a name="l00870"></a>00870 {
+<a name="l00871"></a>00871 hawki_cal_dark_outputs.nb_badpix[idet] = -1 ;
+<a name="l00872"></a>00872 hawki_cal_dark_outputs.master_dark_mean[idet] = -1.0 ;
+<a name="l00873"></a>00873 hawki_cal_dark_outputs.master_dark_med[idet] = -1.0 ;
+<a name="l00874"></a>00874 hawki_cal_dark_outputs.master_dark_stdev[idet] = -1.0 ;
+<a name="l00875"></a>00875 hawki_cal_dark_outputs.master_dark_error_mean[idet] = -1.0 ;
+<a name="l00876"></a>00876 hawki_cal_dark_outputs.master_dark_error_med[idet] = -1.0 ;
+<a name="l00877"></a>00877 hawki_cal_dark_outputs.master_dark_error_stdev[idet] = -1.0 ;
+<a name="l00878"></a>00878 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_VC ; j++)
+<a name="l00879"></a>00879 {
+<a name="l00880"></a>00880 hawki_cal_dark_outputs.vc_mean[idet][j] = -1.0 ;
+<a name="l00881"></a>00881 hawki_cal_dark_outputs.vc_med[idet][j] = -1.0 ;
+<a name="l00882"></a>00882 hawki_cal_dark_outputs.vc_stdev[idet][j] = -1.0 ;
+<a name="l00883"></a>00883 }
+<a name="l00884"></a>00884 }
+<a name="l00885"></a>00885 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__cal__distortion_8c_source.html b/html/hawki__cal__distortion_8c_source.html
new file mode 100644
index 0000000..da765bd
--- /dev/null
+++ b/html/hawki__cal__distortion_8c_source.html
@@ -0,0 +1,1335 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_cal_distortion.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_cal_distortion.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_cal_distortion.c,v 1.14 2012/04/23 10:02:57 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/04/23 10:02:57 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.14 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <string.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_alloc.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "irplib_cat.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "irplib_stdstar.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "irplib_match_cats.h"</span>
+<a name="l00053"></a>00053 <span class="preprocessor">#include "hawki_match_cats.h"</span>
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00056"></a>00056 <span class="comment"> Functions prototypes</span>
+<a name="l00057"></a>00057 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00058"></a>00058
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_create(cpl_plugin *) ;
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_exec(cpl_plugin *) ;
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_destroy(cpl_plugin *) ;
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion(cpl_parameterlist * parlist,
+<a name="l00063"></a>00063 cpl_frameset * frameset);
+<a name="l00064"></a>00064
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_get_apertures_from_raw_distor
+<a name="l00067"></a>00067 (cpl_frameset * raw_target,
+<a name="l00068"></a>00068 <span class="keyword">const</span> cpl_frame * flat,
+<a name="l00069"></a>00069 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00070"></a>00070 <span class="keyword">const</span> cpl_frame * bpm,
+<a name="l00071"></a>00071 cpl_image ** master_sky,
+<a name="l00072"></a>00072 <span class="keywordtype">double</span> sigma_det,
+<a name="l00073"></a>00073 cpl_apertures *** apertures);
+<a name="l00074"></a>00074
+<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_load_master_calib
+<a name="l00076"></a>00076 (<span class="keyword">const</span> cpl_frame * flat,
+<a name="l00077"></a>00077 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00078"></a>00078 <span class="keyword">const</span> cpl_frame * bpm,
+<a name="l00079"></a>00079 cpl_imagelist ** flat_images,
+<a name="l00080"></a>00080 cpl_imagelist ** dark_images,
+<a name="l00081"></a>00081 cpl_imagelist ** bpm_images);
+<a name="l00082"></a>00082
+<a name="l00083"></a>00083 <span class="keyword">static</span> cpl_image ** hawki_cal_distortion_get_master_sky
+<a name="l00084"></a>00084 (cpl_frameset * raw_target,
+<a name="l00085"></a>00085 <span class="keyword">const</span> cpl_frame * flat,
+<a name="l00086"></a>00086 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00087"></a>00087 <span class="keyword">const</span> cpl_frame * bpm);
+<a name="l00088"></a>00088
+<a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_subtract_sky
+<a name="l00090"></a>00090 (cpl_imagelist * distor_corrected,
+<a name="l00091"></a>00091 cpl_image * master_sky);
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093 <span class="keyword">static</span> hawki_distortion ** hawki_cal_distortion_compute_dist_solution
+<a name="l00094"></a>00094 (cpl_apertures *** apertures,
+<a name="l00095"></a>00095 <span class="keywordtype">int</span> nframes,
+<a name="l00096"></a>00096 cpl_bivector * offsets,
+<a name="l00097"></a>00097 <span class="keywordtype">int</span> grid_points,
+<a name="l00098"></a>00098 <span class="keywordtype">int</span> * nmatched_pairs,
+<a name="l00099"></a>00099 <span class="keywordtype">double</span> * rms,
+<a name="l00100"></a>00100 hawki_distortion ** distortion_guess);
+<a name="l00101"></a>00101
+<a name="l00102"></a>00102 <span class="keyword">static</span> cpl_apertures * hawki_cal_distortion_get_image_apertures
+<a name="l00103"></a>00103 (cpl_image * image,
+<a name="l00104"></a>00104 <span class="keywordtype">double</span> sigma_det);
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_fill_obj_pos
+<a name="l00107"></a>00107 (cpl_table * objects_positions,
+<a name="l00108"></a>00108 cpl_apertures * apertures);
+<a name="l00109"></a>00109
+<a name="l00110"></a>00110 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_add_offset_to_positions
+<a name="l00111"></a>00111 (cpl_table ** objects_positions,
+<a name="l00112"></a>00112 cpl_bivector * offsets);
+<a name="l00113"></a>00113
+<a name="l00114"></a>00114 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_fit_first_order_solution
+<a name="l00115"></a>00115 (hawki_distortion * distortion,
+<a name="l00116"></a>00116 cpl_polynomial * fit2d_x,
+<a name="l00117"></a>00117 cpl_polynomial * fit2d_y);
+<a name="l00118"></a>00118
+<a name="l00119"></a>00119 <span class="keyword">static</span> cpl_propertylist ** hawki_cal_distortion_qc
+<a name="l00120"></a>00120 (hawki_distortion ** distortion,
+<a name="l00121"></a>00121 <span class="keywordtype">int</span> * nmatched_pairs,
+<a name="l00122"></a>00122 <span class="keywordtype">double</span> * rms);
+<a name="l00123"></a>00123
+<a name="l00124"></a>00124 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_save
+<a name="l00125"></a>00125 (hawki_distortion ** distortion,
+<a name="l00126"></a>00126 cpl_parameterlist * parlist,
+<a name="l00127"></a>00127 cpl_propertylist ** qclists,
+<a name="l00128"></a>00128 cpl_frameset * recipe_set);
+<a name="l00129"></a>00129
+<a name="l00130"></a>00130 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_retrieve_input_param
+<a name="l00131"></a>00131 (cpl_parameterlist * parlist);
+<a name="l00132"></a>00132
+<a name="l00133"></a>00133
+<a name="l00134"></a>00134 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00135"></a>00135 <span class="comment"> Static variables</span>
+<a name="l00136"></a>00136 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00137"></a>00137
+<a name="l00138"></a>00138 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00139"></a>00139 {
+<a name="l00140"></a>00140 <span class="comment">/* Inputs */</span>
+<a name="l00141"></a>00141 <span class="keywordtype">double</span> sigma_det;
+<a name="l00142"></a>00142 <span class="keywordtype">int</span> grid_points;
+<a name="l00143"></a>00143 <span class="keywordtype">int</span> borders;
+<a name="l00144"></a>00144 <span class="keywordtype">int</span> subtract_linear;
+<a name="l00145"></a>00145 } hawki_cal_distortion_config;
+<a name="l00146"></a>00146
+<a name="l00147"></a>00147 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_cal_distortion_description[] =
+<a name="l00148"></a>00148 <span class="stringliteral">"hawki_cal_distortion -- HAWK-I distortion and astrometry autocalibration.\n\n"</span>
+<a name="l00149"></a>00149 <span class="stringliteral">"The input files must be tagged:\n"</span>
+<a name="l00150"></a>00150 <span class="stringliteral">"distortion_field.fits "</span>HAWKI_CAL_DISTOR_RAW<span class="stringliteral">"\n"</span>
+<a name="l00151"></a>00151 <span class="stringliteral">"sky_distortion.fits "</span>HAWKI_CAL_DISTOR_SKY_RAW<span class="stringliteral">"\n"</span>
+<a name="l00152"></a>00152 <span class="stringliteral">"flat-file.fits "</span>HAWKI_CALPRO_FLAT<span class="stringliteral">" (optional)\n"</span>
+<a name="l00153"></a>00153 <span class="stringliteral">"dark-file.fits "</span>HAWKI_CALPRO_DARK<span class="stringliteral">" (optional)\n"</span>
+<a name="l00154"></a>00154 <span class="stringliteral">"bpm-file.fits "</span>HAWKI_CALPRO_BPM<span class="stringliteral">" (optional)\n\n"</span>
+<a name="l00155"></a>00155 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00156"></a>00156 <span class="stringliteral">"hawki_cal_distortion_distx.fits ("</span>HAWKI_CALPRO_DISTORTION_X<span class="stringliteral">") \n"</span>
+<a name="l00157"></a>00157 <span class="stringliteral">"hawki_cal_distortion_disty.fits ("</span>HAWKI_CALPRO_DISTORTION_Y<span class="stringliteral">") \n\n"</span>
+<a name="l00158"></a>00158 <span class="stringliteral">"The recipe performs the following steps:\n"</span>
+<a name="l00159"></a>00159 <span class="stringliteral">"-Basic calibration of astrometry fields\n"</span>
+<a name="l00160"></a>00160 <span class="stringliteral">"-Autocalibration of distortion, using method in A&A 454,1029 (2006)\n\n"</span>
+<a name="l00161"></a>00161 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00162"></a>00162 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00163"></a>00163 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00166"></a>00166 <span class="comment"> Functions code</span>
+<a name="l00167"></a>00167 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00168"></a>00168
+<a name="l00169"></a>00169 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00177"></a>00177 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00178"></a>00178 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00179"></a>00179 {
+<a name="l00180"></a>00180 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00181"></a>00181 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00182"></a>00182
+<a name="l00183"></a>00183 cpl_plugin_init(plugin,
+<a name="l00184"></a>00184 CPL_PLUGIN_API,
+<a name="l00185"></a>00185 HAWKI_BINARY_VERSION,
+<a name="l00186"></a>00186 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00187"></a>00187 <span class="stringliteral">"hawki_cal_distortion"</span>,
+<a name="l00188"></a>00188 <span class="stringliteral">"Distortion autocalibration"</span>,
+<a name="l00189"></a>00189 hawki_cal_distortion_description,
+<a name="l00190"></a>00190 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00191"></a>00191 PACKAGE_BUGREPORT,
+<a name="l00192"></a>00192 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00193"></a>00193 hawki_cal_distortion_create,
+<a name="l00194"></a>00194 hawki_cal_distortion_exec,
+<a name="l00195"></a>00195 hawki_cal_distortion_destroy);
+<a name="l00196"></a>00196
+<a name="l00197"></a>00197 cpl_pluginlist_append(list, plugin) ;
+<a name="l00198"></a>00198
+<a name="l00199"></a>00199 <span class="keywordflow">return</span> 0;
+<a name="l00200"></a>00200 }
+<a name="l00201"></a>00201
+<a name="l00202"></a>00202 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00211"></a>00211 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00212"></a>00212 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_create(cpl_plugin * plugin)
+<a name="l00213"></a>00213 {
+<a name="l00214"></a>00214 cpl_recipe * recipe ;
+<a name="l00215"></a>00215 cpl_parameter * p ;
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00218"></a>00218 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00219"></a>00219 recipe = (cpl_recipe *)plugin ;
+<a name="l00220"></a>00220 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00221"></a>00221
+<a name="l00222"></a>00222 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00223"></a>00223 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00224"></a>00224 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00225"></a>00225 <span class="keywordflow">return</span> 1;
+<a name="l00226"></a>00226
+<a name="l00227"></a>00227 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00228"></a>00228 <span class="comment">/* --sigma_det */</span>
+<a name="l00229"></a>00229 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_distortion.sigma_det"</span>,
+<a name="l00230"></a>00230 CPL_TYPE_DOUBLE, <span class="stringliteral">"detection level"</span>,
+<a name="l00231"></a>00231 <span class="stringliteral">"hawki.hawki_cal_distortion"</span>, 6.) ;
+<a name="l00232"></a>00232 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sigma_det"</span>) ;
+<a name="l00233"></a>00233 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00234"></a>00234 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00235"></a>00235
+<a name="l00236"></a>00236 <span class="comment">/* --grid_points */</span>
+<a name="l00237"></a>00237 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_distortion.grid_points"</span>,
+<a name="l00238"></a>00238 CPL_TYPE_INT,
+<a name="l00239"></a>00239 <span class="stringliteral">"number of points in distortion grid"</span>,
+<a name="l00240"></a>00240 <span class="stringliteral">"hawki.hawki_cal_distortion"</span>, 9) ;
+<a name="l00241"></a>00241 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"grid_points"</span>) ;
+<a name="l00242"></a>00242 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00243"></a>00243 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00244"></a>00244
+<a name="l00245"></a>00245 <span class="comment">/* --borders */</span>
+<a name="l00246"></a>00246 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_distortion.borders"</span>,
+<a name="l00247"></a>00247 CPL_TYPE_INT,
+<a name="l00248"></a>00248 <span class="stringliteral">"number of pixels to trim at the borders"</span>,
+<a name="l00249"></a>00249 <span class="stringliteral">"hawki.hawki_cal_distortion"</span>, 6) ;
+<a name="l00250"></a>00250 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"borders"</span>) ;
+<a name="l00251"></a>00251 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00252"></a>00252 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00253"></a>00253
+<a name="l00254"></a>00254 <span class="comment">/* --subtract_linear */</span>
+<a name="l00255"></a>00255 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_distortion.subtract_linear"</span>,
+<a name="l00256"></a>00256 CPL_TYPE_BOOL,
+<a name="l00257"></a>00257 <span class="stringliteral">"Subtract a linear term to the solution"</span>,
+<a name="l00258"></a>00258 <span class="stringliteral">"hawki.hawki_cal_distortion"</span>, TRUE) ;
+<a name="l00259"></a>00259 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"subtract_linear"</span>) ;
+<a name="l00260"></a>00260 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00261"></a>00261 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00262"></a>00262
+<a name="l00263"></a>00263 <span class="comment">/* Return */</span>
+<a name="l00264"></a>00264 <span class="keywordflow">return</span> 0;
+<a name="l00265"></a>00265 }
+<a name="l00266"></a>00266
+<a name="l00267"></a>00267 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00273"></a>00273 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00274"></a>00274 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_exec(cpl_plugin * plugin)
+<a name="l00275"></a>00275 {
+<a name="l00276"></a>00276 cpl_recipe * recipe ;
+<a name="l00277"></a>00277
+<a name="l00278"></a>00278 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00279"></a>00279 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00280"></a>00280 recipe = (cpl_recipe *)plugin ;
+<a name="l00281"></a>00281 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00282"></a>00282
+<a name="l00283"></a>00283 <span class="comment">/* Issue a banner */</span>
+<a name="l00284"></a>00284 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00285"></a>00285
+<a name="l00286"></a>00286 <span class="keywordflow">return</span> hawki_cal_distortion(recipe->parameters, recipe->frames) ;
+<a name="l00287"></a>00287 }
+<a name="l00288"></a>00288
+<a name="l00289"></a>00289 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00295"></a>00295 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00296"></a>00296 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_destroy(cpl_plugin * plugin)
+<a name="l00297"></a>00297 {
+<a name="l00298"></a>00298 cpl_recipe * recipe ;
+<a name="l00299"></a>00299
+<a name="l00300"></a>00300 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00301"></a>00301 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00302"></a>00302 recipe = (cpl_recipe *)plugin ;
+<a name="l00303"></a>00303 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00304"></a>00304
+<a name="l00305"></a>00305 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00306"></a>00306 <span class="keywordflow">return</span> 0 ;
+<a name="l00307"></a>00307 }
+<a name="l00308"></a>00308
+<a name="l00309"></a>00309 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00315"></a>00315 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00316"></a>00316 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion(cpl_parameterlist * parlist,
+<a name="l00317"></a>00317 cpl_frameset * frameset)
+<a name="l00318"></a>00318 {
+<a name="l00319"></a>00319 <span class="keyword">const</span> cpl_frame * flat = NULL;
+<a name="l00320"></a>00320 <span class="keyword">const</span> cpl_frame * dark = NULL;
+<a name="l00321"></a>00321 <span class="keyword">const</span> cpl_frame * bpm = NULL;
+<a name="l00322"></a>00322 cpl_frameset * distorframes = NULL;
+<a name="l00323"></a>00323 cpl_frameset * skyframes = NULL;
+<a name="l00324"></a>00324 <span class="keyword">const</span> cpl_frame * distorxguess = NULL;
+<a name="l00325"></a>00325 <span class="keyword">const</span> cpl_frame * distoryguess = NULL;
+<a name="l00326"></a>00326 hawki_distortion ** distortionguess = NULL;
+<a name="l00327"></a>00327 hawki_distortion ** distortion = NULL;
+<a name="l00328"></a>00328 cpl_propertylist ** qclists = NULL;
+<a name="l00329"></a>00329 cpl_image ** master_sky = NULL;
+<a name="l00330"></a>00330 cpl_bivector * nominal_offsets = NULL;
+<a name="l00331"></a>00331 cpl_apertures ** apertures[HAWKI_NB_DETECTORS];
+<a name="l00332"></a>00332 <span class="keywordtype">int</span> nmatched_pairs[HAWKI_NB_DETECTORS];
+<a name="l00333"></a>00333 <span class="keywordtype">double</span> rms[HAWKI_NB_DETECTORS];
+<a name="l00334"></a>00334 <span class="keywordtype">int</span> idet;
+<a name="l00335"></a>00335 <span class="keywordtype">int</span> ioff;
+<a name="l00336"></a>00336 <span class="keywordtype">int</span> iframe;
+<a name="l00337"></a>00337 <span class="keywordtype">int</span> nframes;
+<a name="l00338"></a>00338
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00341"></a>00341 <span class="keywordflow">if</span>(hawki_cal_distortion_retrieve_input_param(parlist))
+<a name="l00342"></a>00342 {
+<a name="l00343"></a>00343 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00344"></a>00344 <span class="keywordflow">return</span> -1;
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346
+<a name="l00347"></a>00347 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00348"></a>00348 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(frameset)) {
+<a name="l00349"></a>00349 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00350"></a>00350 <span class="keywordflow">return</span> -1 ;
+<a name="l00351"></a>00351 }
+<a name="l00352"></a>00352
+<a name="l00353"></a>00353 <span class="comment">/* Retrieve calibration data */</span>
+<a name="l00354"></a>00354 cpl_msg_info(__func__, <span class="stringliteral">"Identifying calibration data"</span>);
+<a name="l00355"></a>00355 flat = cpl_frameset_find_const(frameset, HAWKI_CALPRO_FLAT);
+<a name="l00356"></a>00356 dark = cpl_frameset_find_const(frameset, HAWKI_CALPRO_DARK);
+<a name="l00357"></a>00357 bpm = cpl_frameset_find_const(frameset, HAWKI_CALPRO_BPM);
+<a name="l00358"></a>00358
+<a name="l00359"></a>00359 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00360"></a>00360 cpl_msg_info(__func__, <span class="stringliteral">"Identifying distortion and sky data"</span>);
+<a name="l00361"></a>00361 distorframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(frameset, HAWKI_CAL_DISTOR_RAW) ;
+<a name="l00362"></a>00362 <span class="keywordflow">if</span> (distorframes == NULL)
+<a name="l00363"></a>00363 {
+<a name="l00364"></a>00364 cpl_msg_error(__func__, <span class="stringliteral">"Distortion images have to be provided (%s)"</span>,
+<a name="l00365"></a>00365 HAWKI_CAL_DISTOR_RAW);
+<a name="l00366"></a>00366 <span class="keywordflow">return</span> -1 ;
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368 <span class="comment">/* Retrieve sky frames */</span>
+<a name="l00369"></a>00369 skyframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(frameset, HAWKI_CAL_DISTOR_SKY_RAW) ;
+<a name="l00370"></a>00370 <span class="keywordflow">if</span> (skyframes == NULL)
+<a name="l00371"></a>00371 {
+<a name="l00372"></a>00372 cpl_msg_error(__func__, <span class="stringliteral">"Sky images have to be provided (%s)"</span>,
+<a name="l00373"></a>00373 HAWKI_CAL_DISTOR_SKY_RAW);
+<a name="l00374"></a>00374 cpl_frameset_delete(distorframes);
+<a name="l00375"></a>00375 <span class="keywordflow">return</span> -1 ;
+<a name="l00376"></a>00376 }
+<a name="l00377"></a>00377 <span class="comment">/* Retrieve the distortion first guess (if provided) */</span>
+<a name="l00378"></a>00378 distorxguess = cpl_frameset_find_const(frameset, HAWKI_CALPRO_DISTORTION_X);
+<a name="l00379"></a>00379 distoryguess = cpl_frameset_find_const(frameset, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00380"></a>00380 <span class="keywordflow">if</span>(distorxguess != NULL && distoryguess != NULL)
+<a name="l00381"></a>00381 {
+<a name="l00382"></a>00382 <span class="comment">//distortionguess = hawki_distortion_load(distorxtguess)</span>
+<a name="l00383"></a>00383 }
+<a name="l00384"></a>00384
+<a name="l00385"></a>00385 <span class="comment">/* Get the master sky frame */</span>
+<a name="l00386"></a>00386 cpl_msg_info(__func__, <span class="stringliteral">"Computing the master sky image"</span>);
+<a name="l00387"></a>00387 master_sky = hawki_cal_distortion_get_master_sky(skyframes, flat, dark, bpm);
+<a name="l00388"></a>00388 <span class="keywordflow">if</span>(master_sky == NULL)
+<a name="l00389"></a>00389 {
+<a name="l00390"></a>00390 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get master sky image"</span>) ;
+<a name="l00391"></a>00391 cpl_frameset_delete(distorframes);
+<a name="l00392"></a>00392 cpl_frameset_delete(skyframes);
+<a name="l00393"></a>00393 <span class="keywordflow">return</span> -1;
+<a name="l00394"></a>00394 }
+<a name="l00395"></a>00395
+<a name="l00396"></a>00396 <span class="comment">/* Aperture detection, basic reduction and sky subtraction of distortion images */</span>
+<a name="l00397"></a>00397 cpl_msg_info(__func__, <span class="stringliteral">"Getting objects from distortion images"</span>);
+<a name="l00398"></a>00398 <span class="keywordflow">if</span>(hawki_cal_distortion_get_apertures_from_raw_distor
+<a name="l00399"></a>00399 (distorframes, flat, dark, bpm, master_sky,
+<a name="l00400"></a>00400 hawki_cal_distortion_config.sigma_det, apertures) == -1)
+<a name="l00401"></a>00401 {
+<a name="l00402"></a>00402 cpl_msg_error(__func__,
+<a name="l00403"></a>00403 <span class="stringliteral">"Cannot get objects from distortion images"</span>);
+<a name="l00404"></a>00404 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00405"></a>00405 cpl_image_delete(master_sky[idet]);
+<a name="l00406"></a>00406 cpl_free(master_sky);
+<a name="l00407"></a>00407 cpl_frameset_delete(distorframes);
+<a name="l00408"></a>00408 cpl_frameset_delete(skyframes);
+<a name="l00409"></a>00409 <span class="keywordflow">return</span> -1 ;
+<a name="l00410"></a>00410 }
+<a name="l00411"></a>00411 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00412"></a>00412 cpl_image_delete(master_sky[idet]);
+<a name="l00413"></a>00413 cpl_free(master_sky);
+<a name="l00414"></a>00414
+<a name="l00415"></a>00415 <span class="comment">/* Get the nominal offsets from the header */</span>
+<a name="l00416"></a>00416 cpl_msg_info(__func__,<span class="stringliteral">"Getting the nominal offsets"</span>);
+<a name="l00417"></a>00417 nominal_offsets = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(distorframes);
+<a name="l00418"></a>00418 <span class="keywordflow">if</span> (nominal_offsets == NULL)
+<a name="l00419"></a>00419 {
+<a name="l00420"></a>00420 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the header offsets"</span>) ;
+<a name="l00421"></a>00421 cpl_frameset_delete(distorframes);
+<a name="l00422"></a>00422 cpl_frameset_delete(skyframes);
+<a name="l00423"></a>00423 <span class="keywordflow">return</span> -1;
+<a name="l00424"></a>00424 }
+<a name="l00425"></a>00425
+<a name="l00426"></a>00426 <span class="comment">/* Get the oposite offsets. This is to change from </span>
+<a name="l00427"></a>00427 <span class="comment"> * telescope convention to cpl convention */</span>
+<a name="l00428"></a>00428 cpl_vector_multiply_scalar(cpl_bivector_get_x(nominal_offsets), -1.0);
+<a name="l00429"></a>00429 cpl_vector_multiply_scalar(cpl_bivector_get_y(nominal_offsets), -1.0);
+<a name="l00430"></a>00430
+<a name="l00431"></a>00431 <span class="comment">/* Print the header offsets */</span>
+<a name="l00432"></a>00432 cpl_msg_indent_more();
+<a name="l00433"></a>00433 <span class="keywordflow">for</span> (ioff=0 ; ioff<cpl_bivector_get_size(nominal_offsets) ; ioff++)
+<a name="l00434"></a>00434 {
+<a name="l00435"></a>00435 cpl_msg_info(__func__, <span class="stringliteral">"Telescope offsets (Frame %d): %g %g"</span>, ioff+1,
+<a name="l00436"></a>00436 cpl_bivector_get_x_data(nominal_offsets)[ioff],
+<a name="l00437"></a>00437 cpl_bivector_get_y_data(nominal_offsets)[ioff]);
+<a name="l00438"></a>00438 }
+<a name="l00439"></a>00439 cpl_msg_indent_less();
+<a name="l00440"></a>00440
+<a name="l00441"></a>00441 <span class="comment">/* Get the distortion solution, the real stuff */</span>
+<a name="l00442"></a>00442 cpl_msg_info(__func__, <span class="stringliteral">"Computing the distortion"</span>);
+<a name="l00443"></a>00443 nframes = cpl_frameset_get_size(distorframes);
+<a name="l00444"></a>00444 distortion = hawki_cal_distortion_compute_dist_solution
+<a name="l00445"></a>00445 (apertures, nframes, nominal_offsets,
+<a name="l00446"></a>00446 hawki_cal_distortion_config.grid_points,
+<a name="l00447"></a>00447 nmatched_pairs, rms,
+<a name="l00448"></a>00448 distortionguess);
+<a name="l00449"></a>00449 cpl_bivector_delete(nominal_offsets);
+<a name="l00450"></a>00450 <span class="keywordflow">if</span>(distortion == NULL)
+<a name="l00451"></a>00451 {
+<a name="l00452"></a>00452 cpl_frameset_delete(distorframes);
+<a name="l00453"></a>00453 cpl_frameset_delete(skyframes);
+<a name="l00454"></a>00454 <span class="keywordflow">return</span> -1;
+<a name="l00455"></a>00455 }
+<a name="l00456"></a>00456
+<a name="l00457"></a>00457 <span class="comment">/* Get some QC */</span>
+<a name="l00458"></a>00458 qclists = hawki_cal_distortion_qc(distortion, nmatched_pairs, rms);
+<a name="l00459"></a>00459
+<a name="l00460"></a>00460 <span class="comment">/* Save the products */</span>
+<a name="l00461"></a>00461 cpl_msg_info(__func__,<span class="stringliteral">"Saving products"</span>);
+<a name="l00462"></a>00462 <span class="keywordflow">if</span>(hawki_cal_distortion_save(distortion,
+<a name="l00463"></a>00463 parlist, qclists, frameset) == -1)
+<a name="l00464"></a>00464 {
+<a name="l00465"></a>00465 cpl_msg_error(__func__,<span class="stringliteral">"Could not save products"</span>);
+<a name="l00466"></a>00466 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00467"></a>00467 cpl_propertylist_delete(qclists[idet]);
+<a name="l00468"></a>00468 cpl_free(qclists);
+<a name="l00469"></a>00469 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00470"></a>00470 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion[idet]);
+<a name="l00471"></a>00471 cpl_free(distortion);
+<a name="l00472"></a>00472 cpl_frameset_delete(distorframes);
+<a name="l00473"></a>00473 cpl_frameset_delete(skyframes);
+<a name="l00474"></a>00474 <span class="keywordflow">return</span> -1;
+<a name="l00475"></a>00475 }
+<a name="l00476"></a>00476
+<a name="l00477"></a>00477 <span class="comment">/* Free and return */</span>
+<a name="l00478"></a>00478 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00479"></a>00479 cpl_propertylist_delete(qclists[idet]);
+<a name="l00480"></a>00480 cpl_free(qclists);
+<a name="l00481"></a>00481 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00482"></a>00482 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion[idet]);
+<a name="l00483"></a>00483 cpl_free(distortion);
+<a name="l00484"></a>00484 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00485"></a>00485 {
+<a name="l00486"></a>00486 <span class="keywordflow">for</span>(iframe = 0 ; iframe < nframes; iframe++)
+<a name="l00487"></a>00487 cpl_apertures_delete(apertures[idet][iframe]);
+<a name="l00488"></a>00488 cpl_free(apertures[idet]);
+<a name="l00489"></a>00489 }
+<a name="l00490"></a>00490 cpl_frameset_delete(distorframes);
+<a name="l00491"></a>00491 cpl_frameset_delete(skyframes);
+<a name="l00492"></a>00492
+<a name="l00493"></a>00493
+<a name="l00494"></a>00494 <span class="comment">/* Return */</span>
+<a name="l00495"></a>00495 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00496"></a>00496 {
+<a name="l00497"></a>00497 cpl_msg_error(__func__,
+<a name="l00498"></a>00498 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00499"></a>00499 <span class="keywordflow">return</span> -1 ;
+<a name="l00500"></a>00500 }
+<a name="l00501"></a>00501 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00502"></a>00502 }
+<a name="l00503"></a>00503
+<a name="l00504"></a>00504 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00515"></a>00515 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00516"></a>00516 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_load_master_calib
+<a name="l00517"></a>00517 (<span class="keyword">const</span> cpl_frame * flat,
+<a name="l00518"></a>00518 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00519"></a>00519 <span class="keyword">const</span> cpl_frame * bpm,
+<a name="l00520"></a>00520 cpl_imagelist ** flat_images,
+<a name="l00521"></a>00521 cpl_imagelist ** dark_images,
+<a name="l00522"></a>00522 cpl_imagelist ** bpm_images)
+<a name="l00523"></a>00523 {
+<a name="l00524"></a>00524 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00525"></a>00525
+<a name="l00526"></a>00526 <span class="comment">/* Initializing the pointers */</span>
+<a name="l00527"></a>00527 *flat_images = NULL;
+<a name="l00528"></a>00528 *dark_images = NULL;
+<a name="l00529"></a>00529 *bpm_images = NULL;
+<a name="l00530"></a>00530
+<a name="l00531"></a>00531 <span class="comment">/* Loading the calibration files */</span>
+<a name="l00532"></a>00532 cpl_msg_info(__func__, <span class="stringliteral">"Loading the calibration data"</span>) ;
+<a name="l00533"></a>00533 <span class="keywordflow">if</span>(flat != NULL)
+<a name="l00534"></a>00534 {
+<a name="l00535"></a>00535 *flat_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(flat, CPL_TYPE_FLOAT);
+<a name="l00536"></a>00536 <span class="keywordflow">if</span>(flat_images == NULL)
+<a name="l00537"></a>00537 {
+<a name="l00538"></a>00538 cpl_msg_error(__func__, <span class="stringliteral">"Error reading flat"</span>) ;
+<a name="l00539"></a>00539 <span class="keywordflow">return</span> -1;
+<a name="l00540"></a>00540 }
+<a name="l00541"></a>00541 }
+<a name="l00542"></a>00542 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l00543"></a>00543 {
+<a name="l00544"></a>00544 *dark_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(dark, CPL_TYPE_FLOAT);
+<a name="l00545"></a>00545 <span class="keywordflow">if</span>(dark_images == NULL)
+<a name="l00546"></a>00546 {
+<a name="l00547"></a>00547 cpl_msg_error(__func__, <span class="stringliteral">"Error reading dark"</span>) ;
+<a name="l00548"></a>00548 cpl_imagelist_delete(*flat_images);
+<a name="l00549"></a>00549 <span class="keywordflow">return</span> -1;
+<a name="l00550"></a>00550 }
+<a name="l00551"></a>00551 }
+<a name="l00552"></a>00552 <span class="keywordflow">if</span>(bpm != NULL)
+<a name="l00553"></a>00553 {
+<a name="l00554"></a>00554 *bpm_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(bpm, CPL_TYPE_INT);
+<a name="l00555"></a>00555 <span class="keywordflow">if</span>(bpm_images == NULL)
+<a name="l00556"></a>00556 {
+<a name="l00557"></a>00557 cpl_msg_error(__func__, <span class="stringliteral">"Error reading bpm"</span>) ;
+<a name="l00558"></a>00558 cpl_imagelist_delete(*flat_images);
+<a name="l00559"></a>00559 cpl_imagelist_delete(*dark_images);
+<a name="l00560"></a>00560 <span class="keywordflow">return</span> -1;
+<a name="l00561"></a>00561 }
+<a name="l00562"></a>00562 }
+<a name="l00563"></a>00563
+<a name="l00564"></a>00564 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l00565"></a>00565 {
+<a name="l00566"></a>00566 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened loading calibration"</span>);
+<a name="l00567"></a>00567 cpl_imagelist_delete(*flat_images);
+<a name="l00568"></a>00568 cpl_imagelist_delete(*dark_images);
+<a name="l00569"></a>00569 cpl_imagelist_delete(*bpm_images);
+<a name="l00570"></a>00570 <span class="keywordflow">return</span> -1;
+<a name="l00571"></a>00571 }
+<a name="l00572"></a>00572 <span class="keywordflow">return</span> 0;
+<a name="l00573"></a>00573 }
+<a name="l00574"></a>00574
+<a name="l00575"></a>00575 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00585"></a>00585 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00586"></a>00586 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_get_apertures_from_raw_distor
+<a name="l00587"></a>00587 (cpl_frameset * raw_distor,
+<a name="l00588"></a>00588 <span class="keyword">const</span> cpl_frame * flat,
+<a name="l00589"></a>00589 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00590"></a>00590 <span class="keyword">const</span> cpl_frame * bpm,
+<a name="l00591"></a>00591 cpl_image ** master_sky,
+<a name="l00592"></a>00592 <span class="keywordtype">double</span> sigma_det,
+<a name="l00593"></a>00593 cpl_apertures *** apertures)
+<a name="l00594"></a>00594 {
+<a name="l00595"></a>00595 cpl_imagelist * flat_images;
+<a name="l00596"></a>00596 cpl_imagelist * dark_images;
+<a name="l00597"></a>00597 cpl_imagelist * bpm_images;
+<a name="l00598"></a>00598 cpl_propertylist * plist;
+<a name="l00599"></a>00599
+<a name="l00600"></a>00600 <span class="keywordtype">double</span> science_dit;
+<a name="l00601"></a>00601 <span class="keywordtype">int</span> iframe;
+<a name="l00602"></a>00602 <span class="keywordtype">int</span> nframes;
+<a name="l00603"></a>00603 <span class="keywordtype">int</span> idet;
+<a name="l00604"></a>00604
+<a name="l00605"></a>00605 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00606"></a>00606
+<a name="l00607"></a>00607 <span class="comment">/* Indentation */</span>
+<a name="l00608"></a>00608 cpl_msg_indent_more();
+<a name="l00609"></a>00609
+<a name="l00610"></a>00610 <span class="comment">/* Loading calibrations */</span>
+<a name="l00611"></a>00611 hawki_cal_distortion_load_master_calib
+<a name="l00612"></a>00612 (flat, dark, bpm, &flat_images, &dark_images, &bpm_images);
+<a name="l00613"></a>00613
+<a name="l00614"></a>00614 <span class="comment">/* Multiply the dark image by the science exposure time */</span>
+<a name="l00615"></a>00615 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l00616"></a>00616 {
+<a name="l00617"></a>00617 <span class="keywordflow">if</span> ((plist=cpl_propertylist_load
+<a name="l00618"></a>00618 (cpl_frame_get_filename
+<a name="l00619"></a>00619 (cpl_frameset_get_first_const(raw_distor)), 0)) == NULL)
+<a name="l00620"></a>00620 {
+<a name="l00621"></a>00621 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get header from frame"</span>);
+<a name="l00622"></a>00622 cpl_imagelist_delete(flat_images);
+<a name="l00623"></a>00623 cpl_imagelist_delete(dark_images);
+<a name="l00624"></a>00624 <span class="keywordflow">return</span> -1;
+<a name="l00625"></a>00625 }
+<a name="l00626"></a>00626 science_dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist);
+<a name="l00627"></a>00627 cpl_imagelist_multiply_scalar(dark_images, science_dit);
+<a name="l00628"></a>00628 cpl_propertylist_delete(plist);
+<a name="l00629"></a>00629 }
+<a name="l00630"></a>00630
+<a name="l00631"></a>00631 <span class="comment">/* Loop on detectors */</span>
+<a name="l00632"></a>00632 nframes = cpl_frameset_get_size(raw_distor);
+<a name="l00633"></a>00633 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00634"></a>00634 {
+<a name="l00635"></a>00635 cpl_imagelist * distor_serie;
+<a name="l00636"></a>00636 cpl_imagelist * distor_serie_trimmed;
+<a name="l00637"></a>00637
+<a name="l00638"></a>00638 cpl_msg_info(__func__, <span class="stringliteral">"Working on detector %d"</span>, idet + 1);
+<a name="l00639"></a>00639 cpl_msg_indent_more();
+<a name="l00640"></a>00640
+<a name="l00641"></a>00641 <span class="comment">/* Loading the distortion images for one detector */</span>
+<a name="l00642"></a>00642 cpl_msg_info(__func__, <span class="stringliteral">"Loading distortion images"</span>);
+<a name="l00643"></a>00643 distor_serie = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(raw_distor, idet + 1, CPL_TYPE_FLOAT);
+<a name="l00644"></a>00644 <span class="keywordflow">if</span>(distor_serie== NULL)
+<a name="l00645"></a>00645 {
+<a name="l00646"></a>00646 cpl_msg_error(__func__, <span class="stringliteral">"Error reading distortion images"</span>);
+<a name="l00647"></a>00647 <span class="keywordflow">return</span> -1;
+<a name="l00648"></a>00648 }
+<a name="l00649"></a>00649
+<a name="l00650"></a>00650 <span class="comment">/* Applying the calibrations */</span>
+<a name="l00651"></a>00651 cpl_msg_info(__func__, <span class="stringliteral">"Applying basic calibration"</span>) ;
+<a name="l00652"></a>00652 cpl_msg_indent_more();
+<a name="l00653"></a>00653 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d" title="Apply the calibration to the images.">hawki_flat_dark_bpm_detector_calib</a>
+<a name="l00654"></a>00654 (distor_serie,
+<a name="l00655"></a>00655 cpl_imagelist_get(flat_images, idet),
+<a name="l00656"></a>00656 cpl_imagelist_get(dark_images, idet),
+<a name="l00657"></a>00657 cpl_imagelist_get(bpm_images, idet)) == -1)
+<a name="l00658"></a>00658 {
+<a name="l00659"></a>00659 cpl_msg_error(__func__, <span class="stringliteral">"Cannot calibrate frame"</span>) ;
+<a name="l00660"></a>00660 cpl_imagelist_delete(flat_images);
+<a name="l00661"></a>00661 cpl_imagelist_delete(dark_images);
+<a name="l00662"></a>00662 cpl_imagelist_delete(bpm_images);
+<a name="l00663"></a>00663 cpl_imagelist_delete(distor_serie);
+<a name="l00664"></a>00664 cpl_msg_indent_less() ;
+<a name="l00665"></a>00665 <span class="keywordflow">return</span> -1;
+<a name="l00666"></a>00666 }
+<a name="l00667"></a>00667 cpl_msg_indent_less();
+<a name="l00668"></a>00668
+<a name="l00669"></a>00669 <span class="comment">/* Discard the pixels on the sides */</span>
+<a name="l00670"></a>00670 <span class="keywordflow">if</span> (hawki_cal_distortion_config.borders > 0)
+<a name="l00671"></a>00671 {
+<a name="l00672"></a>00672 distor_serie_trimmed = <a class="code" href="group__hawki__calib.html#ga5013786f602800e5899b011b21f9547f" title="Trim a list of hawki images (usually from one detector)">hawki_trim_detector_calib</a>(distor_serie,
+<a name="l00673"></a>00673 hawki_cal_distortion_config.borders);
+<a name="l00674"></a>00674 cpl_imagelist_delete(distor_serie);
+<a name="l00675"></a>00675 }
+<a name="l00676"></a>00676 <span class="keywordflow">else</span>
+<a name="l00677"></a>00677 distor_serie_trimmed = distor_serie;
+<a name="l00678"></a>00678
+<a name="l00679"></a>00679 <span class="comment">/* Subtract sky */</span>
+<a name="l00680"></a>00680 cpl_msg_info(__func__, <span class="stringliteral">"Subtracting master sky"</span>) ;
+<a name="l00681"></a>00681 <span class="keywordflow">if</span>(hawki_cal_distortion_subtract_sky(distor_serie_trimmed, master_sky[idet]) == -1)
+<a name="l00682"></a>00682 {
+<a name="l00683"></a>00683 cpl_msg_error(__func__, <span class="stringliteral">"Cannot subtract the sky"</span>) ;
+<a name="l00684"></a>00684 cpl_imagelist_delete(flat_images);
+<a name="l00685"></a>00685 cpl_imagelist_delete(dark_images);
+<a name="l00686"></a>00686 cpl_imagelist_delete(bpm_images);
+<a name="l00687"></a>00687 cpl_imagelist_delete(distor_serie_trimmed);
+<a name="l00688"></a>00688 <span class="keywordflow">return</span> -1;
+<a name="l00689"></a>00689 }
+<a name="l00690"></a>00690
+<a name="l00691"></a>00691 <span class="comment">/* Creating apertures */</span>
+<a name="l00692"></a>00692 apertures[idet] = cpl_malloc(<span class="keyword">sizeof</span>(*(apertures[idet])) * nframes);
+<a name="l00693"></a>00693 <span class="keywordflow">for</span>(iframe = 0 ; iframe < nframes; iframe++)
+<a name="l00694"></a>00694 {
+<a name="l00695"></a>00695 cpl_image * this_image = cpl_imagelist_get(distor_serie_trimmed, iframe);
+<a name="l00696"></a>00696 cpl_msg_info(__func__,<span class="stringliteral">"Working with distortion image %d"</span>, iframe+1);
+<a name="l00697"></a>00697 cpl_msg_indent_more();
+<a name="l00698"></a>00698 apertures[idet][iframe] =
+<a name="l00699"></a>00699 hawki_cal_distortion_get_image_apertures(this_image, sigma_det);
+<a name="l00700"></a>00700 cpl_msg_indent_less();
+<a name="l00701"></a>00701 }
+<a name="l00702"></a>00702
+<a name="l00703"></a>00703 <span class="comment">/* Delete the list of images */</span>
+<a name="l00704"></a>00704 cpl_imagelist_delete(distor_serie_trimmed);
+<a name="l00705"></a>00705 cpl_msg_indent_less();
+<a name="l00706"></a>00706 }
+<a name="l00707"></a>00707 cpl_imagelist_delete(flat_images);
+<a name="l00708"></a>00708 cpl_imagelist_delete(dark_images);
+<a name="l00709"></a>00709 cpl_imagelist_delete(bpm_images);
+<a name="l00710"></a>00710
+<a name="l00711"></a>00711
+<a name="l00712"></a>00712 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l00713"></a>00713 {
+<a name="l00714"></a>00714 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened with basic calibration"</span>);
+<a name="l00715"></a>00715 <span class="keywordflow">return</span> -1 ;
+<a name="l00716"></a>00716 }
+<a name="l00717"></a>00717 <span class="keywordflow">return</span> 0;
+<a name="l00718"></a>00718 }
+<a name="l00719"></a>00719
+<a name="l00720"></a>00720 <span class="keyword">static</span> cpl_image ** hawki_cal_distortion_get_master_sky
+<a name="l00721"></a>00721 (cpl_frameset * raw_sky_frames,
+<a name="l00722"></a>00722 <span class="keyword">const</span> cpl_frame * flat,
+<a name="l00723"></a>00723 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00724"></a>00724 <span class="keyword">const</span> cpl_frame * bpm)
+<a name="l00725"></a>00725 {
+<a name="l00726"></a>00726 cpl_propertylist * plist;
+<a name="l00727"></a>00727 <span class="keywordtype">double</span> science_dit;
+<a name="l00728"></a>00728 <span class="keywordtype">int</span> idet;
+<a name="l00729"></a>00729 <span class="keywordtype">int</span> jdet;
+<a name="l00730"></a>00730 cpl_imagelist * flat_images;
+<a name="l00731"></a>00731 cpl_imagelist * dark_images;
+<a name="l00732"></a>00732 cpl_imagelist * bpm_images;
+<a name="l00733"></a>00733 cpl_image ** bkg_images = NULL;
+<a name="l00734"></a>00734
+<a name="l00735"></a>00735 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00736"></a>00736
+<a name="l00737"></a>00737 <span class="comment">/* Indentation */</span>
+<a name="l00738"></a>00738 cpl_msg_indent_more();
+<a name="l00739"></a>00739
+<a name="l00740"></a>00740 <span class="comment">/* Reading calibrations */</span>
+<a name="l00741"></a>00741 hawki_cal_distortion_load_master_calib
+<a name="l00742"></a>00742 (flat, dark, bpm, &flat_images, &dark_images, &bpm_images);
+<a name="l00743"></a>00743
+<a name="l00744"></a>00744 <span class="comment">/* Multiply the dark image by the science exposure time */</span>
+<a name="l00745"></a>00745 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l00746"></a>00746 {
+<a name="l00747"></a>00747 <span class="keywordflow">if</span> ((plist=cpl_propertylist_load
+<a name="l00748"></a>00748 (cpl_frame_get_filename
+<a name="l00749"></a>00749 (cpl_frameset_get_first_const(raw_sky_frames)), 0)) == NULL)
+<a name="l00750"></a>00750 {
+<a name="l00751"></a>00751 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get header from frame"</span>);
+<a name="l00752"></a>00752 cpl_imagelist_delete(flat_images);
+<a name="l00753"></a>00753 cpl_imagelist_delete(dark_images);
+<a name="l00754"></a>00754 cpl_imagelist_delete(bpm_images);
+<a name="l00755"></a>00755 <span class="keywordflow">return</span> NULL;
+<a name="l00756"></a>00756 }
+<a name="l00757"></a>00757 science_dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist);
+<a name="l00758"></a>00758 cpl_imagelist_multiply_scalar(dark_images, science_dit);
+<a name="l00759"></a>00759 cpl_propertylist_delete(plist);
+<a name="l00760"></a>00760 }
+<a name="l00761"></a>00761
+<a name="l00762"></a>00762 <span class="comment">/* Compute the sky median */</span>
+<a name="l00763"></a>00763 bkg_images = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(*bkg_images));
+<a name="l00764"></a>00764 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00765"></a>00765 {
+<a name="l00766"></a>00766 cpl_imagelist * sky_serie;
+<a name="l00767"></a>00767 cpl_imagelist * sky_serie_trimmed;
+<a name="l00768"></a>00768
+<a name="l00769"></a>00769 <span class="comment">/* Loading the sky images for one detector */</span>
+<a name="l00770"></a>00770 sky_serie = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(raw_sky_frames, idet + 1, CPL_TYPE_FLOAT);
+<a name="l00771"></a>00771 <span class="keywordflow">if</span>(sky_serie== NULL)
+<a name="l00772"></a>00772 {
+<a name="l00773"></a>00773 cpl_msg_error(__func__, <span class="stringliteral">"Error reading object image"</span>) ;
+<a name="l00774"></a>00774 <span class="keywordflow">return</span> NULL;
+<a name="l00775"></a>00775 }
+<a name="l00776"></a>00776
+<a name="l00777"></a>00777 <span class="comment">/* Applying the calibrations */</span>
+<a name="l00778"></a>00778 cpl_msg_info(__func__, <span class="stringliteral">"Working on detector %d"</span>, idet + 1);
+<a name="l00779"></a>00779 cpl_msg_indent_more();
+<a name="l00780"></a>00780 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d" title="Apply the calibration to the images.">hawki_flat_dark_bpm_detector_calib</a>
+<a name="l00781"></a>00781 (sky_serie,
+<a name="l00782"></a>00782 cpl_imagelist_get(flat_images, idet),
+<a name="l00783"></a>00783 cpl_imagelist_get(dark_images, idet),
+<a name="l00784"></a>00784 cpl_imagelist_get(bpm_images, idet)) == -1)
+<a name="l00785"></a>00785 {
+<a name="l00786"></a>00786 cpl_msg_error(__func__, <span class="stringliteral">"Cannot calibrate frame"</span>) ;
+<a name="l00787"></a>00787 cpl_imagelist_delete(flat_images);
+<a name="l00788"></a>00788 cpl_imagelist_delete(dark_images);
+<a name="l00789"></a>00789 cpl_imagelist_delete(bpm_images);
+<a name="l00790"></a>00790 cpl_imagelist_delete(sky_serie);
+<a name="l00791"></a>00791 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00792"></a>00792 cpl_image_delete(bkg_images[jdet]);
+<a name="l00793"></a>00793 cpl_free(bkg_images);
+<a name="l00794"></a>00794 cpl_msg_indent_less() ;
+<a name="l00795"></a>00795 <span class="keywordflow">return</span> NULL;
+<a name="l00796"></a>00796 }
+<a name="l00797"></a>00797
+<a name="l00798"></a>00798 <span class="comment">/* Discard the pixels on the sides */</span>
+<a name="l00799"></a>00799 <span class="keywordflow">if</span> (hawki_cal_distortion_config.borders > 0)
+<a name="l00800"></a>00800 {
+<a name="l00801"></a>00801 sky_serie_trimmed = <a class="code" href="group__hawki__calib.html#ga5013786f602800e5899b011b21f9547f" title="Trim a list of hawki images (usually from one detector)">hawki_trim_detector_calib</a>(sky_serie,
+<a name="l00802"></a>00802 hawki_cal_distortion_config.borders);
+<a name="l00803"></a>00803 cpl_imagelist_delete(sky_serie);
+<a name="l00804"></a>00804 }
+<a name="l00805"></a>00805 <span class="keywordflow">else</span>
+<a name="l00806"></a>00806 sky_serie_trimmed = sky_serie;
+<a name="l00807"></a>00807
+<a name="l00808"></a>00808 <span class="comment">/* Averaging */</span>
+<a name="l00809"></a>00809 <span class="keywordflow">if</span> ((bkg_images[idet] =
+<a name="l00810"></a>00810 cpl_imagelist_collapse_median_create(sky_serie_trimmed)) == NULL)
+<a name="l00811"></a>00811 {
+<a name="l00812"></a>00812 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute the median of obj images"</span>);
+<a name="l00813"></a>00813 cpl_imagelist_delete(flat_images);
+<a name="l00814"></a>00814 cpl_imagelist_delete(dark_images);
+<a name="l00815"></a>00815 cpl_imagelist_delete(bpm_images);
+<a name="l00816"></a>00816 cpl_imagelist_delete(sky_serie_trimmed);
+<a name="l00817"></a>00817 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00818"></a>00818 cpl_image_delete(bkg_images[jdet]);
+<a name="l00819"></a>00819 cpl_free(bkg_images);
+<a name="l00820"></a>00820 cpl_msg_indent_less();
+<a name="l00821"></a>00821 <span class="keywordflow">return</span> NULL;
+<a name="l00822"></a>00822 }
+<a name="l00823"></a>00823 cpl_imagelist_delete(sky_serie_trimmed);
+<a name="l00824"></a>00824 cpl_msg_indent_less();
+<a name="l00825"></a>00825 }
+<a name="l00826"></a>00826
+<a name="l00827"></a>00827 <span class="comment">/* Subtract the median of the frame */</span>
+<a name="l00828"></a>00828 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00829"></a>00829 cpl_image_subtract_scalar(bkg_images[idet],
+<a name="l00830"></a>00830 cpl_image_get_median(bkg_images[idet]));
+<a name="l00831"></a>00831
+<a name="l00832"></a>00832 <span class="comment">/* Cleaning up */</span>
+<a name="l00833"></a>00833 cpl_msg_indent_less();
+<a name="l00834"></a>00834 cpl_imagelist_delete(flat_images);
+<a name="l00835"></a>00835 cpl_imagelist_delete(dark_images);
+<a name="l00836"></a>00836 cpl_imagelist_delete(bpm_images);
+<a name="l00837"></a>00837
+<a name="l00838"></a>00838 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l00839"></a>00839 {
+<a name="l00840"></a>00840 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened with basic calibration"</span>);
+<a name="l00841"></a>00841 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00842"></a>00842 cpl_image_delete(bkg_images[idet]);
+<a name="l00843"></a>00843 cpl_free(bkg_images);
+<a name="l00844"></a>00844 <span class="keywordflow">return</span> NULL ;
+<a name="l00845"></a>00845 }
+<a name="l00846"></a>00846 <span class="keywordflow">return</span> bkg_images;
+<a name="l00847"></a>00847 }
+<a name="l00848"></a>00848
+<a name="l00849"></a>00849 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_subtract_sky
+<a name="l00850"></a>00850 (cpl_imagelist * distor_corrected,
+<a name="l00851"></a>00851 cpl_image * master_sky)
+<a name="l00852"></a>00852 {
+<a name="l00853"></a>00853 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00854"></a>00854
+<a name="l00855"></a>00855 <span class="comment">/* Subtract the background to each object frame */</span>
+<a name="l00856"></a>00856 <span class="keywordtype">int</span> idist, ndistor;
+<a name="l00857"></a>00857 ndistor = cpl_imagelist_get_size(distor_corrected);
+<a name="l00858"></a>00858 <span class="keywordflow">for</span>(idist = 0; idist < ndistor; ++idist)
+<a name="l00859"></a>00859 {
+<a name="l00860"></a>00860 cpl_image * target_image =
+<a name="l00861"></a>00861 cpl_imagelist_get(distor_corrected, idist);
+<a name="l00862"></a>00862 <span class="comment">/* First subtract the median of the image */</span>
+<a name="l00863"></a>00863 cpl_image_subtract_scalar
+<a name="l00864"></a>00864 (target_image, cpl_image_get_median(target_image));
+<a name="l00865"></a>00865
+<a name="l00866"></a>00866 <span class="keywordflow">if</span> (cpl_image_subtract
+<a name="l00867"></a>00867 (target_image, master_sky)!=CPL_ERROR_NONE)
+<a name="l00868"></a>00868 {
+<a name="l00869"></a>00869 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the bkg to the images"</span>);
+<a name="l00870"></a>00870 <span class="keywordflow">return</span> -1 ;
+<a name="l00871"></a>00871 }
+<a name="l00872"></a>00872 }
+<a name="l00873"></a>00873
+<a name="l00874"></a>00874 <span class="comment">/* Free and return */</span>
+<a name="l00875"></a>00875 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l00876"></a>00876 {
+<a name="l00877"></a>00877 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened with sky subtraction"</span>);
+<a name="l00878"></a>00878 <span class="keywordflow">return</span> -1;
+<a name="l00879"></a>00879 }
+<a name="l00880"></a>00880 <span class="keywordflow">return</span> 0;
+<a name="l00881"></a>00881 }
+<a name="l00882"></a>00882
+<a name="l00883"></a>00883
+<a name="l00884"></a>00884 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00894"></a>00894 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00895"></a>00895 <span class="keyword">static</span> hawki_distortion ** hawki_cal_distortion_compute_dist_solution
+<a name="l00896"></a>00896 (cpl_apertures *** apertures,
+<a name="l00897"></a>00897 <span class="keywordtype">int</span> nframes,
+<a name="l00898"></a>00898 cpl_bivector * offsets,
+<a name="l00899"></a>00899 <span class="keywordtype">int</span> grid_points,
+<a name="l00900"></a>00900 <span class="keywordtype">int</span> * nmatched_pairs,
+<a name="l00901"></a>00901 <span class="keywordtype">double</span> * rms,
+<a name="l00902"></a>00902 hawki_distortion ** distortion_guess)
+<a name="l00903"></a>00903 {
+<a name="l00904"></a>00904 <span class="keywordtype">int</span> idet;
+<a name="l00905"></a>00905 hawki_distortion ** distortion = NULL;
+<a name="l00906"></a>00906
+<a name="l00907"></a>00907 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00908"></a>00908
+<a name="l00909"></a>00909 <span class="comment">/* Allocate the distortion */</span>
+<a name="l00910"></a>00910 distortion = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(*distortion));
+<a name="l00911"></a>00911
+<a name="l00912"></a>00912 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00913"></a>00913 cpl_msg_indent_more();
+<a name="l00914"></a>00914 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00915"></a>00915 {
+<a name="l00916"></a>00916 cpl_table ** obj_pos;
+<a name="l00917"></a>00917 cpl_table ** obj_pos_offset;
+<a name="l00918"></a>00918 <span class="keywordtype">int</span> iframe;
+<a name="l00919"></a>00919 cpl_table * matches;
+<a name="l00920"></a>00920 hawki_distortion * dist_guess;
+<a name="l00921"></a>00921 cpl_polynomial * fit2d_x = NULL;
+<a name="l00922"></a>00922 cpl_polynomial * fit2d_y = NULL;
+<a name="l00923"></a>00923
+<a name="l00924"></a>00924
+<a name="l00925"></a>00925 cpl_msg_info(__func__, <span class="stringliteral">"Working on detector %d"</span>, idet+1);
+<a name="l00926"></a>00926 cpl_msg_indent_more();
+<a name="l00927"></a>00927
+<a name="l00928"></a>00928 <span class="comment">/* Initialize the objects positions */</span>
+<a name="l00929"></a>00929 obj_pos =
+<a name="l00930"></a>00930 cpl_malloc(<span class="keyword">sizeof</span>(*obj_pos) * nframes);
+<a name="l00931"></a>00931 obj_pos_offset =
+<a name="l00932"></a>00932 cpl_malloc(<span class="keyword">sizeof</span>(*obj_pos_offset) * nframes);
+<a name="l00933"></a>00933 <span class="keywordflow">for</span>(iframe = 0; iframe < nframes; ++iframe)
+<a name="l00934"></a>00934 {
+<a name="l00935"></a>00935 obj_pos[iframe] = cpl_table_new(0);
+<a name="l00936"></a>00936 cpl_table_new_column
+<a name="l00937"></a>00937 (obj_pos[iframe], HAWKI_COL_OBJ_POSX, CPL_TYPE_DOUBLE);
+<a name="l00938"></a>00938 cpl_table_new_column
+<a name="l00939"></a>00939 (obj_pos[iframe], HAWKI_COL_OBJ_POSY, CPL_TYPE_DOUBLE);
+<a name="l00940"></a>00940 }
+<a name="l00941"></a>00941
+<a name="l00942"></a>00942 <span class="comment">/* Loop on images to fill object_positions */</span>
+<a name="l00943"></a>00943 <span class="keywordflow">for</span>(iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l00944"></a>00944 {
+<a name="l00945"></a>00945 cpl_apertures * this_apertures;
+<a name="l00946"></a>00946
+<a name="l00947"></a>00947 <span class="comment">/* Create the detected apertures list */</span>
+<a name="l00948"></a>00948 this_apertures = apertures[idet][iframe];
+<a name="l00949"></a>00949
+<a name="l00950"></a>00950 <span class="comment">/* Fill the objects position table */</span>
+<a name="l00951"></a>00951 hawki_cal_distortion_fill_obj_pos(obj_pos[iframe],
+<a name="l00952"></a>00952 this_apertures);
+<a name="l00953"></a>00953 obj_pos_offset[iframe] = cpl_table_duplicate(obj_pos[iframe]);
+<a name="l00954"></a>00954 }
+<a name="l00955"></a>00955
+<a name="l00956"></a>00956 <span class="comment">/* Get the objects positions with offsets */</span>
+<a name="l00957"></a>00957 hawki_cal_distortion_add_offset_to_positions
+<a name="l00958"></a>00958 (obj_pos_offset, offsets);
+<a name="l00959"></a>00959
+<a name="l00960"></a>00960 <span class="comment">/* Get the all the matching pairs */</span>
+<a name="l00961"></a>00961 cpl_msg_info(__func__, <span class="stringliteral">"Matching all catalogs (may take a while)"</span>);
+<a name="l00962"></a>00962 matches = irplib_match_cat_pairs(obj_pos_offset, nframes,
+<a name="l00963"></a>00963 <a class="code" href="group__hawki__obj__det.html#ga7255ba5ecf2bd6539c02c1f7d765e593" title="Compare two objects positions and determine whetherthey are within a 5 pix tolerance.">hawki_match_condition_5_pix</a>);
+<a name="l00964"></a>00964 <span class="keywordflow">for</span>(iframe = 0; iframe < nframes; ++iframe)
+<a name="l00965"></a>00965 cpl_table_delete(obj_pos_offset[iframe]);
+<a name="l00966"></a>00966 cpl_free(obj_pos_offset);
+<a name="l00967"></a>00967 <span class="keywordflow">if</span>(matches == NULL)
+<a name="l00968"></a>00968 {
+<a name="l00969"></a>00969 cpl_msg_error(__func__, <span class="stringliteral">"Cannot match objects "</span>);
+<a name="l00970"></a>00970 <span class="keywordflow">for</span>(iframe = 0; iframe < nframes; ++iframe)
+<a name="l00971"></a>00971 cpl_table_delete(obj_pos[iframe]);
+<a name="l00972"></a>00972 cpl_free(obj_pos);
+<a name="l00973"></a>00973 <span class="keywordflow">return</span> NULL;
+<a name="l00974"></a>00974 }
+<a name="l00975"></a>00975 cpl_msg_info(__func__,<span class="stringliteral">"Number of matching pairs %"</span>CPL_SIZE_FORMAT,
+<a name="l00976"></a>00976 cpl_table_get_nrow(matches));
+<a name="l00977"></a>00977 nmatched_pairs[idet] = cpl_table_get_nrow(matches);
+<a name="l00978"></a>00978
+<a name="l00979"></a>00979 <span class="comment">/* Compute the distortion */</span>
+<a name="l00980"></a>00980 cpl_msg_info(__func__, <span class="stringliteral">"Computing distortion with the matched objects"</span>);
+<a name="l00981"></a>00981 cpl_msg_info(__func__, <span class="stringliteral">" (This step will take a long time to run)"</span>);
+<a name="l00982"></a>00982 <span class="keywordflow">if</span>(distortion_guess != NULL)
+<a name="l00983"></a>00983 dist_guess = distortion_guess[idet];
+<a name="l00984"></a>00984 <span class="keywordflow">else</span>
+<a name="l00985"></a>00985 dist_guess = NULL;
+<a name="l00986"></a>00986 distortion[idet] = hawki_distortion_compute_solution
+<a name="l00987"></a>00987 ((<span class="keyword">const</span> cpl_table **)obj_pos, offsets, matches,
+<a name="l00988"></a>00988 nframes, HAWKI_DET_NPIX_X , HAWKI_DET_NPIX_Y, grid_points,
+<a name="l00989"></a>00989 dist_guess, rms + idet);
+<a name="l00990"></a>00990 <span class="keywordflow">if</span>(distortion[idet] == NULL)
+<a name="l00991"></a>00991 {
+<a name="l00992"></a>00992 <span class="keywordtype">int</span> jdet;
+<a name="l00993"></a>00993 cpl_msg_error(__func__,<span class="stringliteral">"Could not get the distortion"</span>);
+<a name="l00994"></a>00994 <span class="keywordflow">for</span>(iframe = 0; iframe < nframes; ++iframe)
+<a name="l00995"></a>00995 cpl_table_delete(obj_pos[iframe]);
+<a name="l00996"></a>00996 cpl_free(obj_pos);
+<a name="l00997"></a>00997 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00998"></a>00998 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion[idet]);
+<a name="l00999"></a>00999 cpl_table_delete(matches);
+<a name="l01000"></a>01000 <span class="keywordflow">return</span> NULL;
+<a name="l01001"></a>01001 }
+<a name="l01002"></a>01002
+<a name="l01003"></a>01003 <span class="comment">/* Removing the first order polinomial to the distortion */</span>
+<a name="l01004"></a>01004 <span class="keywordflow">if</span>(hawki_cal_distortion_config.subtract_linear)
+<a name="l01005"></a>01005 {
+<a name="l01006"></a>01006 cpl_msg_info(__func__,<span class="stringliteral">"Subtracting first order polynomial"</span>);
+<a name="l01007"></a>01007 fit2d_x = cpl_polynomial_new(2);
+<a name="l01008"></a>01008 fit2d_y = cpl_polynomial_new(2);
+<a name="l01009"></a>01009 hawki_cal_distortion_fit_first_order_solution
+<a name="l01010"></a>01010 (distortion[idet], fit2d_x, fit2d_y);
+<a name="l01011"></a>01011 }
+<a name="l01012"></a>01012
+<a name="l01013"></a>01013 <span class="comment">/* Free */</span>
+<a name="l01014"></a>01014 <span class="keywordflow">for</span>(iframe = 0; iframe < nframes; ++iframe)
+<a name="l01015"></a>01015 cpl_table_delete(obj_pos[iframe]);
+<a name="l01016"></a>01016 cpl_free(obj_pos);
+<a name="l01017"></a>01017 <span class="keywordflow">if</span>(hawki_cal_distortion_config.subtract_linear)
+<a name="l01018"></a>01018 {
+<a name="l01019"></a>01019 cpl_polynomial_delete(fit2d_x);
+<a name="l01020"></a>01020 cpl_polynomial_delete(fit2d_y);
+<a name="l01021"></a>01021 }
+<a name="l01022"></a>01022 cpl_table_delete(matches);
+<a name="l01023"></a>01023 cpl_msg_indent_less();
+<a name="l01024"></a>01024 }
+<a name="l01025"></a>01025
+<a name="l01026"></a>01026 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l01027"></a>01027 {
+<a name="l01028"></a>01028 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened computing the distortion"</span>);
+<a name="l01029"></a>01029 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01030"></a>01030 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion[idet]);
+<a name="l01031"></a>01031 <span class="keywordflow">return</span> NULL ;
+<a name="l01032"></a>01032 }
+<a name="l01033"></a>01033 <span class="comment">/* Free and return */</span>
+<a name="l01034"></a>01034 <span class="keywordflow">return</span> distortion;
+<a name="l01035"></a>01035 }
+<a name="l01036"></a>01036
+<a name="l01037"></a>01037 <span class="keyword">static</span> cpl_apertures * hawki_cal_distortion_get_image_apertures
+<a name="l01038"></a>01038 (cpl_image * image,
+<a name="l01039"></a>01039 <span class="keywordtype">double</span> sigma_det)
+<a name="l01040"></a>01040 {
+<a name="l01041"></a>01041 cpl_apertures * apertures = NULL;
+<a name="l01042"></a>01042 cpl_mask * kernel = NULL;
+<a name="l01043"></a>01043 cpl_mask * object_mask = NULL;
+<a name="l01044"></a>01044 cpl_image * labels = NULL;
+<a name="l01045"></a>01045 cpl_size nobj;
+<a name="l01046"></a>01046 <span class="keywordtype">double</span> median;
+<a name="l01047"></a>01047 <span class="keywordtype">double</span> med_dist;
+<a name="l01048"></a>01048 <span class="keywordtype">double</span> threshold;
+<a name="l01049"></a>01049
+<a name="l01050"></a>01050 <span class="comment">/* Get the threshold */</span>
+<a name="l01051"></a>01051 median = cpl_image_get_median_dev(image, &med_dist);
+<a name="l01052"></a>01052 threshold = median + sigma_det * med_dist;
+<a name="l01053"></a>01053 cpl_msg_info(__func__,<span class="stringliteral">"Detection threshold: %f"</span>, threshold);
+<a name="l01054"></a>01054
+<a name="l01055"></a>01055 <span class="comment">/* Create the mask */</span>
+<a name="l01056"></a>01056 object_mask = cpl_mask_threshold_image_create
+<a name="l01057"></a>01057 (image, threshold, DBL_MAX);
+<a name="l01058"></a>01058 <span class="keywordflow">if</span> (object_mask == NULL)
+<a name="l01059"></a>01059 <span class="keywordflow">return</span> NULL;
+<a name="l01060"></a>01060
+<a name="l01061"></a>01061 <span class="comment">/* Apply morphological opening to remove single pixel detections */</span>
+<a name="l01062"></a>01062 kernel = cpl_mask_new(3,3);
+<a name="l01063"></a>01063 cpl_mask_not(kernel);
+<a name="l01064"></a>01064
+<a name="l01065"></a>01065 <span class="keywordflow">if</span> (cpl_mask_filter(object_mask, object_mask, kernel,
+<a name="l01066"></a>01066 CPL_FILTER_OPENING, CPL_BORDER_ZERO) != CPL_ERROR_NONE) {
+<a name="l01067"></a>01067 cpl_mask_delete(object_mask) ;
+<a name="l01068"></a>01068 cpl_mask_delete(kernel) ;
+<a name="l01069"></a>01069 <span class="keywordflow">return</span> NULL;
+<a name="l01070"></a>01070 }
+<a name="l01071"></a>01071 cpl_mask_delete(kernel);
+<a name="l01072"></a>01072
+<a name="l01073"></a>01073 <span class="comment">/* Labelise the different detected apertures */</span>
+<a name="l01074"></a>01074 labels = cpl_image_labelise_mask_create(object_mask, &nobj);
+<a name="l01075"></a>01075 <span class="keywordflow">if</span> (labels == NULL)
+<a name="l01076"></a>01076 {
+<a name="l01077"></a>01077 cpl_mask_delete(object_mask);
+<a name="l01078"></a>01078 <span class="keywordflow">return</span> NULL;
+<a name="l01079"></a>01079 }
+<a name="l01080"></a>01080 cpl_mask_delete(object_mask);
+<a name="l01081"></a>01081 cpl_msg_info(__func__, <span class="stringliteral">"Number of objects detected: %"</span>CPL_SIZE_FORMAT,
+<a name="l01082"></a>01082 nobj);
+<a name="l01083"></a>01083
+<a name="l01084"></a>01084 <span class="comment">/* Create the detected apertures list */</span>
+<a name="l01085"></a>01085 apertures = cpl_apertures_new_from_image(image, labels);
+<a name="l01086"></a>01086 <span class="keywordflow">if</span> (apertures == NULL)
+<a name="l01087"></a>01087 {
+<a name="l01088"></a>01088 cpl_image_delete(labels);
+<a name="l01089"></a>01089 <span class="keywordflow">return</span> NULL;
+<a name="l01090"></a>01090 }
+<a name="l01091"></a>01091 cpl_image_delete(labels);
+<a name="l01092"></a>01092 <span class="keywordflow">return</span> apertures;
+<a name="l01093"></a>01093 }
+<a name="l01094"></a>01094
+<a name="l01095"></a>01095 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_fill_obj_pos
+<a name="l01096"></a>01096 (cpl_table * objects_positions,
+<a name="l01097"></a>01097 cpl_apertures * apertures)
+<a name="l01098"></a>01098 {
+<a name="l01099"></a>01099 cpl_size nobjs;
+<a name="l01100"></a>01100 cpl_size iobj;
+<a name="l01101"></a>01101 <span class="keywordtype">double</span> border_off = 0;
+<a name="l01102"></a>01102
+<a name="l01103"></a>01103 <span class="comment">/* Take into account that the images have been trimmed */</span>
+<a name="l01104"></a>01104 <span class="keywordflow">if</span>(hawki_cal_distortion_config.borders > 0)
+<a name="l01105"></a>01105 border_off = hawki_cal_distortion_config.borders;
+<a name="l01106"></a>01106
+<a name="l01107"></a>01107 nobjs = cpl_apertures_get_size(apertures);
+<a name="l01108"></a>01108 cpl_table_set_size(objects_positions, nobjs);
+<a name="l01109"></a>01109
+<a name="l01110"></a>01110 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobjs ; iobj++)
+<a name="l01111"></a>01111 {
+<a name="l01112"></a>01112 <span class="comment">/* Fill with the already known information */</span>
+<a name="l01113"></a>01113 cpl_table_set_double(objects_positions, HAWKI_COL_OBJ_POSX, iobj,
+<a name="l01114"></a>01114 cpl_apertures_get_centroid_x(apertures,
+<a name="l01115"></a>01115 iobj+1) + border_off);
+<a name="l01116"></a>01116 cpl_table_set_double(objects_positions, HAWKI_COL_OBJ_POSY, iobj,
+<a name="l01117"></a>01117 cpl_apertures_get_centroid_y(apertures,
+<a name="l01118"></a>01118 iobj+1) + border_off);
+<a name="l01119"></a>01119 }
+<a name="l01120"></a>01120
+<a name="l01121"></a>01121 <span class="keywordflow">return</span> 0;
+<a name="l01122"></a>01122 }
+<a name="l01123"></a>01123
+<a name="l01124"></a>01124 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_add_offset_to_positions
+<a name="l01125"></a>01125 (cpl_table ** objects_positions,
+<a name="l01126"></a>01126 cpl_bivector * offsets)
+<a name="l01127"></a>01127 {
+<a name="l01128"></a>01128 <span class="keywordtype">int</span> nframes;
+<a name="l01129"></a>01129 <span class="keywordtype">int</span> iframe;
+<a name="l01130"></a>01130 cpl_size nobjs;
+<a name="l01131"></a>01131 cpl_size iobj;
+<a name="l01132"></a>01132
+<a name="l01133"></a>01133 nframes = cpl_bivector_get_size(offsets);
+<a name="l01134"></a>01134
+<a name="l01135"></a>01135 <span class="keywordflow">for</span>(iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l01136"></a>01136 {
+<a name="l01137"></a>01137 <span class="keywordtype">double</span> offset_x;
+<a name="l01138"></a>01138 <span class="keywordtype">double</span> offset_y;
+<a name="l01139"></a>01139 <span class="keywordtype">int</span> null;
+<a name="l01140"></a>01140 offset_x = cpl_bivector_get_x_data(offsets)[iframe];
+<a name="l01141"></a>01141 offset_y = cpl_bivector_get_y_data(offsets)[iframe];
+<a name="l01142"></a>01142 nobjs = cpl_table_get_nrow(objects_positions[iframe]);
+<a name="l01143"></a>01143 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobjs ; iobj++)
+<a name="l01144"></a>01144 {
+<a name="l01145"></a>01145 cpl_table_set_double(objects_positions[iframe],
+<a name="l01146"></a>01146 HAWKI_COL_OBJ_POSX, iobj,
+<a name="l01147"></a>01147 cpl_table_get_double(objects_positions[iframe],
+<a name="l01148"></a>01148 HAWKI_COL_OBJ_POSX, iobj, &null) + offset_x);
+<a name="l01149"></a>01149 cpl_table_set_double(objects_positions[iframe],
+<a name="l01150"></a>01150 HAWKI_COL_OBJ_POSY, iobj,
+<a name="l01151"></a>01151 cpl_table_get_double(objects_positions[iframe],
+<a name="l01152"></a>01152 HAWKI_COL_OBJ_POSY, iobj, &null) + offset_y);
+<a name="l01153"></a>01153 }
+<a name="l01154"></a>01154 }
+<a name="l01155"></a>01155
+<a name="l01156"></a>01156 <span class="keywordflow">return</span> 0;
+<a name="l01157"></a>01157 }
+<a name="l01158"></a>01158
+<a name="l01159"></a>01159 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_fit_first_order_solution
+<a name="l01160"></a>01160 (hawki_distortion * distortion,
+<a name="l01161"></a>01161 cpl_polynomial * fit2d_x,
+<a name="l01162"></a>01162 cpl_polynomial * fit2d_y)
+<a name="l01163"></a>01163 {
+<a name="l01164"></a>01164 cpl_matrix * pixel_pos;
+<a name="l01165"></a>01165 cpl_vector * dist_x_val;
+<a name="l01166"></a>01166 cpl_vector * dist_y_val;
+<a name="l01167"></a>01167 <span class="keywordtype">int</span> nx;
+<a name="l01168"></a>01168 <span class="keywordtype">int</span> ny;
+<a name="l01169"></a>01169 <span class="keywordtype">int</span> i;
+<a name="l01170"></a>01170 <span class="keywordtype">int</span> j;
+<a name="l01171"></a>01171 <span class="keywordtype">int</span> null;
+<a name="l01172"></a>01172 <span class="keyword">const</span> cpl_size mindeg2d[] = {0, 0};
+<a name="l01173"></a>01173 <span class="keyword">const</span> cpl_size maxdeg2d[] = {1, 1};
+<a name="l01174"></a>01174 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l01175"></a>01175 cpl_vector * pix;
+<a name="l01176"></a>01176 cpl_image * dist_x_plane;
+<a name="l01177"></a>01177 cpl_image * dist_y_plane;
+<a name="l01178"></a>01178 <span class="keywordtype">double</span> dist_x_mean;
+<a name="l01179"></a>01179 <span class="keywordtype">double</span> dist_y_mean;
+<a name="l01180"></a>01180
+<a name="l01181"></a>01181 <span class="comment">/* Fill the bivector with pixel positions in X,Y */</span>
+<a name="l01182"></a>01182 nx = <a class="code" href="group__hawki__distortion.html#gaaeaf96920122f1d4f64c164289588345" title="Gives the dimension in X of the distortion solution.">hawki_distortion_get_size_x</a>(distortion);
+<a name="l01183"></a>01183 ny = <a class="code" href="group__hawki__distortion.html#ga990c10037636042cfcc0b40332821e9c" title="Gives the dimension in Y of the distortion solution.">hawki_distortion_get_size_y</a>(distortion);
+<a name="l01184"></a>01184 pixel_pos = cpl_matrix_new(2, nx * ny);
+<a name="l01185"></a>01185 dist_x_val = cpl_vector_new(nx*ny);
+<a name="l01186"></a>01186 dist_y_val = cpl_vector_new(nx*ny);
+<a name="l01187"></a>01187 <span class="keywordflow">for</span>(i = 0; i < nx; ++i)
+<a name="l01188"></a>01188 <span class="keywordflow">for</span>(j = 0; j < ny; ++j)
+<a name="l01189"></a>01189 {
+<a name="l01190"></a>01190 cpl_matrix_set(pixel_pos, 0, i + nx * j, (<span class="keywordtype">double</span>)i);
+<a name="l01191"></a>01191 cpl_matrix_set(pixel_pos, 1, i + nx * j, (<span class="keywordtype">double</span>)j);
+<a name="l01192"></a>01192 cpl_vector_set(dist_x_val, i + nx * j,
+<a name="l01193"></a>01193 cpl_image_get(distortion->dist_x, i+1, j+1, &null));
+<a name="l01194"></a>01194 cpl_vector_set(dist_y_val, i + nx * j,
+<a name="l01195"></a>01195 cpl_image_get(distortion->dist_y, i+1, j+1, &null));
+<a name="l01196"></a>01196 }
+<a name="l01197"></a>01197
+<a name="l01198"></a>01198 <span class="comment">/* Fit the polynomial */</span>
+<a name="l01199"></a>01199 cpl_polynomial_fit(fit2d_x, pixel_pos, NULL, dist_x_val,
+<a name="l01200"></a>01200 NULL, CPL_FALSE, mindeg2d, maxdeg2d);
+<a name="l01201"></a>01201 cpl_polynomial_fit(fit2d_y, pixel_pos, NULL, dist_y_val,
+<a name="l01202"></a>01202 NULL, CPL_FALSE, mindeg2d, maxdeg2d);
+<a name="l01203"></a>01203 <span class="comment">/* Removing the constant term */</span>
+<a name="l01204"></a>01204 cpl_polynomial_set_coeff(fit2d_x, mindeg2d, 0.);
+<a name="l01205"></a>01205 cpl_polynomial_set_coeff(fit2d_y, mindeg2d, 0.);
+<a name="l01206"></a>01206
+<a name="l01207"></a>01207 <span class="comment">/* Subtract the linear term */</span>
+<a name="l01208"></a>01208 pix = cpl_vector_new(2);
+<a name="l01209"></a>01209 dist_x_plane = cpl_image_new(nx,ny,cpl_image_get_type(distortion->dist_x));
+<a name="l01210"></a>01210 dist_y_plane = cpl_image_new(nx,ny,cpl_image_get_type(distortion->dist_y));
+<a name="l01211"></a>01211 <span class="keywordflow">for</span>(i = 0; i < nx; ++i)
+<a name="l01212"></a>01212 <span class="keywordflow">for</span>(j = 0; j < ny; ++j)
+<a name="l01213"></a>01213 {
+<a name="l01214"></a>01214 <span class="keywordtype">double</span> fit_value_x;
+<a name="l01215"></a>01215 <span class="keywordtype">double</span> fit_value_y;
+<a name="l01216"></a>01216 cpl_vector_set(pix, 0, (<span class="keywordtype">double</span>)i);
+<a name="l01217"></a>01217 cpl_vector_set(pix, 1, (<span class="keywordtype">double</span>)j);
+<a name="l01218"></a>01218 fit_value_x = cpl_polynomial_eval(fit2d_x, pix);
+<a name="l01219"></a>01219 fit_value_y = cpl_polynomial_eval(fit2d_y, pix);
+<a name="l01220"></a>01220 cpl_image_set(dist_x_plane, i+1, j+1, fit_value_x);
+<a name="l01221"></a>01221 cpl_image_set(dist_y_plane, i+1, j+1, fit_value_y);
+<a name="l01222"></a>01222 }
+<a name="l01223"></a>01223 cpl_image_subtract(distortion->dist_x, dist_x_plane);
+<a name="l01224"></a>01224 cpl_image_subtract(distortion->dist_y, dist_y_plane);
+<a name="l01225"></a>01225
+<a name="l01226"></a>01226 <span class="comment">/* Subtract the mean distortion, again */</span>
+<a name="l01227"></a>01227 dist_x_mean = cpl_image_get_mean(distortion->dist_x);
+<a name="l01228"></a>01228 dist_y_mean = cpl_image_get_mean(distortion->dist_y);
+<a name="l01229"></a>01229 cpl_msg_warning(__func__,<span class="stringliteral">"Subtracting mean distortion in X %f"</span>,dist_x_mean);
+<a name="l01230"></a>01230 cpl_msg_warning(__func__,<span class="stringliteral">"Subtracting mean distortion in Y %f"</span>,dist_y_mean);
+<a name="l01231"></a>01231 cpl_image_subtract_scalar(distortion->dist_x, dist_x_mean);
+<a name="l01232"></a>01232 cpl_image_subtract_scalar(distortion->dist_y, dist_y_mean);
+<a name="l01233"></a>01233
+<a name="l01234"></a>01234 <span class="comment">/* Free and return */</span>
+<a name="l01235"></a>01235 cpl_matrix_delete(pixel_pos);
+<a name="l01236"></a>01236 cpl_vector_delete(dist_x_val);
+<a name="l01237"></a>01237 cpl_vector_delete(dist_y_val);
+<a name="l01238"></a>01238 cpl_vector_delete(pix);
+<a name="l01239"></a>01239 cpl_image_delete(dist_x_plane);
+<a name="l01240"></a>01240 cpl_image_delete(dist_y_plane);
+<a name="l01241"></a>01241
+<a name="l01242"></a>01242 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l01243"></a>01243 {
+<a name="l01244"></a>01244 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened computing the linear term"</span>);
+<a name="l01245"></a>01245 cpl_msg_error(__func__,<span class="stringliteral">"Error %s"</span>,cpl_error_get_message());
+<a name="l01246"></a>01246 <span class="comment">//cpl_msg_error(__func__,"Where %s",cpl_error_get_where());</span>
+<a name="l01247"></a>01247 <span class="keywordflow">return</span> -1;
+<a name="l01248"></a>01248 }
+<a name="l01249"></a>01249 <span class="keywordflow">return</span> 0;
+<a name="l01250"></a>01250 }
+<a name="l01251"></a>01251
+<a name="l01252"></a>01252 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01257"></a>01257 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01258"></a>01258 <span class="keyword">static</span> cpl_propertylist ** hawki_cal_distortion_qc
+<a name="l01259"></a>01259 (hawki_distortion ** distortion,
+<a name="l01260"></a>01260 <span class="keywordtype">int</span> * nmatched_pairs,
+<a name="l01261"></a>01261 <span class="keywordtype">double</span> * rms)
+<a name="l01262"></a>01262 {
+<a name="l01263"></a>01263 <span class="keywordtype">int</span> idet;
+<a name="l01264"></a>01264 cpl_propertylist ** qclists;
+<a name="l01265"></a>01265
+<a name="l01266"></a>01266 <span class="comment">/* Allocate the qclists */</span>
+<a name="l01267"></a>01267 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01268"></a>01268
+<a name="l01269"></a>01269 <span class="comment">/* Loop on the detectors to get the mean zpoint */</span>
+<a name="l01270"></a>01270 <span class="keywordflow">for</span>(idet = 0 ; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l01271"></a>01271 {
+<a name="l01272"></a>01272 <span class="comment">/* Allocate this qclist */</span>
+<a name="l01273"></a>01273 qclists[idet] = cpl_propertylist_new() ;
+<a name="l01274"></a>01274
+<a name="l01275"></a>01275 cpl_propertylist_append_double
+<a name="l01276"></a>01276 (qclists[idet], <span class="stringliteral">"ESO QC DIST NMATCHED"</span>, nmatched_pairs[idet]);
+<a name="l01277"></a>01277
+<a name="l01278"></a>01278 cpl_propertylist_append_double
+<a name="l01279"></a>01279 (qclists[idet], <span class="stringliteral">"ESO QC DIST TOTAL RMS"</span>, rms[idet]);
+<a name="l01280"></a>01280
+<a name="l01281"></a>01281 <span class="comment">/* Getting the jacobian of the distortion map */</span>
+<a name="l01282"></a>01282 <span class="comment">/* The jacobian has to be definitive positive in all the detector to </span>
+<a name="l01283"></a>01283 <span class="comment"> * be have a biyective function invertible anywhere:</span>
+<a name="l01284"></a>01284 <span class="comment"> * http://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant#Jacobian_determinant</span>
+<a name="l01285"></a>01285 <span class="comment"> * http://en.wikipedia.org/wiki/Inverse_function#Inverses_and_derivatives</span>
+<a name="l01286"></a>01286 <span class="comment"> * This should be a QC check.</span>
+<a name="l01287"></a>01287 <span class="comment"> */</span>
+<a name="l01288"></a>01288
+<a name="l01289"></a>01289
+<a name="l01290"></a>01290 <span class="comment">//cpl_propertylist_append_double</span>
+<a name="l01291"></a>01291 <span class="comment">//(qclists[idet], "ESO QC DIST JACOBIAN_1_1", jacobian[1][1]);</span>
+<a name="l01292"></a>01292 }
+<a name="l01293"></a>01293
+<a name="l01294"></a>01294 <span class="keywordflow">return</span> qclists;
+<a name="l01295"></a>01295 }
+<a name="l01296"></a>01296
+<a name="l01297"></a>01297 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01307"></a>01307 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01308"></a>01308 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_save
+<a name="l01309"></a>01309 (hawki_distortion ** distortion,
+<a name="l01310"></a>01310 cpl_parameterlist * parlist,
+<a name="l01311"></a>01311 cpl_propertylist ** qclists,
+<a name="l01312"></a>01312 cpl_frameset * recipe_set)
+<a name="l01313"></a>01313 {
+<a name="l01314"></a>01314 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_cal_distortion"</span>;
+<a name="l01315"></a>01315
+<a name="l01316"></a>01316 <span class="comment">/* Write the distortion in both axes */</span>
+<a name="l01317"></a>01317 <a class="code" href="group__hawki__save.html#ga7dd654e4062ef0cf42274ebf274f0089" title="Save a HAWKI_NB_DETECTORS extensions HAWKI distortion images.">hawki_distortion_save</a>(recipe_set,
+<a name="l01318"></a>01318 parlist,
+<a name="l01319"></a>01319 recipe_set,
+<a name="l01320"></a>01320 (<span class="keyword">const</span> hawki_distortion **) distortion,
+<a name="l01321"></a>01321 recipe_name,
+<a name="l01322"></a>01322 NULL,
+<a name="l01323"></a>01323 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l01324"></a>01324 <span class="stringliteral">"hawki_cal_distortion_x.fits"</span>,
+<a name="l01325"></a>01325 <span class="stringliteral">"hawki_cal_distortion_y.fits"</span>);
+<a name="l01326"></a>01326
+<a name="l01327"></a>01327 <span class="comment">/* Free and return */</span>
+<a name="l01328"></a>01328 <span class="keywordflow">return</span> 0;
+<a name="l01329"></a>01329 }
+<a name="l01330"></a>01330
+<a name="l01331"></a>01331 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_distortion_retrieve_input_param
+<a name="l01332"></a>01332 (cpl_parameterlist * parlist)
+<a name="l01333"></a>01333 {
+<a name="l01334"></a>01334 cpl_parameter * par ;
+<a name="l01335"></a>01335
+<a name="l01336"></a>01336 par = NULL ;
+<a name="l01337"></a>01337 par = cpl_parameterlist_find
+<a name="l01338"></a>01338 (parlist, <span class="stringliteral">"hawki.hawki_cal_distortion.sigma_det"</span>);
+<a name="l01339"></a>01339 hawki_cal_distortion_config.sigma_det = cpl_parameter_get_double(par);
+<a name="l01340"></a>01340 par = cpl_parameterlist_find
+<a name="l01341"></a>01341 (parlist, <span class="stringliteral">"hawki.hawki_cal_distortion.grid_points"</span>);
+<a name="l01342"></a>01342 hawki_cal_distortion_config.grid_points = cpl_parameter_get_int(par);
+<a name="l01343"></a>01343 par = cpl_parameterlist_find
+<a name="l01344"></a>01344 (parlist, <span class="stringliteral">"hawki.hawki_cal_distortion.borders"</span>);
+<a name="l01345"></a>01345 hawki_cal_distortion_config.borders = cpl_parameter_get_int(par);
+<a name="l01346"></a>01346 par = cpl_parameterlist_find
+<a name="l01347"></a>01347 (parlist, <span class="stringliteral">"hawki.hawki_cal_distortion.subtract_linear"</span>);
+<a name="l01348"></a>01348 hawki_cal_distortion_config.subtract_linear = cpl_parameter_get_bool(par);
+<a name="l01349"></a>01349
+<a name="l01350"></a>01350
+<a name="l01351"></a>01351 <span class="keywordflow">return</span> 0;
+<a name="l01352"></a>01352 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__cal__flat_8c_source.html b/html/hawki__cal__flat_8c_source.html
new file mode 100644
index 0000000..0f20863
--- /dev/null
+++ b/html/hawki__cal__flat_8c_source.html
@@ -0,0 +1,1917 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_cal_flat.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_cal_flat.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_cal_flat.c,v 1.25 2012/01/11 15:02:18 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/01/11 15:02:18 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.25 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00048"></a>00048
+<a name="l00049"></a>00049 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00050"></a>00050 <span class="comment"> Functions prototypes</span>
+<a name="l00051"></a>00051 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_create(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_exec(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_destroy(cpl_plugin *) ;
+<a name="l00056"></a>00056 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00057"></a>00057
+<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_retrieve_input_param
+<a name="l00059"></a>00059 (cpl_parameterlist * parlist);
+<a name="l00060"></a>00060 <span class="keyword">static</span> cpl_imagelist ** hawki_cal_flat_reduce(
+<a name="l00061"></a>00061 cpl_frameset * flatframes,
+<a name="l00062"></a>00062 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark_file,
+<a name="l00063"></a>00063 cpl_table ** raw_flat_stats,
+<a name="l00064"></a>00064 cpl_table ** raw_flat_odd_column_stats,
+<a name="l00065"></a>00065 cpl_table ** raw_flat_even_column_stats,
+<a name="l00066"></a>00066 cpl_table ** raw_flat_odd_row_stats,
+<a name="l00067"></a>00067 cpl_table ** raw_flat_even_row_stats,
+<a name="l00068"></a>00068 cpl_vector ** selected);
+<a name="l00069"></a>00069 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_clean_outliers(cpl_image *, cpl_imagelist *,
+<a name="l00070"></a>00070 cpl_imagelist *, cpl_vector *, cpl_image **) ;
+<a name="l00071"></a>00071 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_save
+<a name="l00072"></a>00072 (cpl_imagelist ** flat,
+<a name="l00073"></a>00073 cpl_table ** raw_flat_stats,
+<a name="l00074"></a>00074 cpl_table ** raw_flat_odd_column_stats,
+<a name="l00075"></a>00075 cpl_table ** raw_flat_even_column_stats,
+<a name="l00076"></a>00076 cpl_table ** raw_flat_odd_row_stats,
+<a name="l00077"></a>00077 cpl_table ** raw_flat_even_row_stats,
+<a name="l00078"></a>00078 cpl_vector ** raw_selected,
+<a name="l00079"></a>00079 <span class="keywordtype">int</span> set_nb,
+<a name="l00080"></a>00080 <span class="keyword">const</span> cpl_frame * bpmdark,
+<a name="l00081"></a>00081 cpl_frameset * flatframes,
+<a name="l00082"></a>00082 cpl_frameset * calibframes,
+<a name="l00083"></a>00083 cpl_parameterlist * parlist,
+<a name="l00084"></a>00084 cpl_frameset * set_tot);
+<a name="l00085"></a>00085 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_compare(<span class="keyword">const</span> cpl_frame *, <span class="keyword">const</span> cpl_frame *) ;
+<a name="l00086"></a>00086 <span class="keyword">static</span> cpl_imagelist * hawki_cal_flat_merge_bpms
+<a name="l00087"></a>00087 (<span class="keyword">const</span> cpl_frame * bpm_orig,
+<a name="l00088"></a>00088 cpl_imagelist * bpm_to_add);
+<a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_select
+<a name="l00090"></a>00090 (cpl_vector * meds,
+<a name="l00091"></a>00091 cpl_vector * rms,
+<a name="l00092"></a>00092 <span class="keywordtype">int</span> auto_flag,
+<a name="l00093"></a>00093 <span class="keywordtype">int</span> auto_max_bins,
+<a name="l00094"></a>00094 <span class="keywordtype">double</span> min_level,
+<a name="l00095"></a>00095 <span class="keywordtype">double</span> max_level,
+<a name="l00096"></a>00096 <span class="keywordtype">double</span> max_rms,
+<a name="l00097"></a>00097 <span class="keywordtype">int</span> min_nframes,
+<a name="l00098"></a>00098 cpl_vector * selection);
+<a name="l00099"></a>00099 <span class="keyword">static</span> cpl_vector * hawki_cal_flat_extract_vector(cpl_vector *,
+<a name="l00100"></a>00100 cpl_vector *) ;
+<a name="l00101"></a>00101
+<a name="l00102"></a>00102 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00103"></a>00103 <span class="comment"> Static variables</span>
+<a name="l00104"></a>00104 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00107"></a>00107 <span class="comment">/* Inputs */</span>
+<a name="l00108"></a>00108 <span class="keywordtype">int</span> llx ;
+<a name="l00109"></a>00109 <span class="keywordtype">int</span> lly ;
+<a name="l00110"></a>00110 <span class="keywordtype">int</span> urx ;
+<a name="l00111"></a>00111 <span class="keywordtype">int</span> ury ;
+<a name="l00112"></a>00112 <span class="keywordtype">int</span> normalise ;
+<a name="l00113"></a>00113 <span class="keywordtype">int</span> second_pass ;
+<a name="l00114"></a>00114 <span class="keywordtype">double</span> sigma_badres ;
+<a name="l00115"></a>00115 <span class="keywordtype">double</span> sigma_bpm ;
+<a name="l00116"></a>00116 <span class="keywordtype">double</span> lowval_bpm ;
+<a name="l00117"></a>00117 <span class="keywordtype">double</span> highval_bpm ;
+<a name="l00118"></a>00118 <span class="keywordtype">int</span> select_auto ;
+<a name="l00119"></a>00119 <span class="keywordtype">int</span> select_auto_max_bins;
+<a name="l00120"></a>00120 <span class="keywordtype">double</span> select_min_level[HAWKI_NB_DETECTORS];
+<a name="l00121"></a>00121 <span class="keywordtype">double</span> select_max_level[HAWKI_NB_DETECTORS];
+<a name="l00122"></a>00122 <span class="keywordtype">double</span> select_max_rms[HAWKI_NB_DETECTORS];
+<a name="l00123"></a>00123 <span class="keywordtype">int</span> select_min_nframes ;
+<a name="l00124"></a>00124 <span class="keywordtype">int</span> extra_stats;
+<a name="l00125"></a>00125 } hawki_cal_flat_config ;
+<a name="l00126"></a>00126
+<a name="l00127"></a>00127 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00128"></a>00128 <span class="comment">/* Outputs */</span>
+<a name="l00129"></a>00129 <span class="keywordtype">int</span> nb_badpix[HAWKI_NB_DETECTORS];
+<a name="l00130"></a>00130 <span class="keywordtype">double</span> norm[HAWKI_NB_DETECTORS];
+<a name="l00131"></a>00131 <span class="keywordtype">double</span> med_stdev[HAWKI_NB_DETECTORS];
+<a name="l00132"></a>00132 <span class="keywordtype">double</span> med_avg[HAWKI_NB_DETECTORS];
+<a name="l00133"></a>00133 <span class="keywordtype">double</span> med_med[HAWKI_NB_DETECTORS];
+<a name="l00134"></a>00134 <span class="keywordtype">double</span> med_min[HAWKI_NB_DETECTORS];
+<a name="l00135"></a>00135 <span class="keywordtype">double</span> med_max[HAWKI_NB_DETECTORS];
+<a name="l00136"></a>00136 } hawki_cal_flat_outputs;
+<a name="l00137"></a>00137
+<a name="l00138"></a>00138 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_cal_flat_description[] =
+<a name="l00139"></a>00139 <span class="stringliteral">"hawki_cal_flat -- HAWKĪI imaging flat-field creation from twillight images.\n"</span>
+<a name="l00140"></a>00140 <span class="stringliteral">"The input of the recipe files listed in the Set Of Frames (sof-file)\n"</span>
+<a name="l00141"></a>00141 <span class="stringliteral">"must be tagged as:\n"</span>
+<a name="l00142"></a>00142 <span class="stringliteral">"raw-file.fits "</span>HAWKI_CAL_FLAT_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00143"></a>00143 <span class="stringliteral">"Optional inputs are:\n"</span>
+<a name="l00144"></a>00144 <span class="stringliteral">"bpmdark-file.fits "</span>HAWKI_CALPRO_BPM_HOT<span class="stringliteral">"\n"</span>
+<a name="l00145"></a>00145 <span class="stringliteral">"dark-file.fits "</span>HAWKI_CALPRO_DARK<span class="stringliteral">"\n"</span>
+<a name="l00146"></a>00146 <span class="stringliteral">"dark_err-file.fits "</span>HAWKI_CALPRO_DARK_ERR<span class="stringliteral">"\n"</span>
+<a name="l00147"></a>00147 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00148"></a>00148 <span class="stringliteral">"hawki_cal_flat_setxx.fits ("</span>HAWKI_CALPRO_FLAT<span class="stringliteral">"): Master flat for filter xx\n"</span>
+<a name="l00149"></a>00149 <span class="stringliteral">"hawki_cal_flat_err_setxx.fits ("</span>HAWKI_CALPRO_FLAT_ERRMAP<span class="stringliteral">"): Master flat residuals\n"</span>
+<a name="l00150"></a>00150 <span class="stringliteral">"hawki_cal_flat_bpmflat_setxx.fits ("</span>HAWKI_CALPRO_BPM_COLD<span class="stringliteral">"): BPM from the flat\n"</span>
+<a name="l00151"></a>00151 <span class="stringliteral">"hawki_cal_flat_stats_setxx.fits ("</span>HAWKI_CALPRO_FLAT_STATS<span class="stringliteral">"): Stats of the individual flats\n"</span>
+<a name="l00152"></a>00152 <span class="stringliteral">"Optionally it also creates:\n"</span>
+<a name="l00153"></a>00153 <span class="stringliteral">"hawki_cal_flat_bpm_setxx.fits ("</span>HAWKI_CALPRO_BPM<span class="stringliteral">"): Bad pixel mask combining bpm from dark and flat\n"</span>
+<a name="l00154"></a>00154 <span class="stringliteral">"hawki_cal_flat_stats_ec_setxx.fits ("</span>HAWKI_CALPRO_FLAT_STATS_EVEN_COL<span class="stringliteral">"): Stats of the individual flats for even columns\n"</span>
+<a name="l00155"></a>00155 <span class="stringliteral">"hawki_cal_flat_stats_oc_setxx.fits ("</span>HAWKI_CALPRO_FLAT_STATS_ODD_COL<span class="stringliteral">"): Stats of the individual flats for odd columns\n"</span>
+<a name="l00156"></a>00156 <span class="stringliteral">"hawki_cal_flat_stats_er_setxx.fits ("</span>HAWKI_CALPRO_FLAT_STATS_EVEN_ROW<span class="stringliteral">"): Stats of the individual flats for even rows\n"</span>
+<a name="l00157"></a>00157 <span class="stringliteral">"hawki_cal_flat_stats_or_setxx.fits ("</span>HAWKI_CALPRO_FLAT_STATS_ODD_ROW<span class="stringliteral">"): Stats of the individual flats for odd rows\n"</span>
+<a name="l00158"></a>00158 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00159"></a>00159 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00160"></a>00160 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00161"></a>00161
+<a name="l00162"></a>00162
+<a name="l00163"></a>00163
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165
+<a name="l00166"></a>00166 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00167"></a>00167 <span class="comment"> Functions code</span>
+<a name="l00168"></a>00168 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00169"></a>00169
+<a name="l00170"></a>00170 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00178"></a>00178 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00179"></a>00179 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00180"></a>00180 {
+<a name="l00181"></a>00181 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00182"></a>00182 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 cpl_plugin_init(plugin,
+<a name="l00185"></a>00185 CPL_PLUGIN_API,
+<a name="l00186"></a>00186 HAWKI_BINARY_VERSION,
+<a name="l00187"></a>00187 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00188"></a>00188 <span class="stringliteral">"hawki_cal_flat"</span>,
+<a name="l00189"></a>00189 <span class="stringliteral">"Twillight flat recipe"</span>,
+<a name="l00190"></a>00190 hawki_cal_flat_description,
+<a name="l00191"></a>00191 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00192"></a>00192 PACKAGE_BUGREPORT,
+<a name="l00193"></a>00193 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00194"></a>00194 hawki_cal_flat_create,
+<a name="l00195"></a>00195 hawki_cal_flat_exec,
+<a name="l00196"></a>00196 hawki_cal_flat_destroy) ;
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 cpl_pluginlist_append(list, plugin) ;
+<a name="l00199"></a>00199
+<a name="l00200"></a>00200 <span class="keywordflow">return</span> 0;
+<a name="l00201"></a>00201 }
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00212"></a>00212 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00213"></a>00213 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_create(cpl_plugin * plugin)
+<a name="l00214"></a>00214 {
+<a name="l00215"></a>00215 cpl_recipe * recipe ;
+<a name="l00216"></a>00216 cpl_parameter * p ;
+<a name="l00217"></a>00217
+<a name="l00218"></a>00218 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00219"></a>00219 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00220"></a>00220 recipe = (cpl_recipe *)plugin ;
+<a name="l00221"></a>00221 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00222"></a>00222
+<a name="l00223"></a>00223 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00224"></a>00224 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00225"></a>00225
+<a name="l00226"></a>00226 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00227"></a>00227 <span class="comment">/* --zone */</span>
+<a name="l00228"></a>00228 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.zone"</span>,
+<a name="l00229"></a>00229 CPL_TYPE_STRING,
+<a name="l00230"></a>00230 <span class="stringliteral">"Stats zone"</span>,
+<a name="l00231"></a>00231 <span class="stringliteral">"hawki.hawki_cal_flat"</span>,
+<a name="l00232"></a>00232 <span class="stringliteral">"1,1,2048,2048"</span>) ;
+<a name="l00233"></a>00233 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"zone"</span>) ;
+<a name="l00234"></a>00234 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00235"></a>00235 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00236"></a>00236
+<a name="l00237"></a>00237 <span class="comment">/* --normalise */</span>
+<a name="l00238"></a>00238 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.normalise"</span>,
+<a name="l00239"></a>00239 CPL_TYPE_BOOL, <span class="stringliteral">"Flag to apply the normalisation"</span>,
+<a name="l00240"></a>00240 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, FALSE) ;
+<a name="l00241"></a>00241 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"normalise"</span>) ;
+<a name="l00242"></a>00242 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00243"></a>00243 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00244"></a>00244
+<a name="l00245"></a>00245 <span class="comment">/* --second_pass */</span>
+<a name="l00246"></a>00246 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.second_pass"</span>,
+<a name="l00247"></a>00247 CPL_TYPE_BOOL, <span class="stringliteral">"Flag to apply a second pass computation"</span>,
+<a name="l00248"></a>00248 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, TRUE) ;
+<a name="l00249"></a>00249 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"second_pass"</span>) ;
+<a name="l00250"></a>00250 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00251"></a>00251 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00252"></a>00252
+<a name="l00253"></a>00253 <span class="comment">/* --sigma_badres */</span>
+<a name="l00254"></a>00254 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.sigma_badres"</span>,
+<a name="l00255"></a>00255 CPL_TYPE_DOUBLE, <span class="stringliteral">"sigma for detection of bad flat results"</span>,
+<a name="l00256"></a>00256 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, 1.0) ;
+<a name="l00257"></a>00257 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sigma_badres"</span>) ;
+<a name="l00258"></a>00258 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00259"></a>00259 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00260"></a>00260
+<a name="l00261"></a>00261 <span class="comment">/* --sigma_bpm */</span>
+<a name="l00262"></a>00262 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.sigma_bpm"</span>,
+<a name="l00263"></a>00263 CPL_TYPE_DOUBLE, <span class="stringliteral">"sigma for detection of bad pixels"</span>,
+<a name="l00264"></a>00264 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, 10.0) ;
+<a name="l00265"></a>00265 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sigma_bpm"</span>) ;
+<a name="l00266"></a>00266 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00267"></a>00267 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00268"></a>00268
+<a name="l00269"></a>00269 <span class="comment">/* --lowval_bpm */</span>
+<a name="l00270"></a>00270 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.lowval_bpm"</span>,
+<a name="l00271"></a>00271 CPL_TYPE_DOUBLE, <span class="stringliteral">"values of the flat below this will be included "</span>
+<a name="l00272"></a>00272 <span class="stringliteral">"in the bpm. In units of final flat (normalised if normalise is on)"</span>,
+<a name="l00273"></a>00273 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, .1) ;
+<a name="l00274"></a>00274 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"lowval_bpm"</span>) ;
+<a name="l00275"></a>00275 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00276"></a>00276 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00277"></a>00277
+<a name="l00278"></a>00278 <span class="comment">/* --highval_bpm */</span>
+<a name="l00279"></a>00279 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.highval_bpm"</span>,
+<a name="l00280"></a>00280 CPL_TYPE_DOUBLE, <span class="stringliteral">"values of the flat above this will be included "</span>
+<a name="l00281"></a>00281 <span class="stringliteral">"in the bpm. In units of final flat (normalized if normalise is on)"</span>,
+<a name="l00282"></a>00282 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, 10.0) ;
+<a name="l00283"></a>00283 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"highval_bpm"</span>) ;
+<a name="l00284"></a>00284 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00285"></a>00285 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00286"></a>00286
+<a name="l00287"></a>00287 <span class="comment">/* --select_auto */</span>
+<a name="l00288"></a>00288 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.select_auto"</span>,
+<a name="l00289"></a>00289 CPL_TYPE_BOOL, <span class="stringliteral">"Flag to automatically select the good input frames"</span>,
+<a name="l00290"></a>00290 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, TRUE);
+<a name="l00291"></a>00291 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"select_auto"</span>) ;
+<a name="l00292"></a>00292 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00293"></a>00293 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00294"></a>00294
+<a name="l00295"></a>00295 <span class="comment">/* --select_auto_max_bins */</span>
+<a name="l00296"></a>00296 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.select_auto_max_bins"</span>,
+<a name="l00297"></a>00297 CPL_TYPE_INT, <span class="stringliteral">"Maximum number of frames requested"</span>,
+<a name="l00298"></a>00298 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, 10) ;
+<a name="l00299"></a>00299 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"select_auto_max_bins"</span>);
+<a name="l00300"></a>00300 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00301"></a>00301 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00302"></a>00302
+<a name="l00303"></a>00303 <span class="comment">/* --select_min_level */</span>
+<a name="l00304"></a>00304 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.select_min_level"</span>,
+<a name="l00305"></a>00305 CPL_TYPE_STRING, <span class="stringliteral">"Minimum ADU level for frames selection"</span>,
+<a name="l00306"></a>00306 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, <span class="stringliteral">"-1.0"</span>) ;
+<a name="l00307"></a>00307 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"select_min_level"</span>) ;
+<a name="l00308"></a>00308 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00309"></a>00309 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00310"></a>00310
+<a name="l00311"></a>00311 <span class="comment">/* --select_max_level */</span>
+<a name="l00312"></a>00312 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.select_max_level"</span>,
+<a name="l00313"></a>00313 CPL_TYPE_STRING, <span class="stringliteral">"Maximum ADU level for frames selection"</span>,
+<a name="l00314"></a>00314 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, <span class="stringliteral">"25000"</span>);
+<a name="l00315"></a>00315 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"select_max_level"</span>);
+<a name="l00316"></a>00316 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00317"></a>00317 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00318"></a>00318
+<a name="l00319"></a>00319 <span class="comment">/* --select_max_rms */</span>
+<a name="l00320"></a>00320 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.select_max_rms"</span>,
+<a name="l00321"></a>00321 CPL_TYPE_STRING, <span class="stringliteral">"Maximum RMS for frames selection"</span>,
+<a name="l00322"></a>00322 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, <span class="stringliteral">"4000"</span>);
+<a name="l00323"></a>00323 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"select_max_rms"</span>);
+<a name="l00324"></a>00324 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00325"></a>00325 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00326"></a>00326
+<a name="l00327"></a>00327 <span class="comment">/* --select_min_nframes */</span>
+<a name="l00328"></a>00328 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.select_min_nframes"</span>,
+<a name="l00329"></a>00329 CPL_TYPE_INT, <span class="stringliteral">"Minimum number of frames requested"</span>,
+<a name="l00330"></a>00330 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, 3);
+<a name="l00331"></a>00331 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"select_min_nframes"</span>) ;
+<a name="l00332"></a>00332 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00333"></a>00333 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00334"></a>00334
+<a name="l00335"></a>00335 <span class="comment">/* --extra_stats */</span>
+<a name="l00336"></a>00336 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_flat.extra_stats"</span>,
+<a name="l00337"></a>00337 CPL_TYPE_BOOL, <span class="stringliteral">"Request for even/odd column/rows statistics"</span>,
+<a name="l00338"></a>00338 <span class="stringliteral">"hawki.hawki_cal_flat"</span>, FALSE) ;
+<a name="l00339"></a>00339 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"extra_stats"</span>) ;
+<a name="l00340"></a>00340 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00341"></a>00341 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00342"></a>00342
+<a name="l00343"></a>00343 <span class="comment">/* Return */</span>
+<a name="l00344"></a>00344 <span class="keywordflow">return</span> 0;
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346
+<a name="l00347"></a>00347 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00353"></a>00353 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00354"></a>00354 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_exec(cpl_plugin * plugin)
+<a name="l00355"></a>00355 {
+<a name="l00356"></a>00356 cpl_recipe * recipe ;
+<a name="l00357"></a>00357
+<a name="l00358"></a>00358 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00359"></a>00359 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00360"></a>00360 recipe = (cpl_recipe *)plugin ;
+<a name="l00361"></a>00361 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00362"></a>00362
+<a name="l00363"></a>00363 <span class="comment">/* Issue a banner */</span>
+<a name="l00364"></a>00364 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00365"></a>00365
+<a name="l00366"></a>00366 <span class="keywordflow">return</span> hawki_cal_flat(recipe->parameters, recipe->frames) ;
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368
+<a name="l00369"></a>00369 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00375"></a>00375 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00376"></a>00376 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_destroy(cpl_plugin * plugin)
+<a name="l00377"></a>00377 {
+<a name="l00378"></a>00378 cpl_recipe * recipe ;
+<a name="l00379"></a>00379
+<a name="l00380"></a>00380 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00381"></a>00381 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00382"></a>00382 recipe = (cpl_recipe *)plugin ;
+<a name="l00383"></a>00383 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00384"></a>00384
+<a name="l00385"></a>00385 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00386"></a>00386 <span class="keywordflow">return</span> 0 ;
+<a name="l00387"></a>00387 }
+<a name="l00388"></a>00388
+<a name="l00389"></a>00389 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00396"></a>00396 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00397"></a>00397 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat(
+<a name="l00398"></a>00398 cpl_parameterlist * parlist,
+<a name="l00399"></a>00399 cpl_frameset * framelist)
+<a name="l00400"></a>00400 {
+<a name="l00401"></a>00401 cpl_size * labels ;
+<a name="l00402"></a>00402 cpl_size nlabels ;
+<a name="l00403"></a>00403 cpl_frameset * flatframes ;
+<a name="l00404"></a>00404 <span class="keywordtype">int</span> nflats;
+<a name="l00405"></a>00405 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark ;
+<a name="l00406"></a>00406 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark_err;
+<a name="l00407"></a>00407 <span class="keyword">const</span> cpl_frame * bpmdark ;
+<a name="l00408"></a>00408 cpl_imagelist ** twflat ;
+<a name="l00409"></a>00409 cpl_table ** raw_flat_stats;
+<a name="l00410"></a>00410 cpl_table ** raw_flat_odd_column_stats = NULL;
+<a name="l00411"></a>00411 cpl_table ** raw_flat_even_column_stats = NULL;
+<a name="l00412"></a>00412 cpl_table ** raw_flat_odd_row_stats = NULL;
+<a name="l00413"></a>00413 cpl_table ** raw_flat_even_row_stats = NULL;
+<a name="l00414"></a>00414 cpl_vector ** raw_selected;
+<a name="l00415"></a>00415 cpl_size i;
+<a name="l00416"></a>00416 <span class="keywordtype">int</span> j ;
+<a name="l00417"></a>00417 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00418"></a>00418
+<a name="l00419"></a>00419 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00420"></a>00420 <span class="keywordflow">if</span>(hawki_cal_flat_retrieve_input_param(parlist))
+<a name="l00421"></a>00421 {
+<a name="l00422"></a>00422 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00423"></a>00423 <span class="keywordflow">return</span> -1;
+<a name="l00424"></a>00424 }
+<a name="l00425"></a>00425
+<a name="l00426"></a>00426 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00427"></a>00427 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00428"></a>00428 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00429"></a>00429 <span class="keywordflow">return</span> -1;
+<a name="l00430"></a>00430 }
+<a name="l00431"></a>00431
+<a name="l00432"></a>00432 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00433"></a>00433 <span class="keywordflow">if</span> ((flatframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist,
+<a name="l00434"></a>00434 HAWKI_CAL_FLAT_RAW)) == NULL) {
+<a name="l00435"></a>00435 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find flat frames in the input list (%s)"</span>,
+<a name="l00436"></a>00436 HAWKI_CAL_FLAT_RAW);
+<a name="l00437"></a>00437 <span class="keywordflow">return</span> -1 ;
+<a name="l00438"></a>00438 }
+<a name="l00439"></a>00439
+<a name="l00440"></a>00440 <span class="comment">/* Retrieve calibration frames */</span>
+<a name="l00441"></a>00441 bpmdark = cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM_HOT);
+<a name="l00442"></a>00442 dark = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_DARK);
+<a name="l00443"></a>00443 dark_err = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_DARK_ERR);
+<a name="l00444"></a>00444
+<a name="l00445"></a>00445 <span class="comment">/* Labelise all input flat frames */</span>
+<a name="l00446"></a>00446 labels = cpl_frameset_labelise(flatframes, hawki_cal_flat_compare,
+<a name="l00447"></a>00447 &nlabels);
+<a name="l00448"></a>00448 <span class="keywordflow">if</span> (labels == NULL) {
+<a name="l00449"></a>00449 cpl_msg_error(__func__, <span class="stringliteral">"Cannot labelise input frames"</span>) ;
+<a name="l00450"></a>00450 cpl_frameset_delete(flatframes);
+<a name="l00451"></a>00451 <span class="keywordflow">return</span> -1;
+<a name="l00452"></a>00452 }
+<a name="l00453"></a>00453
+<a name="l00454"></a>00454 <span class="comment">/* Extract sets and reduce each of them */</span>
+<a name="l00455"></a>00455 <span class="keywordflow">for</span> (i=0 ; i<nlabels ; i++)
+<a name="l00456"></a>00456 {
+<a name="l00457"></a>00457 cpl_frameset * this_filter_flats;
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 <span class="comment">/* Reduce data set nb i */</span>
+<a name="l00460"></a>00460 cpl_msg_info(__func__, <span class="stringliteral">"Reduce data set no %d out of %d"</span>, i+1, nlabels);
+<a name="l00461"></a>00461 cpl_msg_indent_more() ;
+<a name="l00462"></a>00462 this_filter_flats = cpl_frameset_extract(flatframes, labels, i) ;
+<a name="l00463"></a>00463 nflats = cpl_frameset_get_size(this_filter_flats);
+<a name="l00464"></a>00464
+<a name="l00465"></a>00465 <span class="comment">/* Allocate and initialize statistics */</span>
+<a name="l00466"></a>00466 raw_flat_stats = cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_table*));
+<a name="l00467"></a>00467 raw_selected = cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_vector*));
+<a name="l00468"></a>00468 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+<a name="l00469"></a>00469 {
+<a name="l00470"></a>00470 raw_selected[j] = cpl_vector_new(nflats);
+<a name="l00471"></a>00471 raw_flat_stats[j] = cpl_table_new(nflats);
+<a name="l00472"></a>00472 }
+<a name="l00473"></a>00473 <span class="comment">/* Initialize the statistics table */</span>
+<a name="l00474"></a>00474 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_flat_stats);
+<a name="l00475"></a>00475 <span class="keywordflow">if</span>(hawki_cal_flat_config.extra_stats)
+<a name="l00476"></a>00476 {
+<a name="l00477"></a>00477 raw_flat_odd_column_stats =
+<a name="l00478"></a>00478 cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_table*));
+<a name="l00479"></a>00479 raw_flat_even_column_stats =
+<a name="l00480"></a>00480 cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_table*));
+<a name="l00481"></a>00481 raw_flat_odd_row_stats =
+<a name="l00482"></a>00482 cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_table*));
+<a name="l00483"></a>00483 raw_flat_even_row_stats =
+<a name="l00484"></a>00484 cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_table*));
+<a name="l00485"></a>00485 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+<a name="l00486"></a>00486 {
+<a name="l00487"></a>00487 raw_flat_odd_column_stats[j] = cpl_table_new(nflats);
+<a name="l00488"></a>00488 raw_flat_even_column_stats[j] = cpl_table_new(nflats);
+<a name="l00489"></a>00489 raw_flat_odd_row_stats[j] = cpl_table_new(nflats);
+<a name="l00490"></a>00490 raw_flat_even_row_stats[j] = cpl_table_new(nflats);
+<a name="l00491"></a>00491 }
+<a name="l00492"></a>00492 <span class="comment">/* Initialize the statistics table */</span>
+<a name="l00493"></a>00493 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_flat_odd_column_stats);
+<a name="l00494"></a>00494 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_flat_even_column_stats);
+<a name="l00495"></a>00495 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_flat_odd_row_stats);
+<a name="l00496"></a>00496 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_flat_even_row_stats);
+<a name="l00497"></a>00497 }
+<a name="l00498"></a>00498
+<a name="l00499"></a>00499 <span class="comment">/* Reduce */</span>
+<a name="l00500"></a>00500 <span class="keywordflow">if</span> ((twflat = hawki_cal_flat_reduce
+<a name="l00501"></a>00501 (this_filter_flats,
+<a name="l00502"></a>00502 dark,
+<a name="l00503"></a>00503 raw_flat_stats,
+<a name="l00504"></a>00504 raw_flat_odd_column_stats,
+<a name="l00505"></a>00505 raw_flat_even_column_stats,
+<a name="l00506"></a>00506 raw_flat_odd_row_stats,
+<a name="l00507"></a>00507 raw_flat_even_row_stats,
+<a name="l00508"></a>00508 raw_selected)) == NULL)
+<a name="l00509"></a>00509 {
+<a name="l00510"></a>00510 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+<a name="l00511"></a>00511 {
+<a name="l00512"></a>00512 cpl_table_delete(raw_flat_stats[j]);
+<a name="l00513"></a>00513 cpl_vector_delete(raw_selected[j]);
+<a name="l00514"></a>00514 }
+<a name="l00515"></a>00515 cpl_free(raw_flat_stats);
+<a name="l00516"></a>00516 cpl_free(raw_selected);
+<a name="l00517"></a>00517 <span class="keywordflow">if</span>(hawki_cal_flat_config.extra_stats)
+<a name="l00518"></a>00518 {
+<a name="l00519"></a>00519 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+<a name="l00520"></a>00520 {
+<a name="l00521"></a>00521 cpl_table_delete(raw_flat_odd_column_stats[j]);
+<a name="l00522"></a>00522 cpl_table_delete(raw_flat_even_column_stats[j]);
+<a name="l00523"></a>00523 cpl_table_delete(raw_flat_odd_row_stats[j]);
+<a name="l00524"></a>00524 cpl_table_delete(raw_flat_even_row_stats[j]);
+<a name="l00525"></a>00525 }
+<a name="l00526"></a>00526 cpl_free(raw_flat_odd_column_stats);
+<a name="l00527"></a>00527 cpl_free(raw_flat_even_column_stats);
+<a name="l00528"></a>00528 cpl_free(raw_flat_odd_row_stats);
+<a name="l00529"></a>00529 cpl_free(raw_flat_even_row_stats);
+<a name="l00530"></a>00530 }
+<a name="l00531"></a>00531 cpl_frameset_delete(this_filter_flats);
+<a name="l00532"></a>00532 cpl_frameset_delete(flatframes);
+<a name="l00533"></a>00533 cpl_free(labels);
+<a name="l00534"></a>00534 cpl_msg_error(__func__, <span class="stringliteral">"Cannot reduce set nb %d"</span>, i+1) ;
+<a name="l00535"></a>00535 <span class="keywordflow">return</span> 1;
+<a name="l00536"></a>00536
+<a name="l00537"></a>00537 } <span class="keywordflow">else</span> {
+<a name="l00538"></a>00538 <span class="comment">/* Save the products */</span>
+<a name="l00539"></a>00539 cpl_frameset * calib_frames;
+<a name="l00540"></a>00540
+<a name="l00541"></a>00541 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00542"></a>00542 calib_frames = cpl_frameset_new();
+<a name="l00543"></a>00543 <span class="keywordflow">if</span>(bpmdark)
+<a name="l00544"></a>00544 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(bpmdark));
+<a name="l00545"></a>00545 <span class="keywordflow">if</span>(dark)
+<a name="l00546"></a>00546 cpl_frameset_insert(calib_frames,
+<a name="l00547"></a>00547 cpl_frame_duplicate(cpl_frameset_find_const(framelist,
+<a name="l00548"></a>00548 HAWKI_CALPRO_DARK)));
+<a name="l00549"></a>00549 <span class="keywordflow">if</span>(dark_err)
+<a name="l00550"></a>00550 cpl_frameset_insert(calib_frames,
+<a name="l00551"></a>00551 cpl_frame_duplicate(cpl_frameset_find_const(framelist,
+<a name="l00552"></a>00552 HAWKI_CALPRO_DARK_ERR)));
+<a name="l00553"></a>00553 hawki_cal_flat_save
+<a name="l00554"></a>00554 (twflat, raw_flat_stats,
+<a name="l00555"></a>00555 raw_flat_odd_column_stats,
+<a name="l00556"></a>00556 raw_flat_even_column_stats,
+<a name="l00557"></a>00557 raw_flat_odd_row_stats,
+<a name="l00558"></a>00558 raw_flat_even_row_stats,
+<a name="l00559"></a>00559 raw_selected,
+<a name="l00560"></a>00560 i+1, bpmdark, this_filter_flats, calib_frames,
+<a name="l00561"></a>00561 parlist, framelist);
+<a name="l00562"></a>00562 cpl_imagelist_delete(twflat[0]);
+<a name="l00563"></a>00563 cpl_imagelist_delete(twflat[1]);
+<a name="l00564"></a>00564 cpl_imagelist_delete(twflat[2]);
+<a name="l00565"></a>00565 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00566"></a>00566 cpl_imagelist_delete(twflat[3]);
+<a name="l00567"></a>00567 cpl_free(twflat);
+<a name="l00568"></a>00568 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+<a name="l00569"></a>00569 {
+<a name="l00570"></a>00570 cpl_table_delete(raw_flat_stats[j]);
+<a name="l00571"></a>00571 cpl_vector_delete(raw_selected[j]);
+<a name="l00572"></a>00572 }
+<a name="l00573"></a>00573 cpl_free(raw_flat_stats);
+<a name="l00574"></a>00574 cpl_free(raw_selected);
+<a name="l00575"></a>00575 <span class="keywordflow">if</span>(hawki_cal_flat_config.extra_stats)
+<a name="l00576"></a>00576 {
+<a name="l00577"></a>00577 <span class="keywordflow">for</span> (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+<a name="l00578"></a>00578 {
+<a name="l00579"></a>00579 cpl_table_delete(raw_flat_odd_column_stats[j]);
+<a name="l00580"></a>00580 cpl_table_delete(raw_flat_even_column_stats[j]);
+<a name="l00581"></a>00581 cpl_table_delete(raw_flat_odd_row_stats[j]);
+<a name="l00582"></a>00582 cpl_table_delete(raw_flat_even_row_stats[j]);
+<a name="l00583"></a>00583 }
+<a name="l00584"></a>00584 cpl_free(raw_flat_odd_column_stats);
+<a name="l00585"></a>00585 cpl_free(raw_flat_even_column_stats);
+<a name="l00586"></a>00586 cpl_free(raw_flat_odd_row_stats);
+<a name="l00587"></a>00587 cpl_free(raw_flat_even_row_stats);
+<a name="l00588"></a>00588 }
+<a name="l00589"></a>00589 cpl_frameset_delete(calib_frames);
+<a name="l00590"></a>00590 }
+<a name="l00591"></a>00591 cpl_msg_indent_less();
+<a name="l00592"></a>00592 cpl_frameset_delete(this_filter_flats);
+<a name="l00593"></a>00593 }
+<a name="l00594"></a>00594
+<a name="l00595"></a>00595 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00596"></a>00596 cpl_msg_warning(__func__,<span class="stringliteral">"Probably some data could not be saved. "</span>
+<a name="l00597"></a>00597 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00598"></a>00598
+<a name="l00599"></a>00599
+<a name="l00600"></a>00600 <span class="comment">/* Free and return */</span>
+<a name="l00601"></a>00601 cpl_frameset_delete(flatframes);
+<a name="l00602"></a>00602 cpl_free(labels);
+<a name="l00603"></a>00603
+<a name="l00604"></a>00604 <span class="comment">/* Return */</span>
+<a name="l00605"></a>00605 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l00606"></a>00606 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0;
+<a name="l00607"></a>00607 }
+<a name="l00608"></a>00608
+<a name="l00609"></a>00609 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00620"></a>00620 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00621"></a>00621 <span class="keyword">static</span> cpl_imagelist ** hawki_cal_flat_reduce(
+<a name="l00622"></a>00622 cpl_frameset * flatframes,
+<a name="l00623"></a>00623 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark_file,
+<a name="l00624"></a>00624 cpl_table ** raw_flat_stats,
+<a name="l00625"></a>00625 cpl_table ** raw_flat_odd_column_stats,
+<a name="l00626"></a>00626 cpl_table ** raw_flat_even_column_stats,
+<a name="l00627"></a>00627 cpl_table ** raw_flat_odd_row_stats,
+<a name="l00628"></a>00628 cpl_table ** raw_flat_even_row_stats,
+<a name="l00629"></a>00629 cpl_vector ** selected)
+<a name="l00630"></a>00630 {
+<a name="l00631"></a>00631 <span class="keywordtype">int</span> nima ;
+<a name="l00632"></a>00632 cpl_image * ima_cur ;
+<a name="l00633"></a>00633 cpl_image * big_ima ;
+<a name="l00634"></a>00634 cpl_image * big_badres ;
+<a name="l00635"></a>00635 cpl_vector * medians[HAWKI_NB_DETECTORS];
+<a name="l00636"></a>00636 cpl_vector * stdevs[HAWKI_NB_DETECTORS];
+<a name="l00637"></a>00637 cpl_vector * sub_medians ;
+<a name="l00638"></a>00638 cpl_imagelist * in_quad ;
+<a name="l00639"></a>00639 cpl_imagelist ** results ;
+<a name="l00640"></a>00640 cpl_imagelist * res_quad[4] ;
+<a name="l00641"></a>00641 cpl_image * err_quad[4] ;
+<a name="l00642"></a>00642 cpl_image * badres_mask[4] ;
+<a name="l00643"></a>00643 cpl_image * flat_image ;
+<a name="l00644"></a>00644 cpl_image * dark ;
+<a name="l00645"></a>00645 cpl_propertylist * plist;
+<a name="l00646"></a>00646 <span class="keywordtype">double</span> gradient ;
+<a name="l00647"></a>00647 <span class="keywordtype">double</span> flat_dit;
+<a name="l00648"></a>00648 cpl_image * bpmflat;
+<a name="l00649"></a>00649 <span class="keywordtype">int</span> j, k ;
+<a name="l00650"></a>00650 <span class="keywordtype">int</span> idet;
+<a name="l00651"></a>00651
+<a name="l00652"></a>00652 <span class="comment">/* Test entries */</span>
+<a name="l00653"></a>00653 <span class="keywordflow">if</span> (flatframes == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00654"></a>00654
+<a name="l00655"></a>00655 <span class="comment">/* Initialise */</span>
+<a name="l00656"></a>00656 nima = cpl_frameset_get_size(flatframes) ;
+<a name="l00657"></a>00657 <span class="keywordflow">if</span> (nima < 3) {
+<a name="l00658"></a>00658 cpl_msg_error(__func__, <span class="stringliteral">"Not enough frames (%d)"</span>, nima) ;
+<a name="l00659"></a>00659 <span class="keywordflow">return</span> NULL ;
+<a name="l00660"></a>00660 }
+<a name="l00661"></a>00661 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00662"></a>00662 hawki_cal_flat_outputs.norm[idet] = 1.0 ;
+<a name="l00663"></a>00663
+<a name="l00664"></a>00664 <span class="comment">/* Compute statistics */</span>
+<a name="l00665"></a>00665 cpl_msg_info(__func__, <span class="stringliteral">"Compute statistics"</span>) ;
+<a name="l00666"></a>00666 cpl_msg_indent_more() ;
+<a name="l00667"></a>00667 <span class="comment">/* Loop on the HAWKI_NB_DETECTORS chips */</span>
+<a name="l00668"></a>00668 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00669"></a>00669 {
+<a name="l00670"></a>00670
+<a name="l00671"></a>00671 <span class="comment">/* Compute some stats on input images */</span>
+<a name="l00672"></a>00672 cpl_msg_info(__func__, <span class="stringliteral">"Chip number %d"</span>, idet+1) ;
+<a name="l00673"></a>00673 cpl_msg_info(__func__, <span class="stringliteral">"image min max med rms"</span>) ;
+<a name="l00674"></a>00674 cpl_msg_info(__func__, <span class="stringliteral">"--------------------------------------------"</span>) ;
+<a name="l00675"></a>00675 medians[idet] = cpl_vector_new(nima);
+<a name="l00676"></a>00676 stdevs[idet] = cpl_vector_new(nima);
+<a name="l00677"></a>00677 <span class="keywordflow">for</span> (j=0 ; j<nima ; j++)
+<a name="l00678"></a>00678 {
+<a name="l00679"></a>00679 <span class="comment">/* Load the image */</span>
+<a name="l00680"></a>00680 ima_cur = <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(flatframes, j, idet+1, CPL_TYPE_FLOAT) ;
+<a name="l00681"></a>00681
+<a name="l00682"></a>00682 <span class="comment">/* Compute the stats */</span>
+<a name="l00683"></a>00683 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l00684"></a>00684 (raw_flat_stats,
+<a name="l00685"></a>00685 ima_cur,
+<a name="l00686"></a>00686 hawki_cal_flat_config.llx,
+<a name="l00687"></a>00687 hawki_cal_flat_config.lly,
+<a name="l00688"></a>00688 hawki_cal_flat_config.urx,
+<a name="l00689"></a>00689 hawki_cal_flat_config.ury,
+<a name="l00690"></a>00690 idet,
+<a name="l00691"></a>00691 j) !=0 )
+<a name="l00692"></a>00692 {
+<a name="l00693"></a>00693 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute stats on image %d"</span>,j+1);
+<a name="l00694"></a>00694 cpl_msg_indent_less() ;
+<a name="l00695"></a>00695 cpl_image_delete(ima_cur);
+<a name="l00696"></a>00696 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++) cpl_vector_delete(medians[k]) ;
+<a name="l00697"></a>00697 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++) cpl_vector_delete(stdevs[k]) ;
+<a name="l00698"></a>00698 <span class="keywordflow">return</span> NULL ;
+<a name="l00699"></a>00699 }
+<a name="l00700"></a>00700
+<a name="l00701"></a>00701 <span class="keywordflow">if</span>(hawki_cal_flat_config.extra_stats)
+<a name="l00702"></a>00702 {
+<a name="l00703"></a>00703 <span class="keywordflow">if</span>(hawki_image_stats_odd_even_column_row_fill_from_image
+<a name="l00704"></a>00704 (raw_flat_odd_column_stats,
+<a name="l00705"></a>00705 raw_flat_even_column_stats,
+<a name="l00706"></a>00706 raw_flat_odd_row_stats,
+<a name="l00707"></a>00707 raw_flat_even_row_stats,
+<a name="l00708"></a>00708 ima_cur,
+<a name="l00709"></a>00709 idet,
+<a name="l00710"></a>00710 j) !=0 )
+<a name="l00711"></a>00711 {
+<a name="l00712"></a>00712 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute extra stats"</span>);
+<a name="l00713"></a>00713 cpl_msg_indent_less() ;
+<a name="l00714"></a>00714 cpl_image_delete(ima_cur);
+<a name="l00715"></a>00715 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++) cpl_vector_delete(medians[k]) ;
+<a name="l00716"></a>00716 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++) cpl_vector_delete(stdevs[k]) ;
+<a name="l00717"></a>00717 <span class="keywordflow">return</span> NULL ;
+<a name="l00718"></a>00718 }
+<a name="l00719"></a>00719 }
+<a name="l00720"></a>00720 cpl_vector_set(medians[idet], j, cpl_table_get_double
+<a name="l00721"></a>00721 (raw_flat_stats[idet],HAWKI_COL_STAT_MED,j,NULL )) ;
+<a name="l00722"></a>00722 cpl_vector_set(stdevs[idet], j, cpl_table_get_double
+<a name="l00723"></a>00723 (raw_flat_stats[idet],HAWKI_COL_STAT_RMS,j,NULL )) ;
+<a name="l00724"></a>00724 cpl_msg_info(__func__, <span class="stringliteral">"%02d %10.2f %10.2f %10.2f %10.2f"</span>,
+<a name="l00725"></a>00725 j+1,
+<a name="l00726"></a>00726 cpl_table_get_double(raw_flat_stats[idet],
+<a name="l00727"></a>00727 HAWKI_COL_STAT_MIN,j,NULL ),
+<a name="l00728"></a>00728 cpl_table_get_double(raw_flat_stats[idet],
+<a name="l00729"></a>00729 HAWKI_COL_STAT_MAX,j,NULL ),
+<a name="l00730"></a>00730 cpl_table_get_double(raw_flat_stats[idet],
+<a name="l00731"></a>00731 HAWKI_COL_STAT_MED,j,NULL ),
+<a name="l00732"></a>00732 cpl_table_get_double(raw_flat_stats[idet],
+<a name="l00733"></a>00733 HAWKI_COL_STAT_RMS,j,NULL ));
+<a name="l00734"></a>00734 <span class="keywordflow">if</span> (cpl_table_get_double
+<a name="l00735"></a>00735 (raw_flat_stats[idet],HAWKI_COL_STAT_MED,j,NULL ) < 1e-6)
+<a name="l00736"></a>00736 {
+<a name="l00737"></a>00737 cpl_msg_error(__func__, <span class="stringliteral">"image %d has negative flux: aborting"</span>,
+<a name="l00738"></a>00738 j+1) ;
+<a name="l00739"></a>00739 cpl_msg_indent_less() ;
+<a name="l00740"></a>00740 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++) cpl_vector_delete(medians[k]) ;
+<a name="l00741"></a>00741 <span class="keywordflow">for</span> (k=0 ; k<=idet ; k++) cpl_vector_delete(stdevs[k]) ;
+<a name="l00742"></a>00742 <span class="keywordflow">return</span> NULL ;
+<a name="l00743"></a>00743 }
+<a name="l00744"></a>00744 cpl_image_delete(ima_cur);
+<a name="l00745"></a>00745 }
+<a name="l00746"></a>00746 cpl_msg_info(__func__, <span class="stringliteral">"--------------------------------------------"</span>) ;
+<a name="l00747"></a>00747
+<a name="l00748"></a>00748 <span class="comment">/* Compute min max stdev and mean of the medians */</span>
+<a name="l00749"></a>00749 hawki_cal_flat_outputs.med_min[idet] =
+<a name="l00750"></a>00750 cpl_vector_get_min(medians[idet]);
+<a name="l00751"></a>00751 hawki_cal_flat_outputs.med_max[idet] =
+<a name="l00752"></a>00752 cpl_vector_get_max(medians[idet]);
+<a name="l00753"></a>00753 hawki_cal_flat_outputs.med_avg[idet] =
+<a name="l00754"></a>00754 cpl_vector_get_mean(medians[idet]);
+<a name="l00755"></a>00755 hawki_cal_flat_outputs.med_med[idet] =
+<a name="l00756"></a>00756 cpl_vector_get_median_const(medians[idet]);
+<a name="l00757"></a>00757 hawki_cal_flat_outputs.med_stdev[idet] =
+<a name="l00758"></a>00758 cpl_vector_get_stdev(medians[idet]);
+<a name="l00759"></a>00759
+<a name="l00760"></a>00760 <span class="comment">/* See if flux gradient is large enough for a correct fit */</span>
+<a name="l00761"></a>00761 gradient=fabs(hawki_cal_flat_outputs.med_max[idet]/
+<a name="l00762"></a>00762 hawki_cal_flat_outputs.med_min[idet]) ;
+<a name="l00763"></a>00763 <span class="keywordflow">if</span> (gradient < 4.0) {
+<a name="l00764"></a>00764 <span class="comment">/* cpl_msg_warning(__func__, "Low flux gradient: %g", gradient) ;*/</span>
+<a name="l00765"></a>00765 }
+<a name="l00766"></a>00766 }
+<a name="l00767"></a>00767 cpl_msg_indent_less() ;
+<a name="l00768"></a>00768
+<a name="l00769"></a>00769 <span class="comment">/* Allocate for results */</span>
+<a name="l00770"></a>00770 results = cpl_malloc(4 * <span class="keyword">sizeof</span>(cpl_imagelist*)) ;
+<a name="l00771"></a>00771 results[0] = cpl_imagelist_new() ;
+<a name="l00772"></a>00772 results[1] = cpl_imagelist_new() ;
+<a name="l00773"></a>00773 results[2] = cpl_imagelist_new() ;
+<a name="l00774"></a>00774 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass) results[3] = cpl_imagelist_new() ;
+<a name="l00775"></a>00775 <span class="keywordflow">else</span> results[3] = NULL ;
+<a name="l00776"></a>00776
+<a name="l00777"></a>00777 cpl_msg_info(__func__, <span class="stringliteral">"Compute the flat"</span>) ;
+<a name="l00778"></a>00778 cpl_msg_indent_more() ;
+<a name="l00779"></a>00779 <span class="comment">/* Loop on the HAWKI_NB_DETECTORS chips */</span>
+<a name="l00780"></a>00780 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l00781"></a>00781 cpl_msg_info(__func__, <span class="stringliteral">"Chip number %d"</span>, idet+1) ;
+<a name="l00782"></a>00782 cpl_msg_indent_more() ;
+<a name="l00783"></a>00783
+<a name="l00784"></a>00784 <span class="comment">/* Frames selection */</span>
+<a name="l00785"></a>00785 cpl_msg_info(__func__, <span class="stringliteral">"Apply the frames selection"</span>);
+<a name="l00786"></a>00786 <span class="keywordflow">if</span> ((hawki_cal_flat_select(medians[idet],
+<a name="l00787"></a>00787 stdevs[idet],
+<a name="l00788"></a>00788 hawki_cal_flat_config.select_auto,
+<a name="l00789"></a>00789 hawki_cal_flat_config.select_auto_max_bins,
+<a name="l00790"></a>00790 hawki_cal_flat_config.select_min_level[idet],
+<a name="l00791"></a>00791 hawki_cal_flat_config.select_max_level[idet],
+<a name="l00792"></a>00792 hawki_cal_flat_config.select_max_rms[idet],
+<a name="l00793"></a>00793 hawki_cal_flat_config.select_min_nframes,
+<a name="l00794"></a>00794 selected[idet])) == -1)
+<a name="l00795"></a>00795 {
+<a name="l00796"></a>00796 cpl_msg_error(__func__, <span class="stringliteral">"Cannot apply the frames selection"</span>) ;
+<a name="l00797"></a>00797 cpl_imagelist_delete(results[0]) ;
+<a name="l00798"></a>00798 cpl_imagelist_delete(results[1]) ;
+<a name="l00799"></a>00799 cpl_imagelist_delete(results[2]) ;
+<a name="l00800"></a>00800 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00801"></a>00801 cpl_imagelist_delete(results[3]) ;
+<a name="l00802"></a>00802 cpl_free(results) ;
+<a name="l00803"></a>00803 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00804"></a>00804 cpl_vector_delete(medians[k]) ;
+<a name="l00805"></a>00805 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00806"></a>00806 cpl_vector_delete(stdevs[k]) ;
+<a name="l00807"></a>00807 <span class="keywordflow">return</span> NULL ;
+<a name="l00808"></a>00808 }
+<a name="l00809"></a>00809
+<a name="l00810"></a>00810 <span class="comment">/* Apply the medians subselection */</span>
+<a name="l00811"></a>00811 sub_medians = hawki_cal_flat_extract_vector
+<a name="l00812"></a>00812 (medians[idet], selected[idet]) ;
+<a name="l00813"></a>00813
+<a name="l00814"></a>00814 <span class="comment">/* Loop on the 4 quadrants */</span>
+<a name="l00815"></a>00815 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++) {
+<a name="l00816"></a>00816 <span class="comment">/* Load input image chips */</span>
+<a name="l00817"></a>00817 <span class="keywordflow">if</span> ((in_quad = <a class="code" href="group__hawki__load.html#gad5cbc1d866e88c8776ed605e5afa9438" title="Load the quarter of a chip from a frameset in an image list.">hawki_load_quadrants</a>(flatframes, idet+1, j+1,
+<a name="l00818"></a>00818 CPL_TYPE_FLOAT))==NULL) {
+<a name="l00819"></a>00819 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the raw quadrants"</span>) ;
+<a name="l00820"></a>00820 cpl_imagelist_delete(results[0]) ;
+<a name="l00821"></a>00821 cpl_imagelist_delete(results[1]) ;
+<a name="l00822"></a>00822 cpl_imagelist_delete(results[2]) ;
+<a name="l00823"></a>00823 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00824"></a>00824 cpl_imagelist_delete(results[3]) ;
+<a name="l00825"></a>00825 cpl_free(results) ;
+<a name="l00826"></a>00826 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00827"></a>00827 cpl_vector_delete(medians[k]) ;
+<a name="l00828"></a>00828 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00829"></a>00829 cpl_vector_delete(stdevs[k]) ;
+<a name="l00830"></a>00830 cpl_vector_delete(sub_medians) ;
+<a name="l00831"></a>00831 <span class="keywordflow">return</span> NULL ;
+<a name="l00832"></a>00832 }
+<a name="l00833"></a>00833
+<a name="l00834"></a>00834 <span class="comment">/* Apply subselection of the frames */</span>
+<a name="l00835"></a>00835 cpl_imagelist_erase(in_quad, selected[idet]);
+<a name="l00836"></a>00836
+<a name="l00837"></a>00837 <span class="comment">/* Apply dark correction to all planes if requested */</span>
+<a name="l00838"></a>00838 <span class="keywordflow">if</span> (dark_file) {
+<a name="l00839"></a>00839 <span class="keywordflow">if</span> (j==0) cpl_msg_info(__func__, <span class="stringliteral">"Subtracting dark"</span>) ;
+<a name="l00840"></a>00840 <span class="comment">/* Load dark */</span>
+<a name="l00841"></a>00841 <span class="keywordflow">if</span> ((dark = <a class="code" href="group__hawki__load.html#ga686f0c5897e92abd1b6aff98636f56c7" title="Load the quarter of a chip from a file in an image.">hawki_load_quadrant_from_file</a>(dark_file,
+<a name="l00842"></a>00842 idet+1, j+1, CPL_TYPE_FLOAT)) == NULL) {
+<a name="l00843"></a>00843 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the dark quadrants"</span>) ;
+<a name="l00844"></a>00844 cpl_imagelist_delete(in_quad) ;
+<a name="l00845"></a>00845 cpl_imagelist_delete(results[0]) ;
+<a name="l00846"></a>00846 cpl_imagelist_delete(results[1]) ;
+<a name="l00847"></a>00847 cpl_imagelist_delete(results[2]) ;
+<a name="l00848"></a>00848 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00849"></a>00849 cpl_imagelist_delete(results[3]) ;
+<a name="l00850"></a>00850 cpl_free(results) ;
+<a name="l00851"></a>00851 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00852"></a>00852 cpl_vector_delete(medians[k]) ;
+<a name="l00853"></a>00853 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00854"></a>00854 cpl_vector_delete(stdevs[k]) ;
+<a name="l00855"></a>00855 cpl_vector_delete(sub_medians) ;
+<a name="l00856"></a>00856 <span class="keywordflow">return</span> NULL ;
+<a name="l00857"></a>00857 }
+<a name="l00858"></a>00858
+<a name="l00859"></a>00859 <span class="comment">/* Multiply by the dit */</span>
+<a name="l00860"></a>00860 <span class="keywordflow">if</span> ((plist=cpl_propertylist_load
+<a name="l00861"></a>00861 (cpl_frame_get_filename
+<a name="l00862"></a>00862 (cpl_frameset_get_first_const(flatframes)), 0)) == NULL)
+<a name="l00863"></a>00863 {
+<a name="l00864"></a>00864 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get header from frame"</span>);
+<a name="l00865"></a>00865 cpl_imagelist_delete(in_quad) ;
+<a name="l00866"></a>00866 cpl_imagelist_delete(results[0]) ;
+<a name="l00867"></a>00867 cpl_imagelist_delete(results[1]) ;
+<a name="l00868"></a>00868 cpl_imagelist_delete(results[2]) ;
+<a name="l00869"></a>00869 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00870"></a>00870 cpl_imagelist_delete(results[3]) ;
+<a name="l00871"></a>00871 cpl_free(results) ;
+<a name="l00872"></a>00872 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00873"></a>00873 cpl_vector_delete(medians[k]) ;
+<a name="l00874"></a>00874 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00875"></a>00875 cpl_vector_delete(stdevs[k]) ;
+<a name="l00876"></a>00876 cpl_vector_delete(sub_medians) ;
+<a name="l00877"></a>00877 cpl_image_delete(dark);
+<a name="l00878"></a>00878 <span class="keywordflow">return</span> NULL ;
+<a name="l00879"></a>00879 }
+<a name="l00880"></a>00880 flat_dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist);
+<a name="l00881"></a>00881 cpl_image_multiply_scalar(dark, flat_dit);
+<a name="l00882"></a>00882 cpl_propertylist_delete(plist);
+<a name="l00883"></a>00883
+<a name="l00884"></a>00884 <span class="comment">/* Dark correction */</span>
+<a name="l00885"></a>00885 cpl_imagelist_subtract_image(in_quad, dark) ;
+<a name="l00886"></a>00886 cpl_image_delete(dark) ;
+<a name="l00887"></a>00887 <span class="keywordflow">if</span> (cpl_error_get_code() != CPL_ERROR_NONE) {
+<a name="l00888"></a>00888 cpl_msg_warning(__func__,<span class="stringliteral">"Cannot subtract the dark frame"</span>);
+<a name="l00889"></a>00889 cpl_error_reset() ;
+<a name="l00890"></a>00890 }
+<a name="l00891"></a>00891 }
+<a name="l00892"></a>00892
+<a name="l00893"></a>00893 <span class="comment">/* Fit slopes */</span>
+<a name="l00894"></a>00894 err_quad[j] = cpl_image_duplicate(cpl_imagelist_get(in_quad, 0)) ;
+<a name="l00895"></a>00895 res_quad[j] = cpl_fit_imagelist_polynomial(sub_medians, in_quad,
+<a name="l00896"></a>00896 0, 1, CPL_FALSE, CPL_TYPE_FLOAT, err_quad[j]) ;
+<a name="l00897"></a>00897 <span class="keywordflow">if</span> (res_quad[j] == NULL) {
+<a name="l00898"></a>00898 cpl_msg_error(__func__, <span class="stringliteral">"Cannot create twilight flat-field"</span>) ;
+<a name="l00899"></a>00899 cpl_imagelist_delete(results[0]) ;
+<a name="l00900"></a>00900 cpl_imagelist_delete(results[1]) ;
+<a name="l00901"></a>00901 cpl_imagelist_delete(results[2]) ;
+<a name="l00902"></a>00902 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00903"></a>00903 cpl_imagelist_delete(results[3]) ;
+<a name="l00904"></a>00904 cpl_free(results) ;
+<a name="l00905"></a>00905 cpl_imagelist_delete(in_quad) ;
+<a name="l00906"></a>00906 <span class="keywordflow">for</span> (k=0 ; k<j ; k++) cpl_imagelist_delete(res_quad[k]) ;
+<a name="l00907"></a>00907 <span class="keywordflow">for</span> (k=0 ; k<=j ; k++) cpl_image_delete(err_quad[k]) ;
+<a name="l00908"></a>00908 <span class="keywordflow">for</span> (k=0 ; k<j ; k++)
+<a name="l00909"></a>00909 <span class="keywordflow">if</span> (badres_mask[k]) cpl_image_delete(badres_mask[k]) ;
+<a name="l00910"></a>00910 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00911"></a>00911 cpl_vector_delete(medians[k]) ;
+<a name="l00912"></a>00912 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00913"></a>00913 cpl_vector_delete(stdevs[k]) ;
+<a name="l00914"></a>00914 cpl_vector_delete(sub_medians) ;
+<a name="l00915"></a>00915 <span class="keywordflow">return</span> NULL ;
+<a name="l00916"></a>00916 }
+<a name="l00917"></a>00917
+<a name="l00918"></a>00918 <span class="comment">/* Handle the pixels with a high error */</span>
+<a name="l00919"></a>00919 badres_mask[j] = NULL ;
+<a name="l00920"></a>00920 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass) {
+<a name="l00921"></a>00921 <span class="keywordflow">if</span> (j==0) cpl_msg_info(__func__,
+<a name="l00922"></a>00922 <span class="stringliteral">"Second pass to clean the outliers"</span>) ;
+<a name="l00923"></a>00923 <span class="keywordflow">if</span> (hawki_cal_flat_clean_outliers(err_quad[j], res_quad[j],
+<a name="l00924"></a>00924 in_quad, sub_medians, &(badres_mask[j])) == -1) {
+<a name="l00925"></a>00925 cpl_msg_error(__func__, <span class="stringliteral">"Cannot clean the outliers"</span>) ;
+<a name="l00926"></a>00926 cpl_imagelist_delete(results[0]) ;
+<a name="l00927"></a>00927 cpl_imagelist_delete(results[1]) ;
+<a name="l00928"></a>00928 cpl_imagelist_delete(results[2]) ;
+<a name="l00929"></a>00929 cpl_imagelist_delete(results[3]) ;
+<a name="l00930"></a>00930 cpl_free(results) ;
+<a name="l00931"></a>00931 cpl_imagelist_delete(in_quad) ;
+<a name="l00932"></a>00932 <span class="keywordflow">for</span> (k=0 ; k<=j ; k++) cpl_imagelist_delete(res_quad[k]) ;
+<a name="l00933"></a>00933 <span class="keywordflow">for</span> (k=0 ; k<=j ; k++) cpl_image_delete(err_quad[k]) ;
+<a name="l00934"></a>00934 <span class="keywordflow">for</span> (k=0 ; k<=j ; k++) cpl_image_delete(badres_mask[k]) ;
+<a name="l00935"></a>00935 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00936"></a>00936 cpl_vector_delete(medians[k]) ;
+<a name="l00937"></a>00937 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00938"></a>00938 cpl_vector_delete(stdevs[k]) ;
+<a name="l00939"></a>00939 cpl_vector_delete(sub_medians) ;
+<a name="l00940"></a>00940 cpl_msg_indent_less() ;
+<a name="l00941"></a>00941 <span class="keywordflow">return</span> NULL ;
+<a name="l00942"></a>00942 }
+<a name="l00943"></a>00943 }
+<a name="l00944"></a>00944 cpl_imagelist_delete(in_quad) ;
+<a name="l00945"></a>00945 }
+<a name="l00946"></a>00946 cpl_vector_delete(sub_medians) ;
+<a name="l00947"></a>00947
+<a name="l00948"></a>00948 <span class="comment">/* Rebuild the quadrants and put in results */</span>
+<a name="l00949"></a>00949 <span class="comment">/* Rebuild RESULTS */</span>
+<a name="l00950"></a>00950 big_ima = <a class="code" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df" title="Rebuild the 4 quadrants.">hawki_rebuild_quadrants</a>(
+<a name="l00951"></a>00951 cpl_imagelist_get(res_quad[0],1),
+<a name="l00952"></a>00952 cpl_imagelist_get(res_quad[1],1),
+<a name="l00953"></a>00953 cpl_imagelist_get(res_quad[2],1),
+<a name="l00954"></a>00954 cpl_imagelist_get(res_quad[3],1)) ;
+<a name="l00955"></a>00955 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++) cpl_imagelist_delete(res_quad[j]) ;
+<a name="l00956"></a>00956 cpl_imagelist_set(results[0], big_ima, idet) ;
+<a name="l00957"></a>00957 <span class="keywordflow">if</span> (big_ima == NULL) {
+<a name="l00958"></a>00958 cpl_msg_error(__func__, <span class="stringliteral">"Cannot rebuild the image"</span>) ;
+<a name="l00959"></a>00959 cpl_imagelist_delete(results[0]) ;
+<a name="l00960"></a>00960 cpl_imagelist_delete(results[1]) ;
+<a name="l00961"></a>00961 cpl_imagelist_delete(results[2]) ;
+<a name="l00962"></a>00962 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00963"></a>00963 cpl_imagelist_delete(results[3]) ;
+<a name="l00964"></a>00964 cpl_free(results) ;
+<a name="l00965"></a>00965 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++) cpl_image_delete(err_quad[j]) ;
+<a name="l00966"></a>00966 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++)
+<a name="l00967"></a>00967 <span class="keywordflow">if</span> (badres_mask[j]) cpl_image_delete(badres_mask[j]) ;
+<a name="l00968"></a>00968 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00969"></a>00969 cpl_vector_delete(medians[k]) ;
+<a name="l00970"></a>00970 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00971"></a>00971 cpl_vector_delete(stdevs[k]) ;
+<a name="l00972"></a>00972 <span class="keywordflow">return</span> NULL ;
+<a name="l00973"></a>00973 }
+<a name="l00974"></a>00974
+<a name="l00975"></a>00975 <span class="comment">/* Rebuild ERROR */</span>
+<a name="l00976"></a>00976 big_ima = <a class="code" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df" title="Rebuild the 4 quadrants.">hawki_rebuild_quadrants</a>(err_quad[0], err_quad[1],
+<a name="l00977"></a>00977 err_quad[2], err_quad[3]) ;
+<a name="l00978"></a>00978 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++) cpl_image_delete(err_quad[j]) ;
+<a name="l00979"></a>00979 <span class="keywordflow">if</span> (big_ima == NULL) {
+<a name="l00980"></a>00980 cpl_msg_error(__func__, <span class="stringliteral">"Cannot rebuild the image"</span>) ;
+<a name="l00981"></a>00981 cpl_imagelist_delete(results[0]) ;
+<a name="l00982"></a>00982 cpl_imagelist_delete(results[1]) ;
+<a name="l00983"></a>00983 cpl_imagelist_delete(results[2]) ;
+<a name="l00984"></a>00984 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l00985"></a>00985 cpl_imagelist_delete(results[3]) ;
+<a name="l00986"></a>00986 cpl_free(results) ;
+<a name="l00987"></a>00987 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++)
+<a name="l00988"></a>00988 <span class="keywordflow">if</span> (badres_mask[j]) cpl_image_delete(badres_mask[j]) ;
+<a name="l00989"></a>00989 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00990"></a>00990 cpl_vector_delete(medians[k]) ;
+<a name="l00991"></a>00991 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l00992"></a>00992 cpl_vector_delete(stdevs[k]) ;
+<a name="l00993"></a>00993 <span class="keywordflow">return</span> NULL ;
+<a name="l00994"></a>00994 }
+<a name="l00995"></a>00995 cpl_imagelist_set(results[1], big_ima, idet) ;
+<a name="l00996"></a>00996
+<a name="l00997"></a>00997 <span class="comment">/* Rebuild BADRES_MASK */</span>
+<a name="l00998"></a>00998 big_badres = <a class="code" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df" title="Rebuild the 4 quadrants.">hawki_rebuild_quadrants</a>(badres_mask[0], badres_mask[1],
+<a name="l00999"></a>00999 badres_mask[2], badres_mask[3]) ;
+<a name="l01000"></a>01000 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass) {
+<a name="l01001"></a>01001 <span class="keywordflow">for</span> (j=0 ; j<4 ; j++) cpl_image_delete(badres_mask[j]) ;
+<a name="l01002"></a>01002 cpl_imagelist_set(results[3], big_badres, idet) ;
+<a name="l01003"></a>01003 }
+<a name="l01004"></a>01004
+<a name="l01005"></a>01005 <span class="keywordflow">if</span> (hawki_cal_flat_config.normalise) {
+<a name="l01006"></a>01006 <span class="comment">/* Normalize gain */</span>
+<a name="l01007"></a>01007 cpl_msg_info(__func__, <span class="stringliteral">"Normalise the flat"</span>) ;
+<a name="l01008"></a>01008 flat_image = cpl_imagelist_get(results[0], idet) ;
+<a name="l01009"></a>01009 hawki_cal_flat_outputs.norm[idet] =
+<a name="l01010"></a>01010 cpl_image_get_median(flat_image) ;
+<a name="l01011"></a>01011 cpl_image_divide_scalar
+<a name="l01012"></a>01012 (flat_image, hawki_cal_flat_outputs.norm[idet]);
+<a name="l01013"></a>01013 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l01014"></a>01014 cpl_msg_error(__func__, <span class="stringliteral">"Cannot normalise"</span>) ;
+<a name="l01015"></a>01015 cpl_imagelist_delete(results[0]) ;
+<a name="l01016"></a>01016 cpl_imagelist_delete(results[1]) ;
+<a name="l01017"></a>01017 cpl_imagelist_delete(results[2]) ;
+<a name="l01018"></a>01018 <span class="keywordflow">if</span> (hawki_cal_flat_config.second_pass)
+<a name="l01019"></a>01019 cpl_imagelist_delete(results[3]) ;
+<a name="l01020"></a>01020 cpl_free(results) ;
+<a name="l01021"></a>01021 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l01022"></a>01022 cpl_vector_delete(medians[k]) ;
+<a name="l01023"></a>01023 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+<a name="l01024"></a>01024 cpl_vector_delete(stdevs[k]) ;
+<a name="l01025"></a>01025 <span class="keywordflow">return</span> NULL ;
+<a name="l01026"></a>01026 }
+<a name="l01027"></a>01027 }
+<a name="l01028"></a>01028
+<a name="l01029"></a>01029 <span class="comment">/* BPM from the flat */</span>
+<a name="l01030"></a>01030 cpl_msg_info(__func__, <span class="stringliteral">"Compute the BPM from the flat"</span>) ;
+<a name="l01031"></a>01031 bpmflat=<a class="code" href="group__hawki__utils.html#ga5d0deca1786f42488784c23e361d0877" title="Compute the bpm from the flat (aka cold pixels mask)">hawki_compute_flatbpm</a>(cpl_imagelist_get(results[0],idet),
+<a name="l01032"></a>01032 hawki_cal_flat_config.sigma_bpm,
+<a name="l01033"></a>01033 hawki_cal_flat_config.lowval_bpm,
+<a name="l01034"></a>01034 hawki_cal_flat_config.highval_bpm);
+<a name="l01035"></a>01035
+<a name="l01036"></a>01036 cpl_imagelist_set(results[2], bpmflat, idet) ;
+<a name="l01037"></a>01037 hawki_cal_flat_outputs.nb_badpix[idet]=
+<a name="l01038"></a>01038 (int)cpl_image_get_flux(bpmflat);
+<a name="l01039"></a>01039
+<a name="l01040"></a>01040 cpl_msg_indent_less() ;
+<a name="l01041"></a>01041 }
+<a name="l01042"></a>01042 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++) cpl_vector_delete(medians[k]) ;
+<a name="l01043"></a>01043 <span class="keywordflow">for</span> (k=0 ; k<HAWKI_NB_DETECTORS ; k++) cpl_vector_delete(stdevs[k]) ;
+<a name="l01044"></a>01044 cpl_msg_indent_less() ;
+<a name="l01045"></a>01045
+<a name="l01046"></a>01046 <span class="keywordflow">return</span> results ;
+<a name="l01047"></a>01047 }
+<a name="l01048"></a>01048
+<a name="l01049"></a>01049 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01059"></a>01059 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01060"></a>01060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_clean_outliers(
+<a name="l01061"></a>01061 cpl_image * error,
+<a name="l01062"></a>01062 cpl_imagelist * fit_res,
+<a name="l01063"></a>01063 cpl_imagelist * raw,
+<a name="l01064"></a>01064 cpl_vector * medians,
+<a name="l01065"></a>01065 cpl_image ** recomp_mask)
+<a name="l01066"></a>01066 {
+<a name="l01067"></a>01067 cpl_mask * recompute ;
+<a name="l01068"></a>01068 cpl_binary * precompute ;
+<a name="l01069"></a>01069 <span class="keywordtype">double</span> med, stdev, threshold1, threshold2 ;
+<a name="l01070"></a>01070 <span class="keywordtype">int</span> nx, ny, pos, nbad, nima, out, ind, pix ;
+<a name="l01071"></a>01071 cpl_image * cur_ima ;
+<a name="l01072"></a>01072 <span class="keywordtype">float</span> * pimaf ;
+<a name="l01073"></a>01073 <span class="keywordtype">double</span> val, fit_val, a, b, max ;
+<a name="l01074"></a>01074 cpl_vector * z_pix ;
+<a name="l01075"></a>01075 <span class="keywordtype">double</span> * pz_pix ;
+<a name="l01076"></a>01076 cpl_image * onepix ;
+<a name="l01077"></a>01077 cpl_vector * med_purged ;
+<a name="l01078"></a>01078 cpl_imagelist * raw_purged ;
+<a name="l01079"></a>01079 cpl_imagelist * fit_one ;
+<a name="l01080"></a>01080 cpl_image * err_one ;
+<a name="l01081"></a>01081 <span class="keywordtype">int</span> i, j, k ;
+<a name="l01082"></a>01082
+<a name="l01083"></a>01083 <span class="comment">/* Check entries */</span>
+<a name="l01084"></a>01084 <span class="keywordflow">if</span> (error == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01085"></a>01085 <span class="keywordflow">if</span> (fit_res == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01086"></a>01086 <span class="keywordflow">if</span> (raw == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01087"></a>01087
+<a name="l01088"></a>01088 <span class="comment">/* Initialise */</span>
+<a name="l01089"></a>01089 <span class="keywordflow">if</span> (recomp_mask) *recomp_mask = NULL ;
+<a name="l01090"></a>01090
+<a name="l01091"></a>01091 <span class="comment">/* Identify the places to recompute */</span>
+<a name="l01092"></a>01092 med = cpl_image_get_median_dev(error, &stdev) ;
+<a name="l01093"></a>01093 threshold1 = med - hawki_cal_flat_config.sigma_badres * stdev ;
+<a name="l01094"></a>01094 threshold2 = med + hawki_cal_flat_config.sigma_badres * stdev ;
+<a name="l01095"></a>01095 recompute = cpl_mask_threshold_image_create(error,threshold1,threshold2) ;
+<a name="l01096"></a>01096 cpl_mask_not(recompute) ;
+<a name="l01097"></a>01097
+<a name="l01098"></a>01098 <span class="keywordflow">if</span> ((nbad=cpl_mask_count(recompute)) == 0) {
+<a name="l01099"></a>01099 <span class="keywordflow">if</span> (recomp_mask)
+<a name="l01100"></a>01100 *recomp_mask = cpl_image_new_from_mask(recompute) ;
+<a name="l01101"></a>01101 cpl_mask_delete(recompute) ;
+<a name="l01102"></a>01102 <span class="keywordflow">return</span> 0 ;
+<a name="l01103"></a>01103 }
+<a name="l01104"></a>01104 nx = cpl_image_get_size_x(error) ;
+<a name="l01105"></a>01105 ny = cpl_image_get_size_y(error) ;
+<a name="l01106"></a>01106 nima = cpl_imagelist_get_size(raw) ;
+<a name="l01107"></a>01107
+<a name="l01108"></a>01108 <span class="comment">/* Get access to the mask */</span>
+<a name="l01109"></a>01109 precompute = cpl_mask_get_data(recompute) ;
+<a name="l01110"></a>01110 <span class="keywordflow">for</span> (j=0 ; j<ny ; j++) {
+<a name="l01111"></a>01111 <span class="keywordflow">for</span> (i=0 ; i<nx ; i++) {
+<a name="l01112"></a>01112 pos = i + j*nx ;
+<a name="l01113"></a>01113 <span class="comment">/* The pixel has to be recomputed */</span>
+<a name="l01114"></a>01114 <span class="keywordflow">if</span> (precompute[pos] == CPL_BINARY_1) {
+<a name="l01115"></a>01115 <span class="comment">/* Get the pix_val-fit in a vector */</span>
+<a name="l01116"></a>01116 z_pix = cpl_vector_new(nima) ;
+<a name="l01117"></a>01117 <span class="keywordflow">for</span> (k=0 ; k<nima ; k++) {
+<a name="l01118"></a>01118 cur_ima = cpl_imagelist_get(fit_res, 0) ;
+<a name="l01119"></a>01119 pimaf = cpl_image_get_data_float(cur_ima) ;
+<a name="l01120"></a>01120 a = pimaf[pos] ;
+<a name="l01121"></a>01121 cur_ima = cpl_imagelist_get(fit_res, 1) ;
+<a name="l01122"></a>01122 pimaf = cpl_image_get_data_float(cur_ima) ;
+<a name="l01123"></a>01123 b = pimaf[pos] ;
+<a name="l01124"></a>01124 med = cpl_vector_get(medians, k) ;
+<a name="l01125"></a>01125 fit_val = a + b * med ;
+<a name="l01126"></a>01126 cur_ima = cpl_imagelist_get(raw, k) ;
+<a name="l01127"></a>01127 pimaf = cpl_image_get_data_float(cur_ima) ;
+<a name="l01128"></a>01128 cpl_vector_set(z_pix, k, (<span class="keywordtype">double</span>)(pimaf[pos]-fit_val)) ;
+<a name="l01129"></a>01129 }
+<a name="l01130"></a>01130
+<a name="l01131"></a>01131 <span class="comment">/* Identify the outlier */</span>
+<a name="l01132"></a>01132 out = -1 ;
+<a name="l01133"></a>01133 max = -1.0 ;
+<a name="l01134"></a>01134 pz_pix = cpl_vector_get_data(z_pix) ;
+<a name="l01135"></a>01135 <span class="keywordflow">for</span> (k=0 ; k<nima ; k++) {
+<a name="l01136"></a>01136 <span class="keywordflow">if</span> (fabs(pz_pix[k]) > max) {
+<a name="l01137"></a>01137 max = fabs(pz_pix[k]) ;
+<a name="l01138"></a>01138 out = k ;
+<a name="l01139"></a>01139 }
+<a name="l01140"></a>01140 }
+<a name="l01141"></a>01141 cpl_vector_delete(z_pix) ;
+<a name="l01142"></a>01142
+<a name="l01143"></a>01143 <span class="comment">/* Create 1-pixel purged image list and the purged medians */</span>
+<a name="l01144"></a>01144 med_purged = cpl_vector_new(nima-1) ;
+<a name="l01145"></a>01145 raw_purged = cpl_imagelist_new() ;
+<a name="l01146"></a>01146 ind = 0 ;
+<a name="l01147"></a>01147 <span class="keywordflow">for</span> (k=0 ; k<nima ; k++) {
+<a name="l01148"></a>01148 <span class="keywordflow">if</span> (k != out) {
+<a name="l01149"></a>01149 <span class="comment">/* Fill raw_purged */</span>
+<a name="l01150"></a>01150 cur_ima = cpl_imagelist_get(raw, k) ;
+<a name="l01151"></a>01151 onepix=cpl_image_extract(cur_ima, i+1, j+1, i+1, j+1) ;
+<a name="l01152"></a>01152 cpl_imagelist_set(raw_purged, onepix, ind) ;
+<a name="l01153"></a>01153 <span class="comment">/* Fill med_purged */</span>
+<a name="l01154"></a>01154 cpl_vector_set(med_purged, ind,
+<a name="l01155"></a>01155 cpl_vector_get(medians, k)) ;
+<a name="l01156"></a>01156 ind ++;
+<a name="l01157"></a>01157 }
+<a name="l01158"></a>01158 }
+<a name="l01159"></a>01159
+<a name="l01160"></a>01160 <span class="comment">/* Perform the fit */</span>
+<a name="l01161"></a>01161 err_one = cpl_image_duplicate(cpl_imagelist_get(raw_purged,0));
+<a name="l01162"></a>01162 fit_one = cpl_fit_imagelist_polynomial(med_purged, raw_purged,
+<a name="l01163"></a>01163 0, 1, CPL_FALSE, CPL_TYPE_FLOAT, err_one) ;
+<a name="l01164"></a>01164 <span class="keywordflow">if</span> (fit_one == NULL) {
+<a name="l01165"></a>01165 cpl_msg_error(__func__, <span class="stringliteral">"Cannot fit in second pass"</span>) ;
+<a name="l01166"></a>01166 cpl_mask_delete(recompute) ;
+<a name="l01167"></a>01167 cpl_vector_delete(med_purged) ;
+<a name="l01168"></a>01168 cpl_imagelist_delete(raw_purged) ;
+<a name="l01169"></a>01169 cpl_image_delete(err_one) ;
+<a name="l01170"></a>01170 <span class="keywordflow">return</span> -1 ;
+<a name="l01171"></a>01171 }
+<a name="l01172"></a>01172 cpl_vector_delete(med_purged) ;
+<a name="l01173"></a>01173 cpl_imagelist_delete(raw_purged) ;
+<a name="l01174"></a>01174
+<a name="l01175"></a>01175 <span class="comment">/* Write the result in the input */</span>
+<a name="l01176"></a>01176 val = cpl_image_get(err_one, 1, 1, &pix) ;
+<a name="l01177"></a>01177 cpl_image_set(error, i+1, j+1, val) ;
+<a name="l01178"></a>01178 cpl_image_delete(err_one) ;
+<a name="l01179"></a>01179
+<a name="l01180"></a>01180 cur_ima = cpl_imagelist_get(fit_one, 0) ;
+<a name="l01181"></a>01181 val = cpl_image_get(cur_ima, 1, 1, &pix) ;
+<a name="l01182"></a>01182 cur_ima = cpl_imagelist_get(fit_res, 0) ;
+<a name="l01183"></a>01183 cpl_image_set(cur_ima, i+1, j+1, val) ;
+<a name="l01184"></a>01184
+<a name="l01185"></a>01185 cur_ima = cpl_imagelist_get(fit_one, 1) ;
+<a name="l01186"></a>01186 val = cpl_image_get(cur_ima, 1, 1, &pix) ;
+<a name="l01187"></a>01187 cur_ima = cpl_imagelist_get(fit_res, 1) ;
+<a name="l01188"></a>01188 cpl_image_set(cur_ima, i+1, j+1, val) ;
+<a name="l01189"></a>01189 cpl_imagelist_delete(fit_one) ;
+<a name="l01190"></a>01190 }
+<a name="l01191"></a>01191 }
+<a name="l01192"></a>01192 }
+<a name="l01193"></a>01193 <span class="keywordflow">if</span> (recomp_mask)
+<a name="l01194"></a>01194 *recomp_mask = cpl_image_new_from_mask(recompute) ;
+<a name="l01195"></a>01195 cpl_mask_delete(recompute) ;
+<a name="l01196"></a>01196
+<a name="l01197"></a>01197 <span class="comment">/* Return */</span>
+<a name="l01198"></a>01198 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l01199"></a>01199 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l01200"></a>01200 }
+<a name="l01201"></a>01201
+<a name="l01202"></a>01202 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01214"></a>01214 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01215"></a>01215 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_save
+<a name="l01216"></a>01216 (cpl_imagelist ** flat,
+<a name="l01217"></a>01217 cpl_table ** raw_flat_stats,
+<a name="l01218"></a>01218 cpl_table ** raw_flat_odd_column_stats,
+<a name="l01219"></a>01219 cpl_table ** raw_flat_even_column_stats,
+<a name="l01220"></a>01220 cpl_table ** raw_flat_odd_row_stats,
+<a name="l01221"></a>01221 cpl_table ** raw_flat_even_row_stats,
+<a name="l01222"></a>01222 cpl_vector ** raw_selected,
+<a name="l01223"></a>01223 <span class="keywordtype">int</span> set_nb,
+<a name="l01224"></a>01224 <span class="keyword">const</span> cpl_frame * bpmdark,
+<a name="l01225"></a>01225 cpl_frameset * flat_frames,
+<a name="l01226"></a>01226 cpl_frameset * calib_frames,
+<a name="l01227"></a>01227 cpl_parameterlist * parlist,
+<a name="l01228"></a>01228 cpl_frameset * set_tot)
+<a name="l01229"></a>01229 {
+<a name="l01230"></a>01230 cpl_propertylist ** qclists ;
+<a name="l01231"></a>01231 cpl_imagelist * bpm ;
+<a name="l01232"></a>01232 <span class="keyword">const</span> cpl_frame * ref_frame ;
+<a name="l01233"></a>01233 cpl_frameset * used_frames;
+<a name="l01234"></a>01234 <span class="keywordtype">char</span> * filename ;
+<a name="l01235"></a>01235 cpl_propertylist * inputlist ;
+<a name="l01236"></a>01236 <span class="keywordtype">int</span> ext_nb ;
+<a name="l01237"></a>01237 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_cal_flat"</span> ;
+<a name="l01238"></a>01238 <span class="keywordtype">int</span> i ;
+<a name="l01239"></a>01239 <span class="keywordtype">int</span> iflat;
+<a name="l01240"></a>01240 <span class="keywordtype">int</span> nflat;
+<a name="l01241"></a>01241 <span class="keywordtype">int</span> nused;
+<a name="l01242"></a>01242 <span class="keywordtype">char</span> key_name[72];
+<a name="l01243"></a>01243
+<a name="l01244"></a>01244 <span class="comment">/* Get the reference frame */</span>
+<a name="l01245"></a>01245 ref_frame = irplib_frameset_get_first_from_group(flat_frames, CPL_FRAME_GROUP_RAW) ;
+<a name="l01246"></a>01246
+<a name="l01247"></a>01247 <span class="comment">/* Create the QC lists */</span>
+<a name="l01248"></a>01248 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01249"></a>01249 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l01250"></a>01250 qclists[i] = cpl_propertylist_new() ;
+<a name="l01251"></a>01251
+<a name="l01252"></a>01252 <span class="comment">/* Add the raw flat selection keywords */</span>
+<a name="l01253"></a>01253 nflat = cpl_vector_get_size(raw_selected[i]);
+<a name="l01254"></a>01254 nused = 0;
+<a name="l01255"></a>01255 <span class="keywordflow">for</span>(iflat = 0; iflat < nflat; ++iflat)
+<a name="l01256"></a>01256 {
+<a name="l01257"></a>01257 snprintf(key_name, 72, <span class="stringliteral">"ESO QC RAW%02d USED"</span>, iflat + 1);
+<a name="l01258"></a>01258 cpl_propertylist_append_bool
+<a name="l01259"></a>01259 (qclists[i], key_name,
+<a name="l01260"></a>01260 (cpl_vector_get(raw_selected[i], iflat) + 1) / 2);
+<a name="l01261"></a>01261 cpl_table_set_int
+<a name="l01262"></a>01262 (raw_flat_stats[i],HAWKI_COL_STAT_USED, iflat,
+<a name="l01263"></a>01263 cpl_vector_get(raw_selected[i], iflat));
+<a name="l01264"></a>01264 <span class="keywordflow">if</span>(hawki_cal_flat_config.extra_stats)
+<a name="l01265"></a>01265 {
+<a name="l01266"></a>01266 cpl_table_set_int
+<a name="l01267"></a>01267 (raw_flat_odd_column_stats[i],HAWKI_COL_STAT_USED, iflat,
+<a name="l01268"></a>01268 cpl_vector_get(raw_selected[i], iflat));
+<a name="l01269"></a>01269 cpl_table_set_int
+<a name="l01270"></a>01270 (raw_flat_even_column_stats[i],HAWKI_COL_STAT_USED, iflat,
+<a name="l01271"></a>01271 cpl_vector_get(raw_selected[i], iflat));
+<a name="l01272"></a>01272 cpl_table_set_int
+<a name="l01273"></a>01273 (raw_flat_odd_row_stats[i],HAWKI_COL_STAT_USED, iflat,
+<a name="l01274"></a>01274 cpl_vector_get(raw_selected[i], iflat));
+<a name="l01275"></a>01275 cpl_table_set_int
+<a name="l01276"></a>01276 (raw_flat_even_row_stats[i],HAWKI_COL_STAT_USED, iflat,
+<a name="l01277"></a>01277 cpl_vector_get(raw_selected[i], iflat));
+<a name="l01278"></a>01278 }
+<a name="l01279"></a>01279 <span class="keywordflow">if</span>(cpl_vector_get(raw_selected[i], iflat) == 1)
+<a name="l01280"></a>01280 nused++;
+<a name="l01281"></a>01281 }
+<a name="l01282"></a>01282
+<a name="l01283"></a>01283 <span class="comment">/* Add the master flat statistics keywords */</span>
+<a name="l01284"></a>01284 cpl_propertylist_append_int(qclists[i], <span class="stringliteral">"ESO QC FLAT NBADPIX"</span>,
+<a name="l01285"></a>01285 hawki_cal_flat_outputs.nb_badpix[i]);
+<a name="l01286"></a>01286 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT NORM"</span>,
+<a name="l01287"></a>01287 hawki_cal_flat_outputs.norm[i]) ;
+<a name="l01288"></a>01288 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDMEAN"</span>,
+<a name="l01289"></a>01289 hawki_cal_flat_outputs.med_avg[i]) ;
+<a name="l01290"></a>01290 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDMED"</span>,
+<a name="l01291"></a>01291 hawki_cal_flat_outputs.med_med[i]) ;
+<a name="l01292"></a>01292 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDSTDEV"</span>,
+<a name="l01293"></a>01293 hawki_cal_flat_outputs.med_stdev[i]) ;
+<a name="l01294"></a>01294 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDMIN"</span>,
+<a name="l01295"></a>01295 hawki_cal_flat_outputs.med_min[i]) ;
+<a name="l01296"></a>01296 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDMAX"</span>,
+<a name="l01297"></a>01297 hawki_cal_flat_outputs.med_max[i]) ;
+<a name="l01298"></a>01298 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDRANG"</span>,
+<a name="l01299"></a>01299 hawki_cal_flat_outputs.med_max[i] -
+<a name="l01300"></a>01300 hawki_cal_flat_outputs.med_min[i]);
+<a name="l01301"></a>01301 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC FLAT MEDNRANG"</span>,
+<a name="l01302"></a>01302 (hawki_cal_flat_outputs.med_max[i] -
+<a name="l01303"></a>01303 hawki_cal_flat_outputs.med_min[i]) /
+<a name="l01304"></a>01304 hawki_cal_flat_outputs.med_med[i]);
+<a name="l01305"></a>01305 cpl_propertylist_append_int(qclists[i], <span class="stringliteral">"ESO QC DATANCOM"</span>,
+<a name="l01306"></a>01306 nused) ;
+<a name="l01307"></a>01307
+<a name="l01308"></a>01308 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l01309"></a>01309 ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(
+<a name="l01310"></a>01310 cpl_frame_get_filename(ref_frame), i+1);
+<a name="l01311"></a>01311 inputlist = cpl_propertylist_load_regexp(
+<a name="l01312"></a>01312 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l01313"></a>01313 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l01314"></a>01314 cpl_propertylist_append(qclists[i], inputlist) ;
+<a name="l01315"></a>01315
+<a name="l01316"></a>01316 <span class="comment">/* Cleaning */</span>
+<a name="l01317"></a>01317 cpl_propertylist_delete(inputlist) ;
+<a name="l01318"></a>01318 }
+<a name="l01319"></a>01319 <span class="comment">/* Statistics of the raw images in the QC */</span>
+<a name="l01320"></a>01320 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(raw_flat_stats, qclists);
+<a name="l01321"></a>01321
+<a name="l01322"></a>01322 <span class="comment">/* Get the used frames */</span>
+<a name="l01323"></a>01323 used_frames = cpl_frameset_duplicate(flat_frames);
+<a name="l01324"></a>01324 <span class="keywordflow">for</span>(i = 0; i< cpl_frameset_get_size(calib_frames); ++i)
+<a name="l01325"></a>01325 cpl_frameset_insert(used_frames,
+<a name="l01326"></a>01326 cpl_frame_duplicate(cpl_frameset_get_frame(calib_frames, i)));
+<a name="l01327"></a>01327
+<a name="l01328"></a>01328 <span class="comment">/* Write the flat image */</span>
+<a name="l01329"></a>01329 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_set%02d.fits"</span>, set_nb) ;
+<a name="l01330"></a>01330 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(set_tot,
+<a name="l01331"></a>01331 parlist,
+<a name="l01332"></a>01332 used_frames,
+<a name="l01333"></a>01333 flat[0],
+<a name="l01334"></a>01334 recipe_name,
+<a name="l01335"></a>01335 HAWKI_CALPRO_FLAT,
+<a name="l01336"></a>01336 HAWKI_PROTYPE_FLAT,
+<a name="l01337"></a>01337 NULL,
+<a name="l01338"></a>01338 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l01339"></a>01339 filename) ;
+<a name="l01340"></a>01340 cpl_free(filename) ;
+<a name="l01341"></a>01341
+<a name="l01342"></a>01342 <span class="comment">/* Write the error map */</span>
+<a name="l01343"></a>01343 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_err_set%02d.fits"</span>, set_nb) ;
+<a name="l01344"></a>01344 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(set_tot,
+<a name="l01345"></a>01345 parlist,
+<a name="l01346"></a>01346 used_frames,
+<a name="l01347"></a>01347 flat[1],
+<a name="l01348"></a>01348 recipe_name,
+<a name="l01349"></a>01349 HAWKI_CALPRO_FLAT_ERRMAP,
+<a name="l01350"></a>01350 HAWKI_PROTYPE_ERRMAP,
+<a name="l01351"></a>01351 NULL,
+<a name="l01352"></a>01352 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l01353"></a>01353 filename) ;
+<a name="l01354"></a>01354 cpl_free(filename) ;
+<a name="l01355"></a>01355
+<a name="l01356"></a>01356 <span class="comment">/* Write the Cold pixels map */</span>
+<a name="l01357"></a>01357 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_bpmflat_set%02d.fits"</span>, set_nb) ;
+<a name="l01358"></a>01358 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(set_tot,
+<a name="l01359"></a>01359 parlist,
+<a name="l01360"></a>01360 used_frames,
+<a name="l01361"></a>01361 flat[2],
+<a name="l01362"></a>01362 recipe_name,
+<a name="l01363"></a>01363 HAWKI_CALPRO_BPM_COLD,
+<a name="l01364"></a>01364 HAWKI_PROTYPE_BPM,
+<a name="l01365"></a>01365 NULL,
+<a name="l01366"></a>01366 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l01367"></a>01367 filename) ;
+<a name="l01368"></a>01368 cpl_free(filename) ;
+<a name="l01369"></a>01369
+<a name="l01370"></a>01370 <span class="keywordflow">if</span> (flat[3] != NULL) {
+<a name="l01371"></a>01371 <span class="comment">/* Write the recomputed map */</span>
+<a name="l01372"></a>01372 filename=cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_recomputed_set%02d.fits"</span>, set_nb) ;
+<a name="l01373"></a>01373 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(set_tot,
+<a name="l01374"></a>01374 parlist,
+<a name="l01375"></a>01375 used_frames,
+<a name="l01376"></a>01376 flat[3],
+<a name="l01377"></a>01377 recipe_name,
+<a name="l01378"></a>01378 HAWKI_CALPRO_FLAT_RECOMPUTED,
+<a name="l01379"></a>01379 HAWKI_PROTYPE_FLAT,
+<a name="l01380"></a>01380 NULL,
+<a name="l01381"></a>01381 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l01382"></a>01382 filename) ;
+<a name="l01383"></a>01383 cpl_free(filename) ;
+<a name="l01384"></a>01384 }
+<a name="l01385"></a>01385
+<a name="l01386"></a>01386 <span class="comment">/* If the HOT pixel map is passed, merge with the COLD one */</span>
+<a name="l01387"></a>01387 <span class="keywordflow">if</span> (bpmdark != NULL) {
+<a name="l01388"></a>01388 <span class="keywordflow">if</span> ((bpm = hawki_cal_flat_merge_bpms(bpmdark, flat[2])) == NULL) {
+<a name="l01389"></a>01389 cpl_msg_error(__func__, <span class="stringliteral">"Cannot merge bad pixel maps"</span>) ;
+<a name="l01390"></a>01390 } <span class="keywordflow">else</span> {
+<a name="l01391"></a>01391 filename=cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_bpm_set%02d.fits"</span>, set_nb) ;
+<a name="l01392"></a>01392 <span class="comment">/* Get the used frames for statistics */</span>
+<a name="l01393"></a>01393 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(set_tot,
+<a name="l01394"></a>01394 parlist,
+<a name="l01395"></a>01395 used_frames,
+<a name="l01396"></a>01396 bpm,
+<a name="l01397"></a>01397 recipe_name,
+<a name="l01398"></a>01398 HAWKI_CALPRO_BPM,
+<a name="l01399"></a>01399 HAWKI_PROTYPE_BPM,
+<a name="l01400"></a>01400 NULL,
+<a name="l01401"></a>01401 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l01402"></a>01402 filename) ;
+<a name="l01403"></a>01403 cpl_free(filename) ;
+<a name="l01404"></a>01404 cpl_imagelist_delete(bpm) ;
+<a name="l01405"></a>01405 }
+<a name="l01406"></a>01406 }
+<a name="l01407"></a>01407 cpl_frameset_delete(used_frames);
+<a name="l01408"></a>01408
+<a name="l01409"></a>01409 <span class="comment">/* Get the used frames for statistics */</span>
+<a name="l01410"></a>01410 used_frames = cpl_frameset_duplicate(flat_frames);
+<a name="l01411"></a>01411
+<a name="l01412"></a>01412 <span class="comment">/* Write the table with the statistics */</span>
+<a name="l01413"></a>01413 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_stats_set%02d.fits"</span>, set_nb) ;
+<a name="l01414"></a>01414 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(set_tot,
+<a name="l01415"></a>01415 parlist,
+<a name="l01416"></a>01416 used_frames,
+<a name="l01417"></a>01417 (<span class="keyword">const</span> cpl_table **)raw_flat_stats,
+<a name="l01418"></a>01418 recipe_name,
+<a name="l01419"></a>01419 HAWKI_CALPRO_FLAT_STATS,
+<a name="l01420"></a>01420 HAWKI_PROTYPE_FLAT_STATS,
+<a name="l01421"></a>01421 NULL,
+<a name="l01422"></a>01422 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l01423"></a>01423 filename) ;
+<a name="l01424"></a>01424 cpl_free(filename) ;
+<a name="l01425"></a>01425
+<a name="l01426"></a>01426 <span class="keywordflow">if</span>(hawki_cal_flat_config.extra_stats)
+<a name="l01427"></a>01427 {
+<a name="l01428"></a>01428 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_stats_ec_set%02d.fits"</span>, set_nb);
+<a name="l01429"></a>01429 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(set_tot,
+<a name="l01430"></a>01430 parlist,
+<a name="l01431"></a>01431 used_frames,
+<a name="l01432"></a>01432 (<span class="keyword">const</span> cpl_table **)raw_flat_even_column_stats,
+<a name="l01433"></a>01433 recipe_name,
+<a name="l01434"></a>01434 HAWKI_CALPRO_FLAT_STATS_EVEN_COL,
+<a name="l01435"></a>01435 HAWKI_PROTYPE_FLAT_STATS_EVEN_COL,
+<a name="l01436"></a>01436 NULL,
+<a name="l01437"></a>01437 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l01438"></a>01438 filename) ;
+<a name="l01439"></a>01439 cpl_free(filename) ;
+<a name="l01440"></a>01440 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_stats_oc_set%02d.fits"</span>, set_nb);
+<a name="l01441"></a>01441 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(set_tot,
+<a name="l01442"></a>01442 parlist,
+<a name="l01443"></a>01443 used_frames,
+<a name="l01444"></a>01444 (<span class="keyword">const</span> cpl_table **)raw_flat_odd_column_stats,
+<a name="l01445"></a>01445 recipe_name,
+<a name="l01446"></a>01446 HAWKI_CALPRO_FLAT_STATS_ODD_COL,
+<a name="l01447"></a>01447 HAWKI_PROTYPE_FLAT_STATS_ODD_COL,
+<a name="l01448"></a>01448 NULL,
+<a name="l01449"></a>01449 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l01450"></a>01450 filename) ;
+<a name="l01451"></a>01451 cpl_free(filename) ;
+<a name="l01452"></a>01452 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_stats_er_set%02d.fits"</span>, set_nb);
+<a name="l01453"></a>01453 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(set_tot,
+<a name="l01454"></a>01454 parlist,
+<a name="l01455"></a>01455 used_frames,
+<a name="l01456"></a>01456 (<span class="keyword">const</span> cpl_table **)raw_flat_even_row_stats,
+<a name="l01457"></a>01457 recipe_name,
+<a name="l01458"></a>01458 HAWKI_CALPRO_FLAT_STATS_EVEN_ROW,
+<a name="l01459"></a>01459 HAWKI_PROTYPE_FLAT_STATS_EVEN_ROW,
+<a name="l01460"></a>01460 NULL,
+<a name="l01461"></a>01461 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l01462"></a>01462 filename) ;
+<a name="l01463"></a>01463 cpl_free(filename) ;
+<a name="l01464"></a>01464 filename = cpl_sprintf(<span class="stringliteral">"hawki_cal_flat_stats_or_set%02d.fits"</span>, set_nb);
+<a name="l01465"></a>01465 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(set_tot,
+<a name="l01466"></a>01466 parlist,
+<a name="l01467"></a>01467 used_frames,
+<a name="l01468"></a>01468 (<span class="keyword">const</span> cpl_table **)raw_flat_odd_row_stats,
+<a name="l01469"></a>01469 recipe_name,
+<a name="l01470"></a>01470 HAWKI_CALPRO_FLAT_STATS_ODD_ROW,
+<a name="l01471"></a>01471 HAWKI_PROTYPE_FLAT_STATS_ODD_ROW,
+<a name="l01472"></a>01472 NULL,
+<a name="l01473"></a>01473 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l01474"></a>01474 filename) ;
+<a name="l01475"></a>01475 cpl_free(filename) ;
+<a name="l01476"></a>01476 }
+<a name="l01477"></a>01477 cpl_frameset_delete(used_frames);
+<a name="l01478"></a>01478
+<a name="l01479"></a>01479 <span class="comment">/* Free and return */</span>
+<a name="l01480"></a>01480 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l01481"></a>01481 cpl_propertylist_delete(qclists[i]) ;
+<a name="l01482"></a>01482 }
+<a name="l01483"></a>01483 cpl_free(qclists) ;
+<a name="l01484"></a>01484 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l01485"></a>01485 <span class="keywordflow">return</span> 0;
+<a name="l01486"></a>01486 }
+<a name="l01487"></a>01487
+<a name="l01488"></a>01488 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01495"></a>01495 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01496"></a>01496 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_compare(
+<a name="l01497"></a>01497 <span class="keyword">const</span> cpl_frame * frame1,
+<a name="l01498"></a>01498 <span class="keyword">const</span> cpl_frame * frame2)
+<a name="l01499"></a>01499 {
+<a name="l01500"></a>01500 <span class="keywordtype">int</span> comparison ;
+<a name="l01501"></a>01501 cpl_propertylist * plist1 ;
+<a name="l01502"></a>01502 cpl_propertylist * plist2 ;
+<a name="l01503"></a>01503 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval1,
+<a name="l01504"></a>01504 * sval2 ;
+<a name="l01505"></a>01505 <span class="keywordtype">double</span> dval1, dval2 ;
+<a name="l01506"></a>01506
+<a name="l01507"></a>01507
+<a name="l01508"></a>01508 <span class="comment">/* Test entries */</span>
+<a name="l01509"></a>01509 <span class="keywordflow">if</span> (frame1==NULL || frame2==NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01510"></a>01510
+<a name="l01511"></a>01511 <span class="comment">/* Get property lists */</span>
+<a name="l01512"></a>01512 <span class="keywordflow">if</span> ((plist1=cpl_propertylist_load(cpl_frame_get_filename(frame1),
+<a name="l01513"></a>01513 0)) == NULL) {
+<a name="l01514"></a>01514 cpl_msg_error(__func__, <span class="stringliteral">"getting header from reference frame"</span>);
+<a name="l01515"></a>01515 <span class="keywordflow">return</span> -1 ;
+<a name="l01516"></a>01516 }
+<a name="l01517"></a>01517 <span class="keywordflow">if</span> ((plist2=cpl_propertylist_load(cpl_frame_get_filename(frame2),
+<a name="l01518"></a>01518 0)) == NULL) {
+<a name="l01519"></a>01519 cpl_msg_error(__func__, <span class="stringliteral">"getting header from reference frame"</span>);
+<a name="l01520"></a>01520 cpl_propertylist_delete(plist1) ;
+<a name="l01521"></a>01521 <span class="keywordflow">return</span> -1 ;
+<a name="l01522"></a>01522 }
+<a name="l01523"></a>01523
+<a name="l01524"></a>01524 <span class="comment">/* Test status */</span>
+<a name="l01525"></a>01525 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l01526"></a>01526 cpl_propertylist_delete(plist1) ;
+<a name="l01527"></a>01527 cpl_propertylist_delete(plist2) ;
+<a name="l01528"></a>01528 <span class="keywordflow">return</span> -1 ;
+<a name="l01529"></a>01529 }
+<a name="l01530"></a>01530
+<a name="l01531"></a>01531 comparison = 1 ;
+<a name="l01532"></a>01532
+<a name="l01533"></a>01533 <span class="comment">/* Compare filters */</span>
+<a name="l01534"></a>01534 sval1 = <a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501" title="find out which wave band is active">hawki_pfits_get_filter</a>(plist1) ;
+<a name="l01535"></a>01535 sval2 = <a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501" title="find out which wave band is active">hawki_pfits_get_filter</a>(plist2) ;
+<a name="l01536"></a>01536 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l01537"></a>01537 cpl_msg_error(__func__, <span class="stringliteral">"cannot get the filter"</span>);
+<a name="l01538"></a>01538 cpl_propertylist_delete(plist1) ;
+<a name="l01539"></a>01539 cpl_propertylist_delete(plist2) ;
+<a name="l01540"></a>01540 <span class="keywordflow">return</span> -1 ;
+<a name="l01541"></a>01541 }
+<a name="l01542"></a>01542 <span class="keywordflow">if</span> (strcmp(sval1, sval2)) comparison = 0 ;
+<a name="l01543"></a>01543
+<a name="l01544"></a>01544 <span class="comment">/* Compare DITs */</span>
+<a name="l01545"></a>01545 dval1 = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist1) ;
+<a name="l01546"></a>01546 dval2 = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist2) ;
+<a name="l01547"></a>01547 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l01548"></a>01548 cpl_msg_error(__func__, <span class="stringliteral">"cannot get the DIT"</span>);
+<a name="l01549"></a>01549 cpl_propertylist_delete(plist1) ;
+<a name="l01550"></a>01550 cpl_propertylist_delete(plist2) ;
+<a name="l01551"></a>01551 <span class="keywordflow">return</span> -1 ;
+<a name="l01552"></a>01552 }
+<a name="l01553"></a>01553 <span class="keywordflow">if</span> (fabs(dval1-dval2) > 1e-4) comparison = 0 ;
+<a name="l01554"></a>01554
+<a name="l01555"></a>01555 cpl_propertylist_delete(plist1) ;
+<a name="l01556"></a>01556 cpl_propertylist_delete(plist2) ;
+<a name="l01557"></a>01557 <span class="keywordflow">return</span> comparison ;
+<a name="l01558"></a>01558 }
+<a name="l01559"></a>01559
+<a name="l01560"></a>01560 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01567"></a>01567 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01568"></a>01568 <span class="keyword">static</span> cpl_imagelist * hawki_cal_flat_merge_bpms
+<a name="l01569"></a>01569 (<span class="keyword">const</span> cpl_frame * bpm_orig,
+<a name="l01570"></a>01570 cpl_imagelist * bpm_to_merge)
+<a name="l01571"></a>01571 {
+<a name="l01572"></a>01572 cpl_imagelist * merged ;
+<a name="l01573"></a>01573 cpl_imagelist * bpm_orig_im;
+<a name="l01574"></a>01574 cpl_image * tmp ;
+<a name="l01575"></a>01575 <span class="keywordtype">int</span> i ;
+<a name="l01576"></a>01576
+<a name="l01577"></a>01577 <span class="comment">/* Test entries */</span>
+<a name="l01578"></a>01578 <span class="keywordflow">if</span> (bpm_orig==NULL || bpm_to_merge ==NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l01579"></a>01579
+<a name="l01580"></a>01580 <span class="comment">/* Create merged */</span>
+<a name="l01581"></a>01581 merged = cpl_imagelist_new() ;
+<a name="l01582"></a>01582
+<a name="l01583"></a>01583 <span class="comment">/* Load the bpm_file */</span>
+<a name="l01584"></a>01584 bpm_orig_im = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(bpm_orig, CPL_TYPE_INT);
+<a name="l01585"></a>01585 <span class="keywordflow">if</span>(bpm_orig_im == NULL)
+<a name="l01586"></a>01586 {
+<a name="l01587"></a>01587 cpl_msg_error(__func__, <span class="stringliteral">"Cannot read existing bpm %s"</span>,
+<a name="l01588"></a>01588 cpl_frame_get_filename(bpm_orig));
+<a name="l01589"></a>01589 cpl_imagelist_delete(merged);
+<a name="l01590"></a>01590 <span class="keywordflow">return</span> NULL;
+<a name="l01591"></a>01591 }
+<a name="l01592"></a>01592
+<a name="l01593"></a>01593 <span class="comment">/* Loop on the chips */</span>
+<a name="l01594"></a>01594 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l01595"></a>01595
+<a name="l01596"></a>01596 <span class="comment">/* Merge */</span>
+<a name="l01597"></a>01597 tmp = cpl_image_add_create(cpl_imagelist_get(bpm_orig_im, i),
+<a name="l01598"></a>01598 cpl_imagelist_get(bpm_to_merge, i));
+<a name="l01599"></a>01599 cpl_image_multiply(cpl_imagelist_get(bpm_orig_im, i),
+<a name="l01600"></a>01600 cpl_imagelist_get(bpm_to_merge, i));
+<a name="l01601"></a>01601 cpl_image_subtract(tmp, cpl_imagelist_get(bpm_orig_im, i)) ;
+<a name="l01602"></a>01602
+<a name="l01603"></a>01603 <span class="comment">/* Store */</span>
+<a name="l01604"></a>01604 cpl_imagelist_set(merged, tmp, i) ;
+<a name="l01605"></a>01605 }
+<a name="l01606"></a>01606
+<a name="l01607"></a>01607 <span class="comment">/* Clean-up and return */</span>
+<a name="l01608"></a>01608 cpl_imagelist_delete(bpm_orig_im);
+<a name="l01609"></a>01609 <span class="keywordflow">return</span> merged ;
+<a name="l01610"></a>01610 }
+<a name="l01611"></a>01611
+<a name="l01612"></a>01612 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01623"></a>01623 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01624"></a>01624 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_select
+<a name="l01625"></a>01625 (cpl_vector * meds,
+<a name="l01626"></a>01626 cpl_vector * rms,
+<a name="l01627"></a>01627 <span class="keywordtype">int</span> auto_flag,
+<a name="l01628"></a>01628 <span class="keywordtype">int</span> auto_max_bins,
+<a name="l01629"></a>01629 <span class="keywordtype">double</span> min_level,
+<a name="l01630"></a>01630 <span class="keywordtype">double</span> max_level,
+<a name="l01631"></a>01631 <span class="keywordtype">double</span> max_rms,
+<a name="l01632"></a>01632 <span class="keywordtype">int</span> min_nframes,
+<a name="l01633"></a>01633 cpl_vector * selection)
+<a name="l01634"></a>01634 {
+<a name="l01635"></a>01635 <span class="keywordtype">double</span> * pselection ;
+<a name="l01636"></a>01636 <span class="keywordtype">double</span> * pmeds ;
+<a name="l01637"></a>01637 <span class="keywordtype">double</span> * prms ;
+<a name="l01638"></a>01638 <span class="keywordtype">int</span> nvals ;
+<a name="l01639"></a>01639 <span class="keywordtype">int</span> nsel ;
+<a name="l01640"></a>01640 <span class="keywordtype">double</span> first_val, last_val, bin_val, dist, dist_min;
+<a name="l01641"></a>01641 <span class="keywordtype">double</span> bin_low_val;
+<a name="l01642"></a>01642 <span class="keywordtype">double</span> bin_up_val;
+<a name="l01643"></a>01643 <span class="keywordtype">int</span> nbins, ind_closest ;
+<a name="l01644"></a>01644 <span class="keywordtype">int</span> ibin;
+<a name="l01645"></a>01645 <span class="keywordtype">int</span> ival;
+<a name="l01646"></a>01646
+<a name="l01647"></a>01647 <span class="comment">/* Test entries */</span>
+<a name="l01648"></a>01648 <span class="keywordflow">if</span> (meds == NULL) <span class="keywordflow">return</span> -1;
+<a name="l01649"></a>01649 <span class="keywordflow">if</span> (rms == NULL) <span class="keywordflow">return</span> -1;
+<a name="l01650"></a>01650 <span class="keywordflow">if</span> (selection == NULL) <span class="keywordflow">return</span> -1;
+<a name="l01651"></a>01651 <span class="keywordflow">if</span>(cpl_vector_get_size(meds) != cpl_vector_get_size(selection))
+<a name="l01652"></a>01652 {
+<a name="l01653"></a>01653 cpl_msg_error(__func__,
+<a name="l01654"></a>01654 <span class="stringliteral">"The meds and selection vectors have not the same size"</span>);
+<a name="l01655"></a>01655 <span class="keywordflow">return</span> -1;
+<a name="l01656"></a>01656 }
+<a name="l01657"></a>01657
+<a name="l01658"></a>01658 <span class="comment">/* Initialise. All the frames are selected by default */</span>
+<a name="l01659"></a>01659 nvals = cpl_vector_get_size(meds);
+<a name="l01660"></a>01660 pmeds = cpl_vector_get_data(meds);
+<a name="l01661"></a>01661 prms = cpl_vector_get_data(rms);
+<a name="l01662"></a>01662 cpl_vector_fill(selection, 1.0);
+<a name="l01663"></a>01663
+<a name="l01664"></a>01664 <span class="comment">/* Pointer to selection */</span>
+<a name="l01665"></a>01665 pselection = cpl_vector_get_data(selection) ;
+<a name="l01666"></a>01666
+<a name="l01667"></a>01667 <span class="comment">/* First select based on minimum level, if applies */</span>
+<a name="l01668"></a>01668 <span class="keywordflow">if</span> (min_level >= 0.0)
+<a name="l01669"></a>01669 {
+<a name="l01670"></a>01670 <span class="keywordflow">for</span> (ival=0 ; ival<nvals ; ival++)
+<a name="l01671"></a>01671 {
+<a name="l01672"></a>01672 <span class="keywordflow">if</span> (pmeds[ival] < min_level)
+<a name="l01673"></a>01673 pselection[ival] = -1.0 ;
+<a name="l01674"></a>01674 }
+<a name="l01675"></a>01675 }
+<a name="l01676"></a>01676
+<a name="l01677"></a>01677 <span class="comment">/* Second select based on maximum level, if applies */</span>
+<a name="l01678"></a>01678 <span class="keywordflow">if</span> (max_level >= 0.0)
+<a name="l01679"></a>01679 {
+<a name="l01680"></a>01680 <span class="keywordflow">for</span> (ival=0 ; ival<nvals ; ival++)
+<a name="l01681"></a>01681 {
+<a name="l01682"></a>01682 <span class="keywordflow">if</span> (pmeds[ival] > max_level)
+<a name="l01683"></a>01683 pselection[ival] = -1.0 ;
+<a name="l01684"></a>01684 }
+<a name="l01685"></a>01685 }
+<a name="l01686"></a>01686
+<a name="l01687"></a>01687 <span class="comment">/* Third select based on rms maximum level, if applies */</span>
+<a name="l01688"></a>01688 <span class="keywordflow">if</span> (max_rms >= 0.0)
+<a name="l01689"></a>01689 {
+<a name="l01690"></a>01690 <span class="keywordflow">for</span> (ival=0 ; ival<nvals ; ival++)
+<a name="l01691"></a>01691 {
+<a name="l01692"></a>01692 <span class="keywordflow">if</span> (prms[ival] > max_rms)
+<a name="l01693"></a>01693 pselection[ival] = -1.0 ;
+<a name="l01694"></a>01694 }
+<a name="l01695"></a>01695 }
+<a name="l01696"></a>01696
+<a name="l01697"></a>01697 <span class="comment">/* Apply the histogram selection */</span>
+<a name="l01698"></a>01698 <span class="keywordflow">if</span> (auto_flag)
+<a name="l01699"></a>01699 {
+<a name="l01700"></a>01700 <span class="comment">/* Automatic */</span>
+<a name="l01701"></a>01701 cpl_vector * auto_selection;
+<a name="l01702"></a>01702 auto_selection = cpl_vector_new(nvals);
+<a name="l01703"></a>01703 cpl_vector_fill(auto_selection, -1.0);
+<a name="l01704"></a>01704 cpl_msg_info(__func__, <span class="stringliteral">"Automatic dynamic range selection"</span>);
+<a name="l01705"></a>01705 first_val = <a class="code" href="group__hawki__utils.html#ga29ae7b4052fd284d8b01f33e127c2846" title="Gets the minimum value of a vector according to an array of flags.">hawki_vector_get_min_select</a>(meds, selection);
+<a name="l01706"></a>01706 last_val = <a class="code" href="group__hawki__utils.html#gaba8fca8aa585fed96efc75545bfc6b04" title="Gets the maximum value of a vector according to an array of flags.">hawki_vector_get_max_select</a>(meds, selection);
+<a name="l01707"></a>01707
+<a name="l01708"></a>01708 nbins = nvals ;
+<a name="l01709"></a>01709 <span class="keywordflow">if</span> (auto_max_bins > 0 && auto_max_bins < nvals) nbins = auto_max_bins;
+<a name="l01710"></a>01710 <span class="keywordflow">for</span> (ibin=0 ; ibin<nbins ; ibin++)
+<a name="l01711"></a>01711 {
+<a name="l01712"></a>01712 <span class="keywordflow">if</span>(ibin == 0)
+<a name="l01713"></a>01713 bin_val = first_val + (last_val-first_val)*(ibin+1)/nbins ;
+<a name="l01714"></a>01714 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ibin == nbins - 1)
+<a name="l01715"></a>01715 bin_val = first_val + (last_val-first_val)*(ibin)/nbins ;
+<a name="l01716"></a>01716 <span class="keywordflow">else</span>
+<a name="l01717"></a>01717 bin_val = first_val + (last_val-first_val)*(ibin+0.5)/nbins ;
+<a name="l01718"></a>01718 bin_low_val = first_val + (last_val-first_val)*(ibin)/nbins ;
+<a name="l01719"></a>01719 bin_up_val = first_val + (last_val-first_val)*(ibin+1)/nbins ;
+<a name="l01720"></a>01720
+<a name="l01721"></a>01721 <span class="comment">/* Select the closest */</span>
+<a name="l01722"></a>01722 dist_min = fabs(pmeds[0] - bin_val) ;
+<a name="l01723"></a>01723 ind_closest = -1;
+<a name="l01724"></a>01724 <span class="keywordflow">for</span> (ival=0 ; ival<nvals ; ival++)
+<a name="l01725"></a>01725 {
+<a name="l01726"></a>01726 dist = fabs(pmeds[ival] - bin_val) ;
+<a name="l01727"></a>01727 <span class="keywordflow">if</span> (dist < dist_min && pselection[ival] != -1)
+<a name="l01728"></a>01728 {
+<a name="l01729"></a>01729 dist_min = dist;
+<a name="l01730"></a>01730 ind_closest = ival;
+<a name="l01731"></a>01731 }
+<a name="l01732"></a>01732 }
+<a name="l01733"></a>01733 <span class="keywordflow">if</span>(ind_closest != -1)
+<a name="l01734"></a>01734 cpl_vector_set(auto_selection, ind_closest, 1.0);
+<a name="l01735"></a>01735 }
+<a name="l01736"></a>01736 <span class="comment">/* Use the auto_selection */</span>
+<a name="l01737"></a>01737 cpl_vector_copy(selection, auto_selection);
+<a name="l01738"></a>01738 cpl_vector_delete(auto_selection);
+<a name="l01739"></a>01739 }
+<a name="l01740"></a>01740
+<a name="l01741"></a>01741 <span class="comment">/* Print and count the selected frames */</span>
+<a name="l01742"></a>01742 nsel = 0;
+<a name="l01743"></a>01743 cpl_msg_indent_more();
+<a name="l01744"></a>01744 <span class="keywordflow">for</span> (ival=0 ; ival<nvals ; ival++)
+<a name="l01745"></a>01745 {
+<a name="l01746"></a>01746 <span class="keywordflow">if</span>(pselection[ival] != -1)
+<a name="l01747"></a>01747 {
+<a name="l01748"></a>01748 cpl_msg_info(__func__, <span class="stringliteral">"Selected frame %d"</span>, ival+1) ;
+<a name="l01749"></a>01749 nsel++;
+<a name="l01750"></a>01750 }
+<a name="l01751"></a>01751 }
+<a name="l01752"></a>01752 cpl_msg_indent_less();
+<a name="l01753"></a>01753
+<a name="l01754"></a>01754 <span class="comment">/* Check the number of selected against min_nframes */</span>
+<a name="l01755"></a>01755 <span class="keywordflow">if</span> (nsel == 0) {
+<a name="l01756"></a>01756 cpl_msg_error(__func__, <span class="stringliteral">"No frame selected. Check selection criteria"</span>);
+<a name="l01757"></a>01757 <span class="keywordflow">return</span> -1;
+<a name="l01758"></a>01758 }
+<a name="l01759"></a>01759 <span class="keywordflow">if</span> (min_nframes >= 0) {
+<a name="l01760"></a>01760 <span class="keywordflow">if</span> (nsel < min_nframes) {
+<a name="l01761"></a>01761 cpl_msg_error(__func__, <span class="stringliteral">"Not enough selected frames (%d < %d)"</span>,
+<a name="l01762"></a>01762 nsel, min_nframes) ;
+<a name="l01763"></a>01763 <span class="keywordflow">return</span> -1;
+<a name="l01764"></a>01764 }
+<a name="l01765"></a>01765 }
+<a name="l01766"></a>01766
+<a name="l01767"></a>01767 <span class="keywordflow">return</span> 0;
+<a name="l01768"></a>01768 }
+<a name="l01769"></a>01769
+<a name="l01770"></a>01770 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01777"></a>01777 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01778"></a>01778 <span class="keyword">static</span> cpl_vector * hawki_cal_flat_extract_vector(
+<a name="l01779"></a>01779 cpl_vector * in,
+<a name="l01780"></a>01780 cpl_vector * selection)
+<a name="l01781"></a>01781 {
+<a name="l01782"></a>01782 <span class="keywordtype">int</span> nvals ;
+<a name="l01783"></a>01783 cpl_vector * selected ;
+<a name="l01784"></a>01784 <span class="keywordtype">double</span> * pin ;
+<a name="l01785"></a>01785 <span class="keywordtype">double</span> * pselection ;
+<a name="l01786"></a>01786 <span class="keywordtype">double</span> * pselected ;
+<a name="l01787"></a>01787 <span class="keywordtype">int</span> nselected ;
+<a name="l01788"></a>01788 <span class="keywordtype">int</span> i ;
+<a name="l01789"></a>01789
+<a name="l01790"></a>01790 <span class="comment">/* Test entries */</span>
+<a name="l01791"></a>01791 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l01792"></a>01792 <span class="keywordflow">if</span> (selection == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l01793"></a>01793
+<a name="l01794"></a>01794 <span class="comment">/* Initialise */</span>
+<a name="l01795"></a>01795 nvals = cpl_vector_get_size(in) ;
+<a name="l01796"></a>01796 nselected = 0 ;
+<a name="l01797"></a>01797 pin = cpl_vector_get_data(in) ;
+<a name="l01798"></a>01798 pselection = cpl_vector_get_data(selection) ;
+<a name="l01799"></a>01799
+<a name="l01800"></a>01800 <span class="comment">/* Test entries */</span>
+<a name="l01801"></a>01801 <span class="keywordflow">if</span> (nvals != cpl_vector_get_size(selection)) <span class="keywordflow">return</span> NULL ;
+<a name="l01802"></a>01802
+<a name="l01803"></a>01803 <span class="comment">/* Count the selected values */</span>
+<a name="l01804"></a>01804 <span class="keywordflow">for</span> (i=0 ; i<nvals ; i++) {
+<a name="l01805"></a>01805 <span class="keywordflow">if</span> (pselection[i] > 0.0) nselected++ ;
+<a name="l01806"></a>01806 }
+<a name="l01807"></a>01807 <span class="keywordflow">if</span> (nselected == 0) <span class="keywordflow">return</span> NULL ;
+<a name="l01808"></a>01808
+<a name="l01809"></a>01809 <span class="comment">/* Create the selected vector */</span>
+<a name="l01810"></a>01810 selected = cpl_vector_new(nselected) ;
+<a name="l01811"></a>01811 pselected = cpl_vector_get_data(selected) ;
+<a name="l01812"></a>01812
+<a name="l01813"></a>01813 nselected = 0 ;
+<a name="l01814"></a>01814 <span class="keywordflow">for</span> (i=0 ; i<nvals ; i++) {
+<a name="l01815"></a>01815 <span class="keywordflow">if</span> (pselection[i] > 0.0) {
+<a name="l01816"></a>01816 pselected[nselected] = pin[i] ;
+<a name="l01817"></a>01817 nselected++ ;
+<a name="l01818"></a>01818 }
+<a name="l01819"></a>01819 }
+<a name="l01820"></a>01820 <span class="keywordflow">return</span> selected ;
+<a name="l01821"></a>01821 }
+<a name="l01822"></a>01822
+<a name="l01823"></a>01823 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_flat_retrieve_input_param
+<a name="l01824"></a>01824 (cpl_parameterlist * parlist)
+<a name="l01825"></a>01825 {
+<a name="l01826"></a>01826 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval;
+<a name="l01827"></a>01827 cpl_parameter * par;
+<a name="l01828"></a>01828 <span class="keywordtype">int</span> idet;
+<a name="l01829"></a>01829
+<a name="l01830"></a>01830 <span class="comment">/* Initialise */</span>
+<a name="l01831"></a>01831 par = NULL ;
+<a name="l01832"></a>01832 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l01833"></a>01833 hawki_cal_flat_outputs.nb_badpix[idet] = -1 ;
+<a name="l01834"></a>01834 hawki_cal_flat_outputs.med_stdev[idet] = -1.0 ;
+<a name="l01835"></a>01835 hawki_cal_flat_outputs.med_avg[idet] = -1.0 ;
+<a name="l01836"></a>01836 hawki_cal_flat_outputs.med_med[idet] = -1.0 ;
+<a name="l01837"></a>01837 hawki_cal_flat_outputs.med_min[idet] = -1.0 ;
+<a name="l01838"></a>01838 hawki_cal_flat_outputs.med_max[idet] = -1.0 ;
+<a name="l01839"></a>01839 }
+<a name="l01840"></a>01840
+<a name="l01841"></a>01841 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l01842"></a>01842 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.zone"</span>) ;
+<a name="l01843"></a>01843 sval = cpl_parameter_get_string(par) ;
+<a name="l01844"></a>01844 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d,%d,%d"</span>,
+<a name="l01845"></a>01845 &hawki_cal_flat_config.llx,
+<a name="l01846"></a>01846 &hawki_cal_flat_config.lly,
+<a name="l01847"></a>01847 &hawki_cal_flat_config.urx,
+<a name="l01848"></a>01848 &hawki_cal_flat_config.ury)!=4)
+<a name="l01849"></a>01849 {
+<a name="l01850"></a>01850 <span class="keywordflow">return</span> -1 ;
+<a name="l01851"></a>01851 }
+<a name="l01852"></a>01852 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.sigma_badres"</span>) ;
+<a name="l01853"></a>01853 hawki_cal_flat_config.sigma_badres = cpl_parameter_get_double(par) ;
+<a name="l01854"></a>01854 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.sigma_bpm"</span>) ;
+<a name="l01855"></a>01855 hawki_cal_flat_config.sigma_bpm = cpl_parameter_get_double(par) ;
+<a name="l01856"></a>01856 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.lowval_bpm"</span>) ;
+<a name="l01857"></a>01857 hawki_cal_flat_config.lowval_bpm = cpl_parameter_get_double(par) ;
+<a name="l01858"></a>01858 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.highval_bpm"</span>) ;
+<a name="l01859"></a>01859 hawki_cal_flat_config.highval_bpm = cpl_parameter_get_double(par) ;
+<a name="l01860"></a>01860 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.normalise"</span>) ;
+<a name="l01861"></a>01861 hawki_cal_flat_config.normalise = cpl_parameter_get_bool(par) ;
+<a name="l01862"></a>01862 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.second_pass"</span>) ;
+<a name="l01863"></a>01863 hawki_cal_flat_config.second_pass = cpl_parameter_get_bool(par) ;
+<a name="l01864"></a>01864 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.select_auto"</span>) ;
+<a name="l01865"></a>01865 hawki_cal_flat_config.select_auto = cpl_parameter_get_bool(par) ;
+<a name="l01866"></a>01866 par = cpl_parameterlist_find(parlist,
+<a name="l01867"></a>01867 <span class="stringliteral">"hawki.hawki_cal_flat.select_auto_max_bins"</span>) ;
+<a name="l01868"></a>01868 hawki_cal_flat_config.select_auto_max_bins = cpl_parameter_get_int(par);
+<a name="l01869"></a>01869 par = cpl_parameterlist_find(parlist,
+<a name="l01870"></a>01870 <span class="stringliteral">"hawki.hawki_cal_flat.select_min_level"</span>) ;
+<a name="l01871"></a>01871 sval = cpl_parameter_get_string(par);
+<a name="l01872"></a>01872 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%lf,%lf,%lf,%lf"</span>,
+<a name="l01873"></a>01873 &hawki_cal_flat_config.select_min_level[0],
+<a name="l01874"></a>01874 &hawki_cal_flat_config.select_min_level[1],
+<a name="l01875"></a>01875 &hawki_cal_flat_config.select_min_level[2],
+<a name="l01876"></a>01876 &hawki_cal_flat_config.select_min_level[3])!=4)
+<a name="l01877"></a>01877 {
+<a name="l01878"></a>01878 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%f"</span>, &hawki_cal_flat_config.select_min_level[0])!=1)
+<a name="l01879"></a>01879 {
+<a name="l01880"></a>01880 <span class="keywordflow">return</span> -1;
+<a name="l01881"></a>01881 }
+<a name="l01882"></a>01882 <span class="keywordflow">else</span>
+<a name="l01883"></a>01883 {
+<a name="l01884"></a>01884 hawki_cal_flat_config.select_min_level[1] =
+<a name="l01885"></a>01885 hawki_cal_flat_config.select_min_level[0];
+<a name="l01886"></a>01886 hawki_cal_flat_config.select_min_level[2] =
+<a name="l01887"></a>01887 hawki_cal_flat_config.select_min_level[0];
+<a name="l01888"></a>01888 hawki_cal_flat_config.select_min_level[3] =
+<a name="l01889"></a>01889 hawki_cal_flat_config.select_min_level[0];
+<a name="l01890"></a>01890 }
+<a name="l01891"></a>01891 }
+<a name="l01892"></a>01892 par = cpl_parameterlist_find(parlist,
+<a name="l01893"></a>01893 <span class="stringliteral">"hawki.hawki_cal_flat.select_max_level"</span>) ;
+<a name="l01894"></a>01894 sval = cpl_parameter_get_string(par);
+<a name="l01895"></a>01895 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%lf,%lf,%lf,%lf"</span>,
+<a name="l01896"></a>01896 &hawki_cal_flat_config.select_max_level[0],
+<a name="l01897"></a>01897 &hawki_cal_flat_config.select_max_level[1],
+<a name="l01898"></a>01898 &hawki_cal_flat_config.select_max_level[2],
+<a name="l01899"></a>01899 &hawki_cal_flat_config.select_max_level[3])!=4)
+<a name="l01900"></a>01900 {
+<a name="l01901"></a>01901 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%f"</span>, &hawki_cal_flat_config.select_max_level[0])!=1)
+<a name="l01902"></a>01902 {
+<a name="l01903"></a>01903 <span class="keywordflow">return</span> -1;
+<a name="l01904"></a>01904 }
+<a name="l01905"></a>01905 <span class="keywordflow">else</span>
+<a name="l01906"></a>01906 {
+<a name="l01907"></a>01907 hawki_cal_flat_config.select_max_level[1] =
+<a name="l01908"></a>01908 hawki_cal_flat_config.select_max_level[0];
+<a name="l01909"></a>01909 hawki_cal_flat_config.select_max_level[2] =
+<a name="l01910"></a>01910 hawki_cal_flat_config.select_max_level[0];
+<a name="l01911"></a>01911 hawki_cal_flat_config.select_max_level[3] =
+<a name="l01912"></a>01912 hawki_cal_flat_config.select_max_level[0];
+<a name="l01913"></a>01913 }
+<a name="l01914"></a>01914 }
+<a name="l01915"></a>01915 par = cpl_parameterlist_find(parlist,
+<a name="l01916"></a>01916 <span class="stringliteral">"hawki.hawki_cal_flat.select_max_rms"</span>) ;
+<a name="l01917"></a>01917 sval = cpl_parameter_get_string(par);
+<a name="l01918"></a>01918 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%lf,%lf,%lf,%lf"</span>,
+<a name="l01919"></a>01919 hawki_cal_flat_config.select_max_rms,
+<a name="l01920"></a>01920 hawki_cal_flat_config.select_max_rms+1,
+<a name="l01921"></a>01921 hawki_cal_flat_config.select_max_rms+2,
+<a name="l01922"></a>01922 hawki_cal_flat_config.select_max_rms+3)!=4)
+<a name="l01923"></a>01923 {
+<a name="l01924"></a>01924 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%f"</span>, &hawki_cal_flat_config.select_max_rms[0])!=1)
+<a name="l01925"></a>01925 {
+<a name="l01926"></a>01926 <span class="keywordflow">return</span> -1;
+<a name="l01927"></a>01927 }
+<a name="l01928"></a>01928 <span class="keywordflow">else</span>
+<a name="l01929"></a>01929 {
+<a name="l01930"></a>01930 hawki_cal_flat_config.select_max_rms[1] =
+<a name="l01931"></a>01931 hawki_cal_flat_config.select_max_rms[0];
+<a name="l01932"></a>01932 hawki_cal_flat_config.select_max_rms[2] =
+<a name="l01933"></a>01933 hawki_cal_flat_config.select_max_rms[0];
+<a name="l01934"></a>01934 hawki_cal_flat_config.select_max_rms[3] =
+<a name="l01935"></a>01935 hawki_cal_flat_config.select_max_rms[0];
+<a name="l01936"></a>01936 }
+<a name="l01937"></a>01937 }
+<a name="l01938"></a>01938 par = cpl_parameterlist_find(parlist,
+<a name="l01939"></a>01939 <span class="stringliteral">"hawki.hawki_cal_flat.select_min_nframes"</span>) ;
+<a name="l01940"></a>01940 hawki_cal_flat_config.select_min_nframes = cpl_parameter_get_int(par) ;
+<a name="l01941"></a>01941 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_flat.extra_stats"</span>) ;
+<a name="l01942"></a>01942 hawki_cal_flat_config.extra_stats = cpl_parameter_get_bool(par) ;
+<a name="l01943"></a>01943
+<a name="l01944"></a>01944 <span class="keywordflow">if</span>(hawki_cal_flat_config.select_auto_max_bins != -1 &&
+<a name="l01945"></a>01945 !hawki_cal_flat_config.select_auto)
+<a name="l01946"></a>01946 {
+<a name="l01947"></a>01947 cpl_msg_error(__func__,<span class="stringliteral">"Max bins is only allowed with select_auto"</span>);
+<a name="l01948"></a>01948 <span class="keywordflow">return</span> -1;
+<a name="l01949"></a>01949 }
+<a name="l01950"></a>01950
+<a name="l01951"></a>01951 <span class="keywordflow">return</span> 0;
+<a name="l01952"></a>01952 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__cal__illum_8c_source.html b/html/hawki__cal__illum_8c_source.html
new file mode 100644
index 0000000..2a48321
--- /dev/null
+++ b/html/hawki__cal__illum_8c_source.html
@@ -0,0 +1,838 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_cal_illum.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_cal_illum.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_cal_illum.c,v 1.8 2010/06/04 09:45:43 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/06/04 09:45:43 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.8 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_strehl.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00048"></a>00048
+<a name="l00049"></a>00049 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00050"></a>00050 <span class="comment"> Functions prototypes</span>
+<a name="l00051"></a>00051 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_create(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_exec(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_destroy(cpl_plugin *) ;
+<a name="l00056"></a>00056 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_save(<span class="keyword">const</span> cpl_image **, <span class="keyword">const</span> cpl_table **,
+<a name="l00058"></a>00058 cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00059"></a>00059 <span class="keyword">static</span> cpl_image * hawki_cal_illum_compute(cpl_frameset *, <span class="keywordtype">int</span>,
+<a name="l00060"></a>00060 <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, cpl_table **) ;
+<a name="l00061"></a>00061 <span class="keyword">static</span> cpl_vector * hawki_cal_illum_phot(cpl_imagelist *, cpl_bivector *,
+<a name="l00062"></a>00062 <span class="keywordtype">int</span> *) ;
+<a name="l00063"></a>00063 <span class="keyword">static</span> cpl_bivector * hawki_cal_illum_find_pos(cpl_imagelist *,
+<a name="l00064"></a>00064 cpl_bivector *, <span class="keywordtype">int</span>) ;
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00067"></a>00067 <span class="comment"> Static variables</span>
+<a name="l00068"></a>00068 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00069"></a>00069
+<a name="l00070"></a>00070 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00071"></a>00071 <span class="comment">/* Inputs */</span>
+<a name="l00072"></a>00072 <span class="keywordtype">int</span> subtract ;
+<a name="l00073"></a>00073 <span class="keywordtype">int</span> degree ;
+<a name="l00074"></a>00074 <span class="keywordtype">int</span> s_hx ;
+<a name="l00075"></a>00075 <span class="keywordtype">int</span> s_hy ;
+<a name="l00076"></a>00076 <span class="keywordtype">double</span> star_r ;
+<a name="l00077"></a>00077 <span class="keywordtype">double</span> bg_r1 ;
+<a name="l00078"></a>00078 <span class="keywordtype">double</span> bg_r2 ;
+<a name="l00079"></a>00079 } hawki_cal_illum_config ;
+<a name="l00080"></a>00080
+<a name="l00081"></a>00081 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_cal_illum_description[] =
+<a name="l00082"></a>00082 <span class="stringliteral">"hawki_cal_illum -- Illumination recipe\n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"raw-file.fits "</span>HAWKI_CAL_ILLUM_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00085"></a>00085 <span class="stringliteral">"flat-file.fits "</span>HAWKI_CALPRO_FLAT<span class="stringliteral">" or\n"</span>
+<a name="l00086"></a>00086 <span class="stringliteral">"bpm-file.fits "</span>HAWKI_CALPRO_BPM<span class="stringliteral">"\n"</span> ;
+<a name="l00087"></a>00087
+<a name="l00088"></a>00088 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00089"></a>00089 <span class="comment"> Functions code</span>
+<a name="l00090"></a>00090 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00091"></a>00091
+<a name="l00092"></a>00092 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00101"></a>00101 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00102"></a>00102 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00103"></a>00103 {
+<a name="l00104"></a>00104 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe ) ;
+<a name="l00105"></a>00105 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00106"></a>00106
+<a name="l00107"></a>00107 cpl_plugin_init(plugin,
+<a name="l00108"></a>00108 CPL_PLUGIN_API,
+<a name="l00109"></a>00109 HAWKI_BINARY_VERSION,
+<a name="l00110"></a>00110 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00111"></a>00111 <span class="stringliteral">"hawki_cal_illum"</span>,
+<a name="l00112"></a>00112 <span class="stringliteral">"Illumination recipe"</span>,
+<a name="l00113"></a>00113 hawki_cal_illum_description,
+<a name="l00114"></a>00114 <span class="stringliteral">"Yves Jung"</span>,
+<a name="l00115"></a>00115 PACKAGE_BUGREPORT,
+<a name="l00116"></a>00116 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00117"></a>00117 hawki_cal_illum_create,
+<a name="l00118"></a>00118 hawki_cal_illum_exec,
+<a name="l00119"></a>00119 hawki_cal_illum_destroy) ;
+<a name="l00120"></a>00120
+<a name="l00121"></a>00121 cpl_pluginlist_append(list, plugin) ;
+<a name="l00122"></a>00122
+<a name="l00123"></a>00123 <span class="keywordflow">return</span> 0;
+<a name="l00124"></a>00124 }
+<a name="l00125"></a>00125
+<a name="l00126"></a>00126 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00134"></a>00134 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00135"></a>00135 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_create(cpl_plugin * plugin)
+<a name="l00136"></a>00136 {
+<a name="l00137"></a>00137 cpl_recipe * recipe ;
+<a name="l00138"></a>00138 cpl_parameter * p ;
+<a name="l00139"></a>00139
+<a name="l00140"></a>00140 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00141"></a>00141 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00142"></a>00142 recipe = (cpl_recipe *)plugin ;
+<a name="l00143"></a>00143 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00144"></a>00144
+<a name="l00145"></a>00145 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00146"></a>00146 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00147"></a>00147
+<a name="l00148"></a>00148 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00149"></a>00149 <span class="comment">/* --subtract */</span>
+<a name="l00150"></a>00150 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.subtract"</span>,
+<a name="l00151"></a>00151 CPL_TYPE_BOOL, <span class="stringliteral">"Flag to subtract the next images"</span>,
+<a name="l00152"></a>00152 <span class="stringliteral">"hawki.hawki_cal_illum"</span>, TRUE) ;
+<a name="l00153"></a>00153 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"subtract"</span>) ;
+<a name="l00154"></a>00154 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00155"></a>00155 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00156"></a>00156 <span class="comment">/* --degree */</span>
+<a name="l00157"></a>00157 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.degree"</span>,
+<a name="l00158"></a>00158 CPL_TYPE_INT, <span class="stringliteral">"Polynomial degree for the fit"</span>,
+<a name="l00159"></a>00159 <span class="stringliteral">"hawki.hawki_cal_illum"</span>, 3) ;
+<a name="l00160"></a>00160 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"degree"</span>) ;
+<a name="l00161"></a>00161 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00162"></a>00162 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00163"></a>00163 <span class="comment">/* --star_r */</span>
+<a name="l00164"></a>00164 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.star_r"</span>, CPL_TYPE_DOUBLE,
+<a name="l00165"></a>00165 <span class="stringliteral">"the star radius"</span>, <span class="stringliteral">"hawki.hawki_cal_illum"</span>, -1.0) ;
+<a name="l00166"></a>00166 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"star_r"</span>) ;
+<a name="l00167"></a>00167 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00168"></a>00168 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00169"></a>00169 <span class="comment">/* --bg_r1 */</span>
+<a name="l00170"></a>00170 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.bg_r1"</span>, CPL_TYPE_DOUBLE,
+<a name="l00171"></a>00171 <span class="stringliteral">"the internal background radius"</span>, <span class="stringliteral">"hawki.hawki_cal_illum"</span>, -1.0) ;
+<a name="l00172"></a>00172 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"bg_r1"</span>) ;
+<a name="l00173"></a>00173 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00174"></a>00174 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00175"></a>00175 <span class="comment">/* --bg_r2 */</span>
+<a name="l00176"></a>00176 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.bg_r2"</span>, CPL_TYPE_DOUBLE,
+<a name="l00177"></a>00177 <span class="stringliteral">"the external background radius"</span>, <span class="stringliteral">"hawki.hawki_cal_illum"</span>, -1.0) ;
+<a name="l00178"></a>00178 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"bg_r2"</span>) ;
+<a name="l00179"></a>00179 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00180"></a>00180 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00181"></a>00181 <span class="comment">/* --s_hx */</span>
+<a name="l00182"></a>00182 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.s_hx"</span>, CPL_TYPE_INT,
+<a name="l00183"></a>00183 <span class="stringliteral">"Half size of the seach box in x"</span>, <span class="stringliteral">"hawki.hawki_cal_illum"</span>, 50) ;
+<a name="l00184"></a>00184 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"s_hx"</span>) ;
+<a name="l00185"></a>00185 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00186"></a>00186 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00187"></a>00187 <span class="comment">/* --s_hy */</span>
+<a name="l00188"></a>00188 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_illum.s_hy"</span>, CPL_TYPE_INT,
+<a name="l00189"></a>00189 <span class="stringliteral">"Half size of the seach box in y"</span>, <span class="stringliteral">"hawki.hawki_cal_illum"</span>, 50) ;
+<a name="l00190"></a>00190 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"s_hy"</span>) ;
+<a name="l00191"></a>00191 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00192"></a>00192 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00193"></a>00193
+<a name="l00194"></a>00194 <span class="comment">/* Return */</span>
+<a name="l00195"></a>00195 <span class="keywordflow">return</span> 0;
+<a name="l00196"></a>00196 }
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00204"></a>00204 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00205"></a>00205 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_exec(cpl_plugin * plugin)
+<a name="l00206"></a>00206 {
+<a name="l00207"></a>00207 cpl_recipe * recipe ;
+<a name="l00208"></a>00208
+<a name="l00209"></a>00209 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00210"></a>00210 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00211"></a>00211 recipe = (cpl_recipe *)plugin ;
+<a name="l00212"></a>00212 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00213"></a>00213
+<a name="l00214"></a>00214 <span class="comment">/* Issue a banner */</span>
+<a name="l00215"></a>00215 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 <span class="keywordflow">return</span> hawki_cal_illum(recipe->parameters, recipe->frames) ;
+<a name="l00218"></a>00218 }
+<a name="l00219"></a>00219
+<a name="l00220"></a>00220 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00226"></a>00226 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00227"></a>00227 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_destroy(cpl_plugin * plugin)
+<a name="l00228"></a>00228 {
+<a name="l00229"></a>00229 cpl_recipe * recipe ;
+<a name="l00230"></a>00230
+<a name="l00231"></a>00231 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00232"></a>00232 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00233"></a>00233 recipe = (cpl_recipe *)plugin ;
+<a name="l00234"></a>00234 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00235"></a>00235
+<a name="l00236"></a>00236 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00237"></a>00237 <span class="keywordflow">return</span> 0 ;
+<a name="l00238"></a>00238 }
+<a name="l00239"></a>00239
+<a name="l00240"></a>00240 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00247"></a>00247 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00248"></a>00248 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum(
+<a name="l00249"></a>00249 cpl_parameterlist * parlist,
+<a name="l00250"></a>00250 cpl_frameset * frameset)
+<a name="l00251"></a>00251 {
+<a name="l00252"></a>00252 cpl_parameter * par ;
+<a name="l00253"></a>00253 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat ;
+<a name="l00254"></a>00254 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm ;
+<a name="l00255"></a>00255 cpl_frameset * rawframes ;
+<a name="l00256"></a>00256 cpl_frameset * cur_frames ;
+<a name="l00257"></a>00257 <span class="keywordtype">int</span> * labels ;
+<a name="l00258"></a>00258 cpl_image * illum[HAWKI_NB_DETECTORS] ;
+<a name="l00259"></a>00259 cpl_table * flux[HAWKI_NB_DETECTORS] ;
+<a name="l00260"></a>00260 <span class="keywordtype">int</span> i ;
+<a name="l00261"></a>00261
+<a name="l00262"></a>00262 <span class="comment">/* Initialise */</span>
+<a name="l00263"></a>00263 rawframes = NULL ;
+<a name="l00264"></a>00264
+<a name="l00265"></a>00265 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00266"></a>00266 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.subtract"</span>) ;
+<a name="l00267"></a>00267 hawki_cal_illum_config.subtract = cpl_parameter_get_bool(par) ;
+<a name="l00268"></a>00268 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.degree"</span>) ;
+<a name="l00269"></a>00269 hawki_cal_illum_config.degree = cpl_parameter_get_int(par) ;
+<a name="l00270"></a>00270 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.s_hx"</span>) ;
+<a name="l00271"></a>00271 hawki_cal_illum_config.s_hx = cpl_parameter_get_int(par) ;
+<a name="l00272"></a>00272 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.s_hy"</span>) ;
+<a name="l00273"></a>00273 hawki_cal_illum_config.s_hy = cpl_parameter_get_int(par) ;
+<a name="l00274"></a>00274 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.star_r"</span>) ;
+<a name="l00275"></a>00275 hawki_cal_illum_config.star_r = cpl_parameter_get_double(par) ;
+<a name="l00276"></a>00276 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.bg_r1"</span>) ;
+<a name="l00277"></a>00277 hawki_cal_illum_config.bg_r1 = cpl_parameter_get_double(par) ;
+<a name="l00278"></a>00278 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_illum.bg_r2"</span>) ;
+<a name="l00279"></a>00279 hawki_cal_illum_config.bg_r2 = cpl_parameter_get_double(par) ;
+<a name="l00280"></a>00280
+<a name="l00281"></a>00281 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00282"></a>00282 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(frameset)) {
+<a name="l00283"></a>00283 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00284"></a>00284 <span class="keywordflow">return</span> -1 ;
+<a name="l00285"></a>00285 }
+<a name="l00286"></a>00286
+<a name="l00287"></a>00287 <span class="comment">/* Retrieve calibration data */</span>
+<a name="l00288"></a>00288 flat = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(frameset, HAWKI_CALPRO_FLAT) ;
+<a name="l00289"></a>00289 bpm = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(frameset, HAWKI_CALPRO_BPM) ;
+<a name="l00290"></a>00290
+<a name="l00291"></a>00291 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00292"></a>00292 <span class="keywordflow">if</span> ((rawframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(frameset,
+<a name="l00293"></a>00293 HAWKI_CAL_ILLUM_RAW)) == NULL) {
+<a name="l00294"></a>00294 cpl_msg_error(__func__, <span class="stringliteral">"No raw frame in input"</span>) ;
+<a name="l00295"></a>00295 <span class="keywordflow">return</span> -1 ;
+<a name="l00296"></a>00296 }
+<a name="l00297"></a>00297
+<a name="l00298"></a>00298 <span class="comment">/* Labelise frames */</span>
+<a name="l00299"></a>00299 cpl_msg_info(__func__, <span class="stringliteral">"Labelise the frames"</span>) ;
+<a name="l00300"></a>00300 <span class="keywordflow">if</span> ((labels = <a class="code" href="group__hawki__utils.html#ga024bd2557115d5d7d3265dbcbb3b1884" title="Get the frames in which the star is for a given chip.">hawki_detectors_labelise</a>(rawframes)) == NULL) {
+<a name="l00301"></a>00301 cpl_msg_error(__func__, <span class="stringliteral">"Cannot labelise"</span>) ;
+<a name="l00302"></a>00302 cpl_frameset_delete(rawframes) ;
+<a name="l00303"></a>00303 <span class="keywordflow">return</span> -1 ;
+<a name="l00304"></a>00304 }
+<a name="l00305"></a>00305
+<a name="l00306"></a>00306 <span class="comment">/* Loop on the chips */</span>
+<a name="l00307"></a>00307 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00308"></a>00308 cpl_msg_info(__func__, <span class="stringliteral">"Reduce chip nb %d"</span>, i+1) ;
+<a name="l00309"></a>00309
+<a name="l00310"></a>00310 <span class="comment">/* Initialise */</span>
+<a name="l00311"></a>00311 illum[i] = NULL ;
+<a name="l00312"></a>00312
+<a name="l00313"></a>00313 <span class="comment">/* Get the frames for which the star is in chip number i+1 */</span>
+<a name="l00314"></a>00314 <span class="keywordflow">if</span> ((cur_frames = cpl_frameset_extract(rawframes, labels,
+<a name="l00315"></a>00315 i+1)) == NULL) {
+<a name="l00316"></a>00316 cpl_msg_warning(__func__, <span class="stringliteral">"No frames for chip nb %d"</span>, i+1) ;
+<a name="l00317"></a>00317 <span class="comment">/* Create the flux table */</span>
+<a name="l00318"></a>00318 flux[i] = cpl_table_new(1) ;
+<a name="l00319"></a>00319 cpl_table_new_column(flux[i],HAWKI_COL_ILLUM_POSX, CPL_TYPE_DOUBLE);
+<a name="l00320"></a>00320 cpl_table_new_column(flux[i],HAWKI_COL_ILLUM_POSY, CPL_TYPE_DOUBLE);
+<a name="l00321"></a>00321 cpl_table_new_column(flux[i],HAWKI_COL_ILLUM_FLUX, CPL_TYPE_DOUBLE);
+<a name="l00322"></a>00322 } <span class="keywordflow">else</span> {
+<a name="l00323"></a>00323 <span class="comment">/* Create the flux table */</span>
+<a name="l00324"></a>00324 flux[i] = cpl_table_new(cpl_frameset_get_size(cur_frames)) ;
+<a name="l00325"></a>00325 cpl_table_new_column(flux[i],HAWKI_COL_ILLUM_POSX, CPL_TYPE_DOUBLE);
+<a name="l00326"></a>00326 cpl_table_new_column(flux[i],HAWKI_COL_ILLUM_POSY, CPL_TYPE_DOUBLE);
+<a name="l00327"></a>00327 cpl_table_new_column(flux[i],HAWKI_COL_ILLUM_FLUX, CPL_TYPE_DOUBLE);
+<a name="l00328"></a>00328
+<a name="l00329"></a>00329 <span class="comment">/* Get the illumination */</span>
+<a name="l00330"></a>00330 <span class="keywordflow">if</span> ((illum[i] = hawki_cal_illum_compute(cur_frames, i+1,
+<a name="l00331"></a>00331 bpm, flat, &(flux[i]))) == NULL) {
+<a name="l00332"></a>00332 cpl_msg_warning(__func__, <span class="stringliteral">"Cannot compute for chip %d"</span>, i+1) ;
+<a name="l00333"></a>00333 cpl_error_reset() ;
+<a name="l00334"></a>00334 }
+<a name="l00335"></a>00335 cpl_frameset_delete(cur_frames) ;
+<a name="l00336"></a>00336 }
+<a name="l00337"></a>00337 }
+<a name="l00338"></a>00338 cpl_frameset_delete(rawframes) ;
+<a name="l00339"></a>00339 cpl_free(labels) ;
+<a name="l00340"></a>00340
+<a name="l00341"></a>00341 <span class="comment">/* Save the product */</span>
+<a name="l00342"></a>00342 cpl_msg_info(__func__, <span class="stringliteral">"Save the product"</span>) ;
+<a name="l00343"></a>00343 cpl_msg_indent_more() ;
+<a name="l00344"></a>00344 <span class="keywordflow">if</span> (hawki_cal_illum_save((<span class="keyword">const</span> cpl_image **)illum,
+<a name="l00345"></a>00345 (<span class="keyword">const</span> cpl_table **)flux, parlist, frameset)) {
+<a name="l00346"></a>00346 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the product"</span>) ;
+<a name="l00347"></a>00347 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_table_delete(flux[i]) ;
+<a name="l00348"></a>00348 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_image_delete(illum[i]) ;
+<a name="l00349"></a>00349 cpl_msg_indent_less() ;
+<a name="l00350"></a>00350 <span class="keywordflow">return</span> -1 ;
+<a name="l00351"></a>00351 }
+<a name="l00352"></a>00352 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_table_delete(flux[i]) ;
+<a name="l00353"></a>00353 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_image_delete(illum[i]) ;
+<a name="l00354"></a>00354 cpl_msg_indent_less() ;
+<a name="l00355"></a>00355
+<a name="l00356"></a>00356 <span class="comment">/* Return */</span>
+<a name="l00357"></a>00357 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l00358"></a>00358 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00359"></a>00359 }
+<a name="l00360"></a>00360
+<a name="l00361"></a>00361 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00371"></a>00371 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00372"></a>00372 <span class="keyword">static</span> cpl_image * hawki_cal_illum_compute(
+<a name="l00373"></a>00373 cpl_frameset * raw,
+<a name="l00374"></a>00374 <span class="keywordtype">int</span> chip,
+<a name="l00375"></a>00375 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00376"></a>00376 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00377"></a>00377 cpl_table ** fl)
+<a name="l00378"></a>00378 {
+<a name="l00379"></a>00379 cpl_bivector * offsets ;
+<a name="l00380"></a>00380 cpl_imagelist * in ;
+<a name="l00381"></a>00381 cpl_image * ima1 ;
+<a name="l00382"></a>00382 cpl_image * ima2 ;
+<a name="l00383"></a>00383 cpl_bivector * positions ;
+<a name="l00384"></a>00384 cpl_bivector * purged_pos ;
+<a name="l00385"></a>00385 <span class="keywordtype">double</span> * positions_x,
+<a name="l00386"></a>00386 * positions_y,
+<a name="l00387"></a>00387 * purged_pos_x,
+<a name="l00388"></a>00388 * purged_pos_y ;
+<a name="l00389"></a>00389 cpl_vector * flux ;
+<a name="l00390"></a>00390 cpl_vector * purged_flux ;
+<a name="l00391"></a>00391 cpl_polynomial * poly ;
+<a name="l00392"></a>00392 cpl_image * poly_ima ;
+<a name="l00393"></a>00393 <span class="keywordtype">int</span> nval, nx, ny ;
+<a name="l00394"></a>00394 <span class="keywordtype">double</span> val ;
+<a name="l00395"></a>00395 <span class="keywordtype">int</span> ival ;
+<a name="l00396"></a>00396 <span class="keywordtype">int</span> i, j ;
+<a name="l00397"></a>00397
+<a name="l00398"></a>00398 <span class="comment">/* Check entries */</span>
+<a name="l00399"></a>00399 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00400"></a>00400 <span class="keywordflow">if</span> (raw == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00401"></a>00401 <span class="keywordflow">if</span> (fl == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00402"></a>00402
+<a name="l00403"></a>00403 <span class="comment">/* Get the offsets from the raw frames */</span>
+<a name="l00404"></a>00404 cpl_msg_info(__func__, <span class="stringliteral">"Get the offsets from the files headers"</span>) ;
+<a name="l00405"></a>00405 cpl_msg_indent_more() ;
+<a name="l00406"></a>00406 <span class="keywordflow">if</span> ((offsets = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(raw)) == NULL) {
+<a name="l00407"></a>00407 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the offsets"</span>) ;
+<a name="l00408"></a>00408 cpl_msg_indent_less() ;
+<a name="l00409"></a>00409 <span class="keywordflow">return</span> NULL ;
+<a name="l00410"></a>00410 }
+<a name="l00411"></a>00411 cpl_msg_indent_less() ;
+<a name="l00412"></a>00412
+<a name="l00413"></a>00413 <span class="comment">/* Load the input data */</span>
+<a name="l00414"></a>00414 cpl_msg_info(__func__, <span class="stringliteral">"Load the input data"</span>) ;
+<a name="l00415"></a>00415 cpl_msg_indent_more() ;
+<a name="l00416"></a>00416 <span class="keywordflow">if</span> ((in = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(raw, chip, CPL_TYPE_FLOAT)) == NULL) {
+<a name="l00417"></a>00417 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load input data"</span>) ;
+<a name="l00418"></a>00418 cpl_bivector_delete(offsets) ;
+<a name="l00419"></a>00419 cpl_msg_indent_less() ;
+<a name="l00420"></a>00420 <span class="keywordflow">return</span> NULL ;
+<a name="l00421"></a>00421 }
+<a name="l00422"></a>00422 cpl_msg_indent_less() ;
+<a name="l00423"></a>00423
+<a name="l00424"></a>00424 <span class="comment">/* Apply the calibrations */</span>
+<a name="l00425"></a>00425 <span class="keywordflow">if</span> (flat || bpm) {
+<a name="l00426"></a>00426 cpl_msg_indent_more() ;
+<a name="l00427"></a>00427 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#ga07a2392c998d129862af73b06e1d0571" title="Apply the calibration to the images.">hawki_flat_bpm_detector_calib</a>(in, flat, bpm) == -1) {
+<a name="l00428"></a>00428 cpl_msg_error(__func__, <span class="stringliteral">"Cannot apply calibrations"</span>) ;
+<a name="l00429"></a>00429 cpl_bivector_delete(offsets) ;
+<a name="l00430"></a>00430 cpl_imagelist_delete(in) ;
+<a name="l00431"></a>00431 cpl_msg_indent_less() ;
+<a name="l00432"></a>00432 <span class="keywordflow">return</span> NULL ;
+<a name="l00433"></a>00433 }
+<a name="l00434"></a>00434 cpl_msg_indent_less() ;
+<a name="l00435"></a>00435 }
+<a name="l00436"></a>00436
+<a name="l00437"></a>00437 <span class="comment">/* Subtract the consecutive frames */</span>
+<a name="l00438"></a>00438 <span class="keywordflow">if</span> (hawki_cal_illum_config.subtract) {
+<a name="l00439"></a>00439 cpl_msg_info(__func__, <span class="stringliteral">"Subtract the next images"</span>) ;
+<a name="l00440"></a>00440 ima1 = cpl_image_duplicate(cpl_imagelist_get(in, 0)) ;
+<a name="l00441"></a>00441 <span class="keywordflow">for</span> (i=0 ; i<cpl_imagelist_get_size(in) ; i++) {
+<a name="l00442"></a>00442 <span class="keywordflow">if</span> (i==cpl_imagelist_get_size(in)-1) {
+<a name="l00443"></a>00443 ima2 = ima1 ;
+<a name="l00444"></a>00444 } <span class="keywordflow">else</span> {
+<a name="l00445"></a>00445 ima2 = cpl_imagelist_get(in, i+1) ;
+<a name="l00446"></a>00446 }
+<a name="l00447"></a>00447 cpl_image_subtract(cpl_imagelist_get(in, i), ima2) ;
+<a name="l00448"></a>00448 }
+<a name="l00449"></a>00449 cpl_image_delete(ima1) ;
+<a name="l00450"></a>00450 }
+<a name="l00451"></a>00451
+<a name="l00452"></a>00452 <span class="comment">/* Find the positions */</span>
+<a name="l00453"></a>00453 cpl_msg_info(__func__, <span class="stringliteral">"Find the positions"</span>) ;
+<a name="l00454"></a>00454 cpl_msg_indent_more() ;
+<a name="l00455"></a>00455 <span class="keywordflow">if</span> ((positions=hawki_cal_illum_find_pos(in, offsets, chip)) == NULL) {
+<a name="l00456"></a>00456 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find the positions"</span>) ;
+<a name="l00457"></a>00457 cpl_imagelist_delete(in) ;
+<a name="l00458"></a>00458 cpl_bivector_delete(offsets) ;
+<a name="l00459"></a>00459 cpl_msg_indent_less() ;
+<a name="l00460"></a>00460 <span class="keywordflow">return</span> NULL ;
+<a name="l00461"></a>00461 }
+<a name="l00462"></a>00462 cpl_bivector_delete(offsets) ;
+<a name="l00463"></a>00463 cpl_msg_indent_less() ;
+<a name="l00464"></a>00464
+<a name="l00465"></a>00465 <span class="comment">/* Compute the photometry */</span>
+<a name="l00466"></a>00466 cpl_msg_info(__func__, <span class="stringliteral">"Compute the photometry"</span>) ;
+<a name="l00467"></a>00467 cpl_msg_indent_more() ;
+<a name="l00468"></a>00468 <span class="keywordflow">if</span> ((flux=hawki_cal_illum_phot(in, positions, &nval)) == NULL) {
+<a name="l00469"></a>00469 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find the positions"</span>) ;
+<a name="l00470"></a>00470 cpl_imagelist_delete(in) ;
+<a name="l00471"></a>00471 cpl_bivector_delete(positions) ;
+<a name="l00472"></a>00472 cpl_msg_indent_less() ;
+<a name="l00473"></a>00473 <span class="keywordflow">return</span> NULL ;
+<a name="l00474"></a>00474 }
+<a name="l00475"></a>00475 nx = cpl_image_get_size_x(cpl_imagelist_get(in, 0)) ;
+<a name="l00476"></a>00476 ny = cpl_image_get_size_y(cpl_imagelist_get(in, 0)) ;
+<a name="l00477"></a>00477 cpl_imagelist_delete(in) ;
+<a name="l00478"></a>00478 cpl_msg_indent_less() ;
+<a name="l00479"></a>00479 <span class="keywordflow">if</span> (nval < 1) {
+<a name="l00480"></a>00480 cpl_msg_error(__func__, <span class="stringliteral">"No flux computed"</span>) ;
+<a name="l00481"></a>00481 cpl_bivector_delete(positions) ;
+<a name="l00482"></a>00482 cpl_vector_delete(flux) ;
+<a name="l00483"></a>00483 <span class="keywordflow">return</span> NULL ;
+<a name="l00484"></a>00484 }
+<a name="l00485"></a>00485
+<a name="l00486"></a>00486 <span class="comment">/* Purge positions */</span>
+<a name="l00487"></a>00487 purged_pos = cpl_bivector_new(nval) ;
+<a name="l00488"></a>00488 purged_pos_x = cpl_bivector_get_x_data(purged_pos) ;
+<a name="l00489"></a>00489 purged_pos_y = cpl_bivector_get_y_data(purged_pos) ;
+<a name="l00490"></a>00490 positions_x = cpl_bivector_get_x_data(positions) ;
+<a name="l00491"></a>00491 positions_y = cpl_bivector_get_y_data(positions) ;
+<a name="l00492"></a>00492 purged_flux = cpl_vector_new(nval) ;
+<a name="l00493"></a>00493 j = 0 ;
+<a name="l00494"></a>00494 <span class="keywordflow">for</span> (i=0 ; i<cpl_vector_get_size(flux) ; i++) {
+<a name="l00495"></a>00495 <span class="keywordflow">if</span> (fabs(cpl_vector_get(flux, i)) > 0) {
+<a name="l00496"></a>00496 purged_pos_x[j] = positions_x[i] ;
+<a name="l00497"></a>00497 purged_pos_y[j] = positions_y[i] ;
+<a name="l00498"></a>00498 cpl_vector_set(purged_flux, j, cpl_vector_get(flux, i)) ;
+<a name="l00499"></a>00499 j++ ;
+<a name="l00500"></a>00500 }
+<a name="l00501"></a>00501 }
+<a name="l00502"></a>00502
+<a name="l00503"></a>00503 <span class="comment">/* Fill the flux table */</span>
+<a name="l00504"></a>00504 <span class="keywordflow">for</span> (i=0 ; i<cpl_vector_get_size(flux) ; i++) {
+<a name="l00505"></a>00505 cpl_table_set_double(*fl, HAWKI_COL_ILLUM_POSX, i, positions_x[i]) ;
+<a name="l00506"></a>00506 cpl_table_set_double(*fl, HAWKI_COL_ILLUM_POSY, i, positions_y[i]) ;
+<a name="l00507"></a>00507 cpl_table_set_double(*fl, HAWKI_COL_ILLUM_FLUX, i,
+<a name="l00508"></a>00508 cpl_vector_get(flux, i)) ;
+<a name="l00509"></a>00509 }
+<a name="l00510"></a>00510 cpl_bivector_delete(positions) ;
+<a name="l00511"></a>00511 cpl_vector_delete(flux) ;
+<a name="l00512"></a>00512
+<a name="l00513"></a>00513 <span class="comment">/* Fit the polynomial */</span>
+<a name="l00514"></a>00514 cpl_msg_info(__func__, <span class="stringliteral">"Compute the polynomial"</span>) ;
+<a name="l00515"></a>00515 <span class="keywordflow">if</span> ((poly = cpl_polynomial_fit_2d_create(purged_pos, purged_flux,
+<a name="l00516"></a>00516 hawki_cal_illum_config.degree, NULL)) == NULL) {
+<a name="l00517"></a>00517 cpl_msg_error(__func__, <span class="stringliteral">"Cannot fit the polynomial"</span>) ;
+<a name="l00518"></a>00518 cpl_bivector_delete(purged_pos) ;
+<a name="l00519"></a>00519 cpl_vector_delete(purged_flux) ;
+<a name="l00520"></a>00520 <span class="keywordflow">return</span> NULL ;
+<a name="l00521"></a>00521 }
+<a name="l00522"></a>00522 cpl_bivector_delete(purged_pos) ;
+<a name="l00523"></a>00523 cpl_vector_delete(purged_flux) ;
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 <span class="comment">/* Create the polynomial image */</span>
+<a name="l00526"></a>00526 poly_ima = cpl_image_new(nx, ny, CPL_TYPE_FLOAT) ;
+<a name="l00527"></a>00527 cpl_image_fill_polynomial(poly_ima, poly, 1.0, 1.0, 1.0, 1.0) ;
+<a name="l00528"></a>00528 cpl_polynomial_delete(poly) ;
+<a name="l00529"></a>00529
+<a name="l00530"></a>00530 <span class="comment">/* Normalise the image */</span>
+<a name="l00531"></a>00531 val = cpl_image_get(poly_ima, 1024, 1024, &ival) ;
+<a name="l00532"></a>00532 cpl_image_divide_scalar(poly_ima, val) ;
+<a name="l00533"></a>00533
+<a name="l00534"></a>00534 <span class="keywordflow">return</span> poly_ima ;
+<a name="l00535"></a>00535 }
+<a name="l00536"></a>00536
+<a name="l00537"></a>00537 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00545"></a>00545 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00546"></a>00546 <span class="keyword">static</span> cpl_vector * hawki_cal_illum_phot(
+<a name="l00547"></a>00547 cpl_imagelist * ilist,
+<a name="l00548"></a>00548 cpl_bivector * positions,
+<a name="l00549"></a>00549 <span class="keywordtype">int</span> * nvalid)
+<a name="l00550"></a>00550 {
+<a name="l00551"></a>00551 cpl_vector * flux ;
+<a name="l00552"></a>00552 cpl_image * cur_ima ;
+<a name="l00553"></a>00553 <span class="keywordtype">double</span> * pos_x ;
+<a name="l00554"></a>00554 <span class="keywordtype">double</span> * pos_y ;
+<a name="l00555"></a>00555 <span class="keywordtype">int</span> ni ;
+<a name="l00556"></a>00556 <span class="keywordtype">int</span> nok ;
+<a name="l00557"></a>00557 <span class="keywordtype">double</span> bg, fl ;
+<a name="l00558"></a>00558 cpl_bivector * iqe_res ;
+<a name="l00559"></a>00559 <span class="keywordtype">double</span> fwhm_x, fwhm_y, r, r1, r2 ;
+<a name="l00560"></a>00560 <span class="keywordtype">int</span> i ;
+<a name="l00561"></a>00561
+<a name="l00562"></a>00562 <span class="comment">/* Test entries */</span>
+<a name="l00563"></a>00563 <span class="keywordflow">if</span> (ilist == NULL || positions == NULL || nvalid == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00564"></a>00564 ni = cpl_imagelist_get_size(ilist) ;
+<a name="l00565"></a>00565 pos_x = cpl_bivector_get_x_data(positions) ;
+<a name="l00566"></a>00566 pos_y = cpl_bivector_get_y_data(positions) ;
+<a name="l00567"></a>00567 nok = 0 ;
+<a name="l00568"></a>00568
+<a name="l00569"></a>00569 <span class="comment">/* Create the flux vector */</span>
+<a name="l00570"></a>00570 flux = cpl_vector_new(ni) ;
+<a name="l00571"></a>00571
+<a name="l00572"></a>00572 <span class="comment">/* Loop on the frames */</span>
+<a name="l00573"></a>00573 <span class="keywordflow">for</span> (i=0 ; i<ni ; i++) {
+<a name="l00574"></a>00574 cur_ima = cpl_imagelist_get(ilist, i) ;
+<a name="l00575"></a>00575
+<a name="l00576"></a>00576 <span class="comment">/* FWHM_X / FWHM_Y */</span>
+<a name="l00577"></a>00577 <span class="keywordflow">if</span> ((iqe_res = cpl_image_iqe(cur_ima,
+<a name="l00578"></a>00578 (<span class="keywordtype">int</span>)(pos_x[i]-10.0), (<span class="keywordtype">int</span>)(pos_y[i]-10.0),
+<a name="l00579"></a>00579 (<span class="keywordtype">int</span>)(pos_x[i]+10.0), (<span class="keywordtype">int</span>)(pos_y[i]+10.0))) == NULL) {
+<a name="l00580"></a>00580 cpl_msg_debug(__func__,<span class="stringliteral">"Cannot get FWHM for image %d"</span>, i+1);
+<a name="l00581"></a>00581 fwhm_x = fwhm_y = -1.0 ;
+<a name="l00582"></a>00582 cpl_error_reset() ;
+<a name="l00583"></a>00583 } <span class="keywordflow">else</span> {
+<a name="l00584"></a>00584 fwhm_x = cpl_vector_get(cpl_bivector_get_x(iqe_res), 2) ;
+<a name="l00585"></a>00585 fwhm_y = cpl_vector_get(cpl_bivector_get_x(iqe_res), 3) ;
+<a name="l00586"></a>00586 cpl_bivector_delete(iqe_res) ;
+<a name="l00587"></a>00587 }
+<a name="l00588"></a>00588
+<a name="l00589"></a>00589 <span class="comment">/* Determine the radii */</span>
+<a name="l00590"></a>00590 r = hawki_cal_illum_config.star_r ;
+<a name="l00591"></a>00591 <span class="keywordflow">if</span> (r < 0) {
+<a name="l00592"></a>00592 <span class="keywordflow">if</span> (fwhm_x>0 && fwhm_y>0) r = 5*(fwhm_x+fwhm_y)/2.0 ;
+<a name="l00593"></a>00593 <span class="keywordflow">else</span> r = HAWKI_PHOT_STAR_RADIUS ;
+<a name="l00594"></a>00594 }
+<a name="l00595"></a>00595 r1 = hawki_cal_illum_config.bg_r1 ;
+<a name="l00596"></a>00596 r2 = hawki_cal_illum_config.bg_r2 ;
+<a name="l00597"></a>00597 <span class="keywordflow">if</span> (r1 < 0) r1 = r + 10.0 ;
+<a name="l00598"></a>00598 <span class="keywordflow">if</span> (r2 < 0) r2 = r1 + 20.0 ;
+<a name="l00599"></a>00599
+<a name="l00600"></a>00600 bg = irplib_strehl_ring_background(cur_ima, (<span class="keywordtype">int</span>)pos_x[i],
+<a name="l00601"></a>00601 (<span class="keywordtype">int</span>)pos_y[i], r1, r2, IRPLIB_BG_METHOD_MEDIAN) ;
+<a name="l00602"></a>00602 fl = irplib_strehl_disk_flux(cur_ima, (<span class="keywordtype">int</span>)pos_x[i], (<span class="keywordtype">int</span>)pos_y[i],
+<a name="l00603"></a>00603 r, bg) ;
+<a name="l00604"></a>00604 cpl_vector_set(flux, i, fl);
+<a name="l00605"></a>00605 <span class="keywordflow">if</span> (fabs(fl)>1e-3) nok++ ;
+<a name="l00606"></a>00606 cpl_msg_info(__func__, <span class="stringliteral">"Flux for image %d: %g (r=%g, r1=%g, r2=%g)"</span>,
+<a name="l00607"></a>00607 i+1, fl, r, r1, r2) ;
+<a name="l00608"></a>00608 }
+<a name="l00609"></a>00609 *nvalid = nok ;
+<a name="l00610"></a>00610 <span class="keywordflow">return</span> flux ;
+<a name="l00611"></a>00611 }
+<a name="l00612"></a>00612
+<a name="l00613"></a>00613 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00621"></a>00621 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00622"></a>00622 <span class="keyword">static</span> cpl_bivector * hawki_cal_illum_find_pos(
+<a name="l00623"></a>00623 cpl_imagelist * ilist,
+<a name="l00624"></a>00624 cpl_bivector * offsets,
+<a name="l00625"></a>00625 <span class="keywordtype">int</span> chip)
+<a name="l00626"></a>00626 {
+<a name="l00627"></a>00627 cpl_bivector * positions ;
+<a name="l00628"></a>00628 <span class="keywordtype">double</span> * positions_x ;
+<a name="l00629"></a>00629 <span class="keywordtype">double</span> * positions_y ;
+<a name="l00630"></a>00630 <span class="keywordtype">double</span> * offsets_x ;
+<a name="l00631"></a>00631 <span class="keywordtype">double</span> * offsets_y ;
+<a name="l00632"></a>00632 cpl_image * tmp_ima ;
+<a name="l00633"></a>00633 cpl_image * cur_ima ;
+<a name="l00634"></a>00634 cpl_image * filtered_ima ;
+<a name="l00635"></a>00635 cpl_matrix * kernel ;
+<a name="l00636"></a>00636 <span class="keywordtype">int</span> nx, ny, ni ;
+<a name="l00637"></a>00637 <span class="keywordtype">int</span> llx, lly, urx, ury, posx, posy, gap ;
+<a name="l00638"></a>00638 <span class="keywordtype">int</span> i ;
+<a name="l00639"></a>00639
+<a name="l00640"></a>00640 <span class="comment">/* Test entries */</span>
+<a name="l00641"></a>00641 <span class="keywordflow">if</span> (ilist == NULL || offsets == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00642"></a>00642 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00643"></a>00643 ni = cpl_imagelist_get_size(ilist) ;
+<a name="l00644"></a>00644 gap = 147 ;
+<a name="l00645"></a>00645
+<a name="l00646"></a>00646 <span class="comment">/* Create the positions bivector */</span>
+<a name="l00647"></a>00647 positions = cpl_bivector_new(ni) ;
+<a name="l00648"></a>00648 positions_x = cpl_bivector_get_x_data(positions) ;
+<a name="l00649"></a>00649 positions_y = cpl_bivector_get_y_data(positions) ;
+<a name="l00650"></a>00650 offsets_x = cpl_bivector_get_x_data(offsets) ;
+<a name="l00651"></a>00651 offsets_y = cpl_bivector_get_y_data(offsets) ;
+<a name="l00652"></a>00652
+<a name="l00653"></a>00653 <span class="comment">/* Create the kernel */</span>
+<a name="l00654"></a>00654 kernel = cpl_matrix_new(3, 3) ;
+<a name="l00655"></a>00655 cpl_matrix_fill(kernel, 1.0) ;
+<a name="l00656"></a>00656
+<a name="l00657"></a>00657 <span class="comment">/* Loop on all the images */</span>
+<a name="l00658"></a>00658 <span class="keywordflow">for</span> (i=0 ; i<ni ; i++) {
+<a name="l00659"></a>00659 cur_ima = cpl_imagelist_get(ilist, i) ;
+<a name="l00660"></a>00660 nx = cpl_image_get_size_x(cur_ima) ;
+<a name="l00661"></a>00661 ny = cpl_image_get_size_y(cur_ima) ;
+<a name="l00662"></a>00662
+<a name="l00663"></a>00663 <span class="comment">/* Define zone */</span>
+<a name="l00664"></a>00664 <span class="keywordflow">if</span> (chip == 1) {
+<a name="l00665"></a>00665 llx = nx + gap/2.0 + offsets_x[i] - hawki_cal_illum_config.s_hx ;
+<a name="l00666"></a>00666 urx = nx + gap/2.0 + offsets_x[i] + hawki_cal_illum_config.s_hx ;
+<a name="l00667"></a>00667 lly = ny + gap/2.0 + offsets_y[i] - hawki_cal_illum_config.s_hy ;
+<a name="l00668"></a>00668 ury = ny + gap/2.0 + offsets_y[i] + hawki_cal_illum_config.s_hy ;
+<a name="l00669"></a>00669 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (chip == 2) {
+<a name="l00670"></a>00670 llx = offsets_x[i] - gap/2.0 - hawki_cal_illum_config.s_hx ;
+<a name="l00671"></a>00671 urx = offsets_x[i] - gap/2.0 + hawki_cal_illum_config.s_hx ;
+<a name="l00672"></a>00672 lly = ny + gap/2.0 + offsets_y[i] - hawki_cal_illum_config.s_hy ;
+<a name="l00673"></a>00673 ury = ny + gap/2.0 + offsets_y[i] + hawki_cal_illum_config.s_hy ;
+<a name="l00674"></a>00674 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (chip == 3) {
+<a name="l00675"></a>00675 llx = offsets_x[i] - gap/2.0 - hawki_cal_illum_config.s_hx ;
+<a name="l00676"></a>00676 urx = offsets_x[i] - gap/2.0 + hawki_cal_illum_config.s_hx ;
+<a name="l00677"></a>00677 lly = offsets_y[i] - gap/2.0 - hawki_cal_illum_config.s_hy ;
+<a name="l00678"></a>00678 ury = offsets_y[i] - gap/2.0 + hawki_cal_illum_config.s_hy ;
+<a name="l00679"></a>00679 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (chip == 4) {
+<a name="l00680"></a>00680 llx = nx + gap/2.0 + offsets_x[i] - hawki_cal_illum_config.s_hx ;
+<a name="l00681"></a>00681 urx = nx + gap/2.0 + offsets_x[i] + hawki_cal_illum_config.s_hx ;
+<a name="l00682"></a>00682 lly = offsets_y[i] - gap/2.0 - hawki_cal_illum_config.s_hy ;
+<a name="l00683"></a>00683 ury = offsets_y[i] - gap/2.0 + hawki_cal_illum_config.s_hy ;
+<a name="l00684"></a>00684 }
+<a name="l00685"></a>00685
+<a name="l00686"></a>00686 <span class="comment">/* Test zone */</span>
+<a name="l00687"></a>00687 <span class="keywordflow">if</span> (llx>urx || lly>ury || llx<1 || urx>nx || lly<1 || ury>ny) {
+<a name="l00688"></a>00688 cpl_msg_error(__func__, <span class="stringliteral">"Bad specified zone"</span>) ;
+<a name="l00689"></a>00689 cpl_bivector_delete(positions) ;
+<a name="l00690"></a>00690 cpl_matrix_delete(kernel) ;
+<a name="l00691"></a>00691 <span class="keywordflow">return</span> NULL ;
+<a name="l00692"></a>00692 }
+<a name="l00693"></a>00693
+<a name="l00694"></a>00694 <span class="comment">/* Extract */</span>
+<a name="l00695"></a>00695 tmp_ima = cpl_image_extract(cur_ima, llx, lly, urx, ury) ;
+<a name="l00696"></a>00696 filtered_ima =cpl_image_filter_median(tmp_ima, kernel) ;
+<a name="l00697"></a>00697 cpl_image_delete(tmp_ima) ;
+<a name="l00698"></a>00698
+<a name="l00699"></a>00699 <span class="comment">/* Find the max */</span>
+<a name="l00700"></a>00700 cpl_image_get_maxpos(filtered_ima, &posx, &posy) ;
+<a name="l00701"></a>00701 positions_x[i] = llx + posx ;
+<a name="l00702"></a>00702 positions_y[i] = lly + posy ;
+<a name="l00703"></a>00703 cpl_image_delete(filtered_ima) ;
+<a name="l00704"></a>00704 cpl_msg_info(__func__, <span class="stringliteral">"Star found at pos %g, %g in image %d"</span>,
+<a name="l00705"></a>00705 positions_x[i], positions_y[i], i+1) ;
+<a name="l00706"></a>00706 }
+<a name="l00707"></a>00707 cpl_matrix_delete(kernel) ;
+<a name="l00708"></a>00708
+<a name="l00709"></a>00709 <span class="keywordflow">return</span> positions ;
+<a name="l00710"></a>00710 }
+<a name="l00711"></a>00711
+<a name="l00712"></a>00712 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00721"></a>00721 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00722"></a>00722 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_illum_save(
+<a name="l00723"></a>00723 <span class="keyword">const</span> cpl_image ** illum,
+<a name="l00724"></a>00724 <span class="keyword">const</span> cpl_table ** flux,
+<a name="l00725"></a>00725 cpl_parameterlist * parlist,
+<a name="l00726"></a>00726 cpl_frameset * <span class="keyword">set</span>)
+<a name="l00727"></a>00727 {
+<a name="l00728"></a>00728 cpl_propertylist ** qclists ;
+<a name="l00729"></a>00729 cpl_propertylist * paflist ;
+<a name="l00730"></a>00730 cpl_propertylist * paflist_cur ;
+<a name="l00731"></a>00731 <span class="keyword">const</span> cpl_frame * ref_frame ;
+<a name="l00732"></a>00732 cpl_propertylist * inputlist ;
+<a name="l00733"></a>00733 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00734"></a>00734 <span class="keywordtype">char</span> * filename ;
+<a name="l00735"></a>00735 <span class="keywordtype">char</span> sval[16] ;
+<a name="l00736"></a>00736 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_cal_illum"</span> ;
+<a name="l00737"></a>00737 <span class="keywordtype">int</span> i;
+<a name="l00738"></a>00738
+<a name="l00739"></a>00739 <span class="comment">/* Get the reference frame */</span>
+<a name="l00740"></a>00740 ref_frame = irplib_frameset_get_first_from_group(<span class="keyword">set</span>, CPL_FRAME_GROUP_RAW) ;
+<a name="l00741"></a>00741
+<a name="l00742"></a>00742 <span class="comment">/* Create the QC lists */</span>
+<a name="l00743"></a>00743 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l00744"></a>00744 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00745"></a>00745 qclists[i] = cpl_propertylist_new() ;
+<a name="l00746"></a>00746 cpl_propertylist_append_double(qclists[i], <span class="stringliteral">"ESO QC DATANCOM"</span>,
+<a name="l00747"></a>00747 cpl_frameset_get_size(<span class="keyword">set</span>)) ;
+<a name="l00748"></a>00748
+<a name="l00749"></a>00749 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00750"></a>00750 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), i+1);
+<a name="l00751"></a>00751 inputlist = cpl_propertylist_load_regexp(
+<a name="l00752"></a>00752 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00753"></a>00753 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l00754"></a>00754 cpl_propertylist_copy_property_regexp(qclists[i], inputlist, <span class="stringliteral">""</span>, 0) ;
+<a name="l00755"></a>00755 cpl_propertylist_delete(inputlist) ;
+<a name="l00756"></a>00756 }
+<a name="l00757"></a>00757
+<a name="l00758"></a>00758 <span class="comment">/* Write the image */</span>
+<a name="l00759"></a>00759 <a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>(<span class="keyword">set</span>,
+<a name="l00760"></a>00760 parlist,
+<a name="l00761"></a>00761 <span class="keyword">set</span>,
+<a name="l00762"></a>00762 (<span class="keyword">const</span> cpl_image **)illum,
+<a name="l00763"></a>00763 recipe_name,
+<a name="l00764"></a>00764 HAWKI_CALPRO_ILLUM,
+<a name="l00765"></a>00765 HAWKI_PROTYPE_ILLUM,
+<a name="l00766"></a>00766 NULL,
+<a name="l00767"></a>00767 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l00768"></a>00768 <span class="stringliteral">"hawki_cal_illum.fits"</span>) ;
+<a name="l00769"></a>00769 <span class="comment">/* To handle cases where a chip is missing */</span>
+<a name="l00770"></a>00770 <span class="keywordflow">if</span> (cpl_error_get_code() == CPL_ERROR_NULL_INPUT) cpl_error_reset() ;
+<a name="l00771"></a>00771
+<a name="l00772"></a>00772 <span class="comment">/* Write the flux table */</span>
+<a name="l00773"></a>00773 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l00774"></a>00774 parlist,
+<a name="l00775"></a>00775 <span class="keyword">set</span>,
+<a name="l00776"></a>00776 (<span class="keyword">const</span> cpl_table **)flux,
+<a name="l00777"></a>00777 recipe_name,
+<a name="l00778"></a>00778 HAWKI_CALPRO_ILLUM_PHOTOM,
+<a name="l00779"></a>00779 HAWKI_PROTYPE_ILLUM_PHOTOM,
+<a name="l00780"></a>00780 NULL,
+<a name="l00781"></a>00781 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l00782"></a>00782 <span class="stringliteral">"hawki_cal_illum_photom.fits"</span>) ;
+<a name="l00783"></a>00783 <span class="comment">/* To handle cases where a chip is missing */</span>
+<a name="l00784"></a>00784 <span class="keywordflow">if</span> (cpl_error_get_code() == CPL_ERROR_NULL_INPUT) cpl_error_reset() ;
+<a name="l00785"></a>00785
+<a name="l00786"></a>00786 <span class="comment">/* Remove the keywords for the FITS extensions */</span>
+<a name="l00787"></a>00787 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00788"></a>00788 cpl_propertylist_erase_regexp(qclists[i], HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l00789"></a>00789 }
+<a name="l00790"></a>00790
+<a name="l00791"></a>00791 <span class="comment">/* Get FITS header from reference file */</span>
+<a name="l00792"></a>00792 paflist = cpl_propertylist_load_regexp(cpl_frame_get_filename(ref_frame),
+<a name="l00793"></a>00793 0, HAWKI_HEADER_PRI_TOPAF, 0) ;
+<a name="l00794"></a>00794
+<a name="l00795"></a>00795 <span class="comment">/* Add the PRO REC1 ID in the paf files */</span>
+<a name="l00796"></a>00796 cpl_propertylist_prepend_string(paflist, <span class="stringliteral">"PRO REC1 ID"</span>, recipe_name) ;
+<a name="l00797"></a>00797
+<a name="l00798"></a>00798 <span class="comment">/* Add the PRO CATG keyword. This is a workaround, since the current </span>
+<a name="l00799"></a>00799 <span class="comment"> * implemented behaviour is not to have PAF files associated to products.</span>
+<a name="l00800"></a>00800 <span class="comment"> * All this will be removed with the FITS2PAF utility in esorex </span>
+<a name="l00801"></a>00801 <span class="comment"> */</span>
+<a name="l00802"></a>00802 cpl_propertylist_prepend_string(paflist, <span class="stringliteral">"PRO CATG"</span>, HAWKI_CALPRO_ILLUM);
+<a name="l00803"></a>00803
+<a name="l00804"></a>00804 <span class="comment">/* Write the extension PAF files */</span>
+<a name="l00805"></a>00805 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00806"></a>00806 <span class="comment">/* Duplicate paflist */</span>
+<a name="l00807"></a>00807 paflist_cur = cpl_propertylist_duplicate(paflist) ;
+<a name="l00808"></a>00808
+<a name="l00809"></a>00809 <span class="comment">/* Add the EXTNAME keyword in the PAF */</span>
+<a name="l00810"></a>00810 sprintf(sval, <span class="stringliteral">"CHIP%d.INT1"</span>, i+1) ;
+<a name="l00811"></a>00811 cpl_propertylist_prepend_string(paflist_cur, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00812"></a>00812
+<a name="l00813"></a>00813 <span class="comment">/* Get FITS header from reference file extension */</span>
+<a name="l00814"></a>00814 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), i+1);
+<a name="l00815"></a>00815 inputlist = cpl_propertylist_load_regexp(
+<a name="l00816"></a>00816 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00817"></a>00817 HAWKI_HEADER_EXT_TOPAF, 0) ;
+<a name="l00818"></a>00818 cpl_propertylist_copy_property_regexp(paflist_cur, inputlist, <span class="stringliteral">""</span>, 0) ;
+<a name="l00819"></a>00819 cpl_propertylist_delete(inputlist) ;
+<a name="l00820"></a>00820
+<a name="l00821"></a>00821 <span class="comment">/* End of Workaround */</span>
+<a name="l00822"></a>00822
+<a name="l00823"></a>00823 <span class="comment">/* Copy the QC in paflist */</span>
+<a name="l00824"></a>00824 cpl_propertylist_copy_property_regexp(paflist_cur, qclists[i], <span class="stringliteral">""</span>, 0) ;
+<a name="l00825"></a>00825
+<a name="l00826"></a>00826 <span class="comment">/* Paf file name */</span>
+<a name="l00827"></a>00827 filename = cpl_sprintf(<span class="stringliteral">"%s_%02d.paf"</span>, recipe_name, i+1) ;
+<a name="l00828"></a>00828
+<a name="l00829"></a>00829 <span class="comment">/* Save the PAF file */</span>
+<a name="l00830"></a>00830 cpl_dfs_save_paf(<span class="stringliteral">"HAWKI"</span>,
+<a name="l00831"></a>00831 recipe_name,
+<a name="l00832"></a>00832 paflist_cur,
+<a name="l00833"></a>00833 filename) ;
+<a name="l00834"></a>00834 cpl_free(filename) ;
+<a name="l00835"></a>00835 cpl_propertylist_delete(paflist_cur) ;
+<a name="l00836"></a>00836 }
+<a name="l00837"></a>00837
+<a name="l00838"></a>00838 <span class="comment">/* Free and return */</span>
+<a name="l00839"></a>00839 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00840"></a>00840 cpl_propertylist_delete(qclists[i]) ;
+<a name="l00841"></a>00841 }
+<a name="l00842"></a>00842 cpl_free(qclists) ;
+<a name="l00843"></a>00843 cpl_propertylist_delete(paflist) ;
+<a name="l00844"></a>00844 <span class="keywordflow">return</span> 0;
+<a name="l00845"></a>00845 }
+<a name="l00846"></a>00846
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__cal__lingain_8c_source.html b/html/hawki__cal__lingain_8c_source.html
new file mode 100644
index 0000000..45b1e8b
--- /dev/null
+++ b/html/hawki__cal__lingain_8c_source.html
@@ -0,0 +1,232 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_cal_lingain.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_cal_lingain.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_cal_lingain.c,v 1.4 2010/09/28 14:13:48 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the CRIRES Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/09/28 14:13:48 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.4 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes and Defines</span>
+<a name="l00034"></a>00034 <span class="comment"> ----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00037"></a>00037
+<a name="l00038"></a>00038 <span class="preprocessor">#include "irplib_detmon_lg.h"</span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_detmon.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_plugin.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00043"></a>00043
+<a name="l00044"></a>00044 <span class="preprocessor">#define RECIPE_NAME "hawki_cal_lingain"</span>
+<a name="l00045"></a>00045 <span class="preprocessor"></span>
+<a name="l00046"></a>00046 <span class="comment">/* Copy here instrument specific keywords which need to be in the PAF file */</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#define INSTREGEXP "ESO INS SETUP ID"</span>
+<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define PAFREGEXP "^(" REGEXP "|" INSTREGEXP ")$"</span>
+<a name="l00049"></a>00049 <span class="preprocessor"></span>
+<a name="l00050"></a>00050
+<a name="l00051"></a>00051 <span class="comment">/*----------------------------------------------------------------------------</span>
+<a name="l00052"></a>00052 <span class="comment"> Functions prototypes</span>
+<a name="l00053"></a>00053 <span class="comment"> ----------------------------------------------------------------------------*/</span>
+<a name="l00054"></a>00054
+<a name="l00057"></a>00057 cpl_error_code hawki_cal_lingain_fill_parlist_default(cpl_parameterlist * parlist);
+<a name="l00058"></a>00058
+<a name="l00059"></a>00059 IRPLIB_RECIPE_DEFINE(hawki_cal_lingain, HAWKI_BINARY_VERSION,
+<a name="l00060"></a>00060 hawki_cal_lingain_fill_parlist_default(recipe->parameters),
+<a name="l00061"></a>00061 <span class="stringliteral">"Enrique Garcia"</span>, PACKAGE_BUGREPORT, <span class="stringliteral">"2009"</span>,
+<a name="l00062"></a>00062 <span class="stringliteral">"Linearity/Gain recipe for the IR domain"</span>,
+<a name="l00063"></a>00063 irplib_detmon_lg_get_description(RECIPE_NAME, <span class="stringliteral">"HAWKI"</span>,
+<a name="l00064"></a>00064 HAWKI_CAL_LINGAIN_LAMP_RAW,
+<a name="l00065"></a>00065 HAWKI_CAL_LINGAIN_DARK_RAW));
+<a name="l00066"></a>00066
+<a name="l00067"></a>00067 <span class="comment">/*---------------------------------------------------------------------------*/</span>
+<a name="l00068"></a>00068 <span class="comment">/*</span>
+<a name="l00069"></a>00069 <span class="comment"> @brief Interpret the command line options and execute the data processing</span>
+<a name="l00070"></a>00070 <span class="comment"> @param frameset the frames list</span>
+<a name="l00071"></a>00071 <span class="comment"> @param parlist the parameters list</span>
+<a name="l00072"></a>00072 <span class="comment"> @return 0 if everything is ok</span>
+<a name="l00073"></a>00073 <span class="comment"> */</span>
+<a name="l00074"></a>00074 <span class="comment">/*---------------------------------------------------------------------------*/</span>
+<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_lingain(cpl_frameset * frameset,
+<a name="l00076"></a>00076 <span class="keyword">const</span> cpl_parameterlist * parlist)
+<a name="l00077"></a>00077 {
+<a name="l00078"></a>00078 cpl_error_code error ;
+<a name="l00079"></a>00079 cpl_propertylist * pro_lintbl ;
+<a name="l00080"></a>00080 cpl_propertylist * pro_gaintbl ;
+<a name="l00081"></a>00081 cpl_propertylist * pro_coeffscube ;
+<a name="l00082"></a>00082 cpl_propertylist * pro_bpm ;
+<a name="l00083"></a>00083 cpl_propertylist * pro_corr ;
+<a name="l00084"></a>00084 cpl_propertylist * pro_diff ;
+<a name="l00085"></a>00085
+<a name="l00086"></a>00086 <span class="comment">/* Create the PRO keys propertylist */</span>
+<a name="l00087"></a>00087 pro_lintbl = cpl_propertylist_new() ;
+<a name="l00088"></a>00088 cpl_propertylist_append_string(pro_lintbl, CPL_DFS_PRO_CATG,
+<a name="l00089"></a>00089 HAWKI_CALPRO_LINGAIN_LIN) ;
+<a name="l00090"></a>00090 cpl_propertylist_append_string(pro_lintbl, CPL_DFS_PRO_TYPE,
+<a name="l00091"></a>00091 HAWKI_PROTYPE_LIN_STATS) ;
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093 pro_gaintbl = cpl_propertylist_new() ;
+<a name="l00094"></a>00094 cpl_propertylist_append_string(pro_gaintbl, CPL_DFS_PRO_CATG,
+<a name="l00095"></a>00095 HAWKI_CALPRO_LINGAIN_GAIN) ;
+<a name="l00096"></a>00096 cpl_propertylist_append_string(pro_gaintbl, CPL_DFS_PRO_TYPE,
+<a name="l00097"></a>00097 HAWKI_PROTYPE_GAIN_STATS) ;
+<a name="l00098"></a>00098
+<a name="l00099"></a>00099 pro_coeffscube = cpl_propertylist_new() ;
+<a name="l00100"></a>00100 cpl_propertylist_append_string(pro_coeffscube, CPL_DFS_PRO_CATG,
+<a name="l00101"></a>00101 HAWKI_CALPRO_LINGAIN_COEFFS) ;
+<a name="l00102"></a>00102 cpl_propertylist_append_string(pro_coeffscube, CPL_DFS_PRO_TYPE,
+<a name="l00103"></a>00103 HAWKI_PROTYPE_LIN_COEFFS) ;
+<a name="l00104"></a>00104
+<a name="l00105"></a>00105 pro_bpm = cpl_propertylist_new() ;
+<a name="l00106"></a>00106 cpl_propertylist_append_string(pro_bpm, CPL_DFS_PRO_CATG,
+<a name="l00107"></a>00107 HAWKI_CALPRO_LINGAIN_BPM) ;
+<a name="l00108"></a>00108 cpl_propertylist_append_string(pro_bpm, CPL_DFS_PRO_TYPE,
+<a name="l00109"></a>00109 HAWKI_PROTYPE_BPM_LEVELS) ;
+<a name="l00110"></a>00110
+<a name="l00111"></a>00111 pro_corr = cpl_propertylist_new() ;
+<a name="l00112"></a>00112 cpl_propertylist_append_string(pro_corr, CPL_DFS_PRO_CATG,
+<a name="l00113"></a>00113 HAWKI_CALPRO_LINGAIN_CORR) ;
+<a name="l00114"></a>00114 cpl_propertylist_append_string(pro_corr, CPL_DFS_PRO_TYPE,
+<a name="l00115"></a>00115 HAWKI_PROTYPE_LINGAIN_CORR) ;
+<a name="l00116"></a>00116
+<a name="l00117"></a>00117 pro_diff = cpl_propertylist_new() ;
+<a name="l00118"></a>00118 cpl_propertylist_append_string(pro_diff, CPL_DFS_PRO_CATG,
+<a name="l00119"></a>00119 HAWKI_CALPRO_LINGAIN_DIFF) ;
+<a name="l00120"></a>00120 cpl_propertylist_append_string(pro_diff, CPL_DFS_PRO_TYPE,
+<a name="l00121"></a>00121 HAWKI_PROTYPE_LINGAIN_DIFF) ;
+<a name="l00122"></a>00122
+<a name="l00123"></a>00123 <span class="comment">/* Call the lingain function */</span>
+<a name="l00124"></a>00124 error = irplib_detmon_lg(frameset,
+<a name="l00125"></a>00125 parlist,
+<a name="l00126"></a>00126 HAWKI_CAL_LINGAIN_LAMP_RAW,
+<a name="l00127"></a>00127 HAWKI_CAL_LINGAIN_DARK_RAW,
+<a name="l00128"></a>00128 RECIPE_NAME,
+<a name="l00129"></a>00129 PACKAGE_TARNAME,
+<a name="l00130"></a>00130 PAFREGEXP,
+<a name="l00131"></a>00131 pro_lintbl,
+<a name="l00132"></a>00132 pro_gaintbl,
+<a name="l00133"></a>00133 pro_coeffscube,
+<a name="l00134"></a>00134 pro_bpm,
+<a name="l00135"></a>00135 pro_corr,
+<a name="l00136"></a>00136 pro_diff,
+<a name="l00137"></a>00137 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00138"></a>00138 NULL, NULL, TRUE);
+<a name="l00139"></a>00139
+<a name="l00140"></a>00140 <span class="comment">/* Delete the PRO keys propertylist */</span>
+<a name="l00141"></a>00141 cpl_propertylist_delete(pro_lintbl) ;
+<a name="l00142"></a>00142 cpl_propertylist_delete(pro_gaintbl) ;
+<a name="l00143"></a>00143 cpl_propertylist_delete(pro_coeffscube) ;
+<a name="l00144"></a>00144 cpl_propertylist_delete(pro_bpm) ;
+<a name="l00145"></a>00145 cpl_propertylist_delete(pro_corr) ;
+<a name="l00146"></a>00146 cpl_propertylist_delete(pro_diff) ;
+<a name="l00147"></a>00147
+<a name="l00148"></a>00148 <span class="comment">/* Propagate the error, if any */</span>
+<a name="l00149"></a>00149 cpl_ensure_code(!error, error);
+<a name="l00150"></a>00150
+<a name="l00151"></a>00151 <span class="comment">/* Return */</span>
+<a name="l00152"></a>00152 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00153"></a>00153 {
+<a name="l00154"></a>00154 cpl_msg_error(__func__,
+<a name="l00155"></a>00155 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00156"></a>00156 <span class="keywordflow">return</span> -1 ;
+<a name="l00157"></a>00157 }
+<a name="l00158"></a>00158 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0;
+<a name="l00159"></a>00159 }
+<a name="l00160"></a>00160
+<a name="l00161"></a>00161 cpl_error_code
+<a name="l00162"></a>00162 hawki_cal_lingain_fill_parlist_default(cpl_parameterlist * parlist)
+<a name="l00163"></a>00163 {
+<a name="l00164"></a>00164 cpl_parameter * p;
+<a name="l00165"></a>00165 cpl_error_code error ;
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 error=irplib_detmon_lg_fill_parlist_nir_default(parlist,
+<a name="l00168"></a>00168 RECIPE_NAME, PACKAGE_TARNAME);
+<a name="l00169"></a>00169 cpl_ensure_code(!error, error);
+<a name="l00170"></a>00170
+<a name="l00171"></a>00171 <span class="comment">/* Set to reduce all extensions */</span>
+<a name="l00172"></a>00172 p = cpl_parameterlist_find(parlist, PACKAGE_TARNAME <span class="stringliteral">"."</span> RECIPE_NAME
+<a name="l00173"></a>00173 <span class="stringliteral">".exts"</span>);
+<a name="l00174"></a>00174 cpl_ensure_code(p != NULL, CPL_ERROR_DATA_NOT_FOUND);
+<a name="l00175"></a>00175 error = cpl_parameter_set_default_int(p, -1);
+<a name="l00176"></a>00176 cpl_ensure_code(!error, error);
+<a name="l00177"></a>00177
+<a name="l00178"></a>00178
+<a name="l00179"></a>00179 <span class="keywordflow">return</span> CPL_ERROR_NONE;
+<a name="l00180"></a>00180 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__cal__zpoint_8c_source.html b/html/hawki__cal__zpoint_8c_source.html
new file mode 100644
index 0000000..864e0d2
--- /dev/null
+++ b/html/hawki__cal__zpoint_8c_source.html
@@ -0,0 +1,1871 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_cal_zpoint.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_cal_zpoint.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_cal_zpoint.c,v 1.34 2012/04/23 09:58:56 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/04/23 09:58:56 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.34 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_calib.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "irplib_strehl.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "irplib_stdstar.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "irplib_cat.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "irplib_wcs.h"</span>
+<a name="l00046"></a>00046
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00053"></a>00053 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00054"></a>00054 <span class="preprocessor">#include "hawki_alloc.h"</span>
+<a name="l00055"></a>00055
+<a name="l00056"></a>00056 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00057"></a>00057 <span class="comment"> Functions prototypes</span>
+<a name="l00058"></a>00058 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00059"></a>00059
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_create(cpl_plugin *) ;
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_exec(cpl_plugin *) ;
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_destroy(cpl_plugin *) ;
+<a name="l00063"></a>00063 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00064"></a>00064
+<a name="l00065"></a>00065 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_cal_zpoint_output_init(<span class="keywordtype">void</span>);
+<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_retrieve_input_param
+<a name="l00067"></a>00067 (cpl_parameterlist * parlist);
+<a name="l00068"></a>00068 <span class="keyword">static</span> cpl_table ** hawki_cal_zpoint_reduce
+<a name="l00069"></a>00069 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l00070"></a>00070 <span class="keyword">const</span> <span class="keywordtype">char</span> * stdstars,
+<a name="l00071"></a>00071 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00072"></a>00072 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00073"></a>00073 cpl_table ** raw_zpoint_stats,
+<a name="l00074"></a>00074 <span class="keywordtype">int</span> * labels,
+<a name="l00075"></a>00075 cpl_imagelist ** images);
+<a name="l00076"></a>00076 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_save
+<a name="l00077"></a>00077 (cpl_table ** zpoint_tables,
+<a name="l00078"></a>00078 <span class="keywordtype">int</span> * labels,
+<a name="l00079"></a>00079 cpl_imagelist * images,
+<a name="l00080"></a>00080 cpl_table ** raw_zpoint_stats,
+<a name="l00081"></a>00081 cpl_frameset * zpoint_frames,
+<a name="l00082"></a>00082 cpl_frameset * calib_frames,
+<a name="l00083"></a>00083 <span class="keyword">const</span> cpl_frame * stars_frame,
+<a name="l00084"></a>00084 cpl_parameterlist * parlist,
+<a name="l00085"></a>00085 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00086"></a>00086 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_compute_qc
+<a name="l00087"></a>00087 (cpl_propertylist * qcmainparams,
+<a name="l00088"></a>00088 cpl_propertylist ** qcextparams,
+<a name="l00089"></a>00089 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00090"></a>00090 <span class="keyword">static</span> cpl_table ** hawki_cal_zpoint_photom
+<a name="l00091"></a>00091 (cpl_imagelist * ilist,
+<a name="l00092"></a>00092 cpl_bivector * pos,
+<a name="l00093"></a>00093 <span class="keywordtype">int</span> * labels);
+<a name="l00094"></a>00094 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_get_mag(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">double</span>, <span class="keywordtype">double</span>, hawki_band) ;
+<a name="l00095"></a>00095 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_compute_keywords
+<a name="l00096"></a>00096 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l00097"></a>00097 <span class="keywordtype">int</span> * labels);
+<a name="l00098"></a>00098 <span class="keyword">static</span> cpl_error_code hawki_cal_zpoint_get_expected_pos
+<a name="l00099"></a>00099 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l00100"></a>00100 <span class="keywordtype">int</span> * labels);
+<a name="l00101"></a>00101 <span class="keywordtype">int</span> hawki_cal_zpoint_check_epoch_equinox(cpl_propertylist * plist);
+<a name="l00102"></a>00102
+<a name="l00103"></a>00103 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00104"></a>00104 <span class="comment"> Static variables</span>
+<a name="l00105"></a>00105 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00106"></a>00106
+<a name="l00107"></a>00107 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00108"></a>00108 <span class="comment">/* Inputs */</span>
+<a name="l00109"></a>00109 <span class="keywordtype">double</span> xcoord[HAWKI_NB_DETECTORS] ;
+<a name="l00110"></a>00110 <span class="keywordtype">double</span> ycoord[HAWKI_NB_DETECTORS] ;
+<a name="l00111"></a>00111 <span class="keywordtype">double</span> target_ra;
+<a name="l00112"></a>00112 <span class="keywordtype">double</span> target_dec;
+<a name="l00113"></a>00113 <span class="keywordtype">double</span> stdstar_given_magnitude;
+<a name="l00114"></a>00114 <span class="keywordtype">double</span> detect_sigma ;
+<a name="l00115"></a>00115 <span class="keywordtype">int</span> sx ;
+<a name="l00116"></a>00116 <span class="keywordtype">int</span> sy ;
+<a name="l00117"></a>00117 <span class="keywordtype">double</span> phot_star_radius ;
+<a name="l00118"></a>00118 <span class="keywordtype">double</span> phot_bg_r1 ;
+<a name="l00119"></a>00119 <span class="keywordtype">double</span> phot_bg_r2 ;
+<a name="l00120"></a>00120 } hawki_cal_zpoint_config;
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="keyword">static</span> <span class="keyword">struct </span>{
+<a name="l00123"></a>00123 <span class="comment">/* Outputs */</span>
+<a name="l00124"></a>00124 <span class="keywordtype">double</span> dit;
+<a name="l00125"></a>00125 <span class="keywordtype">double</span> pixscale;
+<a name="l00126"></a>00126 <span class="keywordtype">char</span> filter[512];
+<a name="l00127"></a>00127 hawki_band band;
+<a name="l00128"></a>00128 <span class="keywordtype">char</span> starname[512];
+<a name="l00129"></a>00129 <span class="keywordtype">char</span> sptype[512];
+<a name="l00130"></a>00130 <span class="keywordtype">char</span> catalog[512];
+<a name="l00131"></a>00131 <span class="keywordtype">double</span> humidity;
+<a name="l00132"></a>00132 <span class="keywordtype">double</span> airmass[HAWKI_NB_DETECTORS];
+<a name="l00133"></a>00133 <span class="keywordtype">double</span> zpoint[HAWKI_NB_DETECTORS];
+<a name="l00134"></a>00134 <span class="keywordtype">double</span> atx0[HAWKI_NB_DETECTORS];
+<a name="l00135"></a>00135 <span class="keywordtype">double</span> posx[HAWKI_NB_DETECTORS];
+<a name="l00136"></a>00136 <span class="keywordtype">double</span> posy[HAWKI_NB_DETECTORS];
+<a name="l00137"></a>00137 <span class="keywordtype">double</span> flux[HAWKI_NB_DETECTORS];
+<a name="l00138"></a>00138 <span class="keywordtype">double</span> instrmag[HAWKI_NB_DETECTORS];
+<a name="l00139"></a>00139 <span class="keywordtype">double</span> peak[HAWKI_NB_DETECTORS];
+<a name="l00140"></a>00140 <span class="keywordtype">double</span> bgd[HAWKI_NB_DETECTORS];
+<a name="l00141"></a>00141 <span class="keywordtype">double</span> fwhmx[HAWKI_NB_DETECTORS];
+<a name="l00142"></a>00142 <span class="keywordtype">double</span> fwhmy[HAWKI_NB_DETECTORS];
+<a name="l00143"></a>00143 <span class="keywordtype">double</span> fwhm[HAWKI_NB_DETECTORS];
+<a name="l00144"></a>00144 <span class="keywordtype">double</span> fwhmx_as[HAWKI_NB_DETECTORS];
+<a name="l00145"></a>00145 <span class="keywordtype">double</span> fwhmy_as[HAWKI_NB_DETECTORS];
+<a name="l00146"></a>00146 <span class="keywordtype">double</span> fwhm_as[HAWKI_NB_DETECTORS];
+<a name="l00147"></a>00147 <span class="keywordtype">double</span> mean_zpoint;
+<a name="l00148"></a>00148 <span class="keywordtype">double</span> mean_atx0;
+<a name="l00149"></a>00149 <span class="keywordtype">double</span> mean_airmass;
+<a name="l00150"></a>00150 <span class="keywordtype">double</span> ext_coeff;
+<a name="l00151"></a>00151 <span class="keywordtype">double</span> stdstar_ra;
+<a name="l00152"></a>00152 <span class="keywordtype">double</span> stdstar_dec;
+<a name="l00153"></a>00153 <span class="keywordtype">double</span> stdstar_mag_filter;
+<a name="l00154"></a>00154 <span class="keywordtype">double</span> stdstar_mag_H;
+<a name="l00155"></a>00155 <span class="keywordtype">double</span> stdstar_mag_J;
+<a name="l00156"></a>00156 <span class="keywordtype">double</span> stdstar_mag_K;
+<a name="l00157"></a>00157 <span class="keywordtype">double</span> stdstar_mag_Y;
+<a name="l00158"></a>00158 <span class="keywordtype">int</span> stdstar_incat_found;
+<a name="l00159"></a>00159 <span class="keywordtype">int</span> stdstar_mag_available;
+<a name="l00160"></a>00160 <span class="keywordtype">int</span> stdstar_image_detected[HAWKI_NB_DETECTORS];
+<a name="l00161"></a>00161 <span class="keywordtype">int</span> zpoint_computable[HAWKI_NB_DETECTORS];
+<a name="l00162"></a>00162 <span class="keywordtype">int</span> zpoint_mean_computable;
+<a name="l00163"></a>00163 } hawki_cal_zpoint_outputs;
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_cal_zpoint_description[] =
+<a name="l00166"></a>00166 <span class="stringliteral">"hawki_cal_zpoint -- Zero point recipe\n"</span>
+<a name="l00167"></a>00167 <span class="stringliteral">"The input of the recipe files listed in the Set Of Frames (sof-file)\n"</span>
+<a name="l00168"></a>00168 <span class="stringliteral">"must be tagged as:\n"</span>
+<a name="l00169"></a>00169 <span class="stringliteral">"raw-file.fits "</span>HAWKI_CAL_ZPOINT_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00170"></a>00170 <span class="stringliteral">"stdstars-file.fits "</span>HAWKI_CALPRO_STDSTARS<span class="stringliteral">" or\n"</span>
+<a name="l00171"></a>00171 <span class="stringliteral">"flat-file.fits "</span>HAWKI_CALPRO_FLAT<span class="stringliteral">" or\n"</span>
+<a name="l00172"></a>00172 <span class="stringliteral">"bpm-file.fits "</span>HAWKI_CALPRO_BPM<span class="stringliteral">"\n"</span>
+<a name="l00173"></a>00173 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00174"></a>00174 <span class="stringliteral">"hawki_cal_zpoint.fits ("</span>HAWKI_CALPRO_ZPOINT_TAB<span class="stringliteral">"): Zero point solution table\n"</span>
+<a name="l00175"></a>00175 <span class="stringliteral">"hawki_cal_zpoint_check.fits ("</span>HAWKI_CALPRO_ZPOINT_IMA<span class="stringliteral">"): Standard star images corrected (for checking purposes)\n"</span>
+<a name="l00176"></a>00176 <span class="stringliteral">"hawki_cal_zpoint_stats.fits ("</span>HAWKI_CALPRO_ZPOINT_STATS<span class="stringliteral">"): Statistics of the raw standard star images\n"</span>
+<a name="l00177"></a>00177 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00178"></a>00178 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00179"></a>00179 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00182"></a>00182 <span class="comment"> Functions code</span>
+<a name="l00183"></a>00183 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00184"></a>00184
+<a name="l00185"></a>00185 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00193"></a>00193 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00194"></a>00194 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00195"></a>00195 {
+<a name="l00196"></a>00196 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe));
+<a name="l00197"></a>00197 cpl_plugin * plugin = &recipe->interface;
+<a name="l00198"></a>00198
+<a name="l00199"></a>00199 cpl_plugin_init(plugin,
+<a name="l00200"></a>00200 CPL_PLUGIN_API,
+<a name="l00201"></a>00201 HAWKI_BINARY_VERSION,
+<a name="l00202"></a>00202 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00203"></a>00203 <span class="stringliteral">"hawki_cal_zpoint"</span>,
+<a name="l00204"></a>00204 <span class="stringliteral">"Zero point computation recipe"</span>,
+<a name="l00205"></a>00205 hawki_cal_zpoint_description,
+<a name="l00206"></a>00206 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00207"></a>00207 PACKAGE_BUGREPORT,
+<a name="l00208"></a>00208 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00209"></a>00209 hawki_cal_zpoint_create,
+<a name="l00210"></a>00210 hawki_cal_zpoint_exec,
+<a name="l00211"></a>00211 hawki_cal_zpoint_destroy) ;
+<a name="l00212"></a>00212
+<a name="l00213"></a>00213 cpl_pluginlist_append(list, plugin) ;
+<a name="l00214"></a>00214
+<a name="l00215"></a>00215 <span class="keywordflow">return</span> 0;
+<a name="l00216"></a>00216 }
+<a name="l00217"></a>00217
+<a name="l00218"></a>00218 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00227"></a>00227 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00228"></a>00228 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_create(cpl_plugin * plugin)
+<a name="l00229"></a>00229 {
+<a name="l00230"></a>00230 cpl_recipe * recipe ;
+<a name="l00231"></a>00231 cpl_parameter * p ;
+<a name="l00232"></a>00232
+<a name="l00233"></a>00233 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00234"></a>00234 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00235"></a>00235 recipe = (cpl_recipe *)plugin ;
+<a name="l00236"></a>00236 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00237"></a>00237
+<a name="l00238"></a>00238 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00239"></a>00239 recipe->parameters = cpl_parameterlist_new();
+<a name="l00240"></a>00240 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00241"></a>00241 <span class="keywordflow">return</span> 1;
+<a name="l00242"></a>00242
+<a name="l00243"></a>00243 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00244"></a>00244 <span class="comment">/* --detect_sigma */</span>
+<a name="l00245"></a>00245 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.detect_sigma"</span>,
+<a name="l00246"></a>00246 CPL_TYPE_DOUBLE, <span class="stringliteral">"the sigma value for object detection"</span>,
+<a name="l00247"></a>00247 <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, 7.0);
+<a name="l00248"></a>00248 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"detect_sigma"</span>) ;
+<a name="l00249"></a>00249 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00250"></a>00250 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00251"></a>00251 <span class="comment">/* --star_r */</span>
+<a name="l00252"></a>00252 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.star_r"</span>,CPL_TYPE_DOUBLE,
+<a name="l00253"></a>00253 <span class="stringliteral">"the star radius"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, -1.0) ;
+<a name="l00254"></a>00254 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"star_r"</span>) ;
+<a name="l00255"></a>00255 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00256"></a>00256 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00257"></a>00257 <span class="comment">/* --bg_r1 */</span>
+<a name="l00258"></a>00258 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.bg_r1"</span>, CPL_TYPE_DOUBLE,
+<a name="l00259"></a>00259 <span class="stringliteral">"the internal background radius"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, -1.0) ;
+<a name="l00260"></a>00260 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"bg_r1"</span>) ;
+<a name="l00261"></a>00261 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00262"></a>00262 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00263"></a>00263 <span class="comment">/* --bg_r2 */</span>
+<a name="l00264"></a>00264 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.bg_r2"</span>, CPL_TYPE_DOUBLE,
+<a name="l00265"></a>00265 <span class="stringliteral">"the external background radius"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, -1.0) ;
+<a name="l00266"></a>00266 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"bg_r2"</span>) ;
+<a name="l00267"></a>00267 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00268"></a>00268 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00269"></a>00269 <span class="comment">/* --ra */</span>
+<a name="l00270"></a>00270 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.ra"</span>, CPL_TYPE_DOUBLE,
+<a name="l00271"></a>00271 <span class="stringliteral">"RA in degrees"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, 999.0) ;
+<a name="l00272"></a>00272 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ra"</span>) ;
+<a name="l00273"></a>00273 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00274"></a>00274 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00275"></a>00275 <span class="comment">/* --dec */</span>
+<a name="l00276"></a>00276 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.dec"</span>, CPL_TYPE_DOUBLE,
+<a name="l00277"></a>00277 <span class="stringliteral">"DEC in degrees"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, 999.0) ;
+<a name="l00278"></a>00278 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"dec"</span>) ;
+<a name="l00279"></a>00279 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00280"></a>00280 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00281"></a>00281 <span class="comment">/* --mag */</span>
+<a name="l00282"></a>00282 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.mag"</span>, CPL_TYPE_DOUBLE,
+<a name="l00283"></a>00283 <span class="stringliteral">"magnitude"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, 99.0) ;
+<a name="l00284"></a>00284 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"mag"</span>) ;
+<a name="l00285"></a>00285 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00286"></a>00286 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00287"></a>00287 <span class="comment">/* --sx */</span>
+<a name="l00288"></a>00288 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.sx"</span>, CPL_TYPE_INT,
+<a name="l00289"></a>00289 <span class="stringliteral">"x half-size of the search box"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, 100) ;
+<a name="l00290"></a>00290 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sx"</span>) ;
+<a name="l00291"></a>00291 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00292"></a>00292 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00293"></a>00293 <span class="comment">/* --sy */</span>
+<a name="l00294"></a>00294 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.sy"</span>, CPL_TYPE_INT,
+<a name="l00295"></a>00295 <span class="stringliteral">"y half-size of the search box"</span>, <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, 100) ;
+<a name="l00296"></a>00296 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sy"</span>) ;
+<a name="l00297"></a>00297 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00298"></a>00298 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00299"></a>00299 <span class="comment">/* --xcoord */</span>
+<a name="l00300"></a>00300 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.xcoord"</span>, CPL_TYPE_STRING,
+<a name="l00301"></a>00301 <span class="stringliteral">"Coordinates in X where the standard star is located. If -1 use WCS"</span>,
+<a name="l00302"></a>00302 <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, <span class="stringliteral">"-1., -1., -1., -1."</span>);
+<a name="l00303"></a>00303 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"xcoord"</span>) ;
+<a name="l00304"></a>00304 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00305"></a>00305 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00306"></a>00306 <span class="comment">/* --ycoord */</span>
+<a name="l00307"></a>00307 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_cal_zpoint.ycoord"</span>, CPL_TYPE_STRING,
+<a name="l00308"></a>00308 <span class="stringliteral">"Coordinates in Y where the standard star is located. If -1 use WCS"</span>,
+<a name="l00309"></a>00309 <span class="stringliteral">"hawki.hawki_cal_zpoint"</span>, <span class="stringliteral">"-1., -1., -1., -1."</span>) ;
+<a name="l00310"></a>00310 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ycoord"</span>) ;
+<a name="l00311"></a>00311 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00312"></a>00312 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00313"></a>00313
+<a name="l00314"></a>00314 <span class="comment">/* Return */</span>
+<a name="l00315"></a>00315 <span class="keywordflow">return</span> 0;
+<a name="l00316"></a>00316 }
+<a name="l00317"></a>00317
+<a name="l00318"></a>00318 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00324"></a>00324 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00325"></a>00325 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_exec(cpl_plugin * plugin)
+<a name="l00326"></a>00326 {
+<a name="l00327"></a>00327 cpl_recipe * recipe ;
+<a name="l00328"></a>00328
+<a name="l00329"></a>00329 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00330"></a>00330 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00331"></a>00331 recipe = (cpl_recipe *)plugin ;
+<a name="l00332"></a>00332 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00333"></a>00333
+<a name="l00334"></a>00334 <span class="comment">/* Issue a banner */</span>
+<a name="l00335"></a>00335 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00336"></a>00336
+<a name="l00337"></a>00337 <span class="keywordflow">return</span> hawki_cal_zpoint(recipe->parameters, recipe->frames) ;
+<a name="l00338"></a>00338 }
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00346"></a>00346 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00347"></a>00347 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_destroy(cpl_plugin * plugin)
+<a name="l00348"></a>00348 {
+<a name="l00349"></a>00349 cpl_recipe * recipe ;
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00352"></a>00352 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00353"></a>00353 recipe = (cpl_recipe *)plugin ;
+<a name="l00354"></a>00354 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00355"></a>00355
+<a name="l00356"></a>00356 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00357"></a>00357 <span class="keywordflow">return</span> 0 ;
+<a name="l00358"></a>00358 }
+<a name="l00359"></a>00359
+<a name="l00360"></a>00360 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00367"></a>00367 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00368"></a>00368 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint(
+<a name="l00369"></a>00369 cpl_parameterlist * parlist,
+<a name="l00370"></a>00370 cpl_frameset * framelist)
+<a name="l00371"></a>00371 {
+<a name="l00372"></a>00372 cpl_parameter * par ;
+<a name="l00373"></a>00373 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat ;
+<a name="l00374"></a>00374 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm ;
+<a name="l00375"></a>00375 <span class="keyword">const</span> <span class="keywordtype">char</span> * stdstars ;
+<a name="l00376"></a>00376 cpl_frameset * zpoint_frames ;
+<a name="l00377"></a>00377 cpl_frameset * calib_frames ;
+<a name="l00378"></a>00378 <span class="keyword">const</span> cpl_frame * stars_frame;
+<a name="l00379"></a>00379 cpl_table ** raw_zpoint_stats;
+<a name="l00380"></a>00380 cpl_table ** zpoint_tables;
+<a name="l00381"></a>00381 cpl_imagelist * std_star_images ;
+<a name="l00382"></a>00382 <span class="keywordtype">int</span> * labels;
+<a name="l00383"></a>00383 <span class="keywordtype">int</span> idet;
+<a name="l00384"></a>00384
+<a name="l00385"></a>00385 <span class="comment">/* Initialise Output */</span>
+<a name="l00386"></a>00386 hawki_cal_zpoint_output_init();
+<a name="l00387"></a>00387 zpoint_frames = NULL ;
+<a name="l00388"></a>00388 par = NULL ;
+<a name="l00389"></a>00389
+<a name="l00390"></a>00390 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00391"></a>00391 <span class="keywordflow">if</span>(hawki_cal_zpoint_retrieve_input_param(parlist))
+<a name="l00392"></a>00392 {
+<a name="l00393"></a>00393 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00394"></a>00394 <span class="keywordflow">return</span> -1;
+<a name="l00395"></a>00395 }
+<a name="l00396"></a>00396
+<a name="l00397"></a>00397 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00398"></a>00398 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00399"></a>00399 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00400"></a>00400 <span class="keywordflow">return</span> -1 ;
+<a name="l00401"></a>00401 }
+<a name="l00402"></a>00402
+<a name="l00403"></a>00403 <span class="comment">/* Retrieve calibration data */</span>
+<a name="l00404"></a>00404 calib_frames = cpl_frameset_new();
+<a name="l00405"></a>00405 flat = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_FLAT) ;
+<a name="l00406"></a>00406 <span class="keywordflow">if</span>(flat)
+<a name="l00407"></a>00407 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+<a name="l00408"></a>00408 cpl_frameset_find_const(framelist, HAWKI_CALPRO_FLAT)));
+<a name="l00409"></a>00409 bpm = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_BPM) ;
+<a name="l00410"></a>00410 <span class="keywordflow">if</span>(bpm)
+<a name="l00411"></a>00411 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+<a name="l00412"></a>00412 cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM)));
+<a name="l00413"></a>00413
+<a name="l00414"></a>00414 <span class="comment">/* STD stars catalog requested */</span>
+<a name="l00415"></a>00415 stars_frame = cpl_frameset_find_const(framelist, HAWKI_CALPRO_STDSTARS);
+<a name="l00416"></a>00416 <span class="keywordflow">if</span> (stars_frame == NULL)
+<a name="l00417"></a>00417 {
+<a name="l00418"></a>00418 cpl_msg_error(__func__,<span class="stringliteral">"Cannot find the catalog in the input list (%s)"</span>,
+<a name="l00419"></a>00419 HAWKI_CALPRO_STDSTARS);
+<a name="l00420"></a>00420 cpl_frameset_delete(calib_frames);
+<a name="l00421"></a>00421 <span class="keywordflow">return</span> -1 ;
+<a name="l00422"></a>00422 }
+<a name="l00423"></a>00423 stdstars = cpl_frame_get_filename(stars_frame);
+<a name="l00424"></a>00424
+<a name="l00425"></a>00425 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00426"></a>00426 <span class="keywordflow">if</span> ((zpoint_frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist,
+<a name="l00427"></a>00427 HAWKI_CAL_ZPOINT_RAW)) != NULL) {
+<a name="l00428"></a>00428 } <span class="keywordflow">else</span> {
+<a name="l00429"></a>00429 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find raw frames in the input list (%s)"</span>,
+<a name="l00430"></a>00430 HAWKI_CAL_ZPOINT_RAW);
+<a name="l00431"></a>00431 cpl_frameset_delete(calib_frames);
+<a name="l00432"></a>00432 <span class="keywordflow">return</span> -1 ;
+<a name="l00433"></a>00433 }
+<a name="l00434"></a>00434
+<a name="l00435"></a>00435 <span class="comment">/* Exactly 4 images are expected */</span>
+<a name="l00436"></a>00436 <span class="keywordflow">if</span> (cpl_frameset_get_size(zpoint_frames) != 4) {
+<a name="l00437"></a>00437 cpl_msg_error(__func__,
+<a name="l00438"></a>00438 <span class="stringliteral">"4 input raw frames are expected, not %"</span>CPL_SIZE_FORMAT,
+<a name="l00439"></a>00439 cpl_frameset_get_size(zpoint_frames)) ;
+<a name="l00440"></a>00440 cpl_frameset_delete(zpoint_frames) ;
+<a name="l00441"></a>00441 cpl_frameset_delete(calib_frames);
+<a name="l00442"></a>00442 <span class="keywordflow">return</span> -1 ;
+<a name="l00443"></a>00443 }
+<a name="l00444"></a>00444
+<a name="l00445"></a>00445 <span class="comment">/* Create the statistics table */</span>
+<a name="l00446"></a>00446 raw_zpoint_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00447"></a>00447 <span class="keywordflow">for</span>(idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00448"></a>00448 {
+<a name="l00449"></a>00449 raw_zpoint_stats[idet] = cpl_table_new(
+<a name="l00450"></a>00450 cpl_frameset_get_size(zpoint_frames));
+<a name="l00451"></a>00451 }
+<a name="l00452"></a>00452 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_zpoint_stats);
+<a name="l00453"></a>00453
+<a name="l00454"></a>00454 <span class="comment">/* Compute the zpoint values */</span>
+<a name="l00455"></a>00455 cpl_msg_info(__func__, <span class="stringliteral">"Reduce the data"</span>) ;
+<a name="l00456"></a>00456 cpl_msg_indent_more() ;
+<a name="l00457"></a>00457 labels = cpl_calloc(cpl_frameset_get_size(zpoint_frames), <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>)) ;
+<a name="l00458"></a>00458 <span class="keywordflow">if</span> ((zpoint_tables = hawki_cal_zpoint_reduce(zpoint_frames, stdstars,
+<a name="l00459"></a>00459 bpm, flat, raw_zpoint_stats, labels, &std_star_images))==NULL)
+<a name="l00460"></a>00460 {
+<a name="l00461"></a>00461 cpl_msg_error(__func__, <span class="stringliteral">"Cannot reduce the data"</span>) ;
+<a name="l00462"></a>00462 cpl_frameset_delete(zpoint_frames) ;
+<a name="l00463"></a>00463 cpl_frameset_delete(calib_frames);
+<a name="l00464"></a>00464 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(raw_zpoint_stats);
+<a name="l00465"></a>00465 cpl_free(labels);
+<a name="l00466"></a>00466 cpl_msg_indent_less() ;
+<a name="l00467"></a>00467 <span class="keywordflow">return</span> -1 ;
+<a name="l00468"></a>00468 }
+<a name="l00469"></a>00469 cpl_msg_indent_less() ;
+<a name="l00470"></a>00470
+<a name="l00471"></a>00471 <span class="comment">/* Save the products */</span>
+<a name="l00472"></a>00472 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00473"></a>00473 cpl_msg_indent_more() ;
+<a name="l00474"></a>00474 <span class="keywordflow">if</span> (hawki_cal_zpoint_save
+<a name="l00475"></a>00475 (zpoint_tables, labels, std_star_images, raw_zpoint_stats,
+<a name="l00476"></a>00476 zpoint_frames, calib_frames, stars_frame,
+<a name="l00477"></a>00477 parlist, framelist) == -1)
+<a name="l00478"></a>00478 {
+<a name="l00479"></a>00479 cpl_msg_warning(__func__, <span class="stringliteral">"Data could not be saved. "</span>
+<a name="l00480"></a>00480 <span class="stringliteral">"Check permisions or disk space"</span>) ;
+<a name="l00481"></a>00481 cpl_frameset_delete(zpoint_frames);
+<a name="l00482"></a>00482 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_tables) ;
+<a name="l00483"></a>00483 cpl_imagelist_delete(std_star_images) ;
+<a name="l00484"></a>00484 cpl_frameset_delete(calib_frames);
+<a name="l00485"></a>00485 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(raw_zpoint_stats);
+<a name="l00486"></a>00486 cpl_free(labels);
+<a name="l00487"></a>00487 cpl_msg_indent_less() ;
+<a name="l00488"></a>00488 <span class="keywordflow">return</span> -1 ;
+<a name="l00489"></a>00489 }
+<a name="l00490"></a>00490 cpl_msg_indent_less() ;
+<a name="l00491"></a>00491
+<a name="l00492"></a>00492 <span class="comment">/* Free and return */</span>
+<a name="l00493"></a>00493 cpl_frameset_delete(zpoint_frames);
+<a name="l00494"></a>00494 cpl_frameset_delete(calib_frames);
+<a name="l00495"></a>00495 cpl_imagelist_delete(std_star_images);
+<a name="l00496"></a>00496 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_tables);
+<a name="l00497"></a>00497 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(raw_zpoint_stats);
+<a name="l00498"></a>00498 cpl_free(labels);
+<a name="l00499"></a>00499
+<a name="l00500"></a>00500 <span class="comment">/* Return */</span>
+<a name="l00501"></a>00501 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00502"></a>00502 {
+<a name="l00503"></a>00503 cpl_msg_error(__func__,
+<a name="l00504"></a>00504 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00505"></a>00505 <span class="keywordflow">return</span> -1 ;
+<a name="l00506"></a>00506 }
+<a name="l00507"></a>00507 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00508"></a>00508 }
+<a name="l00509"></a>00509
+<a name="l00510"></a>00510 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00520"></a>00520 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00521"></a>00521 <span class="keyword">static</span> cpl_table ** hawki_cal_zpoint_reduce
+<a name="l00522"></a>00522 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l00523"></a>00523 <span class="keyword">const</span> <span class="keywordtype">char</span> * stdstars,
+<a name="l00524"></a>00524 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00525"></a>00525 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00526"></a>00526 cpl_table ** raw_zpoint_stats,
+<a name="l00527"></a>00527 <span class="keywordtype">int</span> * labels,
+<a name="l00528"></a>00528 cpl_imagelist ** star_images)
+<a name="l00529"></a>00529 {
+<a name="l00530"></a>00530 cpl_frame * cur_frame ;
+<a name="l00531"></a>00531 cpl_propertylist * plist ;
+<a name="l00532"></a>00532 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00533"></a>00533 cpl_imagelist * star_images_frame_order ;
+<a name="l00534"></a>00534 <span class="keywordtype">int</span> nima ;
+<a name="l00535"></a>00535 cpl_bivector * positions ;
+<a name="l00536"></a>00536 cpl_image * filt_ima ;
+<a name="l00537"></a>00537 cpl_mask * kernel;
+<a name="l00538"></a>00538 <span class="keywordtype">int</span> size_x, size_y ;
+<a name="l00539"></a>00539 <span class="keywordtype">double</span> pos_x, pos_y, pos_x_cen, pos_y_cen, dist, min_dist ;
+<a name="l00540"></a>00540 cpl_apertures * aperts ;
+<a name="l00541"></a>00541 cpl_table ** zpoint_tables;
+<a name="l00542"></a>00542 cpl_image * tmp_ima ;
+<a name="l00543"></a>00543 <span class="keywordtype">int</span> iaper;
+<a name="l00544"></a>00544 <span class="keywordtype">int</span> idet;
+<a name="l00545"></a>00545 <span class="keywordtype">int</span> iframe;
+<a name="l00546"></a>00546 <span class="keywordtype">int</span> iframe_star = -1;
+<a name="l00547"></a>00547 <span class="keywordtype">int</span> nframes;
+<a name="l00548"></a>00548 <span class="keywordtype">char</span> rastr[32];
+<a name="l00549"></a>00549 <span class="keywordtype">char</span> decstr[32];
+<a name="l00550"></a>00550 cpl_errorstate error_prevstate;
+<a name="l00551"></a>00551 <span class="keywordtype">int</span> return_code;
+<a name="l00552"></a>00552
+<a name="l00553"></a>00553 <span class="comment">/* Check inputs */</span>
+<a name="l00554"></a>00554 <span class="keywordflow">if</span> (<span class="keyword">set</span> == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00555"></a>00555 <span class="keywordflow">if</span> (stdstars == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00556"></a>00556 <span class="keywordflow">if</span> (star_images == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00557"></a>00557
+<a name="l00558"></a>00558 <span class="comment">/* Get the filter name, DIT, Target RA and DEC */</span>
+<a name="l00559"></a>00559 error_prevstate = cpl_errorstate_get();
+<a name="l00560"></a>00560 cur_frame = cpl_frameset_get_frame(<span class="keyword">set</span>, 0) ;
+<a name="l00561"></a>00561 plist=cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0) ;
+<a name="l00562"></a>00562 <span class="keywordflow">if</span> ((sval = <a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501" title="find out which wave band is active">hawki_pfits_get_filter</a>(plist)) == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00563"></a>00563 <span class="keywordflow">else</span> sprintf(hawki_cal_zpoint_outputs.filter, sval) ;
+<a name="l00564"></a>00564 <span class="keywordflow">if</span> (hawki_cal_zpoint_config.target_ra > 998.0)
+<a name="l00565"></a>00565 {
+<a name="l00566"></a>00566 hawki_cal_zpoint_config.target_ra = <a class="code" href="group__hawki__pfits.html#ga36892dc77006059ba553e9a98c9b55fc" title="find out the target RA">hawki_pfits_get_targ_alpha</a>(plist);
+<a name="l00567"></a>00567 <span class="comment">//hawki_cal_zpoint_config.target_ra = hawki_pfits_get_ra(plist) -</span>
+<a name="l00568"></a>00568 <span class="comment">//hawki_pfits_get_cumoffseta(plist) / 3600.;// Not valid before Nov 2008</span>
+<a name="l00569"></a>00569 <span class="keywordflow">if</span>(hawki_cal_zpoint_check_epoch_equinox(plist) == -1)
+<a name="l00570"></a>00570 {
+<a name="l00571"></a>00571 cpl_propertylist_delete(plist);
+<a name="l00572"></a>00572 <span class="keywordflow">return</span> NULL;
+<a name="l00573"></a>00573 }
+<a name="l00574"></a>00574 }
+<a name="l00575"></a>00575 <span class="keywordflow">if</span> (hawki_cal_zpoint_config.target_dec > 998.0)
+<a name="l00576"></a>00576 {
+<a name="l00577"></a>00577 hawki_cal_zpoint_config.target_dec = <a class="code" href="group__hawki__pfits.html#ga0330c53376304376257417ea4edbee5c" title="find out the target DEC">hawki_pfits_get_targ_delta</a>(plist);
+<a name="l00578"></a>00578 <span class="comment">//hawki_cal_zpoint_config.target_dec = hawki_pfits_get_dec(plist) -</span>
+<a name="l00579"></a>00579 <span class="comment">//hawki_pfits_get_cumoffsetd(plist) / 3600.;// Not valid before Nov 2008</span>
+<a name="l00580"></a>00580 <span class="keywordflow">if</span>(hawki_cal_zpoint_check_epoch_equinox(plist) == -1)
+<a name="l00581"></a>00581 {
+<a name="l00582"></a>00582 cpl_propertylist_delete(plist);
+<a name="l00583"></a>00583 <span class="keywordflow">return</span> NULL;
+<a name="l00584"></a>00584 }
+<a name="l00585"></a>00585 }
+<a name="l00586"></a>00586 hawki_cal_zpoint_outputs.dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist) ;
+<a name="l00587"></a>00587 hawki_cal_zpoint_outputs.pixscale = <a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b" title="find out the pixel scale">hawki_pfits_get_pixscale</a>(plist) ;
+<a name="l00588"></a>00588 cpl_propertylist_delete(plist) ;
+<a name="l00589"></a>00589 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00590"></a>00590 {
+<a name="l00591"></a>00591 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get keywords from main header:"</span>);
+<a name="l00592"></a>00592 cpl_msg_indent_more();
+<a name="l00593"></a>00593 cpl_msg_error(__func__, <span class="stringliteral">"%s"</span>,cpl_error_get_message());
+<a name="l00594"></a>00594 cpl_msg_indent_less();
+<a name="l00595"></a>00595 <span class="keywordflow">return</span> NULL ;
+<a name="l00596"></a>00596 }
+<a name="l00597"></a>00597 cpl_msg_info(__func__,<span class="stringliteral">"Searching catalog stars closest to target:"</span>);
+<a name="l00598"></a>00598 cpl_msg_indent_more();
+<a name="l00599"></a>00599 <a class="code" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3" title="This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)">hawki_utils_ra2str</a>(rastr, 32, hawki_cal_zpoint_config.target_ra);
+<a name="l00600"></a>00600 <a class="code" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6" title="This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2...">hawki_utils_dec2str</a>(decstr, 32, hawki_cal_zpoint_config.target_dec);
+<a name="l00601"></a>00601 cpl_msg_info(__func__,<span class="stringliteral">"RA = %g (%s); DEC = %g (%s)"</span>,
+<a name="l00602"></a>00602 hawki_cal_zpoint_config.target_ra, rastr,
+<a name="l00603"></a>00603 hawki_cal_zpoint_config.target_dec, decstr);
+<a name="l00604"></a>00604 cpl_msg_info(__func__,<span class="stringliteral">"HAWK-I Filter: %s"</span>, hawki_cal_zpoint_outputs.filter);
+<a name="l00605"></a>00605 cpl_msg_indent_less();
+<a name="l00606"></a>00606
+<a name="l00607"></a>00607 <span class="comment">/* Get the band */</span>
+<a name="l00608"></a>00608 <span class="keywordflow">if</span> ((hawki_cal_zpoint_outputs.band =
+<a name="l00609"></a>00609 <a class="code" href="group__hawki__utils.html#ga6d85879fd8b8895544f7787e8a6ddade" title="Get the band.">hawki_get_band</a>(hawki_cal_zpoint_outputs.filter)) ==
+<a name="l00610"></a>00610 HAWKI_BAND_UNKNOWN) {
+<a name="l00611"></a>00611 cpl_msg_error(__func__, <span class="stringliteral">"Cannot associate the filter %s to a band"</span>,
+<a name="l00612"></a>00612 hawki_cal_zpoint_outputs.filter) ;
+<a name="l00613"></a>00613 <span class="keywordflow">return</span> NULL ;
+<a name="l00614"></a>00614 }
+<a name="l00615"></a>00615
+<a name="l00616"></a>00616 <span class="comment">/* Get the standard star information from database */</span>
+<a name="l00617"></a>00617 cpl_msg_indent_more();
+<a name="l00618"></a>00618 return_code = hawki_cal_zpoint_get_mag(stdstars,
+<a name="l00619"></a>00619 hawki_cal_zpoint_config.target_ra,
+<a name="l00620"></a>00620 hawki_cal_zpoint_config.target_dec,
+<a name="l00621"></a>00621 hawki_cal_zpoint_outputs.band);
+<a name="l00622"></a>00622 <span class="keywordflow">if</span> (return_code == -1)
+<a name="l00623"></a>00623 {
+<a name="l00624"></a>00624 cpl_msg_error(__func__, <span class="stringliteral">"Could not open star database"</span>);
+<a name="l00625"></a>00625 <span class="keywordflow">return</span> NULL ;
+<a name="l00626"></a>00626 }
+<a name="l00627"></a>00627 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(return_code == 1)
+<a name="l00628"></a>00628 {
+<a name="l00629"></a>00629 cpl_msg_warning(__func__,<span class="stringliteral">"No suitable star found in catalog"</span>);
+<a name="l00630"></a>00630 cpl_msg_warning(__func__,<span class="stringliteral">"Using the target coordinates "</span>
+<a name="l00631"></a>00631 <span class="stringliteral">"as the standard star coordinates: "</span>);
+<a name="l00632"></a>00632 hawki_cal_zpoint_outputs.stdstar_ra =
+<a name="l00633"></a>00633 hawki_cal_zpoint_config.target_ra;
+<a name="l00634"></a>00634 hawki_cal_zpoint_outputs.stdstar_dec =
+<a name="l00635"></a>00635 hawki_cal_zpoint_config.target_dec;
+<a name="l00636"></a>00636 <a class="code" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3" title="This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)">hawki_utils_ra2str</a>(rastr, 32, hawki_cal_zpoint_outputs.stdstar_ra);
+<a name="l00637"></a>00637 <a class="code" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6" title="This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2...">hawki_utils_dec2str</a>(decstr, 32, hawki_cal_zpoint_outputs.stdstar_dec);
+<a name="l00638"></a>00638 cpl_msg_info(__func__, <span class="stringliteral">" RA = %g (%s) ; DEC = %g (%s)"</span>,
+<a name="l00639"></a>00639 hawki_cal_zpoint_outputs.stdstar_ra, rastr,
+<a name="l00640"></a>00640 hawki_cal_zpoint_outputs.stdstar_dec, decstr);
+<a name="l00641"></a>00641 }
+<a name="l00642"></a>00642 <span class="keywordflow">else</span>
+<a name="l00643"></a>00643 {
+<a name="l00644"></a>00644 cpl_msg_info(__func__, <span class="stringliteral">"Catalog where the star was found: %s"</span>,
+<a name="l00645"></a>00645 hawki_cal_zpoint_outputs.catalog);
+<a name="l00646"></a>00646 cpl_msg_info(__func__, <span class="stringliteral">"Star name: %s"</span>,
+<a name="l00647"></a>00647 hawki_cal_zpoint_outputs.starname);
+<a name="l00648"></a>00648 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+<a name="l00649"></a>00649 {
+<a name="l00650"></a>00650 cpl_msg_info(__func__, <span class="stringliteral">"Star magnitude in filter %s : %g [mag]"</span>,
+<a name="l00651"></a>00651 hawki_cal_zpoint_outputs.filter,
+<a name="l00652"></a>00652 hawki_cal_zpoint_outputs.stdstar_mag_filter);
+<a name="l00653"></a>00653 }
+<a name="l00654"></a>00654 <a class="code" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3" title="This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)">hawki_utils_ra2str</a>(rastr, 32, hawki_cal_zpoint_outputs.stdstar_ra);
+<a name="l00655"></a>00655 <a class="code" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6" title="This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2...">hawki_utils_dec2str</a>(decstr, 32, hawki_cal_zpoint_outputs.stdstar_dec);
+<a name="l00656"></a>00656 cpl_msg_info(__func__, <span class="stringliteral">"Star coordinates: RA = %g (%s) ; DEC = %g (%s)"</span>,
+<a name="l00657"></a>00657 hawki_cal_zpoint_outputs.stdstar_ra, rastr,
+<a name="l00658"></a>00658 hawki_cal_zpoint_outputs.stdstar_dec, decstr);
+<a name="l00659"></a>00659 }
+<a name="l00660"></a>00660 <span class="keywordflow">if</span> (hawki_cal_zpoint_config.stdstar_given_magnitude < 98.0)
+<a name="l00661"></a>00661 {
+<a name="l00662"></a>00662 hawki_cal_zpoint_outputs.stdstar_mag_available = 1;
+<a name="l00663"></a>00663 hawki_cal_zpoint_outputs.stdstar_mag_filter =
+<a name="l00664"></a>00664 hawki_cal_zpoint_config.stdstar_given_magnitude;
+<a name="l00665"></a>00665 cpl_msg_info(__func__, <span class="stringliteral">"Using user defined "</span>
+<a name="l00666"></a>00666 <span class="stringliteral">"star magnitude in filter %s : %g [mag]"</span>,
+<a name="l00667"></a>00667 hawki_cal_zpoint_outputs.filter,
+<a name="l00668"></a>00668 hawki_cal_zpoint_outputs.stdstar_mag_filter);
+<a name="l00669"></a>00669 }
+<a name="l00670"></a>00670 cpl_msg_indent_less();
+<a name="l00671"></a>00671
+<a name="l00672"></a>00672 <span class="comment">/* Labelise frames */</span>
+<a name="l00673"></a>00673 cpl_msg_info(__func__, <span class="stringliteral">"Guessing which frame the STD is in for each chip"</span>);
+<a name="l00674"></a>00674 <a class="code" href="group__hawki__utils.html#gabee84f3ed597df9a6ae97f07fc2204a0" title="Get the frames in which the star is for a given chip.">hawki_detectors_locate_star</a>
+<a name="l00675"></a>00675 (<span class="keyword">set</span>, hawki_cal_zpoint_outputs.stdstar_ra,
+<a name="l00676"></a>00676 hawki_cal_zpoint_outputs.stdstar_dec, labels);
+<a name="l00677"></a>00677 <span class="keywordflow">if</span> (labels == NULL)
+<a name="l00678"></a>00678 {
+<a name="l00679"></a>00679 cpl_msg_error(__func__, <span class="stringliteral">"Cannot determine which frame the STD is on"</span>) ;
+<a name="l00680"></a>00680 <span class="keywordflow">return</span> NULL ;
+<a name="l00681"></a>00681 }
+<a name="l00682"></a>00682
+<a name="l00683"></a>00683 <span class="comment">/* Compute the expected position of the star in pixels */</span>
+<a name="l00684"></a>00684 <span class="comment">/* This is stored in hawki_cal_zpoint_config.xcoord, ycoord */</span>
+<a name="l00685"></a>00685 cpl_msg_indent_more();
+<a name="l00686"></a>00686 <span class="keywordflow">if</span>(hawki_cal_zpoint_get_expected_pos(<span class="keyword">set</span>, labels) != CPL_ERROR_NONE)
+<a name="l00687"></a>00687 {
+<a name="l00688"></a>00688 cpl_msg_error(__func__,<span class="stringliteral">"Could not determine where the star is located"</span>);
+<a name="l00689"></a>00689 cpl_msg_indent_less();
+<a name="l00690"></a>00690 <span class="keywordflow">return</span> NULL;
+<a name="l00691"></a>00691 }
+<a name="l00692"></a>00692 cpl_msg_indent_less();
+<a name="l00693"></a>00693
+<a name="l00694"></a>00694 <span class="comment">/* Fetch the airmass and humidity */</span>
+<a name="l00695"></a>00695 hawki_cal_zpoint_compute_keywords(<span class="keyword">set</span>, labels);
+<a name="l00696"></a>00696
+<a name="l00697"></a>00697 <span class="comment">/* Create the positions vector */</span>
+<a name="l00698"></a>00698 nima = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l00699"></a>00699 positions = cpl_bivector_new(nima) ;
+<a name="l00700"></a>00700
+<a name="l00701"></a>00701 <span class="comment">/* Initialize */</span>
+<a name="l00702"></a>00702 *star_images = cpl_imagelist_new();
+<a name="l00703"></a>00703
+<a name="l00704"></a>00704 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00705"></a>00705 nframes = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l00706"></a>00706 cpl_msg_info(__func__,<span class="stringliteral">"Loop on the chips"</span>);
+<a name="l00707"></a>00707 cpl_msg_indent_more() ;
+<a name="l00708"></a>00708 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00709"></a>00709 {
+<a name="l00710"></a>00710 cpl_imagelist * sky_images;
+<a name="l00711"></a>00711 cpl_image * star_ima = NULL;
+<a name="l00712"></a>00712 cpl_image * sky;
+<a name="l00713"></a>00713 cpl_image * flat_im;
+<a name="l00714"></a>00714 <span class="keywordtype">int</span> ext_nb;
+<a name="l00715"></a>00715
+<a name="l00716"></a>00716 cpl_msg_info(__func__, <span class="stringliteral">"Loading the chip %d"</span>, idet+1);
+<a name="l00717"></a>00717 cpl_msg_indent_more() ;
+<a name="l00718"></a>00718
+<a name="l00719"></a>00719 <span class="comment">/* Allocate */</span>
+<a name="l00720"></a>00720 sky_images = cpl_imagelist_new();
+<a name="l00721"></a>00721
+<a name="l00722"></a>00722 cpl_msg_indent_more() ;
+<a name="l00723"></a>00723 <span class="keywordflow">for</span> (iframe=0 ; iframe<nframes ; iframe++)
+<a name="l00724"></a>00724 {
+<a name="l00725"></a>00725 cpl_image * ima_cur;
+<a name="l00726"></a>00726
+<a name="l00727"></a>00727 <span class="comment">/* Load the image */</span>
+<a name="l00728"></a>00728 ima_cur = <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(<span class="keyword">set</span>, iframe, idet+1, CPL_TYPE_FLOAT) ;
+<a name="l00729"></a>00729 <span class="keywordflow">if</span>(ima_cur == NULL)
+<a name="l00730"></a>00730 {
+<a name="l00731"></a>00731 cpl_bivector_delete(positions) ;
+<a name="l00732"></a>00732 cpl_imagelist_delete(*star_images);
+<a name="l00733"></a>00733 cpl_imagelist_delete(sky_images) ;
+<a name="l00734"></a>00734 cpl_msg_error(__func__, <span class="stringliteral">"Error reading image"</span>);
+<a name="l00735"></a>00735 <span class="keywordflow">return</span> NULL;
+<a name="l00736"></a>00736 }
+<a name="l00737"></a>00737 <span class="comment">/* Get image statistics */</span>
+<a name="l00738"></a>00738 size_x = cpl_image_get_size_x(ima_cur) ;
+<a name="l00739"></a>00739 size_y = cpl_image_get_size_y(ima_cur) ;
+<a name="l00740"></a>00740 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l00741"></a>00741 (raw_zpoint_stats,
+<a name="l00742"></a>00742 ima_cur,
+<a name="l00743"></a>00743 1,
+<a name="l00744"></a>00744 1,
+<a name="l00745"></a>00745 size_x,
+<a name="l00746"></a>00746 size_y,
+<a name="l00747"></a>00747 idet,
+<a name="l00748"></a>00748 iframe) !=0 )
+<a name="l00749"></a>00749 {
+<a name="l00750"></a>00750 cpl_msg_error(__func__,<span class="stringliteral">"Cannot compute stats on ima %d det %d"</span>,
+<a name="l00751"></a>00751 iframe+1, idet+1);
+<a name="l00752"></a>00752 cpl_bivector_delete(positions) ;
+<a name="l00753"></a>00753 cpl_imagelist_delete(*star_images);
+<a name="l00754"></a>00754 cpl_imagelist_delete(sky_images) ;
+<a name="l00755"></a>00755 cpl_image_delete(ima_cur);
+<a name="l00756"></a>00756 cpl_msg_indent_less() ;
+<a name="l00757"></a>00757 <span class="keywordflow">return</span> NULL ;
+<a name="l00758"></a>00758 }
+<a name="l00759"></a>00759
+<a name="l00760"></a>00760 <span class="comment">/* Add the image to either the sky images or the star image */</span>
+<a name="l00761"></a>00761 <span class="keywordflow">if</span>(labels[iframe] == idet + 1)
+<a name="l00762"></a>00762 {
+<a name="l00763"></a>00763 star_ima = ima_cur;
+<a name="l00764"></a>00764 iframe_star = iframe;
+<a name="l00765"></a>00765 }
+<a name="l00766"></a>00766 <span class="keywordflow">else</span>
+<a name="l00767"></a>00767 cpl_imagelist_set(sky_images, ima_cur,
+<a name="l00768"></a>00768 cpl_imagelist_get_size(sky_images));
+<a name="l00769"></a>00769 }
+<a name="l00770"></a>00770 cpl_msg_indent_less();
+<a name="l00771"></a>00771
+<a name="l00772"></a>00772 <span class="comment">/* Create the sky */</span>
+<a name="l00773"></a>00773 cpl_msg_info(__func__, <span class="stringliteral">"Correct for the sky"</span>);
+<a name="l00774"></a>00774 sky = cpl_imagelist_collapse_median_create(sky_images);
+<a name="l00775"></a>00775 cpl_imagelist_delete(sky_images) ;
+<a name="l00776"></a>00776
+<a name="l00777"></a>00777 <span class="comment">/* Subtract the sky */</span>
+<a name="l00778"></a>00778 cpl_image_subtract(star_ima, sky) ;
+<a name="l00779"></a>00779 cpl_image_delete(sky) ;
+<a name="l00780"></a>00780
+<a name="l00781"></a>00781 <span class="comment">/* Divide by the flatfield if one is provided */</span>
+<a name="l00782"></a>00782 <span class="keywordflow">if</span> (flat) {
+<a name="l00783"></a>00783 cpl_msg_info(__func__, <span class="stringliteral">"Correct for the flat"</span>) ;
+<a name="l00784"></a>00784
+<a name="l00785"></a>00785 <span class="comment">/* Get the extension with the current chip */</span>
+<a name="l00786"></a>00786 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(flat, idet + 1)) == -1)
+<a name="l00787"></a>00787 {
+<a name="l00788"></a>00788 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with chip %d"</span>,
+<a name="l00789"></a>00789 idet + 1);
+<a name="l00790"></a>00790 cpl_imagelist_delete(*star_images) ;
+<a name="l00791"></a>00791 cpl_bivector_delete(positions) ;
+<a name="l00792"></a>00792 <span class="keywordflow">return</span> NULL ;
+<a name="l00793"></a>00793 }
+<a name="l00794"></a>00794 <span class="comment">/* Load */</span>
+<a name="l00795"></a>00795 flat_im = cpl_image_load(flat, CPL_TYPE_FLOAT, 0, ext_nb) ;
+<a name="l00796"></a>00796 cpl_image_divide(star_ima, flat_im) ;
+<a name="l00797"></a>00797 cpl_image_delete(flat_im) ;
+<a name="l00798"></a>00798 }
+<a name="l00799"></a>00799
+<a name="l00800"></a>00800 <span class="comment">/* Correct the bad pixels */</span>
+<a name="l00801"></a>00801 <span class="keywordflow">if</span> (bpm) {
+<a name="l00802"></a>00802 cpl_msg_info(__func__, <span class="stringliteral">"Correct for the bad pixels"</span>) ;
+<a name="l00803"></a>00803 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#gacab5ec7e7db02bd1f46661c443a6c16b" title="Apply the BPM correction to an image.">hawki_bpm_calib</a>(star_ima, bpm, idet + 1) == -1)
+<a name="l00804"></a>00804 {
+<a name="l00805"></a>00805 cpl_msg_error(__func__, <span class="stringliteral">"Cannot correct the BPM for chip %d"</span>,
+<a name="l00806"></a>00806 idet + 1);
+<a name="l00807"></a>00807 cpl_imagelist_delete(*star_images) ;
+<a name="l00808"></a>00808 cpl_bivector_delete(positions) ;
+<a name="l00809"></a>00809 <span class="keywordflow">return</span> NULL ;
+<a name="l00810"></a>00810 }
+<a name="l00811"></a>00811 }
+<a name="l00812"></a>00812
+<a name="l00813"></a>00813 <span class="comment">/* Put the result in the image list */</span>
+<a name="l00814"></a>00814 cpl_imagelist_set(*star_images, star_ima,
+<a name="l00815"></a>00815 cpl_imagelist_get_size(*star_images)) ;
+<a name="l00816"></a>00816
+<a name="l00817"></a>00817 <span class="comment">/* Object detection */</span>
+<a name="l00818"></a>00818 cpl_msg_info(__func__,<span class="stringliteral">"For chip %d the STD should be on frame %d"</span>,
+<a name="l00819"></a>00819 idet + 1, iframe_star+1);
+<a name="l00820"></a>00820 pos_x_cen = pos_y_cen = -1.0 ;
+<a name="l00821"></a>00821 size_x = cpl_image_get_size_x(star_ima) ;
+<a name="l00822"></a>00822 size_y = cpl_image_get_size_y(star_ima) ;
+<a name="l00823"></a>00823
+<a name="l00824"></a>00824 <span class="comment">/* Filtering the image*/</span>
+<a name="l00825"></a>00825 kernel = cpl_mask_new(3, 3);
+<a name="l00826"></a>00826 cpl_mask_not(kernel);
+<a name="l00827"></a>00827 filt_ima = cpl_image_new(cpl_image_get_size_x(star_ima),
+<a name="l00828"></a>00828 cpl_image_get_size_y(star_ima),
+<a name="l00829"></a>00829 cpl_image_get_type(star_ima));
+<a name="l00830"></a>00830 cpl_image_filter_mask(filt_ima, star_ima, kernel, CPL_FILTER_MEDIAN,
+<a name="l00831"></a>00831 CPL_BORDER_FILTER);
+<a name="l00832"></a>00832 cpl_mask_delete(kernel);
+<a name="l00833"></a>00833
+<a name="l00834"></a>00834 <span class="comment">/* Looking for apertures */</span>
+<a name="l00835"></a>00835 aperts = cpl_apertures_extract_sigma(filt_ima,
+<a name="l00836"></a>00836 hawki_cal_zpoint_config.detect_sigma) ;
+<a name="l00837"></a>00837 cpl_image_delete(filt_ima) ;
+<a name="l00838"></a>00838 <span class="keywordflow">if</span> (aperts == NULL)
+<a name="l00839"></a>00839 {
+<a name="l00840"></a>00840 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find the central object"</span>) ;
+<a name="l00841"></a>00841 cpl_imagelist_delete(*star_images) ;
+<a name="l00842"></a>00842 cpl_bivector_delete(positions) ;
+<a name="l00843"></a>00843 <span class="keywordflow">return</span> NULL ;
+<a name="l00844"></a>00844 }
+<a name="l00845"></a>00845 min_dist = size_x * size_x + size_y * size_y ;
+<a name="l00846"></a>00846 <span class="keywordflow">for</span> (iaper=0 ; iaper<cpl_apertures_get_size(aperts) ; iaper++) {
+<a name="l00847"></a>00847 pos_x = cpl_apertures_get_centroid_x(aperts, iaper+1) ;
+<a name="l00848"></a>00848 pos_y = cpl_apertures_get_centroid_y(aperts, iaper+1) ;
+<a name="l00849"></a>00849 dist = (pos_x-hawki_cal_zpoint_config.xcoord[idet])*
+<a name="l00850"></a>00850 (pos_x-hawki_cal_zpoint_config.xcoord[idet]) +
+<a name="l00851"></a>00851 (pos_y-hawki_cal_zpoint_config.ycoord[idet])*
+<a name="l00852"></a>00852 (pos_y-hawki_cal_zpoint_config.ycoord[idet]);
+<a name="l00853"></a>00853 <span class="keywordflow">if</span> (dist<min_dist) {
+<a name="l00854"></a>00854 min_dist = dist ;
+<a name="l00855"></a>00855 pos_x_cen = pos_x ;
+<a name="l00856"></a>00856 pos_y_cen = pos_y ;
+<a name="l00857"></a>00857 }
+<a name="l00858"></a>00858 }
+<a name="l00859"></a>00859 cpl_apertures_delete(aperts) ;
+<a name="l00860"></a>00860
+<a name="l00861"></a>00861 cpl_vector_set(cpl_bivector_get_x(positions), iframe_star, pos_x_cen) ;
+<a name="l00862"></a>00862 cpl_vector_set(cpl_bivector_get_y(positions), iframe_star, pos_y_cen) ;
+<a name="l00863"></a>00863 cpl_msg_info(__func__, <span class="stringliteral">"Expected star position: %g %g"</span>,
+<a name="l00864"></a>00864 hawki_cal_zpoint_config.xcoord[idet],
+<a name="l00865"></a>00865 hawki_cal_zpoint_config.ycoord[idet]);
+<a name="l00866"></a>00866 cpl_msg_info(__func__, <span class="stringliteral">"Bright object position: %g %g"</span>,
+<a name="l00867"></a>00867 pos_x_cen, pos_y_cen) ;
+<a name="l00868"></a>00868
+<a name="l00869"></a>00869 <span class="comment">/* Check that the star is within the search window */</span>
+<a name="l00870"></a>00870 <span class="keywordflow">if</span>(fabs(pos_x_cen - hawki_cal_zpoint_config.xcoord[idet]) >
+<a name="l00871"></a>00871 hawki_cal_zpoint_config.sx ||
+<a name="l00872"></a>00872 fabs(pos_y_cen - hawki_cal_zpoint_config.ycoord[idet]) >
+<a name="l00873"></a>00873 hawki_cal_zpoint_config.sy)
+<a name="l00874"></a>00874 {
+<a name="l00875"></a>00875 hawki_cal_zpoint_outputs.stdstar_image_detected[idet] = 0;
+<a name="l00876"></a>00876 cpl_msg_warning(cpl_func,<span class="stringliteral">"No object has been found within the box"</span>
+<a name="l00877"></a>00877 <span class="stringliteral">"limits [%d, %d] around the expected position"</span>,
+<a name="l00878"></a>00878 hawki_cal_zpoint_config.sx,
+<a name="l00879"></a>00879 hawki_cal_zpoint_config.sy);
+<a name="l00880"></a>00880 }
+<a name="l00881"></a>00881 <span class="keywordflow">else</span>
+<a name="l00882"></a>00882 {
+<a name="l00883"></a>00883 hawki_cal_zpoint_outputs.stdstar_image_detected[idet] = 1;
+<a name="l00884"></a>00884 }
+<a name="l00885"></a>00885
+<a name="l00886"></a>00886 <span class="comment">/* Free */</span>
+<a name="l00887"></a>00887 cpl_msg_indent_less() ;
+<a name="l00888"></a>00888 }
+<a name="l00889"></a>00889 cpl_msg_indent_less() ;
+<a name="l00890"></a>00890
+<a name="l00891"></a>00891 <span class="comment">/* Reorder the images (frame order) */</span>
+<a name="l00892"></a>00892 star_images_frame_order = cpl_imagelist_new() ;
+<a name="l00893"></a>00893 <span class="keywordflow">for</span> (iframe=0 ; iframe< nframes; iframe++)
+<a name="l00894"></a>00894 {
+<a name="l00895"></a>00895 tmp_ima = cpl_image_duplicate
+<a name="l00896"></a>00896 (cpl_imagelist_get(*star_images, labels[iframe] -1 ));
+<a name="l00897"></a>00897 cpl_imagelist_set(star_images_frame_order, tmp_ima, iframe);
+<a name="l00898"></a>00898 }
+<a name="l00899"></a>00899
+<a name="l00900"></a>00900 <span class="comment">/* Compute the photometry */</span>
+<a name="l00901"></a>00901 cpl_msg_info(__func__, <span class="stringliteral">"Compute the photometry"</span>) ;
+<a name="l00902"></a>00902 cpl_msg_indent_more() ;
+<a name="l00903"></a>00903 <span class="keywordflow">if</span> ((zpoint_tables = hawki_cal_zpoint_photom
+<a name="l00904"></a>00904 (star_images_frame_order, positions, labels))==NULL) {
+<a name="l00905"></a>00905 cpl_msg_error(__func__, <span class="stringliteral">"Cannot reduce"</span>) ;
+<a name="l00906"></a>00906 cpl_bivector_delete(positions) ;
+<a name="l00907"></a>00907 cpl_imagelist_delete(star_images_frame_order) ;
+<a name="l00908"></a>00908 cpl_msg_indent_less() ;
+<a name="l00909"></a>00909 <span class="keywordflow">return</span> NULL ;
+<a name="l00910"></a>00910 }
+<a name="l00911"></a>00911
+<a name="l00912"></a>00912
+<a name="l00913"></a>00913 <span class="comment">/* Free and exit */</span>
+<a name="l00914"></a>00914 cpl_msg_indent_less() ;
+<a name="l00915"></a>00915 cpl_bivector_delete(positions) ;
+<a name="l00916"></a>00916 cpl_imagelist_delete(star_images_frame_order) ;
+<a name="l00917"></a>00917
+<a name="l00918"></a>00918 <span class="keywordflow">return</span> zpoint_tables;
+<a name="l00919"></a>00919 }
+<a name="l00920"></a>00920
+<a name="l00921"></a>00921 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00931"></a>00931 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00932"></a>00932 <span class="keyword">static</span> cpl_table ** hawki_cal_zpoint_photom(
+<a name="l00933"></a>00933 cpl_imagelist * ilist,
+<a name="l00934"></a>00934 cpl_bivector * pos,
+<a name="l00935"></a>00935 <span class="keywordtype">int</span> * labels)
+<a name="l00936"></a>00936 {
+<a name="l00937"></a>00937 cpl_table ** zpoint;
+<a name="l00938"></a>00938 <span class="keywordtype">int</span> nframes;
+<a name="l00939"></a>00939 <span class="keywordtype">double</span> r, r1, r2;
+<a name="l00940"></a>00940 <span class="keywordtype">double</span> stdstar_mag;
+<a name="l00941"></a>00941 <span class="keywordtype">double</span> dit;
+<a name="l00942"></a>00942 <span class="keywordtype">double</span> extinction;
+<a name="l00943"></a>00943 <span class="keywordtype">double</span> pixscale;
+<a name="l00944"></a>00944 cpl_image * ima ;
+<a name="l00945"></a>00945 <span class="keywordtype">double</span> * pos_x ;
+<a name="l00946"></a>00946 <span class="keywordtype">double</span> * pos_y ;
+<a name="l00947"></a>00947 <span class="keywordtype">double</span> bgd, fl, zp, peak, fwhm_x, fwhm_y ;
+<a name="l00948"></a>00948 cpl_bivector * iqe_res ;
+<a name="l00949"></a>00949 <span class="keywordtype">int</span> iframe;
+<a name="l00950"></a>00950 <span class="keywordtype">int</span> idet;
+<a name="l00951"></a>00951
+<a name="l00952"></a>00952 <span class="comment">/* Test entries */</span>
+<a name="l00953"></a>00953 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00954"></a>00954 <span class="keywordflow">if</span> (pos == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00955"></a>00955
+<a name="l00956"></a>00956 <span class="comment">/* Initialise */</span>
+<a name="l00957"></a>00957 nframes = cpl_imagelist_get_size(ilist) ;
+<a name="l00958"></a>00958 stdstar_mag = hawki_cal_zpoint_outputs.stdstar_mag_filter;
+<a name="l00959"></a>00959 dit = hawki_cal_zpoint_outputs.dit ;
+<a name="l00960"></a>00960 pixscale = hawki_cal_zpoint_outputs.pixscale ;
+<a name="l00961"></a>00961
+<a name="l00962"></a>00962 <span class="comment">/* Get extinction */</span>
+<a name="l00963"></a>00963 <span class="keywordflow">switch</span> (hawki_cal_zpoint_outputs.band) {
+<a name="l00964"></a>00964 <span class="keywordflow">case</span> HAWKI_BAND_J: extinction = 0.098 ; break ;
+<a name="l00965"></a>00965 <span class="keywordflow">case</span> HAWKI_BAND_H: extinction = 0.039 ; break ;
+<a name="l00966"></a>00966 <span class="keywordflow">case</span> HAWKI_BAND_K: extinction = 0.065 ; break ;
+<a name="l00967"></a>00967 <span class="keywordflow">case</span> HAWKI_BAND_Y: extinction = 0.00 ; break ;
+<a name="l00968"></a>00968 <span class="keywordflow">default</span>: extinction = 0.00 ; break ;
+<a name="l00969"></a>00969 }
+<a name="l00970"></a>00970 hawki_cal_zpoint_outputs.ext_coeff = extinction;
+<a name="l00971"></a>00971 cpl_msg_info(__func__,<span class="stringliteral">"Using tabulated extinction for band %s: %f"</span>,
+<a name="l00972"></a>00972 hawki_cal_zpoint_outputs.filter, extinction);
+<a name="l00973"></a>00973
+<a name="l00974"></a>00974 <span class="comment">/* Loop on the images */</span>
+<a name="l00975"></a>00975 <span class="keywordflow">for</span> (iframe=0 ; iframe<nframes ; iframe++) {
+<a name="l00976"></a>00976 idet = labels[iframe]-1;
+<a name="l00977"></a>00977 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_image_detected[idet] == 1)
+<a name="l00978"></a>00978 {
+<a name="l00979"></a>00979 <span class="comment">/* Get the current image */</span>
+<a name="l00980"></a>00980 ima = cpl_imagelist_get(ilist, iframe) ;
+<a name="l00981"></a>00981
+<a name="l00982"></a>00982 <span class="comment">/* Get the current position */</span>
+<a name="l00983"></a>00983 pos_x = cpl_bivector_get_x_data(pos) ;
+<a name="l00984"></a>00984 pos_y = cpl_bivector_get_y_data(pos) ;
+<a name="l00985"></a>00985
+<a name="l00986"></a>00986 <span class="comment">/* FWHM_X / FWHM_Y */</span>
+<a name="l00987"></a>00987 iqe_res = cpl_image_iqe
+<a name="l00988"></a>00988 (ima, (<span class="keywordtype">int</span>)(pos_x[iframe]-10.0), (<span class="keywordtype">int</span>)(pos_y[iframe]-10.0),
+<a name="l00989"></a>00989 (<span class="keywordtype">int</span>)(pos_x[iframe]+10.0), (<span class="keywordtype">int</span>)(pos_y[iframe]+10.0));
+<a name="l00990"></a>00990 <span class="keywordflow">if</span> (iqe_res == NULL)
+<a name="l00991"></a>00991 {
+<a name="l00992"></a>00992 cpl_msg_debug(__func__,<span class="stringliteral">"Cannot compute FWHM for chip %d"</span>,
+<a name="l00993"></a>00993 idet + 1);
+<a name="l00994"></a>00994 fwhm_x = fwhm_y = -1.0 ;
+<a name="l00995"></a>00995 cpl_error_reset() ;
+<a name="l00996"></a>00996 } <span class="keywordflow">else</span> {
+<a name="l00997"></a>00997 fwhm_x = cpl_vector_get(cpl_bivector_get_x(iqe_res), 2) ;
+<a name="l00998"></a>00998 fwhm_y = cpl_vector_get(cpl_bivector_get_x(iqe_res), 3) ;
+<a name="l00999"></a>00999 cpl_bivector_delete(iqe_res) ;
+<a name="l01000"></a>01000 }
+<a name="l01001"></a>01001
+<a name="l01002"></a>01002 <span class="comment">/* Determine the radii */</span>
+<a name="l01003"></a>01003 r = hawki_cal_zpoint_config.phot_star_radius ;
+<a name="l01004"></a>01004 <span class="keywordflow">if</span> (r < 0) {
+<a name="l01005"></a>01005 <span class="keywordflow">if</span> (fwhm_x>0 && fwhm_y>0) r = 5*(fwhm_x+fwhm_y)/2.0 ;
+<a name="l01006"></a>01006 <span class="keywordflow">else</span> r = HAWKI_PHOT_STAR_RADIUS ;
+<a name="l01007"></a>01007 }
+<a name="l01008"></a>01008 r1 = hawki_cal_zpoint_config.phot_bg_r1 ;
+<a name="l01009"></a>01009 r2 = hawki_cal_zpoint_config.phot_bg_r2 ;
+<a name="l01010"></a>01010 <span class="keywordflow">if</span> (r1 < 0) r1 = r + 10.0 ;
+<a name="l01011"></a>01011 <span class="keywordflow">if</span> (r2 < 0) r2 = r1 + 20.0 ;
+<a name="l01012"></a>01012 <span class="comment">//cpl_msg_info(__func__, "Use radii for star: %g and background: %g, %g",</span>
+<a name="l01013"></a>01013 <span class="comment">// r, r1, r2) ;</span>
+<a name="l01014"></a>01014
+<a name="l01015"></a>01015 <span class="comment">/* Compute the photometry */</span>
+<a name="l01016"></a>01016 <span class="comment">/* Background */</span>
+<a name="l01017"></a>01017 bgd = irplib_strehl_ring_background(ima, (<span class="keywordtype">int</span>)(pos_x[iframe]),
+<a name="l01018"></a>01018 (<span class="keywordtype">int</span>)(pos_y[iframe]), (<span class="keywordtype">int</span>)r1, (<span class="keywordtype">int</span>)r2, IRPLIB_BG_METHOD_MEDIAN);
+<a name="l01019"></a>01019 <span class="comment">/* Flux */</span>
+<a name="l01020"></a>01020 fl = irplib_strehl_disk_flux(ima,
+<a name="l01021"></a>01021 (<span class="keywordtype">int</span>)(pos_x[iframe]), (<span class="keywordtype">int</span>)(pos_y[iframe]), (<span class="keywordtype">int</span>)r, bgd);
+<a name="l01022"></a>01022
+<a name="l01023"></a>01023 <span class="comment">//cpl_msg_info(__func__, "Zero point in chip %d: %g", labels[iframe], zp) ;</span>
+<a name="l01024"></a>01024 <span class="comment">/* Peak */</span>
+<a name="l01025"></a>01025 peak = cpl_image_get_max_window(ima,
+<a name="l01026"></a>01026 (<span class="keywordtype">int</span>)(pos_x[iframe]-5), (<span class="keywordtype">int</span>)(pos_y[iframe]-5),
+<a name="l01027"></a>01027 (<span class="keywordtype">int</span>)(pos_x[iframe]+5), (<span class="keywordtype">int</span>)(pos_y[iframe]+5));
+<a name="l01028"></a>01028
+<a name="l01029"></a>01029 <span class="comment">/* Zero Point */</span>
+<a name="l01030"></a>01030 <span class="keywordflow">if</span> (hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+<a name="l01031"></a>01031 {
+<a name="l01032"></a>01032 <span class="keywordflow">if</span> (fl > 0 && dit > 0)
+<a name="l01033"></a>01033 {
+<a name="l01034"></a>01034 hawki_cal_zpoint_outputs.zpoint_computable[idet] = 1;
+<a name="l01035"></a>01035 zp = stdstar_mag + 2.5 * log10(fl) - 2.5 * log10(dit);
+<a name="l01036"></a>01036
+<a name="l01037"></a>01037 hawki_cal_zpoint_outputs.zpoint[idet] = zp;
+<a name="l01038"></a>01038 hawki_cal_zpoint_outputs.atx0[idet] = zp +
+<a name="l01039"></a>01039 extinction * hawki_cal_zpoint_outputs.airmass[idet];
+<a name="l01040"></a>01040 }
+<a name="l01041"></a>01041 <span class="keywordflow">else</span>
+<a name="l01042"></a>01042 hawki_cal_zpoint_outputs.zpoint_computable[idet] = 0;
+<a name="l01043"></a>01043 }
+<a name="l01044"></a>01044 hawki_cal_zpoint_outputs.posx[idet] = pos_x[iframe];
+<a name="l01045"></a>01045 hawki_cal_zpoint_outputs.posy[idet] = pos_y[iframe];
+<a name="l01046"></a>01046 hawki_cal_zpoint_outputs.flux[idet] = fl;
+<a name="l01047"></a>01047 hawki_cal_zpoint_outputs.instrmag[idet] = 2.5 * log10(fl/dit);
+<a name="l01048"></a>01048 hawki_cal_zpoint_outputs.peak[idet] = peak;
+<a name="l01049"></a>01049 hawki_cal_zpoint_outputs.bgd[idet] = bgd;
+<a name="l01050"></a>01050 hawki_cal_zpoint_outputs.fwhmx[idet] = fwhm_x;
+<a name="l01051"></a>01051 hawki_cal_zpoint_outputs.fwhmy[idet] = fwhm_y;
+<a name="l01052"></a>01052 <span class="keywordflow">if</span> (fwhm_x > 0 && fwhm_y > 0)
+<a name="l01053"></a>01053 hawki_cal_zpoint_outputs.fwhm[idet] = sqrt(fwhm_x*fwhm_y);
+<a name="l01054"></a>01054 <span class="keywordflow">else</span>
+<a name="l01055"></a>01055 hawki_cal_zpoint_outputs.fwhm[idet] = -1.0;
+<a name="l01056"></a>01056 hawki_cal_zpoint_outputs.fwhmx_as[idet] = fwhm_x * pixscale;
+<a name="l01057"></a>01057 hawki_cal_zpoint_outputs.fwhmy_as[idet] = fwhm_y * pixscale;
+<a name="l01058"></a>01058 <span class="keywordflow">if</span> (fwhm_x > 0 && fwhm_y > 0)
+<a name="l01059"></a>01059 hawki_cal_zpoint_outputs.fwhm_as[idet] =
+<a name="l01060"></a>01060 sqrt(fwhm_x*fwhm_y*pixscale*pixscale);
+<a name="l01061"></a>01061 <span class="keywordflow">else</span>
+<a name="l01062"></a>01062 hawki_cal_zpoint_outputs.fwhm_as[labels[iframe]-1] = -1.0;
+<a name="l01063"></a>01063 }
+<a name="l01064"></a>01064 <span class="keywordflow">else</span>
+<a name="l01065"></a>01065 {
+<a name="l01066"></a>01066 cpl_msg_warning(cpl_func,<span class="stringliteral">"Standard star not detected in chip %d. "</span>
+<a name="l01067"></a>01067 <span class="stringliteral">"No zeropoint computed."</span>, idet + 1);
+<a name="l01068"></a>01068 }
+<a name="l01069"></a>01069
+<a name="l01070"></a>01070 }
+<a name="l01071"></a>01071
+<a name="l01072"></a>01072 <span class="comment">/* Create the table */</span>
+<a name="l01073"></a>01073 zpoint = <a class="code" href="group__hawki__alloc.html#gad7e4f1acdafde6f40fac069f727c9080" title="Allocates a set of four tables.">hawki_table_new</a>(1);
+<a name="l01074"></a>01074 <span class="comment">//tab = cpl_table_new(nframes) ;</span>
+<a name="l01075"></a>01075 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l01076"></a>01076 cpl_table_new_column(zpoint[idet],
+<a name="l01077"></a>01077 HAWKI_COL_ZPOINT_CHIP, CPL_TYPE_INT);
+<a name="l01078"></a>01078 cpl_table_new_column(zpoint[idet],
+<a name="l01079"></a>01079 HAWKI_COL_ZPOINT_STARNAME, CPL_TYPE_STRING);
+<a name="l01080"></a>01080 cpl_table_new_column(zpoint[idet],
+<a name="l01081"></a>01081 HAWKI_COL_ZPOINT_POSX, CPL_TYPE_DOUBLE);
+<a name="l01082"></a>01082 cpl_table_set_column_unit(zpoint[idet],
+<a name="l01083"></a>01083 HAWKI_COL_ZPOINT_POSX,<span class="stringliteral">"pix"</span>);
+<a name="l01084"></a>01084 cpl_table_new_column(zpoint[idet],
+<a name="l01085"></a>01085 HAWKI_COL_ZPOINT_POSY, CPL_TYPE_DOUBLE);
+<a name="l01086"></a>01086 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_POSY,<span class="stringliteral">"pix"</span>);
+<a name="l01087"></a>01087 cpl_table_new_column(zpoint[idet],
+<a name="l01088"></a>01088 HAWKI_COL_ZPOINT_ZPOINT, CPL_TYPE_DOUBLE);
+<a name="l01089"></a>01089 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_ZPOINT,<span class="stringliteral">"mag"</span>);
+<a name="l01090"></a>01090 cpl_table_new_column(zpoint[idet],
+<a name="l01091"></a>01091 HAWKI_COL_ZPOINT_ATX0, CPL_TYPE_DOUBLE);
+<a name="l01092"></a>01092 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_ATX0,<span class="stringliteral">"mag"</span>);
+<a name="l01093"></a>01093 cpl_table_new_column(zpoint[idet],
+<a name="l01094"></a>01094 HAWKI_COL_ZPOINT_AIRMASS, CPL_TYPE_DOUBLE);
+<a name="l01095"></a>01095 cpl_table_new_column(zpoint[idet],
+<a name="l01096"></a>01096 HAWKI_COL_ZPOINT_FLUX, CPL_TYPE_DOUBLE);
+<a name="l01097"></a>01097 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FLUX,<span class="stringliteral">"ADU"</span>);
+<a name="l01098"></a>01098 cpl_table_new_column(zpoint[idet],
+<a name="l01099"></a>01099 HAWKI_COL_ZPOINT_INSTRMAG, CPL_TYPE_DOUBLE);
+<a name="l01100"></a>01100 cpl_table_set_column_unit(zpoint[idet],
+<a name="l01101"></a>01101 HAWKI_COL_ZPOINT_INSTRMAG,<span class="stringliteral">"log(ADU/s)"</span>);
+<a name="l01102"></a>01102 cpl_table_new_column(zpoint[idet],
+<a name="l01103"></a>01103 HAWKI_COL_ZPOINT_FILTER, CPL_TYPE_STRING);
+<a name="l01104"></a>01104 cpl_table_new_column(zpoint[idet],
+<a name="l01105"></a>01105 HAWKI_COL_ZPOINT_PEAK, CPL_TYPE_DOUBLE);
+<a name="l01106"></a>01106 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_PEAK,<span class="stringliteral">"ADU"</span>);
+<a name="l01107"></a>01107 cpl_table_new_column(zpoint[idet],
+<a name="l01108"></a>01108 HAWKI_COL_ZPOINT_BGD, CPL_TYPE_DOUBLE);
+<a name="l01109"></a>01109 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_BGD,<span class="stringliteral">"ADU"</span>);
+<a name="l01110"></a>01110 cpl_table_new_column(zpoint[idet],
+<a name="l01111"></a>01111 HAWKI_COL_ZPOINT_FWHMX, CPL_TYPE_DOUBLE);
+<a name="l01112"></a>01112 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMX,<span class="stringliteral">"pix"</span>);
+<a name="l01113"></a>01113 cpl_table_new_column(zpoint[idet],
+<a name="l01114"></a>01114 HAWKI_COL_ZPOINT_FWHMY, CPL_TYPE_DOUBLE);
+<a name="l01115"></a>01115 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMY,<span class="stringliteral">"pix"</span>);
+<a name="l01116"></a>01116 cpl_table_new_column(zpoint[idet],
+<a name="l01117"></a>01117 HAWKI_COL_ZPOINT_FWHM, CPL_TYPE_DOUBLE);
+<a name="l01118"></a>01118 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHM,<span class="stringliteral">"pix"</span>);
+<a name="l01119"></a>01119 cpl_table_new_column(zpoint[idet],
+<a name="l01120"></a>01120 HAWKI_COL_ZPOINT_FWHMX_AS, CPL_TYPE_DOUBLE);
+<a name="l01121"></a>01121 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMX_AS,<span class="stringliteral">"arcsec"</span>);
+<a name="l01122"></a>01122 cpl_table_new_column(zpoint[idet],
+<a name="l01123"></a>01123 HAWKI_COL_ZPOINT_FWHMY_AS, CPL_TYPE_DOUBLE);
+<a name="l01124"></a>01124 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMY_AS,<span class="stringliteral">"arcsec"</span>);
+<a name="l01125"></a>01125 cpl_table_new_column(zpoint[idet],
+<a name="l01126"></a>01126 HAWKI_COL_ZPOINT_FWHM_AS, CPL_TYPE_DOUBLE);
+<a name="l01127"></a>01127 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHM_AS,<span class="stringliteral">"arcsec"</span>);
+<a name="l01128"></a>01128 cpl_table_new_column(zpoint[idet],
+<a name="l01129"></a>01129 HAWKI_COL_ZPOINT_STARMAG, CPL_TYPE_DOUBLE);
+<a name="l01130"></a>01130 cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_STARMAG,<span class="stringliteral">"mag"</span>);
+<a name="l01131"></a>01131
+<a name="l01132"></a>01132 cpl_table_set_int(zpoint[idet], HAWKI_COL_ZPOINT_CHIP, 0, idet+1) ;
+<a name="l01133"></a>01133 cpl_table_set_string(zpoint[idet], HAWKI_COL_ZPOINT_FILTER, 0,
+<a name="l01134"></a>01134 hawki_cal_zpoint_outputs.filter);
+<a name="l01135"></a>01135 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_AIRMASS, 0,
+<a name="l01136"></a>01136 hawki_cal_zpoint_outputs.airmass[idet]) ;
+<a name="l01137"></a>01137 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_incat_found== 1)
+<a name="l01138"></a>01138 {
+<a name="l01139"></a>01139 cpl_table_set_string(zpoint[idet], HAWKI_COL_ZPOINT_STARNAME, 0,
+<a name="l01140"></a>01140 hawki_cal_zpoint_outputs.starname) ;
+<a name="l01141"></a>01141 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_mag_available== 1)
+<a name="l01142"></a>01142 {
+<a name="l01143"></a>01143 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_STARMAG, 0,
+<a name="l01144"></a>01144 hawki_cal_zpoint_outputs.stdstar_mag_filter);
+<a name="l01145"></a>01145 }
+<a name="l01146"></a>01146 }
+<a name="l01147"></a>01147 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_image_detected[idet] == 1)
+<a name="l01148"></a>01148 {
+<a name="l01149"></a>01149 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_POSX, 0,
+<a name="l01150"></a>01150 hawki_cal_zpoint_outputs.posx[idet]) ;
+<a name="l01151"></a>01151 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_POSY, 0,
+<a name="l01152"></a>01152 hawki_cal_zpoint_outputs.posy[idet]) ;
+<a name="l01153"></a>01153 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FLUX, 0,
+<a name="l01154"></a>01154 hawki_cal_zpoint_outputs.flux[idet]) ;
+<a name="l01155"></a>01155 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_INSTRMAG, 0,
+<a name="l01156"></a>01156 hawki_cal_zpoint_outputs.instrmag[idet]) ;
+<a name="l01157"></a>01157 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_PEAK, 0,
+<a name="l01158"></a>01158 hawki_cal_zpoint_outputs.peak[idet]) ;
+<a name="l01159"></a>01159 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_BGD, 0,
+<a name="l01160"></a>01160 hawki_cal_zpoint_outputs.bgd[idet]) ;
+<a name="l01161"></a>01161 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMX, 0,
+<a name="l01162"></a>01162 hawki_cal_zpoint_outputs.fwhmx[idet]) ;
+<a name="l01163"></a>01163 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMY, 0,
+<a name="l01164"></a>01164 hawki_cal_zpoint_outputs.fwhmy[idet]) ;
+<a name="l01165"></a>01165 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHM, 0,
+<a name="l01166"></a>01166 hawki_cal_zpoint_outputs.fwhm[idet]) ;
+<a name="l01167"></a>01167 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMX_AS, 0,
+<a name="l01168"></a>01168 hawki_cal_zpoint_outputs.fwhmx_as[idet]) ;
+<a name="l01169"></a>01169 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMY_AS, 0,
+<a name="l01170"></a>01170 hawki_cal_zpoint_outputs.fwhmy_as[idet]) ;
+<a name="l01171"></a>01171 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHM_AS, 0,
+<a name="l01172"></a>01172 hawki_cal_zpoint_outputs.fwhm_as[idet]) ;
+<a name="l01173"></a>01173 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+<a name="l01174"></a>01174 {
+<a name="l01175"></a>01175 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_ZPOINT, 0,
+<a name="l01176"></a>01176 hawki_cal_zpoint_outputs.zpoint[idet]);
+<a name="l01177"></a>01177 cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_ATX0, 0,
+<a name="l01178"></a>01178 hawki_cal_zpoint_outputs.atx0[idet]);
+<a name="l01179"></a>01179 }
+<a name="l01180"></a>01180 }
+<a name="l01181"></a>01181 }
+<a name="l01182"></a>01182
+<a name="l01183"></a>01183 <span class="comment">/* Mean values */</span>
+<a name="l01184"></a>01184 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+<a name="l01185"></a>01185 {
+<a name="l01186"></a>01186 <span class="keywordtype">int</span> nzpoint = 0;
+<a name="l01187"></a>01187 hawki_cal_zpoint_outputs.mean_zpoint = 0.0 ;
+<a name="l01188"></a>01188 hawki_cal_zpoint_outputs.mean_atx0 = 0.0 ;
+<a name="l01189"></a>01189 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l01190"></a>01190 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+<a name="l01191"></a>01191 {
+<a name="l01192"></a>01192
+<a name="l01193"></a>01193 hawki_cal_zpoint_outputs.mean_zpoint +=
+<a name="l01194"></a>01194 hawki_cal_zpoint_outputs.zpoint[idet] ;
+<a name="l01195"></a>01195 hawki_cal_zpoint_outputs.mean_atx0 +=
+<a name="l01196"></a>01196 hawki_cal_zpoint_outputs.atx0[idet] ;
+<a name="l01197"></a>01197 nzpoint++;
+<a name="l01198"></a>01198 }
+<a name="l01199"></a>01199 }
+<a name="l01200"></a>01200 <span class="keywordflow">if</span>(nzpoint > 0)
+<a name="l01201"></a>01201 {
+<a name="l01202"></a>01202 hawki_cal_zpoint_outputs.zpoint_mean_computable = 1;
+<a name="l01203"></a>01203 hawki_cal_zpoint_outputs.mean_zpoint /= nzpoint ;
+<a name="l01204"></a>01204 hawki_cal_zpoint_outputs.mean_atx0 /= nzpoint ;
+<a name="l01205"></a>01205 }
+<a name="l01206"></a>01206 }
+<a name="l01207"></a>01207
+<a name="l01208"></a>01208 <span class="comment">/* Output results */</span>
+<a name="l01209"></a>01209 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01210"></a>01210 {
+<a name="l01211"></a>01211 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+<a name="l01212"></a>01212 {
+<a name="l01213"></a>01213 cpl_msg_info(__func__, <span class="stringliteral">"Zero point [at airmass=1] in chip %d:"</span>,
+<a name="l01214"></a>01214 idet + 1);
+<a name="l01215"></a>01215 cpl_msg_indent_more();
+<a name="l01216"></a>01216 cpl_msg_info(__func__,<span class="stringliteral">" ZP: %g [%g]"</span>,
+<a name="l01217"></a>01217 hawki_cal_zpoint_outputs.zpoint[idet],
+<a name="l01218"></a>01218 hawki_cal_zpoint_outputs.atx0[idet]);
+<a name="l01219"></a>01219 cpl_msg_info(__func__,<span class="stringliteral">" Flux of star: %f"</span>,
+<a name="l01220"></a>01220 hawki_cal_zpoint_outputs.flux[idet]);
+<a name="l01221"></a>01221 cpl_msg_indent_less();
+<a name="l01222"></a>01222 }
+<a name="l01223"></a>01223 <span class="keywordflow">else</span>
+<a name="l01224"></a>01224 cpl_msg_info(__func__, <span class="stringliteral">"Zero point not available for chip %d"</span>,
+<a name="l01225"></a>01225 idet + 1);
+<a name="l01226"></a>01226
+<a name="l01227"></a>01227 }
+<a name="l01228"></a>01228
+<a name="l01229"></a>01229 <span class="keywordflow">return</span> zpoint;
+<a name="l01230"></a>01230 }
+<a name="l01231"></a>01231
+<a name="l01232"></a>01232 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01240"></a>01240 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01241"></a>01241 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_get_mag(
+<a name="l01242"></a>01242 <span class="keyword">const</span> <span class="keywordtype">char</span> * std_file,
+<a name="l01243"></a>01243 <span class="keywordtype">double</span> pointing_ra,
+<a name="l01244"></a>01244 <span class="keywordtype">double</span> pointing_dec,
+<a name="l01245"></a>01245 hawki_band band)
+<a name="l01246"></a>01246 {
+<a name="l01247"></a>01247 cpl_table * catalogue;
+<a name="l01248"></a>01248 <span class="keywordtype">char</span> * star_name;
+<a name="l01249"></a>01249 <span class="keywordtype">char</span> * used_catname;
+<a name="l01250"></a>01250 <span class="keywordtype">char</span> * star_type;
+<a name="l01251"></a>01251 <span class="keywordtype">double</span> stdstar_ra;
+<a name="l01252"></a>01252 <span class="keywordtype">double</span> stdstar_dec;
+<a name="l01253"></a>01253 <span class="keywordtype">double</span> mag_filter;
+<a name="l01254"></a>01254 <span class="keywordtype">double</span> mag_J;
+<a name="l01255"></a>01255 <span class="keywordtype">double</span> mag_H;
+<a name="l01256"></a>01256 <span class="keywordtype">double</span> mag_K;
+<a name="l01257"></a>01257 <span class="keywordtype">double</span> mag_Y;
+<a name="l01258"></a>01258 <span class="keywordtype">int</span> mag_invalid;
+<a name="l01259"></a>01259 <span class="keywordtype">int</span> star_ind;
+<a name="l01260"></a>01260
+<a name="l01261"></a>01261 hawki_cal_zpoint_outputs.stdstar_incat_found = 0;
+<a name="l01262"></a>01262
+<a name="l01263"></a>01263 <span class="comment">/* Load the catalog */</span>
+<a name="l01264"></a>01264 <span class="keywordflow">if</span> ((catalogue = irplib_stdstar_load_catalog(std_file, <span class="stringliteral">"all"</span>)) == NULL) {
+<a name="l01265"></a>01265 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot read catalogue file %s"</span>,std_file);
+<a name="l01266"></a>01266 <span class="keywordflow">return</span> -1;
+<a name="l01267"></a>01267 }
+<a name="l01268"></a>01268
+<a name="l01269"></a>01269 <span class="comment">/* Check that the columns are there */</span>
+<a name="l01270"></a>01270 <span class="keywordflow">if</span> (irplib_stdstar_check_columns_exist(catalogue) != CPL_ERROR_NONE) {
+<a name="l01271"></a>01271 cpl_msg_error(cpl_func,<span class="stringliteral">"Note all the columns are present"</span>
+<a name="l01272"></a>01272 <span class="stringliteral">" in the catalogue file %s"</span>,std_file);
+<a name="l01273"></a>01273 <span class="keywordflow">return</span> -1;
+<a name="l01274"></a>01274 }
+<a name="l01275"></a>01275
+<a name="l01276"></a>01276 <span class="comment">/* Select stars within a given distance */</span>
+<a name="l01277"></a>01277 <span class="keywordflow">if</span> (irplib_stdstar_select_stars_dist(catalogue,
+<a name="l01278"></a>01278 pointing_ra, pointing_dec, 5.0) == -1) {
+<a name="l01279"></a>01279 cpl_table_delete(catalogue) ;
+<a name="l01280"></a>01280 <span class="keywordflow">return</span> 1;
+<a name="l01281"></a>01281 }
+<a name="l01282"></a>01282
+<a name="l01283"></a>01283 <span class="comment">/* Take the closest */</span>
+<a name="l01284"></a>01284 <span class="keywordflow">if</span> ((star_ind=irplib_stdstar_find_closest(catalogue,
+<a name="l01285"></a>01285 pointing_ra, pointing_dec)) < 0) {
+<a name="l01286"></a>01286 cpl_table_delete(catalogue) ;
+<a name="l01287"></a>01287 <span class="keywordflow">return</span> 1;
+<a name="l01288"></a>01288 }
+<a name="l01289"></a>01289
+<a name="l01290"></a>01290 <span class="comment">/* Retrieve the star information */</span>
+<a name="l01291"></a>01291 hawki_cal_zpoint_outputs.stdstar_incat_found = 1;
+<a name="l01292"></a>01292 star_name = cpl_strdup(cpl_table_get_string(catalogue,
+<a name="l01293"></a>01293 IRPLIB_STDSTAR_STAR_COL, star_ind));
+<a name="l01294"></a>01294 used_catname = cpl_strdup(cpl_table_get_string
+<a name="l01295"></a>01295 (catalogue, IRPLIB_STDSTAR_CAT_COL, star_ind));
+<a name="l01296"></a>01296 star_type = cpl_strdup(cpl_table_get_string(catalogue,
+<a name="l01297"></a>01297 IRPLIB_STDSTAR_TYPE_COL, star_ind));
+<a name="l01298"></a>01298 stdstar_ra = cpl_table_get_double(catalogue,
+<a name="l01299"></a>01299 IRPLIB_STDSTAR_RA_COL, star_ind, NULL);
+<a name="l01300"></a>01300 stdstar_dec = cpl_table_get_double(catalogue,
+<a name="l01301"></a>01301 IRPLIB_STDSTAR_DEC_COL, star_ind, NULL);
+<a name="l01302"></a>01302 mag_filter = cpl_table_get_double(catalogue, <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(band),
+<a name="l01303"></a>01303 star_ind, &mag_invalid);
+<a name="l01304"></a>01304 mag_H = cpl_table_get_double(catalogue, <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_H),
+<a name="l01305"></a>01305 star_ind, NULL);
+<a name="l01306"></a>01306 mag_J = cpl_table_get_double(catalogue, <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_J),
+<a name="l01307"></a>01307 star_ind, NULL);
+<a name="l01308"></a>01308 mag_K = cpl_table_get_double(catalogue, <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_K),
+<a name="l01309"></a>01309 star_ind, NULL);
+<a name="l01310"></a>01310 mag_Y = cpl_table_get_double(catalogue, <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_Y),
+<a name="l01311"></a>01311 star_ind, NULL);
+<a name="l01312"></a>01312
+<a name="l01313"></a>01313 <span class="comment">/* Store results */</span>
+<a name="l01314"></a>01314 strcpy(hawki_cal_zpoint_outputs.starname, star_name) ;
+<a name="l01315"></a>01315 strcpy(hawki_cal_zpoint_outputs.sptype, star_type) ;
+<a name="l01316"></a>01316 strcpy(hawki_cal_zpoint_outputs.catalog, used_catname);
+<a name="l01317"></a>01317 hawki_cal_zpoint_outputs.stdstar_ra = stdstar_ra;
+<a name="l01318"></a>01318 hawki_cal_zpoint_outputs.stdstar_dec = stdstar_dec;
+<a name="l01319"></a>01319 <span class="keywordflow">if</span>(mag_invalid == 0)
+<a name="l01320"></a>01320 {
+<a name="l01321"></a>01321 hawki_cal_zpoint_outputs.stdstar_mag_available = 1;
+<a name="l01322"></a>01322 hawki_cal_zpoint_outputs.stdstar_mag_filter = mag_filter;
+<a name="l01323"></a>01323 }
+<a name="l01324"></a>01324 <span class="keywordflow">else</span>
+<a name="l01325"></a>01325 hawki_cal_zpoint_outputs.stdstar_mag_available = 0;
+<a name="l01326"></a>01326 hawki_cal_zpoint_outputs.stdstar_mag_H = mag_H;
+<a name="l01327"></a>01327 hawki_cal_zpoint_outputs.stdstar_mag_J = mag_J;
+<a name="l01328"></a>01328 hawki_cal_zpoint_outputs.stdstar_mag_K = mag_K;
+<a name="l01329"></a>01329 hawki_cal_zpoint_outputs.stdstar_mag_Y = mag_Y;
+<a name="l01330"></a>01330 cpl_free(star_name);
+<a name="l01331"></a>01331 cpl_free(star_type);
+<a name="l01332"></a>01332 cpl_free(used_catname);
+<a name="l01333"></a>01333 cpl_table_delete(catalogue);
+<a name="l01334"></a>01334
+<a name="l01335"></a>01335 <span class="keywordflow">return</span> 0;
+<a name="l01336"></a>01336 }
+<a name="l01337"></a>01337
+<a name="l01338"></a>01338 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01347"></a>01347 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01348"></a>01348 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_save
+<a name="l01349"></a>01349 (cpl_table ** zpoint_tables,
+<a name="l01350"></a>01350 <span class="keywordtype">int</span> * labels,
+<a name="l01351"></a>01351 cpl_imagelist * images,
+<a name="l01352"></a>01352 cpl_table ** raw_zpoint_stats,
+<a name="l01353"></a>01353 cpl_frameset * zpoint_frames,
+<a name="l01354"></a>01354 cpl_frameset * calib_frames,
+<a name="l01355"></a>01355 <span class="keyword">const</span> cpl_frame * stars_frame,
+<a name="l01356"></a>01356 cpl_parameterlist * parlist,
+<a name="l01357"></a>01357 cpl_frameset * <span class="keyword">set</span>)
+<a name="l01358"></a>01358 {
+<a name="l01359"></a>01359 cpl_propertylist * qcmainparams;
+<a name="l01360"></a>01360 cpl_propertylist ** qcextparams;
+<a name="l01361"></a>01361 cpl_propertylist * mainheader;
+<a name="l01362"></a>01362 cpl_propertylist ** extheaders;
+<a name="l01363"></a>01363 cpl_propertylist ** statsqcextparams;
+<a name="l01364"></a>01364 cpl_propertylist ** statsextheaders;
+<a name="l01365"></a>01365 cpl_frameset * used_frames;
+<a name="l01366"></a>01366 <span class="keyword">const</span> <span class="keywordtype">char</span> * ref_filename;
+<a name="l01367"></a>01367 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_cal_zpoint"</span> ;
+<a name="l01368"></a>01368 <span class="keywordtype">int</span> idet;
+<a name="l01369"></a>01369 <span class="keywordtype">int</span> iframe;
+<a name="l01370"></a>01370 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l01371"></a>01371
+<a name="l01372"></a>01372
+<a name="l01373"></a>01373 <span class="comment">/* Get the reference frame */</span>
+<a name="l01374"></a>01374 ref_filename = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(<span class="keyword">set</span>);
+<a name="l01375"></a>01375
+<a name="l01376"></a>01376 <span class="comment">/* Create QC parameters for the zpoint table */</span>
+<a name="l01377"></a>01377 qcmainparams = cpl_propertylist_new();
+<a name="l01378"></a>01378 qcextparams = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01379"></a>01379 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01380"></a>01380 qcextparams[idet] = cpl_propertylist_new();
+<a name="l01381"></a>01381 <span class="comment">/* Write QC parameters */</span>
+<a name="l01382"></a>01382 hawki_cal_zpoint_compute_qc(qcmainparams, qcextparams, <span class="keyword">set</span>);
+<a name="l01383"></a>01383
+<a name="l01384"></a>01384 <span class="comment">/* Create QC parameters for the stats table: Statistics of the raw images */</span>
+<a name="l01385"></a>01385 statsqcextparams = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01386"></a>01386 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01387"></a>01387 statsqcextparams[idet] = cpl_propertylist_new();
+<a name="l01388"></a>01388 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(raw_zpoint_stats, statsqcextparams);
+<a name="l01389"></a>01389
+<a name="l01390"></a>01390 <span class="comment">/* Create the main and extension headers for the zpoint table*/</span>
+<a name="l01391"></a>01391 mainheader = cpl_propertylist_new();
+<a name="l01392"></a>01392 extheaders = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01393"></a>01393 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01394"></a>01394 extheaders[idet] = cpl_propertylist_new();
+<a name="l01395"></a>01395 <span class="comment">/* Copy QC params to the headers */</span>
+<a name="l01396"></a>01396 cpl_propertylist_append(mainheader, qcmainparams);
+<a name="l01397"></a>01397 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01398"></a>01398 cpl_propertylist_append(extheaders[idet], qcextparams[idet]) ;
+<a name="l01399"></a>01399
+<a name="l01400"></a>01400 <span class="comment">/* Create the extension headers for the stats table*/</span>
+<a name="l01401"></a>01401 statsextheaders = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01402"></a>01402 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01403"></a>01403 statsextheaders[idet] = cpl_propertylist_duplicate(statsqcextparams[idet]);
+<a name="l01404"></a>01404
+<a name="l01405"></a>01405 <span class="comment">/* Write additional keywords to the headers */</span>
+<a name="l01406"></a>01406 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01407"></a>01407 {
+<a name="l01408"></a>01408 cpl_propertylist * inputlist;
+<a name="l01409"></a>01409 cpl_propertylist * wcslist;
+<a name="l01410"></a>01410 <span class="keywordtype">int</span> this_iframe = -1;
+<a name="l01411"></a>01411 <span class="keywordtype">int</span> ext_nb;
+<a name="l01412"></a>01412
+<a name="l01413"></a>01413 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l01414"></a>01414 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(ref_filename, idet+1);
+<a name="l01415"></a>01415 inputlist = cpl_propertylist_load_regexp(ref_filename, ext_nb,
+<a name="l01416"></a>01416 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l01417"></a>01417 cpl_propertylist_append(extheaders[idet], inputlist);
+<a name="l01418"></a>01418 cpl_propertylist_append(statsextheaders[idet], inputlist);
+<a name="l01419"></a>01419 cpl_propertylist_delete(inputlist);
+<a name="l01420"></a>01420
+<a name="l01421"></a>01421 <span class="comment">/* Propagate WCS keywords */</span>
+<a name="l01422"></a>01422 <span class="keywordflow">for</span>(iframe=0; iframe<cpl_frameset_get_size(zpoint_frames); iframe++)
+<a name="l01423"></a>01423 <span class="keywordflow">if</span>(labels[iframe] == idet + 1)
+<a name="l01424"></a>01424 this_iframe = iframe;
+<a name="l01425"></a>01425 wcslist = cpl_propertylist_load_regexp
+<a name="l01426"></a>01426 (cpl_frame_get_filename(cpl_frameset_get_frame(zpoint_frames, this_iframe)),
+<a name="l01427"></a>01427 ext_nb, HAWKI_HEADER_WCS, 0);
+<a name="l01428"></a>01428 cpl_propertylist_copy_property_regexp
+<a name="l01429"></a>01429 (extheaders[idet], wcslist, HAWKI_HEADER_WCS, 0);
+<a name="l01430"></a>01430 cpl_propertylist_delete(wcslist);
+<a name="l01431"></a>01431 }
+<a name="l01432"></a>01432
+<a name="l01433"></a>01433 <span class="comment">/* Write the zpoint table */</span>
+<a name="l01434"></a>01434 used_frames = cpl_frameset_duplicate(zpoint_frames);
+<a name="l01435"></a>01435 <span class="keywordflow">for</span>(iframe = 0; iframe< cpl_frameset_get_size(calib_frames); ++iframe)
+<a name="l01436"></a>01436 cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+<a name="l01437"></a>01437 cpl_frameset_get_frame(calib_frames, iframe)));
+<a name="l01438"></a>01438 cpl_frameset_insert(used_frames, cpl_frame_duplicate(stars_frame));
+<a name="l01439"></a>01439 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l01440"></a>01440 parlist,
+<a name="l01441"></a>01441 used_frames,
+<a name="l01442"></a>01442 (<span class="keyword">const</span> cpl_table **)zpoint_tables,
+<a name="l01443"></a>01443 recipe_name,
+<a name="l01444"></a>01444 HAWKI_CALPRO_ZPOINT_TAB,
+<a name="l01445"></a>01445 HAWKI_PROTYPE_ZPOINT_TAB,
+<a name="l01446"></a>01446 mainheader,
+<a name="l01447"></a>01447 (<span class="keyword">const</span> cpl_propertylist **)extheaders,
+<a name="l01448"></a>01448 <span class="stringliteral">"hawki_cal_zpoint.fits"</span>);
+<a name="l01449"></a>01449 cpl_frameset_delete(used_frames);
+<a name="l01450"></a>01450
+<a name="l01451"></a>01451 <span class="comment">/* Write the table with the raw zpoint objects statistics */</span>
+<a name="l01452"></a>01452 used_frames = cpl_frameset_duplicate(zpoint_frames);
+<a name="l01453"></a>01453 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l01454"></a>01454 parlist,
+<a name="l01455"></a>01455 used_frames,
+<a name="l01456"></a>01456 (<span class="keyword">const</span> cpl_table **)raw_zpoint_stats,
+<a name="l01457"></a>01457 recipe_name,
+<a name="l01458"></a>01458 HAWKI_CALPRO_ZPOINT_STATS,
+<a name="l01459"></a>01459 HAWKI_PROTYPE_ZPOINT_STATS,
+<a name="l01460"></a>01460 NULL,
+<a name="l01461"></a>01461 (<span class="keyword">const</span> cpl_propertylist **)statsextheaders,
+<a name="l01462"></a>01462 <span class="stringliteral">"hawki_cal_zpoint_stats.fits"</span>);
+<a name="l01463"></a>01463
+<a name="l01464"></a>01464 <span class="comment">/* Write the images */</span>
+<a name="l01465"></a>01465 <span class="keywordflow">for</span>(iframe = 0; iframe< cpl_frameset_get_size(calib_frames); ++iframe)
+<a name="l01466"></a>01466 cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+<a name="l01467"></a>01467 cpl_frameset_get_frame(calib_frames, iframe)));
+<a name="l01468"></a>01468 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(<span class="keyword">set</span>,
+<a name="l01469"></a>01469 parlist,
+<a name="l01470"></a>01470 used_frames,
+<a name="l01471"></a>01471 images,
+<a name="l01472"></a>01472 recipe_name,
+<a name="l01473"></a>01473 HAWKI_CALPRO_ZPOINT_IMA,
+<a name="l01474"></a>01474 HAWKI_PROTYPE_ZPOINT_IMA,
+<a name="l01475"></a>01475 NULL,
+<a name="l01476"></a>01476 NULL,
+<a name="l01477"></a>01477 <span class="stringliteral">"hawki_cal_zpoint_check.fits"</span>) ;
+<a name="l01478"></a>01478 cpl_frameset_delete(used_frames);
+<a name="l01479"></a>01479
+<a name="l01480"></a>01480 <span class="comment">/* Free */</span>
+<a name="l01481"></a>01481 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l01482"></a>01482 cpl_propertylist_delete(extheaders[idet]) ;
+<a name="l01483"></a>01483 cpl_propertylist_delete(qcextparams[idet]) ;
+<a name="l01484"></a>01484 cpl_propertylist_delete(statsqcextparams[idet]);
+<a name="l01485"></a>01485 cpl_propertylist_delete(statsextheaders[idet]);
+<a name="l01486"></a>01486 }
+<a name="l01487"></a>01487 cpl_propertylist_delete(mainheader);
+<a name="l01488"></a>01488 cpl_propertylist_delete(qcmainparams);
+<a name="l01489"></a>01489 cpl_free(extheaders);
+<a name="l01490"></a>01490 cpl_free(qcextparams);
+<a name="l01491"></a>01491 cpl_free(statsqcextparams);
+<a name="l01492"></a>01492 cpl_free(statsextheaders);
+<a name="l01493"></a>01493
+<a name="l01494"></a>01494 <span class="comment">/* Free */</span>
+<a name="l01495"></a>01495 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l01496"></a>01496 {
+<a name="l01497"></a>01497 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l01498"></a>01498 <span class="keywordflow">return</span> -1;
+<a name="l01499"></a>01499 }
+<a name="l01500"></a>01500 <span class="keywordflow">return</span> 0;
+<a name="l01501"></a>01501 }
+<a name="l01502"></a>01502
+<a name="l01503"></a>01503 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01510"></a>01510 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01511"></a>01511 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_compute_qc
+<a name="l01512"></a>01512 (cpl_propertylist * qcmainparams,
+<a name="l01513"></a>01513 cpl_propertylist ** qcextparams,
+<a name="l01514"></a>01514 cpl_frameset * <span class="keyword">set</span>)
+<a name="l01515"></a>01515 {
+<a name="l01516"></a>01516 <span class="keywordtype">int</span> idet;
+<a name="l01517"></a>01517 <span class="keywordtype">int</span> nframes;
+<a name="l01518"></a>01518
+<a name="l01519"></a>01519
+<a name="l01520"></a>01520 nframes = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l01521"></a>01521
+<a name="l01522"></a>01522 <span class="comment">/* Check inputs */</span>
+<a name="l01523"></a>01523 <span class="keywordflow">if</span> (qcmainparams == NULL) <span class="keywordflow">return</span> -1;
+<a name="l01524"></a>01524 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01525"></a>01525 <span class="keywordflow">if</span> (qcextparams[idet] == NULL) <span class="keywordflow">return</span> -1;
+<a name="l01526"></a>01526
+<a name="l01527"></a>01527 <span class="comment">/* Write the QC params common to all extensions in the main header */</span>
+<a name="l01528"></a>01528 cpl_propertylist_append_string(qcmainparams, <span class="stringliteral">"ESO QC FILTER OBS"</span>,
+<a name="l01529"></a>01529 hawki_cal_zpoint_outputs.filter);
+<a name="l01530"></a>01530 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC FILTER OBS"</span>,
+<a name="l01531"></a>01531 <span class="stringliteral">"Observation filter"</span>);
+<a name="l01532"></a>01532 cpl_propertylist_append_string(qcmainparams, <span class="stringliteral">"ESO QC FILTER REF"</span>,
+<a name="l01533"></a>01533 <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(hawki_cal_zpoint_outputs.band)) ;
+<a name="l01534"></a>01534 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC FILTER REF"</span>,
+<a name="l01535"></a>01535 <span class="stringliteral">"Reference filter"</span>);
+<a name="l01536"></a>01536 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC AMBI RHUM AVG"</span>,
+<a name="l01537"></a>01537 hawki_cal_zpoint_outputs.humidity);
+<a name="l01538"></a>01538 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC AMBI RHUM AVG"</span>,
+<a name="l01539"></a>01539 <span class="stringliteral">"(percent) ambient relative humidity @ 30/2 m"</span>);
+<a name="l01540"></a>01540 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC AIRMASS MEAN"</span>,
+<a name="l01541"></a>01541 hawki_cal_zpoint_outputs.mean_airmass) ;
+<a name="l01542"></a>01542 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC AIRMASS MEAN"</span>,
+<a name="l01543"></a>01543 <span class="stringliteral">"Average airmass"</span>);
+<a name="l01544"></a>01544 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC DATANCOM"</span>,
+<a name="l01545"></a>01545 nframes);
+<a name="l01546"></a>01546 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC DATANCOM"</span>,
+<a name="l01547"></a>01547 <span class="stringliteral">"Number of files used for the reduction"</span>);
+<a name="l01548"></a>01548 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_incat_found == 1)
+<a name="l01549"></a>01549 {
+<a name="l01550"></a>01550 cpl_propertylist_append_string(qcmainparams, <span class="stringliteral">"ESO QC STDNAME"</span>,
+<a name="l01551"></a>01551 hawki_cal_zpoint_outputs.starname) ;
+<a name="l01552"></a>01552 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC STDNAME"</span>,
+<a name="l01553"></a>01553 <span class="stringliteral">"Standard star name"</span>);
+<a name="l01554"></a>01554 cpl_propertylist_append_string(qcmainparams, <span class="stringliteral">"ESO QC SPECTYPE"</span>,
+<a name="l01555"></a>01555 hawki_cal_zpoint_outputs.sptype) ;
+<a name="l01556"></a>01556 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC SPECTYPE"</span>,
+<a name="l01557"></a>01557 <span class="stringliteral">"Standard star spectral type"</span>);
+<a name="l01558"></a>01558 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC STARMAG H"</span>,
+<a name="l01559"></a>01559 hawki_cal_zpoint_outputs.stdstar_mag_H) ;
+<a name="l01560"></a>01560 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC STARMAG H"</span>,
+<a name="l01561"></a>01561 <span class="stringliteral">"Standard star magnitude in H"</span>);
+<a name="l01562"></a>01562 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC STARMAG J"</span>,
+<a name="l01563"></a>01563 hawki_cal_zpoint_outputs.stdstar_mag_J) ;
+<a name="l01564"></a>01564 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC STARMAG J"</span>,
+<a name="l01565"></a>01565 <span class="stringliteral">"Standard star magnitude in J"</span>);
+<a name="l01566"></a>01566 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC STARMAG K"</span>,
+<a name="l01567"></a>01567 hawki_cal_zpoint_outputs.stdstar_mag_K) ;
+<a name="l01568"></a>01568 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC STARMAG K"</span>,
+<a name="l01569"></a>01569 <span class="stringliteral">"Standard star magnitude in K"</span>);
+<a name="l01570"></a>01570 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC STARMAG Y"</span>,
+<a name="l01571"></a>01571 hawki_cal_zpoint_outputs.stdstar_mag_Y) ;
+<a name="l01572"></a>01572 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC STARMAG Y"</span>,
+<a name="l01573"></a>01573 <span class="stringliteral">"Standard star magnitude in Y"</span>);
+<a name="l01574"></a>01574 cpl_propertylist_append_string(qcmainparams, <span class="stringliteral">"ESO QC CATNAME"</span>,
+<a name="l01575"></a>01575 hawki_cal_zpoint_outputs.catalog) ;
+<a name="l01576"></a>01576 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC CATNAME"</span>,
+<a name="l01577"></a>01577 <span class="stringliteral">"Standard star catalogue name"</span>);
+<a name="l01578"></a>01578 }
+<a name="l01579"></a>01579 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+<a name="l01580"></a>01580 {
+<a name="l01581"></a>01581 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC STARMAG"</span>,
+<a name="l01582"></a>01582 hawki_cal_zpoint_outputs.stdstar_mag_filter) ;
+<a name="l01583"></a>01583 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC STARMAG"</span>,
+<a name="l01584"></a>01584 <span class="stringliteral">"Standard star magnitude in observed filter"</span>);
+<a name="l01585"></a>01585 }
+<a name="l01586"></a>01586 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.zpoint_mean_computable == 1)
+<a name="l01587"></a>01587 {
+<a name="l01588"></a>01588 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC ZPOINT MEAN"</span>,
+<a name="l01589"></a>01589 hawki_cal_zpoint_outputs.mean_zpoint) ;
+<a name="l01590"></a>01590 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC ZPOINT MEAN"</span>,
+<a name="l01591"></a>01591 <span class="stringliteral">"Mean measured zero-point for all the chips [mag]"</span>);
+<a name="l01592"></a>01592 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC ATX0 MEAN"</span>,
+<a name="l01593"></a>01593 hawki_cal_zpoint_outputs.mean_atx0);
+<a name="l01594"></a>01594 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC ATX0 MEAN"</span>,
+<a name="l01595"></a>01595 <span class="stringliteral">"Mean extinction corrected zero-point for all the chips [mag]"</span>);
+<a name="l01596"></a>01596 cpl_propertylist_append_double(qcmainparams, <span class="stringliteral">"ESO QC ZPOINT EXT COEFF"</span>,
+<a name="l01597"></a>01597 hawki_cal_zpoint_outputs.ext_coeff);
+<a name="l01598"></a>01598 cpl_propertylist_set_comment(qcmainparams, <span class="stringliteral">"ESO QC ZPOINT EXT COEFF"</span>,
+<a name="l01599"></a>01599 <span class="stringliteral">"Extinction coefficient used in the computation of ATX0"</span>);
+<a name="l01600"></a>01600 }
+<a name="l01601"></a>01601
+<a name="l01602"></a>01602 <span class="comment">/* Write QC params that are specific of the extension */</span>
+<a name="l01603"></a>01603 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01604"></a>01604 {
+<a name="l01605"></a>01605 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+<a name="l01606"></a>01606 {
+<a name="l01607"></a>01607 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT"</span>,
+<a name="l01608"></a>01608 hawki_cal_zpoint_outputs.zpoint[idet]) ;
+<a name="l01609"></a>01609 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT"</span>,
+<a name="l01610"></a>01610 <span class="stringliteral">"Measured zero-point for a given chip [mag]"</span>);
+<a name="l01611"></a>01611 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ATX0"</span>,
+<a name="l01612"></a>01612 hawki_cal_zpoint_outputs.atx0[idet]);
+<a name="l01613"></a>01613 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ATX0"</span>,
+<a name="l01614"></a>01614 <span class="stringliteral">"Extinction corrected zero-point for a given chip [mag]"</span>);
+<a name="l01615"></a>01615 }
+<a name="l01616"></a>01616 <span class="keywordflow">if</span>(hawki_cal_zpoint_outputs.stdstar_image_detected[idet] == 1)
+<a name="l01617"></a>01617 {
+<a name="l01618"></a>01618 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT POSX"</span>,
+<a name="l01619"></a>01619 hawki_cal_zpoint_outputs.posx[idet]);
+<a name="l01620"></a>01620 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT POSX"</span>,
+<a name="l01621"></a>01621 <span class="stringliteral">"X position of the standard star [pixel]"</span>);
+<a name="l01622"></a>01622 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT POSY"</span>,
+<a name="l01623"></a>01623 hawki_cal_zpoint_outputs.posy[idet]);
+<a name="l01624"></a>01624 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT POSY"</span>,
+<a name="l01625"></a>01625 <span class="stringliteral">"Y position of the standard star [pixel]"</span>);
+<a name="l01626"></a>01626 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FLUX"</span>,
+<a name="l01627"></a>01627 hawki_cal_zpoint_outputs.flux[idet]);
+<a name="l01628"></a>01628 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FLUX"</span>,
+<a name="l01629"></a>01629 <span class="stringliteral">"Flux of the standard star [ADU]"</span>);
+<a name="l01630"></a>01630 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT PEAK"</span>,
+<a name="l01631"></a>01631 hawki_cal_zpoint_outputs.peak[idet]) ;
+<a name="l01632"></a>01632 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT PEAK"</span>,
+<a name="l01633"></a>01633 <span class="stringliteral">"Peak of the standard starr [ADU]"</span>);
+<a name="l01634"></a>01634 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT BGD"</span>,
+<a name="l01635"></a>01635 hawki_cal_zpoint_outputs.bgd[idet]) ;
+<a name="l01636"></a>01636 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT BGD"</span>,
+<a name="l01637"></a>01637 <span class="stringliteral">"Background around the standard star [ADU]"</span>);
+<a name="l01638"></a>01638 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMX"</span>,
+<a name="l01639"></a>01639 hawki_cal_zpoint_outputs.fwhmx[idet]);
+<a name="l01640"></a>01640 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMX"</span>,
+<a name="l01641"></a>01641 <span class="stringliteral">"X FWHM of the standard star [pixel]"</span>);
+<a name="l01642"></a>01642 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMY"</span>,
+<a name="l01643"></a>01643 hawki_cal_zpoint_outputs.fwhmy[idet]);
+<a name="l01644"></a>01644 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMY"</span>,
+<a name="l01645"></a>01645 <span class="stringliteral">"Y FWHM of the standard star [pixel]"</span>);
+<a name="l01646"></a>01646 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHM"</span>,
+<a name="l01647"></a>01647 hawki_cal_zpoint_outputs.fwhm[idet]);
+<a name="l01648"></a>01648 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHM"</span>,
+<a name="l01649"></a>01649 <span class="stringliteral">"FWHM of the standard star [pixel]"</span>);
+<a name="l01650"></a>01650 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMX_AS"</span>,
+<a name="l01651"></a>01651 hawki_cal_zpoint_outputs.fwhmx_as[idet]);
+<a name="l01652"></a>01652 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMX_AS"</span>,
+<a name="l01653"></a>01653 <span class="stringliteral">"X FWHM of the standard star [arcsec]"</span>);
+<a name="l01654"></a>01654 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMY_AS"</span>,
+<a name="l01655"></a>01655 hawki_cal_zpoint_outputs.fwhmy_as[idet]);
+<a name="l01656"></a>01656 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHMY_AS"</span>,
+<a name="l01657"></a>01657 <span class="stringliteral">"Y FWHM of the standard star [arcsec]"</span>);
+<a name="l01658"></a>01658 cpl_propertylist_append_double(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHM_AS"</span>,
+<a name="l01659"></a>01659 hawki_cal_zpoint_outputs.fwhm_as[idet]);
+<a name="l01660"></a>01660 cpl_propertylist_set_comment(qcextparams[idet], <span class="stringliteral">"ESO QC ZPOINT FWHM_AS"</span>,
+<a name="l01661"></a>01661 <span class="stringliteral">"FWHM of the standard star [arcsec]"</span>);
+<a name="l01662"></a>01662 }
+<a name="l01663"></a>01663 }
+<a name="l01664"></a>01664 <span class="keywordflow">return</span> 0;
+<a name="l01665"></a>01665 }
+<a name="l01666"></a>01666
+<a name="l01667"></a>01667 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01673"></a>01673 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01674"></a>01674 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_cal_zpoint_compute_keywords(
+<a name="l01675"></a>01675 cpl_frameset * <span class="keyword">set</span>,
+<a name="l01676"></a>01676 <span class="keywordtype">int</span> * labels)
+<a name="l01677"></a>01677 {
+<a name="l01678"></a>01678 <span class="keywordtype">int</span> nframes ;
+<a name="l01679"></a>01679 cpl_vector * hum_vec ;
+<a name="l01680"></a>01680 cpl_frame * cur_frame ;
+<a name="l01681"></a>01681 cpl_propertylist * plist ;
+<a name="l01682"></a>01682 <span class="keywordtype">int</span> iframe;
+<a name="l01683"></a>01683
+<a name="l01684"></a>01684 <span class="comment">/* Test inputs */</span>
+<a name="l01685"></a>01685 <span class="keywordflow">if</span> (<span class="keyword">set</span> == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01686"></a>01686
+<a name="l01687"></a>01687 <span class="comment">/* Initialize */</span>
+<a name="l01688"></a>01688 nframes = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l01689"></a>01689 hawki_cal_zpoint_outputs.mean_airmass = 0.0 ;
+<a name="l01690"></a>01690
+<a name="l01691"></a>01691 hum_vec = cpl_vector_new(nframes) ;
+<a name="l01692"></a>01692
+<a name="l01693"></a>01693 <span class="keywordflow">for</span> (iframe=0 ; iframe<nframes ; iframe++) {
+<a name="l01694"></a>01694 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l01695"></a>01695 cpl_vector_delete(hum_vec) ;
+<a name="l01696"></a>01696 <span class="keywordflow">return</span> -1 ;
+<a name="l01697"></a>01697 }
+<a name="l01698"></a>01698 cur_frame = cpl_frameset_get_frame(<span class="keyword">set</span>, iframe) ;
+<a name="l01699"></a>01699 plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0) ;
+<a name="l01700"></a>01700 <span class="keywordflow">if</span> (iframe==0)
+<a name="l01701"></a>01701 hawki_cal_zpoint_outputs.mean_airmass +=
+<a name="l01702"></a>01702 <a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(plist) ;
+<a name="l01703"></a>01703 <span class="keywordflow">if</span> (iframe==nframes-1)
+<a name="l01704"></a>01704 hawki_cal_zpoint_outputs.mean_airmass +=
+<a name="l01705"></a>01705 <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(plist);
+<a name="l01706"></a>01706 hawki_cal_zpoint_outputs.airmass[labels[iframe] - 1] =
+<a name="l01707"></a>01707 (<a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(plist) +
+<a name="l01708"></a>01708 <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(plist)) / 2.;
+<a name="l01709"></a>01709 cpl_vector_set(hum_vec, iframe, <a class="code" href="group__hawki__pfits.html#ga643c35f35f7f49a3e1c6bafd022e364a" title="find out the humidity level">hawki_pfits_get_humidity_level</a>(plist));
+<a name="l01710"></a>01710 cpl_propertylist_delete(plist) ;
+<a name="l01711"></a>01711 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l01712"></a>01712 cpl_vector_delete(hum_vec) ;
+<a name="l01713"></a>01713 cpl_error_reset() ;
+<a name="l01714"></a>01714 <span class="keywordflow">return</span> -1 ;
+<a name="l01715"></a>01715 }
+<a name="l01716"></a>01716 }
+<a name="l01717"></a>01717 hawki_cal_zpoint_outputs.humidity = cpl_vector_get_mean(hum_vec) ;
+<a name="l01718"></a>01718 hawki_cal_zpoint_outputs.mean_airmass /= 2 ;
+<a name="l01719"></a>01719
+<a name="l01720"></a>01720 <span class="comment">/* Free and return */</span>
+<a name="l01721"></a>01721 cpl_vector_delete(hum_vec) ;
+<a name="l01722"></a>01722 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l01723"></a>01723 <span class="keywordflow">return</span> 0 ;
+<a name="l01724"></a>01724 }
+<a name="l01725"></a>01725
+<a name="l01726"></a>01726 <span class="keyword">static</span> cpl_error_code hawki_cal_zpoint_get_expected_pos
+<a name="l01727"></a>01727 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l01728"></a>01728 <span class="keywordtype">int</span> * labels)
+<a name="l01729"></a>01729 {
+<a name="l01730"></a>01730 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename;
+<a name="l01731"></a>01731 <span class="keywordtype">int</span> iframe;
+<a name="l01732"></a>01732
+<a name="l01733"></a>01733 <span class="keywordflow">for</span>(iframe=0 ; iframe<HAWKI_NB_DETECTORS ; iframe++)
+<a name="l01734"></a>01734 {
+<a name="l01735"></a>01735 cpl_propertylist * wcs_plist;
+<a name="l01736"></a>01736 cpl_wcs * wcs;
+<a name="l01737"></a>01737 <span class="keywordtype">int</span> idet;
+<a name="l01738"></a>01738
+<a name="l01739"></a>01739 idet = labels[iframe];
+<a name="l01740"></a>01740 <span class="keywordflow">if</span>(hawki_cal_zpoint_config.xcoord[idet - 1] == -1 ||
+<a name="l01741"></a>01741 hawki_cal_zpoint_config.ycoord[idet - 1] == -1)
+<a name="l01742"></a>01742 {
+<a name="l01743"></a>01743 filename = cpl_frame_get_filename
+<a name="l01744"></a>01744 (cpl_frameset_get_frame_const(<span class="keyword">set</span>, iframe));
+<a name="l01745"></a>01745 wcs_plist = cpl_propertylist_load
+<a name="l01746"></a>01746 (filename, <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(filename, idet));
+<a name="l01747"></a>01747 wcs = cpl_wcs_new_from_propertylist(wcs_plist);
+<a name="l01748"></a>01748 cpl_propertylist_delete(wcs_plist);
+<a name="l01749"></a>01749 <span class="keywordflow">if</span>(wcs == NULL)
+<a name="l01750"></a>01750 {
+<a name="l01751"></a>01751 cpl_msg_error(__func__, <span class="stringliteral">"Could not get WCS info"</span>);
+<a name="l01752"></a>01752 cpl_wcs_delete(wcs);
+<a name="l01753"></a>01753 <span class="keywordflow">return</span> CPL_ERROR_ILLEGAL_INPUT;
+<a name="l01754"></a>01754 }
+<a name="l01755"></a>01755 <span class="keywordflow">if</span>(irplib_wcs_radectoxy(wcs,
+<a name="l01756"></a>01756 hawki_cal_zpoint_outputs.stdstar_ra,
+<a name="l01757"></a>01757 hawki_cal_zpoint_outputs.stdstar_dec,
+<a name="l01758"></a>01758 &(hawki_cal_zpoint_config.xcoord[idet - 1]),
+<a name="l01759"></a>01759 &(hawki_cal_zpoint_config.ycoord[idet - 1]))
+<a name="l01760"></a>01760 != CPL_ERROR_NONE)
+<a name="l01761"></a>01761 {
+<a name="l01762"></a>01762 cpl_msg_error(__func__,<span class="stringliteral">"Could not get the expected position of star"</span>);
+<a name="l01763"></a>01763 cpl_wcs_delete(wcs);
+<a name="l01764"></a>01764 <span class="keywordflow">return</span> CPL_ERROR_UNSPECIFIED;
+<a name="l01765"></a>01765 }
+<a name="l01766"></a>01766 cpl_msg_info(cpl_func,
+<a name="l01767"></a>01767 <span class="stringliteral">"Star expected position in detector %d is X=%f Y=%f"</span>,
+<a name="l01768"></a>01768 idet, hawki_cal_zpoint_config.xcoord[idet - 1],
+<a name="l01769"></a>01769 hawki_cal_zpoint_config.ycoord[idet - 1]);
+<a name="l01770"></a>01770
+<a name="l01771"></a>01771 <span class="comment">/* Free */</span>
+<a name="l01772"></a>01772 cpl_wcs_delete(wcs);
+<a name="l01773"></a>01773 }
+<a name="l01774"></a>01774 <span class="keywordflow">else</span>
+<a name="l01775"></a>01775 {
+<a name="l01776"></a>01776 cpl_msg_info(cpl_func,
+<a name="l01777"></a>01777 <span class="stringliteral">"Using given star position in detector %d: X=%f Y=%f"</span>,
+<a name="l01778"></a>01778 idet,
+<a name="l01779"></a>01779 hawki_cal_zpoint_config.xcoord[idet - 1],
+<a name="l01780"></a>01780 hawki_cal_zpoint_config.ycoord[idet - 1]);
+<a name="l01781"></a>01781
+<a name="l01782"></a>01782 }
+<a name="l01783"></a>01783 }
+<a name="l01784"></a>01784
+<a name="l01785"></a>01785 <span class="keywordflow">return</span> 0;
+<a name="l01786"></a>01786 }
+<a name="l01787"></a>01787
+<a name="l01788"></a>01788
+<a name="l01789"></a>01789 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_cal_zpoint_output_init(<span class="keywordtype">void</span>)
+<a name="l01790"></a>01790 {
+<a name="l01791"></a>01791 <span class="keywordtype">int</span> idet;
+<a name="l01792"></a>01792
+<a name="l01793"></a>01793 hawki_cal_zpoint_outputs.starname[0] = (char)0 ;
+<a name="l01794"></a>01794 hawki_cal_zpoint_outputs.sptype[0] = (char)0 ;
+<a name="l01795"></a>01795 hawki_cal_zpoint_outputs.filter[0] = (char)0 ;
+<a name="l01796"></a>01796 hawki_cal_zpoint_outputs.catalog[0] = (char)0 ;
+<a name="l01797"></a>01797 hawki_cal_zpoint_outputs.pixscale = -1.0 ;
+<a name="l01798"></a>01798 hawki_cal_zpoint_outputs.dit = -1.0 ;
+<a name="l01799"></a>01799 hawki_cal_zpoint_outputs.humidity = -1.0 ;
+<a name="l01800"></a>01800 hawki_cal_zpoint_outputs.mean_airmass = -1.0 ;
+<a name="l01801"></a>01801 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l01802"></a>01802 {
+<a name="l01803"></a>01803 hawki_cal_zpoint_outputs.airmass[idet] = -1.0 ;
+<a name="l01804"></a>01804 hawki_cal_zpoint_outputs.zpoint[idet] = -1.0 ;
+<a name="l01805"></a>01805 hawki_cal_zpoint_outputs.atx0[idet] = -1.0 ;
+<a name="l01806"></a>01806 hawki_cal_zpoint_outputs.posx[idet] = -1.0 ;
+<a name="l01807"></a>01807 hawki_cal_zpoint_outputs.posy[idet] = -1.0 ;
+<a name="l01808"></a>01808 hawki_cal_zpoint_outputs.flux[idet] = -1.0 ;
+<a name="l01809"></a>01809 hawki_cal_zpoint_outputs.peak[idet] = -1.0 ;
+<a name="l01810"></a>01810 hawki_cal_zpoint_outputs.bgd[idet] = -1.0 ;
+<a name="l01811"></a>01811 hawki_cal_zpoint_outputs.fwhmx[idet] = -1.0 ;
+<a name="l01812"></a>01812 hawki_cal_zpoint_outputs.fwhmy[idet] = -1.0 ;
+<a name="l01813"></a>01813 hawki_cal_zpoint_outputs.fwhm[idet] = -1.0 ;
+<a name="l01814"></a>01814 hawki_cal_zpoint_outputs.fwhmx_as[idet] = -1.0 ;
+<a name="l01815"></a>01815 hawki_cal_zpoint_outputs.fwhmy_as[idet] = -1.0 ;
+<a name="l01816"></a>01816 hawki_cal_zpoint_outputs .fwhm_as[idet] = -1.0 ;
+<a name="l01817"></a>01817 }
+<a name="l01818"></a>01818 }
+<a name="l01819"></a>01819
+<a name="l01820"></a>01820 <span class="keywordtype">int</span> hawki_cal_zpoint_retrieve_input_param
+<a name="l01821"></a>01821 (cpl_parameterlist * parlist)
+<a name="l01822"></a>01822 {
+<a name="l01823"></a>01823 cpl_parameter * par ;
+<a name="l01824"></a>01824 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l01825"></a>01825
+<a name="l01826"></a>01826 par = NULL ;
+<a name="l01827"></a>01827
+<a name="l01828"></a>01828 <span class="comment">/* --ra */</span>
+<a name="l01829"></a>01829 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.ra"</span>) ;
+<a name="l01830"></a>01830 hawki_cal_zpoint_config.target_ra = cpl_parameter_get_double(par) ;
+<a name="l01831"></a>01831 <span class="comment">/* --dec */</span>
+<a name="l01832"></a>01832 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.dec"</span>) ;
+<a name="l01833"></a>01833 hawki_cal_zpoint_config.target_dec = cpl_parameter_get_double(par) ;
+<a name="l01834"></a>01834 <span class="comment">/* --mag */</span>
+<a name="l01835"></a>01835 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.mag"</span>) ;
+<a name="l01836"></a>01836 hawki_cal_zpoint_config.stdstar_given_magnitude =
+<a name="l01837"></a>01837 cpl_parameter_get_double(par) ;
+<a name="l01838"></a>01838 <span class="comment">/* --detect_sigma */</span>
+<a name="l01839"></a>01839 par = cpl_parameterlist_find(parlist,<span class="stringliteral">"hawki.hawki_cal_zpoint.detect_sigma"</span>);
+<a name="l01840"></a>01840 hawki_cal_zpoint_config.detect_sigma = cpl_parameter_get_double(par) ;
+<a name="l01841"></a>01841 <span class="comment">/* --sx */</span>
+<a name="l01842"></a>01842 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.sx"</span>) ;
+<a name="l01843"></a>01843 hawki_cal_zpoint_config.sx = cpl_parameter_get_int(par) ;
+<a name="l01844"></a>01844 <span class="comment">/* --sy */</span>
+<a name="l01845"></a>01845 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.sy"</span>) ;
+<a name="l01846"></a>01846 hawki_cal_zpoint_config.sy = cpl_parameter_get_int(par) ;
+<a name="l01847"></a>01847 <span class="comment">/* --star_r */</span>
+<a name="l01848"></a>01848 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.star_r"</span>) ;
+<a name="l01849"></a>01849 hawki_cal_zpoint_config.phot_star_radius = cpl_parameter_get_double(par) ;
+<a name="l01850"></a>01850 <span class="comment">/* --bg_r1 */</span>
+<a name="l01851"></a>01851 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.bg_r1"</span>) ;
+<a name="l01852"></a>01852 hawki_cal_zpoint_config.phot_bg_r1 = cpl_parameter_get_double(par) ;
+<a name="l01853"></a>01853 <span class="comment">/* --bg_r2 */</span>
+<a name="l01854"></a>01854 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.bg_r2"</span>) ;
+<a name="l01855"></a>01855 hawki_cal_zpoint_config.phot_bg_r2 = cpl_parameter_get_double(par) ;
+<a name="l01856"></a>01856 <span class="comment">/* --xcoord */</span>
+<a name="l01857"></a>01857 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.xcoord"</span>);
+<a name="l01858"></a>01858 sval = cpl_parameter_get_string(par);
+<a name="l01859"></a>01859 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%lf,%lf,%lf,%lf"</span>,
+<a name="l01860"></a>01860 hawki_cal_zpoint_config.xcoord,
+<a name="l01861"></a>01861 hawki_cal_zpoint_config.xcoord+1,
+<a name="l01862"></a>01862 hawki_cal_zpoint_config.xcoord+2,
+<a name="l01863"></a>01863 hawki_cal_zpoint_config.xcoord+3)!=4)
+<a name="l01864"></a>01864 {
+<a name="l01865"></a>01865 <span class="keywordflow">return</span> -1;
+<a name="l01866"></a>01866 }
+<a name="l01867"></a>01867 <span class="comment">/* --ycoord */</span>
+<a name="l01868"></a>01868 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_cal_zpoint.ycoord"</span>);
+<a name="l01869"></a>01869 sval = cpl_parameter_get_string(par);
+<a name="l01870"></a>01870 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%lf,%lf,%lf,%lf"</span>,
+<a name="l01871"></a>01871 hawki_cal_zpoint_config.ycoord,
+<a name="l01872"></a>01872 hawki_cal_zpoint_config.ycoord+1,
+<a name="l01873"></a>01873 hawki_cal_zpoint_config.ycoord+2,
+<a name="l01874"></a>01874 hawki_cal_zpoint_config.ycoord+3)!=4)
+<a name="l01875"></a>01875 {
+<a name="l01876"></a>01876 <span class="keywordflow">return</span> -1;
+<a name="l01877"></a>01877 }
+<a name="l01878"></a>01878
+<a name="l01879"></a>01879 <span class="keywordflow">return</span> 0;
+<a name="l01880"></a>01880 }
+<a name="l01881"></a>01881
+<a name="l01882"></a>01882 <span class="keywordtype">int</span> hawki_cal_zpoint_check_epoch_equinox(cpl_propertylist * plist)
+<a name="l01883"></a>01883 {
+<a name="l01884"></a>01884 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__pfits.html#ga07110c618d0772882174838d8ce9a168" title="find out the target epoch">hawki_pfits_get_targ_epoch</a>(plist) != 2000. ||
+<a name="l01885"></a>01885 <a class="code" href="group__hawki__pfits.html#ga662be8ce410cbfa244f51ec8e5f0baad" title="find out the target equinox">hawki_pfits_get_targ_equinox</a>(plist) != 2000.)
+<a name="l01886"></a>01886 {
+<a name="l01887"></a>01887 cpl_msg_error(__func__,<span class="stringliteral">"Epoch and equinox must be 2000."</span>);
+<a name="l01888"></a>01888 <span class="keywordflow">return</span> -1;
+<a name="l01889"></a>01889 }
+<a name="l01890"></a>01890 <span class="keywordflow">else</span>
+<a name="l01891"></a>01891 <span class="keywordflow">return</span> 0;
+<a name="l01892"></a>01892 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__calib_8c_source.html b/html/hawki__calib_8c_source.html
new file mode 100644
index 0000000..6c61acb
--- /dev/null
+++ b/html/hawki__calib_8c_source.html
@@ -0,0 +1,451 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_calib.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_calib.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_calib.c,v 1.6 2010/11/03 18:50:38 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/11/03 18:50:38 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.6 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00045"></a>00045
+<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00054"></a>00054 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00071"></a>00071 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00072"></a>00072 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#gaa722d4147127c2af3088266c63d79489" title="Apply the calibration to the images.">hawki_flat_dark_bpm_imglist_calib</a>
+<a name="l00073"></a><a class="code" href="group__hawki__calib.html#gaa722d4147127c2af3088266c63d79489">00073</a> (cpl_imagelist * ilist,
+<a name="l00074"></a>00074 cpl_imagelist * flat,
+<a name="l00075"></a>00075 cpl_imagelist * dark,
+<a name="l00076"></a>00076 cpl_imagelist * bpm)
+<a name="l00077"></a>00077 {
+<a name="l00078"></a>00078 <span class="keywordtype">int</span> idet;
+<a name="l00079"></a>00079
+<a name="l00080"></a>00080 <span class="comment">/* Test entries */</span>
+<a name="l00081"></a>00081 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00082"></a>00082
+<a name="l00083"></a>00083 <span class="comment">/* Dark correction */</span>
+<a name="l00084"></a>00084 <span class="keywordflow">if</span> (dark != NULL)
+<a name="l00085"></a>00085 {
+<a name="l00086"></a>00086 cpl_msg_info(cpl_func, <span class="stringliteral">"Subtracting the dark to each chip image"</span>) ;
+<a name="l00087"></a>00087 <span class="comment">/* Apply the dark correction to the images */</span>
+<a name="l00088"></a>00088 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00089"></a>00089 {
+<a name="l00090"></a>00090 <span class="keywordflow">if</span> (cpl_image_subtract(cpl_imagelist_get(ilist, idet),
+<a name="l00091"></a>00091 cpl_imagelist_get(dark, idet))!=CPL_ERROR_NONE)
+<a name="l00092"></a>00092 {
+<a name="l00093"></a>00093 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the dark to chip %d"</span>,
+<a name="l00094"></a>00094 idet+1);
+<a name="l00095"></a>00095 <span class="keywordflow">return</span> -1 ;
+<a name="l00096"></a>00096 }
+<a name="l00097"></a>00097 }
+<a name="l00098"></a>00098 }
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="comment">/* Flat-field correction */</span>
+<a name="l00101"></a>00101 <span class="keywordflow">if</span> (flat != NULL)
+<a name="l00102"></a>00102 {
+<a name="l00103"></a>00103 cpl_msg_info(cpl_func, <span class="stringliteral">"Dividing the flat to each chip image"</span>) ;
+<a name="l00104"></a>00104 <span class="comment">/* Apply the flat correction to the images */</span>
+<a name="l00105"></a>00105 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00106"></a>00106 {
+<a name="l00107"></a>00107 <span class="keywordflow">if</span> (cpl_image_divide(cpl_imagelist_get(ilist, idet),
+<a name="l00108"></a>00108 cpl_imagelist_get(flat, idet))!=CPL_ERROR_NONE)
+<a name="l00109"></a>00109 {
+<a name="l00110"></a>00110 cpl_msg_error(__func__,<span class="stringliteral">"Cannot apply the flatfield to chip %d"</span>,
+<a name="l00111"></a>00111 idet+1);
+<a name="l00112"></a>00112 <span class="keywordflow">return</span> -1 ;
+<a name="l00113"></a>00113 }
+<a name="l00114"></a>00114 }
+<a name="l00115"></a>00115 }
+<a name="l00116"></a>00116
+<a name="l00117"></a>00117 <span class="comment">/* Correct the bad pixels if requested */</span>
+<a name="l00118"></a>00118 <span class="keywordflow">if</span> (bpm != NULL)
+<a name="l00119"></a>00119 {
+<a name="l00120"></a>00120 cpl_msg_info(cpl_func, <span class="stringliteral">"Correct the bad pixels to each chip image"</span>);
+<a name="l00121"></a>00121 <span class="comment">/* Apply the flat correction to the images */</span>
+<a name="l00122"></a>00122 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00123"></a>00123 {
+<a name="l00124"></a>00124 cpl_mask * bpm_im_bin ;
+<a name="l00125"></a>00125 <span class="comment">/* Convert the map from integer to binary */</span>
+<a name="l00126"></a>00126 bpm_im_bin = cpl_mask_threshold_image_create
+<a name="l00127"></a>00127 (cpl_imagelist_get(bpm, idet), -0.5, 0.5) ;
+<a name="l00128"></a>00128 cpl_mask_not(bpm_im_bin) ;
+<a name="l00129"></a>00129 cpl_image_reject_from_mask(cpl_imagelist_get(ilist, idet), bpm_im_bin);
+<a name="l00130"></a>00130 <span class="keywordflow">if</span> (cpl_detector_interpolate_rejected
+<a name="l00131"></a>00131 (cpl_imagelist_get(ilist, idet)) != CPL_ERROR_NONE)
+<a name="l00132"></a>00132 {
+<a name="l00133"></a>00133 cpl_msg_error
+<a name="l00134"></a>00134 (cpl_func, <span class="stringliteral">"Cannot clean the bad pixels in chip %d"</span>,
+<a name="l00135"></a>00135 idet+1);
+<a name="l00136"></a>00136 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00137"></a>00137 <span class="keywordflow">return</span> -1 ;
+<a name="l00138"></a>00138 }
+<a name="l00139"></a>00139 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00140"></a>00140 }
+<a name="l00141"></a>00141 }
+<a name="l00142"></a>00142
+<a name="l00143"></a>00143 <span class="comment">/* Return */</span>
+<a name="l00144"></a>00144 <span class="keywordflow">return</span> 0 ;
+<a name="l00145"></a>00145 }
+<a name="l00146"></a>00146
+<a name="l00147"></a>00147 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00160"></a>00160 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00161"></a><a class="code" href="group__hawki__calib.html#gabf25546801362d0be3ac42779e8fb29c">00161</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#gabf25546801362d0be3ac42779e8fb29c" title="Apply the calibration to the images.">hawki_flat_bpm_imglist_calib</a>(
+<a name="l00162"></a>00162 cpl_imagelist * ilist,
+<a name="l00163"></a>00163 cpl_imagelist * flat,
+<a name="l00164"></a>00164 cpl_imagelist * bpm)
+<a name="l00165"></a>00165 {
+<a name="l00166"></a>00166 <span class="keywordtype">int</span> idet;
+<a name="l00167"></a>00167
+<a name="l00168"></a>00168 <span class="comment">/* Test entries */</span>
+<a name="l00169"></a>00169 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00170"></a>00170
+<a name="l00171"></a>00171 <span class="comment">/* Flat-field correction */</span>
+<a name="l00172"></a>00172 <span class="keywordflow">if</span> (flat != NULL)
+<a name="l00173"></a>00173 {
+<a name="l00174"></a>00174 cpl_msg_info(cpl_func, <span class="stringliteral">"Divide the images by the flatfield"</span>) ;
+<a name="l00175"></a>00175 <span class="comment">/* Apply the flat correction to the images */</span>
+<a name="l00176"></a>00176 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00177"></a>00177 {
+<a name="l00178"></a>00178 <span class="keywordflow">if</span> (cpl_image_divide(cpl_imagelist_get(ilist, idet),
+<a name="l00179"></a>00179 cpl_imagelist_get(flat, idet))!=CPL_ERROR_NONE)
+<a name="l00180"></a>00180 {
+<a name="l00181"></a>00181 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the flatfield to the images"</span>);
+<a name="l00182"></a>00182 <span class="keywordflow">return</span> -1 ;
+<a name="l00183"></a>00183 }
+<a name="l00184"></a>00184 }
+<a name="l00185"></a>00185 }
+<a name="l00186"></a>00186
+<a name="l00187"></a>00187 <span class="comment">/* Correct the bad pixels if requested */</span>
+<a name="l00188"></a>00188 <span class="keywordflow">if</span> (bpm != NULL)
+<a name="l00189"></a>00189 {
+<a name="l00190"></a>00190 cpl_msg_info(cpl_func, <span class="stringliteral">"Correct the bad pixels in the images"</span>) ;
+<a name="l00191"></a>00191 <span class="comment">/* Apply the flat correction to the images */</span>
+<a name="l00192"></a>00192 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00193"></a>00193 {
+<a name="l00194"></a>00194 cpl_mask * bpm_im_bin ;
+<a name="l00195"></a>00195 <span class="comment">/* Convert the map from integer to binary */</span>
+<a name="l00196"></a>00196 bpm_im_bin = cpl_mask_threshold_image_create
+<a name="l00197"></a>00197 (cpl_imagelist_get(bpm, idet), -0.5, 0.5) ;
+<a name="l00198"></a>00198 cpl_mask_not(bpm_im_bin) ;
+<a name="l00199"></a>00199 cpl_image_reject_from_mask(cpl_imagelist_get(ilist, idet), bpm_im_bin);
+<a name="l00200"></a>00200 <span class="keywordflow">if</span> (cpl_detector_interpolate_rejected
+<a name="l00201"></a>00201 (cpl_imagelist_get(ilist, idet)) != CPL_ERROR_NONE)
+<a name="l00202"></a>00202 {
+<a name="l00203"></a>00203 cpl_msg_error
+<a name="l00204"></a>00204 (cpl_func, <span class="stringliteral">"Cannot clean the bad pixels in detector %d"</span>,
+<a name="l00205"></a>00205 idet+1);
+<a name="l00206"></a>00206 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00207"></a>00207 <span class="keywordflow">return</span> -1 ;
+<a name="l00208"></a>00208 }
+<a name="l00209"></a>00209 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00210"></a>00210 }
+<a name="l00211"></a>00211 }
+<a name="l00212"></a>00212
+<a name="l00213"></a>00213 <span class="comment">/* Return */</span>
+<a name="l00214"></a>00214 <span class="keywordflow">return</span> 0 ;
+<a name="l00215"></a>00215 }
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00224"></a>00224 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00225"></a>00225 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#ga648180245b7cace291a654d5b31e5f75" title="Apply the background subtraction to the images.">hawki_bkg_imglist_calib</a>
+<a name="l00226"></a><a class="code" href="group__hawki__calib.html#ga648180245b7cace291a654d5b31e5f75">00226</a> (cpl_imagelist * ilist,
+<a name="l00227"></a>00227 cpl_imagelist * bkg)
+<a name="l00228"></a>00228 {
+<a name="l00229"></a>00229 <span class="keywordtype">int</span> idet;
+<a name="l00230"></a>00230
+<a name="l00231"></a>00231 <span class="comment">/* Test entries */</span>
+<a name="l00232"></a>00232 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00233"></a>00233
+<a name="l00234"></a>00234 <span class="comment">/* Background correction */</span>
+<a name="l00235"></a>00235 <span class="keywordflow">if</span> (bkg != NULL)
+<a name="l00236"></a>00236 {
+<a name="l00237"></a>00237 cpl_msg_info(cpl_func, <span class="stringliteral">"Subtract the images by the bkg"</span>) ;
+<a name="l00238"></a>00238 <span class="comment">/* Apply the bkg correction to the images */</span>
+<a name="l00239"></a>00239 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00240"></a>00240 {
+<a name="l00241"></a>00241 <span class="keywordflow">if</span> (cpl_image_subtract(cpl_imagelist_get(ilist, idet),
+<a name="l00242"></a>00242 cpl_imagelist_get(bkg, idet))!=CPL_ERROR_NONE)
+<a name="l00243"></a>00243 {
+<a name="l00244"></a>00244 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the bkg to the images"</span>);
+<a name="l00245"></a>00245 <span class="keywordflow">return</span> -1 ;
+<a name="l00246"></a>00246 }
+<a name="l00247"></a>00247 }
+<a name="l00248"></a>00248 }
+<a name="l00249"></a>00249
+<a name="l00250"></a>00250 <span class="comment">/* Return */</span>
+<a name="l00251"></a>00251 <span class="keywordflow">return</span> 0 ;
+<a name="l00252"></a>00252
+<a name="l00253"></a>00253 }
+<a name="l00254"></a>00254
+<a name="l00255"></a>00255 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00275"></a>00275 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00276"></a><a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d">00276</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d" title="Apply the calibration to the images.">hawki_flat_dark_bpm_detector_calib</a>(
+<a name="l00277"></a>00277 cpl_imagelist * ilist,
+<a name="l00278"></a>00278 cpl_image * flat,
+<a name="l00279"></a>00279 cpl_image * dark,
+<a name="l00280"></a>00280 cpl_image * bpm)
+<a name="l00281"></a>00281 {
+<a name="l00282"></a>00282 cpl_mask * bpm_im_bin ;
+<a name="l00283"></a>00283 <span class="keywordtype">int</span> i ;
+<a name="l00284"></a>00284
+<a name="l00285"></a>00285 <span class="comment">/* Test entries */</span>
+<a name="l00286"></a>00286 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00287"></a>00287
+<a name="l00288"></a>00288 <span class="comment">/* Dark correction */</span>
+<a name="l00289"></a>00289 <span class="keywordflow">if</span> (dark != NULL)
+<a name="l00290"></a>00290 {
+<a name="l00291"></a>00291 cpl_msg_info(cpl_func, <span class="stringliteral">"Subtract the images by the dark"</span>) ;
+<a name="l00292"></a>00292 <span class="keywordflow">if</span> (cpl_imagelist_subtract_image(ilist, dark)!=CPL_ERROR_NONE)
+<a name="l00293"></a>00293 {
+<a name="l00294"></a>00294 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the dark to the images"</span>);
+<a name="l00295"></a>00295 <span class="keywordflow">return</span> -1 ;
+<a name="l00296"></a>00296 }
+<a name="l00297"></a>00297 }
+<a name="l00298"></a>00298
+<a name="l00299"></a>00299 <span class="comment">/* Flat-field correction */</span>
+<a name="l00300"></a>00300 <span class="keywordflow">if</span> (flat != NULL) {
+<a name="l00301"></a>00301 cpl_msg_info(cpl_func, <span class="stringliteral">"Divide the images by the flatfield"</span>) ;
+<a name="l00302"></a>00302
+<a name="l00303"></a>00303 <span class="comment">/* Apply the flatfield correction to the images */</span>
+<a name="l00304"></a>00304 <span class="keywordflow">if</span> (cpl_imagelist_divide_image(ilist, flat)!=CPL_ERROR_NONE) {
+<a name="l00305"></a>00305 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the flatfield to the images"</span>);
+<a name="l00306"></a>00306 <span class="keywordflow">return</span> -1 ;
+<a name="l00307"></a>00307 }
+<a name="l00308"></a>00308 }
+<a name="l00309"></a>00309
+<a name="l00310"></a>00310 <span class="comment">/* Correct the bad pixels if requested */</span>
+<a name="l00311"></a>00311 <span class="keywordflow">if</span> (bpm != NULL) {
+<a name="l00312"></a>00312 cpl_msg_info(cpl_func, <span class="stringliteral">"Correct the bad pixels in the images"</span>) ;
+<a name="l00313"></a>00313
+<a name="l00314"></a>00314 <span class="comment">/* Convert the map from integer to binary */</span>
+<a name="l00315"></a>00315 bpm_im_bin = cpl_mask_threshold_image_create(bpm, -0.5, 0.5) ;
+<a name="l00316"></a>00316 cpl_mask_not(bpm_im_bin) ;
+<a name="l00317"></a>00317 <span class="comment">/* Apply the bad pixels cleaning */</span>
+<a name="l00318"></a>00318 <span class="keywordflow">for</span> (i=0 ; i<cpl_imagelist_get_size(ilist) ; i++) {
+<a name="l00319"></a>00319 cpl_image_reject_from_mask(cpl_imagelist_get(ilist, i), bpm_im_bin);
+<a name="l00320"></a>00320 <span class="keywordflow">if</span> (cpl_detector_interpolate_rejected(
+<a name="l00321"></a>00321 cpl_imagelist_get(ilist, i)) != CPL_ERROR_NONE) {
+<a name="l00322"></a>00322 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot clean the bad pixels in obj %d"</span>,
+<a name="l00323"></a>00323 i+1);
+<a name="l00324"></a>00324 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00325"></a>00325 <span class="keywordflow">return</span> -1 ;
+<a name="l00326"></a>00326 }
+<a name="l00327"></a>00327 }
+<a name="l00328"></a>00328 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00329"></a>00329 }
+<a name="l00330"></a>00330
+<a name="l00331"></a>00331 <span class="comment">/* Return */</span>
+<a name="l00332"></a>00332 <span class="keywordflow">return</span> 0 ;
+<a name="l00333"></a>00333 }
+<a name="l00334"></a>00334
+<a name="l00335"></a>00335 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00353"></a>00353 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00354"></a><a class="code" href="group__hawki__calib.html#ga07a2392c998d129862af73b06e1d0571">00354</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#ga07a2392c998d129862af73b06e1d0571" title="Apply the calibration to the images.">hawki_flat_bpm_detector_calib</a>(
+<a name="l00355"></a>00355 cpl_imagelist * ilist,
+<a name="l00356"></a>00356 cpl_image * flat,
+<a name="l00357"></a>00357 cpl_image * bpm)
+<a name="l00358"></a>00358 {
+<a name="l00359"></a>00359 cpl_mask * bpm_im_bin ;
+<a name="l00360"></a>00360 <span class="keywordtype">int</span> i ;
+<a name="l00361"></a>00361
+<a name="l00362"></a>00362 <span class="comment">/* Test entries */</span>
+<a name="l00363"></a>00363 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00364"></a>00364
+<a name="l00365"></a>00365 <span class="comment">/* Flat-field correction */</span>
+<a name="l00366"></a>00366 <span class="keywordflow">if</span> (flat != NULL) {
+<a name="l00367"></a>00367 cpl_msg_info(cpl_func, <span class="stringliteral">"Divide the images by the flatfield"</span>) ;
+<a name="l00368"></a>00368
+<a name="l00369"></a>00369 <span class="comment">/* Apply the flatfield correction to the images */</span>
+<a name="l00370"></a>00370 <span class="keywordflow">if</span> (cpl_imagelist_divide_image(ilist, flat)!=CPL_ERROR_NONE) {
+<a name="l00371"></a>00371 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot apply the flatfield to the images"</span>);
+<a name="l00372"></a>00372 <span class="keywordflow">return</span> -1 ;
+<a name="l00373"></a>00373 }
+<a name="l00374"></a>00374 }
+<a name="l00375"></a>00375
+<a name="l00376"></a>00376 <span class="comment">/* Correct the bad pixels if requested */</span>
+<a name="l00377"></a>00377 <span class="keywordflow">if</span> (bpm != NULL) {
+<a name="l00378"></a>00378 cpl_msg_info(cpl_func, <span class="stringliteral">"Correct the bad pixels in the images"</span>) ;
+<a name="l00379"></a>00379
+<a name="l00380"></a>00380 <span class="comment">/* Convert the map from integer to binary */</span>
+<a name="l00381"></a>00381 bpm_im_bin = cpl_mask_threshold_image_create(bpm, -0.5, 0.5) ;
+<a name="l00382"></a>00382 cpl_mask_not(bpm_im_bin) ;
+<a name="l00383"></a>00383 <span class="comment">/* Apply the bad pixels cleaning */</span>
+<a name="l00384"></a>00384 <span class="keywordflow">for</span> (i=0 ; i<cpl_imagelist_get_size(ilist) ; i++) {
+<a name="l00385"></a>00385 cpl_image_reject_from_mask(cpl_imagelist_get(ilist, i), bpm_im_bin);
+<a name="l00386"></a>00386 <span class="keywordflow">if</span> (cpl_detector_interpolate_rejected(
+<a name="l00387"></a>00387 cpl_imagelist_get(ilist, i)) != CPL_ERROR_NONE) {
+<a name="l00388"></a>00388 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot clean the bad pixels in obj %d"</span>,
+<a name="l00389"></a>00389 i+1);
+<a name="l00390"></a>00390 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00391"></a>00391 <span class="keywordflow">return</span> -1 ;
+<a name="l00392"></a>00392 }
+<a name="l00393"></a>00393 }
+<a name="l00394"></a>00394 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00395"></a>00395 }
+<a name="l00396"></a>00396
+<a name="l00397"></a>00397 <span class="comment">/* Return */</span>
+<a name="l00398"></a>00398 <span class="keywordflow">return</span> 0 ;
+<a name="l00399"></a>00399 }
+<a name="l00400"></a>00400
+<a name="l00401"></a>00401 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00412"></a>00412 cpl_imagelist * <a class="code" href="group__hawki__calib.html#ga5013786f602800e5899b011b21f9547f" title="Trim a list of hawki images (usually from one detector)">hawki_trim_detector_calib</a>
+<a name="l00413"></a><a class="code" href="group__hawki__calib.html#ga5013786f602800e5899b011b21f9547f">00413</a> (cpl_imagelist * imalist,
+<a name="l00414"></a>00414 <span class="keywordtype">int</span> nborder)
+<a name="l00415"></a>00415 {
+<a name="l00416"></a>00416 <span class="keywordtype">int</span> i = 0;
+<a name="l00417"></a>00417 <span class="comment">/* Discard the pixels on the sides */</span>
+<a name="l00418"></a>00418 cpl_imagelist * trimmed_images = cpl_imagelist_new();
+<a name="l00419"></a>00419 <span class="keywordflow">while</span>(cpl_imagelist_get_size(imalist) > 0)
+<a name="l00420"></a>00420 {
+<a name="l00421"></a>00421 cpl_image * non_trimmed;
+<a name="l00422"></a>00422 cpl_image * trimmed;
+<a name="l00423"></a>00423 <span class="keywordtype">int</span> nx;
+<a name="l00424"></a>00424 <span class="keywordtype">int</span> ny;
+<a name="l00425"></a>00425
+<a name="l00426"></a>00426 non_trimmed = cpl_imagelist_unset(imalist, 0);
+<a name="l00427"></a>00427 nx = cpl_image_get_size_x(non_trimmed);
+<a name="l00428"></a>00428 ny = cpl_image_get_size_y(non_trimmed);
+<a name="l00429"></a>00429 trimmed = cpl_image_extract(non_trimmed,
+<a name="l00430"></a>00430 nborder+1, nborder+1,
+<a name="l00431"></a>00431 nx-nborder, ny-nborder);
+<a name="l00432"></a>00432 cpl_imagelist_set(trimmed_images, trimmed, i);
+<a name="l00433"></a>00433 ++i;
+<a name="l00434"></a>00434 cpl_image_delete(non_trimmed);
+<a name="l00435"></a>00435 }
+<a name="l00436"></a>00436
+<a name="l00437"></a>00437 <span class="keywordflow">return</span> trimmed_images;
+<a name="l00438"></a>00438 }
+<a name="l00439"></a>00439
+<a name="l00440"></a>00440 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00449"></a>00449 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00450"></a><a class="code" href="group__hawki__calib.html#gacab5ec7e7db02bd1f46661c443a6c16b">00450</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#gacab5ec7e7db02bd1f46661c443a6c16b" title="Apply the BPM correction to an image.">hawki_bpm_calib</a>(
+<a name="l00451"></a>00451 cpl_image * ima,
+<a name="l00452"></a>00452 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00453"></a>00453 <span class="keywordtype">int</span> idet)
+<a name="l00454"></a>00454 {
+<a name="l00455"></a>00455 cpl_mask * bpm_im_bin ;
+<a name="l00456"></a>00456 cpl_image * bpm_im_int ;
+<a name="l00457"></a>00457 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 <span class="comment">/* Test entries */</span>
+<a name="l00460"></a>00460 <span class="keywordflow">if</span> (ima == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00461"></a>00461 <span class="keywordflow">if</span> (idet < 1 || idet > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> -1 ;
+<a name="l00462"></a>00462 <span class="keywordflow">if</span> (bpm == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00463"></a>00463
+<a name="l00464"></a>00464 <span class="comment">/* Get the extension number for this detector */</span>
+<a name="l00465"></a>00465 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(bpm, idet)) == -1) {
+<a name="l00466"></a>00466 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with detector %d"</span>, idet) ;
+<a name="l00467"></a>00467 <span class="keywordflow">return</span> -1 ;
+<a name="l00468"></a>00468 }
+<a name="l00469"></a>00469 <span class="comment">/* Load the bad pixels image */</span>
+<a name="l00470"></a>00470 <span class="keywordflow">if</span> ((bpm_im_int = cpl_image_load(bpm, CPL_TYPE_INT, 0, ext_nb)) == NULL) {
+<a name="l00471"></a>00471 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot load the bad pixel map %s"</span>, bpm) ;
+<a name="l00472"></a>00472 <span class="keywordflow">return</span> -1 ;
+<a name="l00473"></a>00473 }
+<a name="l00474"></a>00474 <span class="comment">/* Convert the map from integer to binary */</span>
+<a name="l00475"></a>00475 bpm_im_bin = cpl_mask_threshold_image_create(bpm_im_int, -0.5, 0.5) ;
+<a name="l00476"></a>00476 cpl_mask_not(bpm_im_bin) ;
+<a name="l00477"></a>00477 cpl_image_delete(bpm_im_int) ;
+<a name="l00478"></a>00478 <span class="comment">/* Apply the bad pixels cleaning */</span>
+<a name="l00479"></a>00479 cpl_image_reject_from_mask(ima, bpm_im_bin);
+<a name="l00480"></a>00480 <span class="keywordflow">if</span> (cpl_detector_interpolate_rejected(ima) != CPL_ERROR_NONE) {
+<a name="l00481"></a>00481 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot clean the bad pixels"</span>);
+<a name="l00482"></a>00482 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00483"></a>00483 <span class="keywordflow">return</span> -1 ;
+<a name="l00484"></a>00484 }
+<a name="l00485"></a>00485 cpl_mask_delete(bpm_im_bin) ;
+<a name="l00486"></a>00486
+<a name="l00487"></a>00487 <span class="comment">/* Return */</span>
+<a name="l00488"></a>00488 <span class="keywordflow">return</span> 0 ;
+<a name="l00489"></a>00489 }
+<a name="l00490"></a>00490
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__calib_8h_source.html b/html/hawki__calib_8h_source.html
new file mode 100644
index 0000000..424fd2a
--- /dev/null
+++ b/html/hawki__calib_8h_source.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_calib.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_calib.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_calib.h,v 1.6 2010/11/03 18:50:47 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/11/03 18:50:47 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.6 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_CALIB_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALIB_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> Function definitions</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#gacab5ec7e7db02bd1f46661c443a6c16b" title="Apply the BPM correction to an image.">hawki_bpm_calib</a>
+<a name="l00042"></a>00042 (cpl_image * ima,
+<a name="l00043"></a>00043 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00044"></a>00044 <span class="keywordtype">int</span> idet);
+<a name="l00045"></a>00045 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#ga07a2392c998d129862af73b06e1d0571" title="Apply the calibration to the images.">hawki_flat_bpm_detector_calib</a>
+<a name="l00046"></a>00046 (cpl_imagelist * ilist,
+<a name="l00047"></a>00047 cpl_image * flat,
+<a name="l00048"></a>00048 cpl_image * bpm);
+<a name="l00049"></a>00049 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d" title="Apply the calibration to the images.">hawki_flat_dark_bpm_detector_calib</a>
+<a name="l00050"></a>00050 (cpl_imagelist * ilist,
+<a name="l00051"></a>00051 cpl_image * flat,
+<a name="l00052"></a>00052 cpl_image * dark,
+<a name="l00053"></a>00053 cpl_image * bpm);
+<a name="l00054"></a>00054 cpl_imagelist * <a class="code" href="group__hawki__calib.html#ga5013786f602800e5899b011b21f9547f" title="Trim a list of hawki images (usually from one detector)">hawki_trim_detector_calib</a>
+<a name="l00055"></a>00055 (cpl_imagelist * ilist,
+<a name="l00056"></a>00056 <span class="keywordtype">int</span> nborder);
+<a name="l00057"></a>00057 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#gaa722d4147127c2af3088266c63d79489" title="Apply the calibration to the images.">hawki_flat_dark_bpm_imglist_calib</a>
+<a name="l00058"></a>00058 (cpl_imagelist * ilist,
+<a name="l00059"></a>00059 cpl_imagelist * flat,
+<a name="l00060"></a>00060 cpl_imagelist * dark,
+<a name="l00061"></a>00061 cpl_imagelist * bpm);
+<a name="l00062"></a>00062 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#gabf25546801362d0be3ac42779e8fb29c" title="Apply the calibration to the images.">hawki_flat_bpm_imglist_calib</a>
+<a name="l00063"></a>00063 (cpl_imagelist * ilist,
+<a name="l00064"></a>00064 cpl_imagelist * flat,
+<a name="l00065"></a>00065 cpl_imagelist * bpm);
+<a name="l00066"></a>00066 <span class="keywordtype">int</span> <a class="code" href="group__hawki__calib.html#ga648180245b7cace291a654d5b31e5f75" title="Apply the background subtraction to the images.">hawki_bkg_imglist_calib</a>
+<a name="l00067"></a>00067 (cpl_imagelist * ilist,
+<a name="l00068"></a>00068 cpl_imagelist * bkg);
+<a name="l00069"></a>00069 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__combine_8c_source.html b/html/hawki__combine_8c_source.html
new file mode 100644
index 0000000..4e7f9f9
--- /dev/null
+++ b/html/hawki__combine_8c_source.html
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_combine.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_combine.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_combine.c,v 1.1.1.1 2007/02/13 16:03:30 yjung Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: yjung $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2007/02/13 16:03:30 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1.1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "hawki_combine.h"</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00042"></a>00042 <span class="comment"> Functions prototypes</span>
+<a name="l00043"></a>00043 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00044"></a>00044
+<a name="l00045"></a>00045 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__combine_8h_source.html b/html/hawki__combine_8h_source.html
new file mode 100644
index 0000000..0945a50
--- /dev/null
+++ b/html/hawki__combine_8h_source.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_combine.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_combine.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_combine.h,v 1.1.1.1 2007/02/13 16:03:30 yjung Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: yjung $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2007/02/13 16:03:30 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1.1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_COMBINE_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COMBINE_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Functions prototypes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__dfs_8c_source.html b/html/hawki__dfs_8c_source.html
new file mode 100644
index 0000000..8c1afae
--- /dev/null
+++ b/html/hawki__dfs_8c_source.html
@@ -0,0 +1,154 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_dfs.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_dfs.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_dfs.c,v 1.28 2010/11/29 03:32:41 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/11/29 03:32:41 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.28 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00049"></a>00049 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050
+<a name="l00053"></a>00053 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00059"></a>00059 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00060"></a><a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b">00060</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(cpl_frameset * <span class="keyword">set</span>)
+<a name="l00061"></a>00061 {
+<a name="l00062"></a>00062 cpl_frame * cur_frame ;
+<a name="l00063"></a>00063 <span class="keyword">const</span> <span class="keywordtype">char</span> * tag ;
+<a name="l00064"></a>00064 <span class="keywordtype">int</span> nframes ;
+<a name="l00065"></a>00065 <span class="keywordtype">int</span> i ;
+<a name="l00066"></a>00066
+<a name="l00067"></a>00067 <span class="comment">/* Check entries */</span>
+<a name="l00068"></a>00068 <span class="keywordflow">if</span> (<span class="keyword">set</span> == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00069"></a>00069
+<a name="l00070"></a>00070 <span class="comment">/* Initialize */</span>
+<a name="l00071"></a>00071 nframes = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="comment">/* Loop on frames */</span>
+<a name="l00074"></a>00074 <span class="keywordflow">for</span> (i=0 ; i<nframes ; i++) {
+<a name="l00075"></a>00075 cur_frame = cpl_frameset_get_frame(<span class="keyword">set</span>, i) ;
+<a name="l00076"></a>00076 tag = cpl_frame_get_tag(cur_frame) ;
+<a name="l00077"></a>00077
+<a name="l00078"></a>00078 <span class="comment">/* RAW frames */</span>
+<a name="l00079"></a>00079 <span class="keywordflow">if</span> (!strcmp(tag, HAWKI_COMMAND_LINE) ||
+<a name="l00080"></a>00080 !strcmp(tag, HAWKI_CAL_DARK_RAW) ||
+<a name="l00081"></a>00081 !strcmp(tag, HAWKI_TEC_FLAT_RAW) ||
+<a name="l00082"></a>00082 !strcmp(tag, HAWKI_CAL_FLAT_RAW) ||
+<a name="l00083"></a>00083 !strcmp(tag, HAWKI_CAL_ZPOINT_RAW) ||
+<a name="l00084"></a>00084 !strcmp(tag, HAWKI_CAL_ILLUM_RAW) ||
+<a name="l00085"></a>00085 !strcmp(tag, HAWKI_CAL_DISTOR_RAW) ||
+<a name="l00086"></a>00086 !strcmp(tag, HAWKI_IMG_JITTER_SKY_RAW) ||
+<a name="l00087"></a>00087 !strcmp(tag, HAWKI_IMG_JITTER_RAW) ||
+<a name="l00088"></a>00088 !strcmp(tag, HAWKI_CAL_LINGAIN_LAMP_RAW) ||
+<a name="l00089"></a>00089 !strcmp(tag, HAWKI_CAL_LINGAIN_DARK_RAW) ||
+<a name="l00090"></a>00090 !strcmp(tag, HAWKI_CALPRO_BASICCALIBRATED) ||
+<a name="l00091"></a>00091 !strcmp(tag, HAWKI_CALPRO_SKY_BASICCALIBRATED) ||
+<a name="l00092"></a>00092 !strcmp(tag, HAWKI_CALPRO_BKGIMAGE) ||
+<a name="l00093"></a>00093 !strcmp(tag, HAWKI_CALPRO_BKG_SUBTRACTED) ||
+<a name="l00094"></a>00094 !strcmp(tag, HAWKI_CALPRO_DIST_CORRECTED) ||
+<a name="l00095"></a>00095 !strcmp(tag, HAWKI_CALPRO_COMBINED) ||
+<a name="l00096"></a>00096 !strcmp(tag, HAWKI_CALPRO_ZPOINT_TAB))
+<a name="l00097"></a>00097 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW) ;
+<a name="l00098"></a>00098 <span class="comment">/* CALIB frames */</span>
+<a name="l00099"></a>00099 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(tag, HAWKI_CALPRO_BPM) ||
+<a name="l00100"></a>00100 !strcmp(tag, HAWKI_UTIL_STDSTARS_RAW) ||
+<a name="l00101"></a>00101 !strcmp(tag, HAWKI_UTIL_DISTMAP_RAW) ||
+<a name="l00102"></a>00102 !strcmp(tag, HAWKI_CALPRO_BPM_HOT) ||
+<a name="l00103"></a>00103 !strcmp(tag, HAWKI_CALPRO_BPM_COLD) ||
+<a name="l00104"></a>00104 !strcmp(tag, HAWKI_CALPRO_FLAT) ||
+<a name="l00105"></a>00105 !strcmp(tag, HAWKI_CALPRO_DARK) ||
+<a name="l00106"></a>00106 !strcmp(tag, HAWKI_CALPRO_STDSTARS) ||
+<a name="l00107"></a>00107 !strcmp(tag, HAWKI_CALPRO_DISTORTION))
+<a name="l00108"></a>00108 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ;
+<a name="l00109"></a>00109 }
+<a name="l00110"></a>00110 <span class="keywordflow">return</span> 0 ;
+<a name="l00111"></a>00111 }
+<a name="l00112"></a>00112
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__dfs_8h_source.html b/html/hawki__dfs_8h_source.html
new file mode 100644
index 0000000..994a5ff
--- /dev/null
+++ b/html/hawki__dfs_8h_source.html
@@ -0,0 +1,561 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_dfs.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_dfs.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_dfs.h,v 1.56 2011/02/09 17:16:23 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/02/09 17:16:23 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.56 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_DFS_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DFS_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Define</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="comment">/******************************************/</span>
+<a name="l00036"></a>00036 <span class="comment">/* DEFINE HERE THE DIFFERENT COLUMN NAMES */</span>
+<a name="l00037"></a>00037 <span class="comment">/******************************************/</span>
+<a name="l00038"></a>00038 <span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_ALT "TEL_ALT"</span>
+<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AZ "TEL_AZ"</span>
+<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM "TEL_AMBI_RHUM"</span>
+<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0 "TEL_AMBI_TAU0"</span>
+<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP "TEL_AMBI_TEMP"</span>
+<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR "TEL_AMBI_WINDDIR"</span>
+<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP "TEL_AMBI_WINDSP"</span>
+<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM "TEL_IA_FWHM"</span>
+<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START "ADA_ABSROT_START"</span>
+<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END "ADA_ABSROT_END"</span>
+<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA "ADA_ABSROT_DELTA"</span>
+<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START "TEL_AIRM_START"</span>
+<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END "TEL_AIRM_END"</span>
+<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AIRM "TEL_AIRM"</span>
+<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START "TEL_AMBI_FWHM_START"</span>
+<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END "TEL_AMBI_FWHM_END"</span>
+<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM "TEL_AMBI_FWHM"</span>
+<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START "TEL_AMBI_PRES_START"</span>
+<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END "TEL_AMBI_PRES_END"</span>
+<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES "TEL_AMBI_PRES"</span>
+<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START "TEL_PARANG_START"</span>
+<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END "TEL_PARANG_END"</span>
+<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG "TEL_PARANG"</span>
+<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA "TEL_PARANG_DELTA"</span>
+<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA "SEQ_CUMOFFSETA"</span>
+<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD "SEQ_CUMOFFSETD"</span>
+<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX "SEQ_CUMOFFSETX"</span>
+<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY "SEQ_CUMOFFSETY"</span>
+<a name="l00066"></a>00066 <span class="preprocessor"></span>
+<a name="l00067"></a>00067 <span class="preprocessor">#define HAWKI_COL_STAT_MIN "MINIMUM"</span>
+<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_STAT_MAX "MAXIMUM"</span>
+<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_STAT_MED "MEDIAN"</span>
+<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_STAT_MEAN "MEAN"</span>
+<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_STAT_RMS "RMS"</span>
+<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_STAT_USED "USED"</span>
+<a name="l00073"></a>00073 <span class="preprocessor"></span>
+<a name="l00074"></a>00074 <span class="preprocessor">#define HAWKI_COL_ZPOINT_MAG "MAG"</span>
+<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_STARNAME "STARNAME"</span>
+<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_CHIP "CHIP"</span>
+<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_ERRMAG "MAG_ERR"</span>
+<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FILTER "FILTER"</span>
+<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_AIRMASS "AIRMASS"</span>
+<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_POSX "POSX"</span>
+<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_POSY "POSY"</span>
+<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_ZPOINT "ZPOINT"</span>
+<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_ZPOINT_ERR "ZPOINT_ERR"</span>
+<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_ATX0 "ATX0"</span>
+<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FLUX "FLUX"</span>
+<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FLUX_ERR "FLUX_ERR"</span>
+<a name="l00087"></a>00087 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_INSTRMAG "INSTRMAG"</span>
+<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_INSTRMAG_ERR "INSTRMAG_ERR"</span>
+<a name="l00089"></a>00089 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_PEAK "PEAK"</span>
+<a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_BGD "BGD"</span>
+<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FWHMX "FWHMX"</span>
+<a name="l00092"></a>00092 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FWHMY "FWHMY"</span>
+<a name="l00093"></a>00093 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FWHM "FWHM"</span>
+<a name="l00094"></a>00094 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FWHMX_AS "FWHMX_AS"</span>
+<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FWHMY_AS "FWHMY_AS"</span>
+<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_FWHM_AS "FWHM_AS"</span>
+<a name="l00097"></a>00097 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ZPOINT_STARMAG "STAR_CAT_MAG"</span>
+<a name="l00098"></a>00098 <span class="preprocessor"></span>
+<a name="l00099"></a>00099 <span class="preprocessor">#define HAWKI_COL_PHOT_FILTER "FILTER"</span>
+<a name="l00100"></a>00100 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_PHOT_EXTCOEFF "EXT"</span>
+<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_PHOT_DEXTCOEFF "DEXT"</span>
+<a name="l00102"></a>00102 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_PHOT_ZEROPOINT "ZPOINT"</span>
+<a name="l00103"></a>00103 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_PHOT_DZEROPOINT "DZPOINT"</span>
+<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_PHOT_COLORTERM "COL"</span>
+<a name="l00105"></a>00105 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_PHOT_DCOLORTERM "DCOL"</span>
+<a name="l00106"></a>00106 <span class="preprocessor"></span>
+<a name="l00107"></a>00107 <span class="preprocessor">#define HAWKI_COL_OBJ_POSX "POS_X"</span>
+<a name="l00108"></a>00108 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OBJ_POSY "POS_Y"</span>
+<a name="l00109"></a>00109 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OBJ_FWHM_MAJAX "FWHM_MAJAX"</span>
+<a name="l00110"></a>00110 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OBJ_FWHM_MINAX "FWHM_MINAX"</span>
+<a name="l00111"></a>00111 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OBJ_ELLIP "ELLIP"</span>
+<a name="l00112"></a>00112 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OBJ_ANGLE "ANGLE"</span>
+<a name="l00113"></a>00113 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OBJ_FLUX "FLUX"</span>
+<a name="l00114"></a>00114 <span class="preprocessor"></span>
+<a name="l00115"></a>00115 <span class="preprocessor">#define HAWKI_COL_ILLUM_POSX "POSX"</span>
+<a name="l00116"></a>00116 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ILLUM_POSY "POSY"</span>
+<a name="l00117"></a>00117 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_ILLUM_FLUX "FLUX"</span>
+<a name="l00118"></a>00118 <span class="preprocessor"></span>
+<a name="l00119"></a>00119 <span class="preprocessor">#define HAWKI_COL_DIST_DXGC "DXGC"</span>
+<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_DIST_DYGC "DYGC"</span>
+<a name="l00121"></a>00121 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_DIST_I "I"</span>
+<a name="l00122"></a>00122 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_DIST_J "J"</span>
+<a name="l00123"></a>00123 <span class="preprocessor"></span>
+<a name="l00124"></a>00124 <span class="preprocessor">#define HAWKI_COL_OFFSET_X "X_OFFSET"</span>
+<a name="l00125"></a>00125 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_OFFSET_Y "Y_OFFSET"</span>
+<a name="l00126"></a>00126 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_CORRELATION "CORRELATION"</span>
+<a name="l00127"></a>00127 <span class="preprocessor"></span>
+<a name="l00128"></a>00128 <span class="preprocessor">#define HAWKI_COL_2MASS_RA "RA"</span>
+<a name="l00129"></a>00129 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_DEC "Dec"</span>
+<a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_J_MAG "j_m"</span>
+<a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_J_MAGSIG "j_msig"</span>
+<a name="l00132"></a>00132 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_H_MAG "h_m"</span>
+<a name="l00133"></a>00133 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_H_MAGSIG "h_msig"</span>
+<a name="l00134"></a>00134 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_K_MAG "k_m"</span>
+<a name="l00135"></a>00135 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_K_MAGSIG "k_msig"</span>
+<a name="l00136"></a>00136 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_XPREDICT "xpredict"</span>
+<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_COL_2MASS_YPREDICT "ypredict"</span>
+<a name="l00138"></a>00138 <span class="preprocessor"></span>
+<a name="l00139"></a>00139 <span class="preprocessor">#define HAWKI_COL_MATCHING_SETS "MATCHING_SETS"</span>
+<a name="l00140"></a>00140 <span class="preprocessor"></span>
+<a name="l00141"></a>00141 <span class="comment">/*************************************/</span>
+<a name="l00142"></a>00142 <span class="comment">/* DEFINE HERE THE PRO.CATG KEYWORDS */</span>
+<a name="l00143"></a>00143
+<a name="l00144"></a>00144 <span class="comment">/* Type HAWKI_PROTYPE_COMBINED */</span>
+<a name="l00145"></a>00145 <span class="preprocessor">#define HAWKI_CALPRO_COMBINED "COMBINED"</span>
+<a name="l00146"></a>00146 <span class="preprocessor"></span>
+<a name="l00147"></a>00147 <span class="comment">/* Type HAWKI_PROTYPE_COMB_CONTRIB_MAP */</span>
+<a name="l00148"></a>00148 <span class="preprocessor">#define HAWKI_CALPRO_COMB_CONTRIB_MAP "COMBINED_CONTRIB_MAP"</span>
+<a name="l00149"></a>00149 <span class="preprocessor"></span>
+<a name="l00150"></a>00150 <span class="comment">/* Type HAWKI_PROTYPE_STITCHED */</span>
+<a name="l00151"></a>00151 <span class="preprocessor">#define HAWKI_CALPRO_STITCHED "STITCHED"</span>
+<a name="l00152"></a>00152 <span class="preprocessor"></span>
+<a name="l00153"></a>00153 <span class="comment">/* Type HAWKI_PROTYPE_DIST_CORRECTED */</span>
+<a name="l00154"></a>00154 <span class="preprocessor">#define HAWKI_CALPRO_DIST_CORRECTED "DIST_CORRECTED"</span>
+<a name="l00155"></a>00155 <span class="preprocessor"></span>
+<a name="l00156"></a>00156 <span class="comment">/* Type HAWKI_PROTYPE_ILLUM */</span>
+<a name="l00157"></a>00157 <span class="preprocessor">#define HAWKI_CALPRO_ILLUM "ILLUM"</span>
+<a name="l00158"></a>00158 <span class="preprocessor"></span>
+<a name="l00159"></a>00159 <span class="comment">/* Type HAWKI_PROTYPE_BKGIMAGE */</span>
+<a name="l00160"></a>00160 <span class="preprocessor">#define HAWKI_CALPRO_BKGIMAGE "BKG_IM"</span>
+<a name="l00161"></a>00161 <span class="preprocessor"></span>
+<a name="l00162"></a>00162 <span class="comment">/* Type HAWKI_PROTYPE_BKGBPM */</span>
+<a name="l00163"></a>00163 <span class="preprocessor">#define HAWKI_CALPRO_BKGBPM "BKG_BPM"</span>
+<a name="l00164"></a>00164 <span class="preprocessor"></span>
+<a name="l00165"></a>00165 <span class="comment">/* Type HAWKI_PROTYPE_OBJ_PARAM */</span>
+<a name="l00166"></a>00166 <span class="preprocessor">#define HAWKI_CALPRO_OBJ_PARAM "OBJ_PARAM"</span>
+<a name="l00167"></a>00167 <span class="preprocessor"></span>
+<a name="l00168"></a>00168 <span class="comment">/* Type HAWKI_PROTYPE_OBJ_MASK */</span>
+<a name="l00169"></a>00169 <span class="preprocessor">#define HAWKI_CALPRO_OBJ_MASK "OBJ_MASK"</span>
+<a name="l00170"></a>00170 <span class="preprocessor"></span>
+<a name="l00171"></a>00171 <span class="comment">/* Type HAWKI_PROTYPE_SCIENCE_PCS */</span>
+<a name="l00172"></a>00172 <span class="preprocessor">#define HAWKI_CALPRO_SCIENCE_PCS "SCIENCE_PCS"</span>
+<a name="l00173"></a>00173 <span class="preprocessor"></span>
+<a name="l00174"></a>00174 <span class="comment">/* Type HAWKI_PROTYPE_ERRMAP */</span>
+<a name="l00175"></a>00175 <span class="preprocessor">#define HAWKI_CALPRO_FLAT_ERRMAP "FLAT_ERRMAP"</span>
+<a name="l00176"></a>00176 <span class="preprocessor"></span>
+<a name="l00177"></a>00177 <span class="comment">/* Type HAWKI_PROTYPE_BPM */</span>
+<a name="l00178"></a>00178 <span class="preprocessor">#define HAWKI_CALPRO_BPM "BPM"</span>
+<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_BPM_HOT "BPM_HOT"</span>
+<a name="l00180"></a>00180 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_BPM_COLD "BPM_COLD"</span>
+<a name="l00181"></a>00181 <span class="preprocessor"></span>
+<a name="l00182"></a>00182 <span class="comment">/* Type HAWKI_PROTYPE_FLAT */</span>
+<a name="l00183"></a>00183 <span class="preprocessor">#define HAWKI_CALPRO_FLAT "FLAT_IM"</span>
+<a name="l00184"></a>00184 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_FLAT_ERR "FLAT_ERR"</span>
+<a name="l00185"></a>00185 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_FLAT_RECOMPUTED "FLAT_RECOMPUTED"</span>
+<a name="l00186"></a>00186 <span class="preprocessor"></span>
+<a name="l00187"></a>00187 <span class="comment">/* Type HAWKI_PROTYPE_DARK */</span>
+<a name="l00188"></a>00188 <span class="preprocessor">#define HAWKI_CALPRO_DARK "DARK_IM"</span>
+<a name="l00189"></a>00189 <span class="preprocessor"></span>
+<a name="l00190"></a>00190 <span class="comment">/* Type HAWKI_PROTYPE_DARK_ERR */</span>
+<a name="l00191"></a>00191 <span class="preprocessor">#define HAWKI_CALPRO_DARK_ERR "DARK_ERR"</span>
+<a name="l00192"></a>00192 <span class="preprocessor"></span>
+<a name="l00193"></a>00193 <span class="comment">/* Type HAWKI_PROTYPE_ILLUM_PHOTOM */</span>
+<a name="l00194"></a>00194 <span class="preprocessor">#define HAWKI_CALPRO_ILLUM_PHOTOM "ILLUM_PHOTOM"</span>
+<a name="l00195"></a>00195 <span class="preprocessor"></span>
+<a name="l00196"></a>00196 <span class="comment">/* Type HAWKI_PROTYPE_FLAT_STATS */</span>
+<a name="l00197"></a>00197 <span class="preprocessor">#define HAWKI_CALPRO_FLAT_STATS "FLAT_STATS"</span>
+<a name="l00198"></a>00198 <span class="preprocessor"></span>
+<a name="l00199"></a>00199 <span class="comment">/* Type HAWKI_PROTYPE_FLAT_STATS_EVEN_COL */</span>
+<a name="l00200"></a>00200 <span class="preprocessor">#define HAWKI_CALPRO_FLAT_STATS_EVEN_COL "FLAT_STATS_EVEN_COL"</span>
+<a name="l00201"></a>00201 <span class="preprocessor"></span>
+<a name="l00202"></a>00202 <span class="comment">/* Type HAWKI_PROTYPE_FLAT_STATS_ODD_COL */</span>
+<a name="l00203"></a>00203 <span class="preprocessor">#define HAWKI_CALPRO_FLAT_STATS_ODD_COL "FLAT_STATS_ODD_COL"</span>
+<a name="l00204"></a>00204 <span class="preprocessor"></span>
+<a name="l00205"></a>00205 <span class="comment">/* Type HAWKI_PROTYPE_FLAT_STATS_EVEN_ROW */</span>
+<a name="l00206"></a>00206 <span class="preprocessor">#define HAWKI_CALPRO_FLAT_STATS_EVEN_ROW "FLAT_STATS_EVEN_ROW"</span>
+<a name="l00207"></a>00207 <span class="preprocessor"></span>
+<a name="l00208"></a>00208 <span class="comment">/* Type HAWKI_PROTYPE_FLAT_STATS_ODD_ROW */</span>
+<a name="l00209"></a>00209 <span class="preprocessor">#define HAWKI_CALPRO_FLAT_STATS_ODD_ROW "FLAT_STATS_ODD_ROW"</span>
+<a name="l00210"></a>00210 <span class="preprocessor"></span>
+<a name="l00211"></a>00211 <span class="comment">/* Type HAWKI_PROTYPE_DARK_STATS */</span>
+<a name="l00212"></a>00212 <span class="preprocessor">#define HAWKI_CALPRO_DARK_STATS "DARK_STATS"</span>
+<a name="l00213"></a>00213 <span class="preprocessor"></span>
+<a name="l00214"></a>00214 <span class="comment">/* Type HAWKI_PROTYPE_ZPOINT_STATS */</span>
+<a name="l00215"></a>00215 <span class="preprocessor">#define HAWKI_CALPRO_ZPOINT_STATS "ZPOINT_STATS"</span>
+<a name="l00216"></a>00216 <span class="preprocessor"></span>
+<a name="l00217"></a>00217 <span class="comment">/* Type HAWKI_PROTYPE_JITTER_STATS */</span>
+<a name="l00218"></a>00218 <span class="preprocessor">#define HAWKI_CALPRO_JITTER_STATS "JITTER_STATS"</span>
+<a name="l00219"></a>00219 <span class="preprocessor"></span>
+<a name="l00220"></a>00220 <span class="comment">/* Type HAWKI_PROTYPE_JITTER_BKG_STATS */</span>
+<a name="l00221"></a>00221 <span class="preprocessor">#define HAWKI_CALPRO_JITTER_BKG_STATS "BKG_STATS"</span>
+<a name="l00222"></a>00222 <span class="preprocessor"></span>
+<a name="l00223"></a>00223 <span class="comment">/* Type HAWKI_PROTYPE_STDSTARS */</span>
+<a name="l00224"></a>00224 <span class="preprocessor">#define HAWKI_CALPRO_STDSTARS "STDSTARS_CATS"</span>
+<a name="l00225"></a>00225 <span class="preprocessor"></span>
+<a name="l00226"></a>00226 <span class="comment">/* Type HAWKI_PROTYPE_DISTORTION */</span>
+<a name="l00227"></a>00227 <span class="preprocessor">#define HAWKI_CALPRO_DISTORTION "DISTORTION"</span>
+<a name="l00228"></a>00228 <span class="preprocessor"></span>
+<a name="l00229"></a>00229 <span class="comment">/* Type HAWKI_PROTYPE_DISTORTION_X */</span>
+<a name="l00230"></a>00230 <span class="preprocessor">#define HAWKI_CALPRO_DISTORTION_X "DISTORTION_X"</span>
+<a name="l00231"></a>00231 <span class="preprocessor"></span>
+<a name="l00232"></a>00232 <span class="comment">/* Type HAWKI_PROTYPE_DISTORTION_Y */</span>
+<a name="l00233"></a>00233 <span class="preprocessor">#define HAWKI_CALPRO_DISTORTION_Y "DISTORTION_Y"</span>
+<a name="l00234"></a>00234 <span class="preprocessor"></span>
+<a name="l00235"></a>00235 <span class="comment">/* Type HAWKI_PROTYPE_ZPOINT_TAB */</span>
+<a name="l00236"></a>00236 <span class="preprocessor">#define HAWKI_CALPRO_ZPOINT_TAB "ZPOINT_RES"</span>
+<a name="l00237"></a>00237 <span class="preprocessor"></span>
+<a name="l00238"></a>00238 <span class="comment">/* Type HAWKI_PROTYPE_PHOT_TAB */</span>
+<a name="l00239"></a>00239 <span class="preprocessor">#define HAWKI_CALPRO_PHOT_TAB "PHOT_COEFF"</span>
+<a name="l00240"></a>00240 <span class="preprocessor"></span>
+<a name="l00241"></a>00241 <span class="comment">/* Type HAWKI_PROTYPE_ZPOINT_IMA */</span>
+<a name="l00242"></a>00242 <span class="preprocessor">#define HAWKI_CALPRO_ZPOINT_IMA "ZPOINT_IMA"</span>
+<a name="l00243"></a>00243 <span class="preprocessor"></span>
+<a name="l00244"></a>00244 <span class="comment">/* Type HAWKI_PROTYPE_COEFFS */</span>
+<a name="l00245"></a>00245 <span class="preprocessor">#define HAWKI_CALPRO_LINGAIN_LIN "LINGAIN_LIN"</span>
+<a name="l00246"></a>00246 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_LINGAIN_GAIN "LINGAIN_GAIN"</span>
+<a name="l00247"></a>00247 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_LINGAIN_COEFFS "LINGAIN_COEFFS"</span>
+<a name="l00248"></a>00248 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_LINGAIN_BPM "LINGAIN_BPM"</span>
+<a name="l00249"></a>00249 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_LINGAIN_CORR "LINGAIN_CORR"</span>
+<a name="l00250"></a>00250 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CALPRO_LINGAIN_DIFF "LINGAIN_DIFF"</span>
+<a name="l00251"></a>00251 <span class="preprocessor"></span>
+<a name="l00252"></a>00252 <span class="comment">/* Type HAWKI_PROTYPE_BETSFOCUS */</span>
+<a name="l00253"></a>00253 <span class="preprocessor">#define HAWKI_CALPRO_BESTFOCUS "BEST_FOCUS"</span>
+<a name="l00254"></a>00254 <span class="preprocessor"></span>
+<a name="l00255"></a>00255 <span class="comment">/* Type HAWKI_PROTYPE_BASICCALIBRATED */</span>
+<a name="l00256"></a>00256 <span class="preprocessor">#define HAWKI_CALPRO_BASICCALIBRATED "BASIC_CALIBRATED"</span>
+<a name="l00257"></a>00257 <span class="preprocessor"></span>
+<a name="l00258"></a>00258
+<a name="l00259"></a>00259 <span class="comment">/* Type HAWKI_PROTYPE_SKY_BASICCALIBRATED */</span>
+<a name="l00260"></a>00260 <span class="preprocessor">#define HAWKI_CALPRO_SKY_BASICCALIBRATED "SKY_BASIC_CALIBRATED"</span>
+<a name="l00261"></a>00261 <span class="preprocessor"></span>
+<a name="l00262"></a>00262 <span class="comment">/* Type HAWKI_PROTYPE_BKG_SUBTRACTED */</span>
+<a name="l00263"></a>00263 <span class="preprocessor">#define HAWKI_CALPRO_BKG_SUBTRACTED "BKG_SUBTRACTED"</span>
+<a name="l00264"></a>00264 <span class="preprocessor"></span>
+<a name="l00265"></a>00265 <span class="comment">/* Type HAWKI_PROTYPE_FILTERPOSCHECK_STATS */</span>
+<a name="l00266"></a>00266 <span class="preprocessor">#define HAWKI_CALPRO_FILTERPOSCHECK_STATS "FILTERPOS_CHECK_STATS"</span>
+<a name="l00267"></a>00267 <span class="preprocessor"></span>
+<a name="l00268"></a>00268 <span class="comment">/* Type HAWKI_PROTYPE_OFFSETS */</span>
+<a name="l00269"></a>00269 <span class="preprocessor">#define HAWKI_CALPRO_OFFSETS "OFFSETS_REFINED"</span>
+<a name="l00270"></a>00270 <span class="preprocessor"></span>
+<a name="l00271"></a>00271 <span class="comment">/*************************************/</span>
+<a name="l00272"></a>00272
+<a name="l00273"></a>00273 <span class="comment">/*************************************/</span>
+<a name="l00274"></a>00274 <span class="comment">/* DEFINE HERE THE PRO.TYPE KEYWORDS */</span>
+<a name="l00275"></a>00275 <span class="comment">/* Images */</span>
+<a name="l00276"></a>00276 <span class="preprocessor">#define HAWKI_PROTYPE_BPM "BPM"</span>
+<a name="l00277"></a>00277 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_DARK "DARK"</span>
+<a name="l00278"></a>00278 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_DARK_ERR "DARK_ERR"</span>
+<a name="l00279"></a>00279 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_FLAT "FLAT"</span>
+<a name="l00280"></a>00280 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_ZPOINT_IMA "ZPOINT_IMA"</span>
+<a name="l00281"></a>00281 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_COMBINED "COMBINED"</span>
+<a name="l00282"></a>00282 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_COMB_CONTRIB_MAP "COMBINED_CONTRIB_MAP"</span>
+<a name="l00283"></a>00283 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_STITCHED "STITCHED"</span>
+<a name="l00284"></a>00284 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_ILLUM "ILLUM"</span>
+<a name="l00285"></a>00285 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_DIST_CORRECTED "DIST_CORRECTED"</span>
+<a name="l00286"></a>00286 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_BKGIMAGE "BKG_IM"</span>
+<a name="l00287"></a>00287 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_BKGBPM "BKG_BPM"</span>
+<a name="l00288"></a>00288 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_ERRMAP "ERRMAP"</span>
+<a name="l00289"></a>00289 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_BESTFOCUS "BEST_FOCUS"</span>
+<a name="l00290"></a>00290 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_BASICCALIBRATED "BASIC_CALIBRATED"</span>
+<a name="l00291"></a>00291 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_SKY_BASICCALIBRATED "SKY_BASIC_CALIBRATED"</span>
+<a name="l00292"></a>00292 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_BKG_SUBTRACTED "BKG_SUBTRACTED"</span>
+<a name="l00293"></a>00293 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_OBJ_MASK "OBJ_MASK"</span>
+<a name="l00294"></a>00294 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_DISTORTION_X "DISTORTION_X"</span>
+<a name="l00295"></a>00295 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_DISTORTION_Y "DISTORTION_Y"</span>
+<a name="l00296"></a>00296 <span class="preprocessor"></span>
+<a name="l00297"></a>00297
+<a name="l00298"></a>00298 <span class="comment">/* Tables */</span>
+<a name="l00299"></a>00299 <span class="comment">/* Col: HAWKI_COL_OBJ_POSX */</span>
+<a name="l00300"></a>00300 <span class="comment">/* HAWKI_COL_OBJ_POSY */</span>
+<a name="l00301"></a>00301 <span class="comment">/* HAWKI_COL_OBJ_FWHMX */</span>
+<a name="l00302"></a>00302 <span class="comment">/* HAWKI_COL_OBJ_FWHMY */</span>
+<a name="l00303"></a>00303 <span class="comment">/* HAWKI_COL_OBJ_ANGLE */</span>
+<a name="l00304"></a>00304 <span class="comment">/* HAWKI_COL_OBJ_FLUX */</span>
+<a name="l00305"></a>00305 <span class="preprocessor">#define HAWKI_PROTYPE_OBJ_PARAM "OBJ_PARAM"</span>
+<a name="l00306"></a>00306 <span class="preprocessor"></span>
+<a name="l00307"></a>00307 <span class="comment">/* Col: HAWKI_COL_ILLUM_POSX */</span>
+<a name="l00308"></a>00308 <span class="comment">/* HAWKI_COL_ILLUM_POSY */</span>
+<a name="l00309"></a>00309 <span class="comment">/* HAWKI_COL_ILLUM_FLUX */</span>
+<a name="l00310"></a>00310 <span class="preprocessor">#define HAWKI_PROTYPE_ILLUM_PHOTOM "ILLUM_PHOTOM"</span>
+<a name="l00311"></a>00311 <span class="preprocessor"></span>
+<a name="l00312"></a>00312 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00313"></a>00313 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00314"></a>00314 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00315"></a>00315 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00316"></a>00316 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00317"></a>00317 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00318"></a>00318 <span class="preprocessor">#define HAWKI_PROTYPE_FLAT_STATS "FLAT_STATS"</span>
+<a name="l00319"></a>00319 <span class="preprocessor"></span>
+<a name="l00320"></a>00320 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00321"></a>00321 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00322"></a>00322 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00323"></a>00323 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00324"></a>00324 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00325"></a>00325 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00326"></a>00326 <span class="preprocessor">#define HAWKI_PROTYPE_FLAT_STATS_EVEN_COL "FLAT_STATS_EVEN_COL"</span>
+<a name="l00327"></a>00327 <span class="preprocessor"></span>
+<a name="l00328"></a>00328 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00329"></a>00329 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00330"></a>00330 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00331"></a>00331 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00332"></a>00332 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00333"></a>00333 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00334"></a>00334 <span class="preprocessor">#define HAWKI_PROTYPE_FLAT_STATS_ODD_COL "FLAT_STATS_ODD_COL"</span>
+<a name="l00335"></a>00335 <span class="preprocessor"></span>
+<a name="l00336"></a>00336 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00337"></a>00337 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00338"></a>00338 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00339"></a>00339 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00340"></a>00340 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00341"></a>00341 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00342"></a>00342 <span class="preprocessor">#define HAWKI_PROTYPE_FLAT_STATS_EVEN_ROW "FLAT_STATS_EVEN_ROW"</span>
+<a name="l00343"></a>00343 <span class="preprocessor"></span>
+<a name="l00344"></a>00344 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00345"></a>00345 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00346"></a>00346 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00347"></a>00347 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00348"></a>00348 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00349"></a>00349 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00350"></a>00350 <span class="preprocessor">#define HAWKI_PROTYPE_FLAT_STATS_ODD_ROW "FLAT_STATS_ODD_ROW"</span>
+<a name="l00351"></a>00351 <span class="preprocessor"></span>
+<a name="l00352"></a>00352 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00353"></a>00353 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00354"></a>00354 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00355"></a>00355 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00356"></a>00356 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00357"></a>00357 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00358"></a>00358 <span class="preprocessor">#define HAWKI_PROTYPE_DARK_STATS "DARK_STATS"</span>
+<a name="l00359"></a>00359 <span class="preprocessor"></span>
+<a name="l00360"></a>00360 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00361"></a>00361 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00362"></a>00362 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00363"></a>00363 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00364"></a>00364 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00365"></a>00365 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00366"></a>00366 <span class="preprocessor">#define HAWKI_PROTYPE_ZPOINT_STATS "ZPOINT_STATS"</span>
+<a name="l00367"></a>00367 <span class="preprocessor"></span>
+<a name="l00368"></a>00368 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00369"></a>00369 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00370"></a>00370 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00371"></a>00371 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00372"></a>00372 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00373"></a>00373 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00374"></a>00374 <span class="preprocessor">#define HAWKI_PROTYPE_JITTER_STATS "JITTER_STATS"</span>
+<a name="l00375"></a>00375 <span class="preprocessor"></span>
+<a name="l00376"></a>00376 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00377"></a>00377 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00378"></a>00378 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00379"></a>00379 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00380"></a>00380 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00381"></a>00381 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00382"></a>00382 <span class="preprocessor">#define HAWKI_PROTYPE_JITTER_BKG_STATS "BKG_STATS"</span>
+<a name="l00383"></a>00383 <span class="preprocessor"></span>
+<a name="l00384"></a>00384 <span class="comment">/* Col: HAWKI_COL_STAT_MIN */</span>
+<a name="l00385"></a>00385 <span class="comment">/* HAWKI_COL_STAT_MAX */</span>
+<a name="l00386"></a>00386 <span class="comment">/* HAWKI_COL_STAT_MED */</span>
+<a name="l00387"></a>00387 <span class="comment">/* HAWKI_COL_STAT_RMS */</span>
+<a name="l00388"></a>00388 <span class="comment">/* HAWKI_COL_STAT_MEAN */</span>
+<a name="l00389"></a>00389 <span class="comment">/* HAWKI_COL_STAT_USED */</span>
+<a name="l00390"></a>00390 <span class="preprocessor">#define HAWKI_PROTYPE_FILTERPOSCHECK_STATS "FILTERPOS_CHECK_STATS"</span>
+<a name="l00391"></a>00391 <span class="preprocessor"></span>
+<a name="l00392"></a>00392 <span class="comment">/* Col: IRPLIB_STDSTAR_STAR_COL */</span>
+<a name="l00393"></a>00393 <span class="comment">/* IRPLIB_STDSTAR_TYPE_COL */</span>
+<a name="l00394"></a>00394 <span class="comment">/* IRPLIB_STDSTAR_RA_COL */</span>
+<a name="l00395"></a>00395 <span class="comment">/* IRPLIB_STDSTAR_DEC_COL */</span>
+<a name="l00396"></a>00396 <span class="comment">/* Filters .... */</span>
+<a name="l00397"></a>00397 <span class="preprocessor">#define HAWKI_PROTYPE_STDSTARS "STDSTARS"</span>
+<a name="l00398"></a>00398 <span class="preprocessor"></span>
+<a name="l00399"></a>00399 <span class="comment">/* Col: HAWKI_COL_DIST_DXGC */</span>
+<a name="l00400"></a>00400 <span class="comment">/* HAWKI_COL_DIST_DYGC */</span>
+<a name="l00401"></a>00401 <span class="comment">/* HAWKI_COL_DIST_I */</span>
+<a name="l00402"></a>00402 <span class="comment">/* HAWKI_COL_DIST_J */</span>
+<a name="l00403"></a>00403 <span class="preprocessor">#define HAWKI_PROTYPE_DISTORTION "DISTORTION"</span>
+<a name="l00404"></a>00404 <span class="preprocessor"></span>
+<a name="l00405"></a>00405 <span class="comment">/* Col: HAWKI_COL_ZPOINT_CHIP */</span>
+<a name="l00406"></a>00406 <span class="comment">/* HAWKI_COL_ZPOINT_POSX */</span>
+<a name="l00407"></a>00407 <span class="comment">/* HAWKI_COL_ZPOINT_POSY */</span>
+<a name="l00408"></a>00408 <span class="comment">/* HAWKI_COL_ZPOINT_ZPOINT */</span>
+<a name="l00409"></a>00409 <span class="comment">/* HAWKI_COL_ZPOINT_ATX0 */</span>
+<a name="l00410"></a>00410 <span class="comment">/* HAWKI_COL_ZPOINT_FLUX */</span>
+<a name="l00411"></a>00411 <span class="comment">/* HAWKI_COL_ZPOINT_PEAK */</span>
+<a name="l00412"></a>00412 <span class="comment">/* HAWKI_COL_ZPOINT_BGD */</span>
+<a name="l00413"></a>00413 <span class="comment">/* HAWKI_COL_ZPOINT_FWHMX */</span>
+<a name="l00414"></a>00414 <span class="comment">/* HAWKI_COL_ZPOINT_FWHMY */</span>
+<a name="l00415"></a>00415 <span class="comment">/* HAWKI_COL_ZPOINT_FWHM */</span>
+<a name="l00416"></a>00416 <span class="comment">/* HAWKI_COL_ZPOINT_FWHMX_AS */</span>
+<a name="l00417"></a>00417 <span class="comment">/* HAWKI_COL_ZPOINT_FWHMY_AS */</span>
+<a name="l00418"></a>00418 <span class="comment">/* HAWKI_COL_ZPOINT_FWHM_AS */</span>
+<a name="l00419"></a>00419 <span class="preprocessor">#define HAWKI_PROTYPE_ZPOINT_TAB "ZPOINT_TAB"</span>
+<a name="l00420"></a>00420 <span class="preprocessor"></span>
+<a name="l00421"></a>00421 <span class="comment">/* Col: HAWKI_COL_PHOT_FILTER */</span>
+<a name="l00422"></a>00422 <span class="comment">/* HAWKI_COL_PHOT_EXTCOEFF */</span>
+<a name="l00423"></a>00423 <span class="comment">/* HAWKI_COL_PHOT_DEXTCOEFF */</span>
+<a name="l00424"></a>00424 <span class="comment">/* HAWKI_COL_PHOT_ZEROPOINT */</span>
+<a name="l00425"></a>00425 <span class="comment">/* HAWKI_COL_PHOT_DZEROPOINT */</span>
+<a name="l00426"></a>00426 <span class="comment">/* HAWKI_COL_PHOT_COLORTERM */</span>
+<a name="l00427"></a>00427 <span class="comment">/* HAWKI_COL_PHOT_DCOLORTERM */</span>
+<a name="l00428"></a>00428 <span class="preprocessor">#define HAWKI_PROTYPE_PHOT_TAB "PHOT_COEFF"</span>
+<a name="l00429"></a>00429 <span class="preprocessor"></span>
+<a name="l00430"></a>00430 <span class="comment">/* Col: HAWKI_COL_RAW_JITTER_QC_TEL_ALT */</span>
+<a name="l00431"></a>00431 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AZ */</span>
+<a name="l00432"></a>00432 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM */</span>
+<a name="l00433"></a>00433 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0 */</span>
+<a name="l00434"></a>00434 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP */</span>
+<a name="l00435"></a>00435 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR */</span>
+<a name="l00436"></a>00436 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP */</span>
+<a name="l00437"></a>00437 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM */</span>
+<a name="l00438"></a>00438 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START */</span>
+<a name="l00439"></a>00439 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END */</span>
+<a name="l00440"></a>00440 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA */</span>
+<a name="l00441"></a>00441 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START */</span>
+<a name="l00442"></a>00442 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END */</span>
+<a name="l00443"></a>00443 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AIRM */</span>
+<a name="l00444"></a>00444 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START */</span>
+<a name="l00445"></a>00445 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END */</span>
+<a name="l00446"></a>00446 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM */</span>
+<a name="l00447"></a>00447 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START */</span>
+<a name="l00448"></a>00448 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END */</span>
+<a name="l00449"></a>00449 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES */</span>
+<a name="l00450"></a>00450 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START */</span>
+<a name="l00451"></a>00451 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END */</span>
+<a name="l00452"></a>00452 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG */</span>
+<a name="l00453"></a>00453 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA */</span>
+<a name="l00454"></a>00454 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA */</span>
+<a name="l00455"></a>00455 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD */</span>
+<a name="l00456"></a>00456 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX */</span>
+<a name="l00457"></a>00457 <span class="comment">/* HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY */</span>
+<a name="l00458"></a>00458 <span class="preprocessor">#define HAWKI_PROTYPE_SCIENCE_PCS "SCIENCE_PCS"</span>
+<a name="l00459"></a>00459 <span class="preprocessor"></span>
+<a name="l00460"></a>00460 <span class="comment">/* HAWKI_COL_OFFSET_X */</span>
+<a name="l00461"></a>00461 <span class="comment">/* HAWKI_COL_OFFSET_Y */</span>
+<a name="l00462"></a>00462 <span class="comment">/* HAWKI_COL_CORRELATION */</span>
+<a name="l00463"></a>00463 <span class="preprocessor">#define HAWKI_PROTYPE_OFFSETS "OFFSETS_REFINED"</span>
+<a name="l00464"></a>00464 <span class="preprocessor"></span>
+<a name="l00465"></a>00465 <span class="comment">/* TODO: This is to be deprecated */</span>
+<a name="l00466"></a>00466 <span class="preprocessor">#define HAWKI_PROTYPE_COEFFS "COEFFS"</span>
+<a name="l00467"></a>00467 <span class="preprocessor"></span>
+<a name="l00468"></a>00468 <span class="preprocessor">#define HAWKI_PROTYPE_LIN_STATS "LIN_STATS"</span>
+<a name="l00469"></a>00469 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_LIN_COEFFS "LIN_COEFFS"</span>
+<a name="l00470"></a>00470 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_GAIN_STATS "GAIN_STATS"</span>
+<a name="l00471"></a>00471 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_BPM_LEVELS "BPM_LEVELS"</span>
+<a name="l00472"></a>00472 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_LINGAIN_CORR "LINGAIN_CORR"</span>
+<a name="l00473"></a>00473 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROTYPE_LINGAIN_DIFF "LINGAIN_DIFF"</span>
+<a name="l00474"></a>00474 <span class="preprocessor"></span>
+<a name="l00475"></a>00475
+<a name="l00476"></a>00476
+<a name="l00477"></a>00477 <span class="comment">/************************************/</span>
+<a name="l00478"></a>00478
+<a name="l00479"></a>00479 <span class="comment">/************************************/</span>
+<a name="l00480"></a>00480 <span class="comment">/* Define here the DO.CATG keywords */</span>
+<a name="l00481"></a>00481 <span class="preprocessor">#define HAWKI_COMMAND_LINE "COMMAND_LINE"</span>
+<a name="l00482"></a>00482 <span class="preprocessor"></span>
+<a name="l00483"></a>00483 <span class="preprocessor">#define HAWKI_CAL_DARK_RAW "DARK"</span>
+<a name="l00484"></a>00484 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_TEC_FLAT_RAW "TEC_FLAT"</span>
+<a name="l00485"></a>00485 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_FLAT_RAW "FLAT"</span>
+<a name="l00486"></a>00486 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_FOCUS_RAW "FOCUS"</span>
+<a name="l00487"></a>00487 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_ZPOINT_RAW "ZPOINT"</span>
+<a name="l00488"></a>00488 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_ILLUM_RAW "TEC_STD"</span>
+<a name="l00489"></a>00489 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_IMG_JITTER_RAW "JITTER_OBS"</span>
+<a name="l00490"></a>00490 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_IMG_JITTER_SKY_RAW "JITTER_SKY"</span>
+<a name="l00491"></a>00491 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_LINGAIN_LAMP_RAW "DETLIN_LAMP"</span>
+<a name="l00492"></a>00492 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_LINGAIN_DARK_RAW "DETLIN_DARK"</span>
+<a name="l00493"></a>00493 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_DISTOR_RAW "DISTOR_OBS"</span>
+<a name="l00494"></a>00494 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_CAL_DISTOR_SKY_RAW "DISTOR_SKY"</span>
+<a name="l00495"></a>00495 <span class="preprocessor"></span>
+<a name="l00496"></a>00496 <span class="preprocessor">#define HAWKI_UTIL_STDSTARS_RAW "STDSTAR_CAT"</span>
+<a name="l00497"></a>00497 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_UTIL_DISTMAP_RAW "DIST_MAP"</span>
+<a name="l00498"></a>00498 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_UTIL_CAT_2MASS "CAT_2MASS"</span>
+<a name="l00499"></a>00499 <span class="preprocessor"></span><span class="comment">/************************************/</span>
+<a name="l00500"></a>00500
+<a name="l00501"></a>00501 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00502"></a>00502 <span class="comment"> Functions prototypes</span>
+<a name="l00503"></a>00503 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00504"></a>00504
+<a name="l00505"></a>00505 <span class="keywordtype">int</span> <a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(cpl_frameset *) ;
+<a name="l00506"></a>00506
+<a name="l00507"></a>00507 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__distortion_8c_source.html b/html/hawki__distortion_8c_source.html
new file mode 100644
index 0000000..2360517
--- /dev/null
+++ b/html/hawki__distortion_8c_source.html
@@ -0,0 +1,1104 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_distortion.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_distortion.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_distortion.c,v 1.32 2011/02/23 11:49:37 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/02/23 11:49:37 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.32 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">//Minimization algorithm hard-coded constants</span>
+<a name="l00033"></a>00033 <span class="preprocessor">#define HAWKI_DISTORTION_MAX_ITER 10000</span>
+<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DISTORTION_TOLERANCE 0.001</span>
+<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DISTORTION_MAX_ITER2 100000</span>
+<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DISTORTION_TOLERANCE2 0.0001</span>
+<a name="l00037"></a>00037 <span class="preprocessor"></span>
+<a name="l00038"></a>00038 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00039"></a>00039 <span class="comment"> Includes</span>
+<a name="l00040"></a>00040 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include <math.h></span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include <cxdeque.h></span>
+<a name="l00045"></a>00045 <span class="preprocessor">#ifdef HAVE_LIBGSL</span>
+<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#include <gsl/gsl_multimin.h></span>
+<a name="l00047"></a>00047 <span class="preprocessor">#endif</span>
+<a name="l00048"></a>00048 <span class="preprocessor"></span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00053"></a>00053
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055
+<a name="l00056"></a>00056 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00060"></a>00060 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00061"></a>00061
+<a name="l00069"></a><a class="code" href="struct__hawki__distortion__obj__function__args__.html">00069</a> <span class="keyword">struct </span><a class="code" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a>
+<a name="l00070"></a>00070 {
+<a name="l00071"></a>00071 <span class="keyword">const</span> cpl_table ** ref_catalogues;
+<a name="l00072"></a>00072 <span class="keyword">const</span> cpl_table * matching_sets;
+<a name="l00073"></a>00073 cpl_bivector * offsets;
+<a name="l00074"></a>00074 hawki_distortion * distortion;
+<a name="l00075"></a>00075 <span class="keywordtype">int</span> ncats;
+<a name="l00076"></a>00076 };
+<a name="l00077"></a>00077
+<a name="l00078"></a>00078
+<a name="l00079"></a>00079 <span class="comment">//Private functions</span>
+<a name="l00080"></a>00080
+<a name="l00081"></a>00081 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d" title="Interpolates the distortion solution at a given position.">hawki_distortion_interpolate_distortion</a>
+<a name="l00082"></a>00082 (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00083"></a>00083 <span class="keywordtype">double</span> x_pos,
+<a name="l00084"></a>00084 <span class="keywordtype">double</span> y_pos,
+<a name="l00085"></a>00085 <span class="keywordtype">double</span> * x_dist,
+<a name="l00086"></a>00086 <span class="keywordtype">double</span> * y_dist);
+<a name="l00087"></a>00087
+<a name="l00088"></a>00088 <span class="keywordtype">double</span> <a class="code" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea" title="This private function computes the rms, which is the objective function of the minimization algorithm...">hawki_distortion_compute_rms</a>
+<a name="l00089"></a>00089 (<span class="keyword">const</span> cpl_table ** ref_catalogues,
+<a name="l00090"></a>00090 <span class="keyword">const</span> cpl_bivector * cat_offsets,
+<a name="l00091"></a>00091 <span class="keyword">const</span> cpl_table * matching_sets,
+<a name="l00092"></a>00092 <span class="keywordtype">int</span> ncats,
+<a name="l00093"></a>00093 hawki_distortion * distortion);
+<a name="l00094"></a>00094
+<a name="l00095"></a>00095 <span class="preprocessor">#ifdef HAVE_LIBGSL</span>
+<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="keywordtype">double</span> hawki_distortion_gsl_obj_function
+<a name="l00097"></a>00097 (<span class="keyword">const</span> gsl_vector * dist_param,
+<a name="l00098"></a>00098 <span class="keywordtype">void</span> * args);
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="keywordtype">int</span> hawki_distortion_update_solution_from_param
+<a name="l00101"></a>00101 (hawki_distortion * distortion,
+<a name="l00102"></a>00102 <span class="keyword">const</span> gsl_vector * dist_param);
+<a name="l00103"></a>00103
+<a name="l00104"></a>00104 <span class="keywordtype">int</span> hawki_distortion_update_offsets_from_param
+<a name="l00105"></a>00105 (cpl_bivector * offsets,
+<a name="l00106"></a>00106 <span class="keyword">const</span> gsl_vector * dist_param);
+<a name="l00107"></a>00107
+<a name="l00108"></a>00108 <span class="keywordtype">int</span> hawki_distortion_update_param_from_solution
+<a name="l00109"></a>00109 (gsl_vector * dist_param,
+<a name="l00110"></a>00110 <span class="keyword">const</span> hawki_distortion * distortion);
+<a name="l00111"></a>00111
+<a name="l00112"></a>00112 <span class="keywordtype">int</span> hawki_distortion_update_param_from_offsets
+<a name="l00113"></a>00113 (gsl_vector * dist_param,
+<a name="l00114"></a>00114 <span class="keyword">const</span> cpl_bivector * offsets);
+<a name="l00115"></a>00115 <span class="preprocessor">#endif</span>
+<a name="l00116"></a>00116 <span class="preprocessor"></span>
+<a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="group__hawki__distortion.html#gaa7dc1bd3e8cd954c453ecfdf2b0fe968" title="Compute the standard deviation of two vectors, not using flagged values.">hawki_distortion_get_flag_vars</a>
+<a name="l00118"></a>00118 (<span class="keywordtype">double</span> * x_val, <span class="keywordtype">double</span> * y_val, <span class="keywordtype">int</span> *pos_flag,
+<a name="l00119"></a>00119 <span class="keywordtype">int</span> nvals, <span class="keywordtype">int</span> *nvalid, <span class="keywordtype">double</span> *var_x, <span class="keywordtype">double</span> *var_y);
+<a name="l00120"></a>00120
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00130"></a>00130 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00131"></a>00131 hawki_distortion * <a class="code" href="group__hawki__distortion.html#gae37defaaf5c0bd86686df3285b89763d" title="Allocate a new distortion solution.">hawki_distortion_grid_new</a>
+<a name="l00132"></a><a class="code" href="group__hawki__distortion.html#gae37defaaf5c0bd86686df3285b89763d">00132</a> (<span class="keywordtype">int</span> detector_nx,
+<a name="l00133"></a>00133 <span class="keywordtype">int</span> detector_ny,
+<a name="l00134"></a>00134 <span class="keywordtype">int</span> grid_size)
+<a name="l00135"></a>00135 {
+<a name="l00136"></a>00136 hawki_distortion * distortion;
+<a name="l00137"></a>00137
+<a name="l00138"></a>00138 <span class="comment">//Allocate the structure</span>
+<a name="l00139"></a>00139 distortion = cpl_malloc(<span class="keyword">sizeof</span>(hawki_distortion));
+<a name="l00140"></a>00140
+<a name="l00141"></a>00141 <span class="comment">//Allocate the images</span>
+<a name="l00142"></a>00142 distortion->dist_x = cpl_image_new
+<a name="l00143"></a>00143 (grid_size, grid_size, CPL_TYPE_FLOAT);
+<a name="l00144"></a>00144 distortion->dist_y = cpl_image_new
+<a name="l00145"></a>00145 (grid_size, grid_size, CPL_TYPE_FLOAT);
+<a name="l00146"></a>00146
+<a name="l00147"></a>00147 <span class="comment">//Create the transformation between distortion images and the detector</span>
+<a name="l00148"></a>00148 distortion->x_cdelt = detector_nx / (double)grid_size;
+<a name="l00149"></a>00149 distortion->y_cdelt = detector_ny / (double)grid_size;
+<a name="l00150"></a>00150 distortion->x_crval = 0.5 + 0.5 * distortion->x_cdelt;
+<a name="l00151"></a>00151 distortion->y_crval = 0.5 + 0.5 * distortion->y_cdelt;
+<a name="l00152"></a>00152
+<a name="l00153"></a>00153 <span class="keywordflow">return</span> distortion;
+<a name="l00154"></a>00154 }
+<a name="l00155"></a>00155
+<a name="l00156"></a>00156 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00161"></a>00161 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00162"></a>00162 <span class="keywordtype">void</span> <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>
+<a name="l00163"></a><a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712">00163</a> (hawki_distortion * distortion)
+<a name="l00164"></a>00164 {
+<a name="l00165"></a>00165 <span class="keywordflow">if</span>(distortion == NULL)
+<a name="l00166"></a>00166 <span class="keywordflow">return</span>;
+<a name="l00167"></a>00167 cpl_image_delete(distortion->dist_x);
+<a name="l00168"></a>00168 cpl_image_delete(distortion->dist_y);
+<a name="l00169"></a>00169 cpl_free(distortion);
+<a name="l00170"></a>00170 }
+<a name="l00171"></a>00171
+<a name="l00172"></a>00172 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00180"></a>00180 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00181"></a>00181 hawki_distortion * <a class="code" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7" title="Loads the distortion solution for one detector.">hawki_distortion_load</a>
+<a name="l00182"></a><a class="code" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7">00182</a> (<span class="keyword">const</span> cpl_frame * dist_x,
+<a name="l00183"></a>00183 <span class="keyword">const</span> cpl_frame * dist_y,
+<a name="l00184"></a>00184 <span class="keywordtype">int</span> idet)
+<a name="l00185"></a>00185 {
+<a name="l00186"></a>00186 <span class="keyword">const</span> <span class="keywordtype">char</span> * file_dist_x;
+<a name="l00187"></a>00187 <span class="keyword">const</span> <span class="keywordtype">char</span> * file_dist_y;
+<a name="l00188"></a>00188 hawki_distortion * distortion;
+<a name="l00189"></a>00189 <span class="keywordtype">int</span> iext;
+<a name="l00190"></a>00190 cpl_propertylist * plist;
+<a name="l00191"></a>00191
+<a name="l00192"></a>00192 <span class="comment">//Allocate the structure</span>
+<a name="l00193"></a>00193 distortion = cpl_malloc(<span class="keyword">sizeof</span>(hawki_distortion));
+<a name="l00194"></a>00194
+<a name="l00195"></a>00195 <span class="comment">//Read the images</span>
+<a name="l00196"></a>00196 file_dist_x = cpl_frame_get_filename(dist_x);
+<a name="l00197"></a>00197 file_dist_y = cpl_frame_get_filename(dist_y);
+<a name="l00198"></a>00198 distortion->dist_x = <a class="code" href="group__hawki__load.html#gada33a0608b91dc44f69f821e6f40b8d1" title="Load one the chips of HAWKI images from a frame into an image.">hawki_load_frame_detector</a>
+<a name="l00199"></a>00199 (dist_x, idet, CPL_TYPE_FLOAT);
+<a name="l00200"></a>00200 distortion->dist_y = <a class="code" href="group__hawki__load.html#gada33a0608b91dc44f69f821e6f40b8d1" title="Load one the chips of HAWKI images from a frame into an image.">hawki_load_frame_detector</a>
+<a name="l00201"></a>00201 (dist_y, idet, CPL_TYPE_FLOAT);
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 <span class="comment">//Read the WCS keywords</span>
+<a name="l00204"></a>00204 iext = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(file_dist_x, idet);
+<a name="l00205"></a>00205 plist = cpl_propertylist_load(file_dist_x, iext);
+<a name="l00206"></a>00206 distortion->x_crval = cpl_propertylist_get_double(plist, <span class="stringliteral">"CRVAL1"</span>);
+<a name="l00207"></a>00207 distortion->x_cdelt = cpl_propertylist_get_double(plist, <span class="stringliteral">"CDELT1"</span>);
+<a name="l00208"></a>00208 distortion->y_crval = cpl_propertylist_get_double(plist, <span class="stringliteral">"CRVAL2"</span>);
+<a name="l00209"></a>00209 distortion->y_cdelt = cpl_propertylist_get_double(plist, <span class="stringliteral">"CDELT2"</span>);
+<a name="l00210"></a>00210 <span class="keywordflow">if</span>(cpl_propertylist_get_double(plist, <span class="stringliteral">"CRPIX1"</span>) != 1 ||
+<a name="l00211"></a>00211 cpl_propertylist_get_double(plist, <span class="stringliteral">"CRPIX2"</span>) != 1)
+<a name="l00212"></a>00212 {
+<a name="l00213"></a>00213 cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00214"></a>00214 __FILE__, __LINE__,<span class="stringliteral">"Wrong CRPIX? keywords"</span>);
+<a name="l00215"></a>00215 cpl_image_delete(distortion->dist_x);
+<a name="l00216"></a>00216 cpl_image_delete(distortion->dist_y);
+<a name="l00217"></a>00217 cpl_propertylist_delete(plist);
+<a name="l00218"></a>00218 cpl_free(distortion);
+<a name="l00219"></a>00219 <span class="keywordflow">return</span> NULL;
+<a name="l00220"></a>00220 }
+<a name="l00221"></a>00221 cpl_propertylist_delete(plist);
+<a name="l00222"></a>00222 <span class="comment">//Check that the keywords in X and Y are compatibles;</span>
+<a name="l00223"></a>00223 plist = cpl_propertylist_load(file_dist_y, iext);
+<a name="l00224"></a>00224 <span class="keywordflow">if</span>(distortion->x_crval != cpl_propertylist_get_double(plist, <span class="stringliteral">"CRVAL1"</span>) ||
+<a name="l00225"></a>00225 distortion->x_cdelt != cpl_propertylist_get_double(plist, <span class="stringliteral">"CDELT1"</span>) ||
+<a name="l00226"></a>00226 distortion->y_crval != cpl_propertylist_get_double(plist, <span class="stringliteral">"CRVAL2"</span>) ||
+<a name="l00227"></a>00227 distortion->y_cdelt != cpl_propertylist_get_double(plist, <span class="stringliteral">"CDELT2"</span>) ||
+<a name="l00228"></a>00228 cpl_propertylist_get_double(plist, <span class="stringliteral">"CRPIX1"</span>) != 1 ||
+<a name="l00229"></a>00229 cpl_propertylist_get_double(plist, <span class="stringliteral">"CRPIX2"</span>) != 1)
+<a name="l00230"></a>00230 {
+<a name="l00231"></a>00231 cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT, __FILE__,
+<a name="l00232"></a>00232 __LINE__,<span class="stringliteral">"WCS keywords mismatch in X and Y distortions"</span>);
+<a name="l00233"></a>00233 cpl_image_delete(distortion->dist_x);
+<a name="l00234"></a>00234 cpl_image_delete(distortion->dist_y);
+<a name="l00235"></a>00235 cpl_propertylist_delete(plist);
+<a name="l00236"></a>00236 cpl_free(distortion);
+<a name="l00237"></a>00237 <span class="keywordflow">return</span> NULL;
+<a name="l00238"></a>00238 }
+<a name="l00239"></a>00239 cpl_propertylist_delete(plist);
+<a name="l00240"></a>00240
+<a name="l00241"></a>00241 <span class="keywordflow">return</span> distortion;
+<a name="l00242"></a>00242 }
+<a name="l00243"></a>00243
+<a name="l00244"></a>00244 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00250"></a>00250 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00251"></a>00251 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#gaaeaf96920122f1d4f64c164289588345" title="Gives the dimension in X of the distortion solution.">hawki_distortion_get_size_x</a>
+<a name="l00252"></a><a class="code" href="group__hawki__distortion.html#gaaeaf96920122f1d4f64c164289588345">00252</a> (<span class="keyword">const</span> hawki_distortion * distortion)
+<a name="l00253"></a>00253 {
+<a name="l00254"></a>00254 <span class="keywordflow">if</span>(distortion == NULL)
+<a name="l00255"></a>00255 {
+<a name="l00256"></a>00256 cpl_error_set(__func__,CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00257"></a>00257 }
+<a name="l00258"></a>00258 <span class="keywordflow">return</span> cpl_image_get_size_x(distortion->dist_x);
+<a name="l00259"></a>00259 }
+<a name="l00260"></a>00260
+<a name="l00261"></a>00261 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00267"></a>00267 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00268"></a>00268 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga990c10037636042cfcc0b40332821e9c" title="Gives the dimension in Y of the distortion solution.">hawki_distortion_get_size_y</a>
+<a name="l00269"></a><a class="code" href="group__hawki__distortion.html#ga990c10037636042cfcc0b40332821e9c">00269</a> (<span class="keyword">const</span> hawki_distortion * distortion)
+<a name="l00270"></a>00270 {
+<a name="l00271"></a>00271 <span class="keywordflow">if</span>(distortion == NULL)
+<a name="l00272"></a>00272 {
+<a name="l00273"></a>00273 cpl_error_set(__func__,CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00274"></a>00274 }
+<a name="l00275"></a>00275 <span class="keywordflow">return</span> cpl_image_get_size_y(distortion->dist_x);
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277
+<a name="l00278"></a>00278 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00285"></a>00285 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00286"></a>00286 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga52da9acfab98a1592e65df9c6bfba484" title="Apply the distortion correction.">hawki_distortion_correct_alldetectors</a>
+<a name="l00287"></a><a class="code" href="group__hawki__distortion.html#ga52da9acfab98a1592e65df9c6bfba484">00287</a> (cpl_image ** ilist,
+<a name="l00288"></a>00288 <span class="keyword">const</span> cpl_frame * frame_dist_x,
+<a name="l00289"></a>00289 <span class="keyword">const</span> cpl_frame * frame_dist_y)
+<a name="l00290"></a>00290 {
+<a name="l00291"></a>00291 cpl_image * corr[HAWKI_NB_DETECTORS];
+<a name="l00292"></a>00292 hawki_distortion * distortion;
+<a name="l00293"></a>00293 cpl_image * dist_x;
+<a name="l00294"></a>00294 cpl_image * dist_y;
+<a name="l00295"></a>00295 <span class="keywordtype">int</span> idet, j ;
+<a name="l00296"></a>00296
+<a name="l00297"></a>00297 <span class="comment">/* Test entries */</span>
+<a name="l00298"></a>00298 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00299"></a>00299 <span class="keywordflow">if</span> (frame_dist_x == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00300"></a>00300 <span class="keywordflow">if</span> (frame_dist_y == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00301"></a>00301
+<a name="l00302"></a>00302 <span class="comment">/* Loop on the 4 chips */</span>
+<a name="l00303"></a>00303 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00304"></a>00304 {
+<a name="l00305"></a>00305 <span class="keywordtype">int</span> nx;
+<a name="l00306"></a>00306 <span class="keywordtype">int</span> ny;
+<a name="l00307"></a>00307
+<a name="l00308"></a>00308 <span class="comment">/* Get the image size */</span>
+<a name="l00309"></a>00309 nx = cpl_image_get_size_x(ilist[idet]);
+<a name="l00310"></a>00310 ny = cpl_image_get_size_y(ilist[idet]);
+<a name="l00311"></a>00311
+<a name="l00312"></a>00312 <span class="comment">/* Load the distortion */</span>
+<a name="l00313"></a>00313 <span class="keywordflow">if</span> ((distortion = <a class="code" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7" title="Loads the distortion solution for one detector.">hawki_distortion_load</a>
+<a name="l00314"></a>00314 (frame_dist_x, frame_dist_y, idet + 1)) == NULL)
+<a name="l00315"></a>00315 {
+<a name="l00316"></a>00316 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the distortion for chip %d"</span>,
+<a name="l00317"></a>00317 idet+1) ;
+<a name="l00318"></a>00318 <span class="keywordflow">for</span> (j=0 ; j<idet ; j++) cpl_image_delete(corr[j]) ;
+<a name="l00319"></a>00319 <span class="keywordflow">return</span> -1 ;
+<a name="l00320"></a>00320 }
+<a name="l00321"></a>00321
+<a name="l00322"></a>00322 <span class="comment">/* Create the offsets images */</span>
+<a name="l00323"></a>00323 dist_x = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+<a name="l00324"></a>00324 dist_y = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+<a name="l00325"></a>00325 <span class="keywordflow">if</span> (hawki_distortion_create_maps_detector
+<a name="l00326"></a>00326 (distortion, dist_x, dist_y))
+<a name="l00327"></a>00327 {
+<a name="l00328"></a>00328 cpl_msg_error(__func__, <span class="stringliteral">"Cannot create the distortion maps"</span>) ;
+<a name="l00329"></a>00329 cpl_image_delete(dist_x);
+<a name="l00330"></a>00330 cpl_image_delete(dist_y);
+<a name="l00331"></a>00331 <span class="keywordflow">for</span> (j=0 ; j<idet ; j++) cpl_image_delete(corr[j]) ;
+<a name="l00332"></a>00332 <span class="keywordflow">return</span> -1;
+<a name="l00333"></a>00333 }
+<a name="l00334"></a>00334
+<a name="l00335"></a>00335 <span class="comment">/* Correct this image */</span>
+<a name="l00336"></a>00336 corr[idet] = <a class="code" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c" title="Apply the distortion correction to one chip.">hawki_distortion_correct_detector</a>(ilist[idet], dist_x, dist_y);
+<a name="l00337"></a>00337 <span class="keywordflow">if</span>(corr[idet] == NULL)
+<a name="l00338"></a>00338 {
+<a name="l00339"></a>00339 cpl_msg_error(__func__, <span class="stringliteral">"Cannot correct the distortion"</span>) ;
+<a name="l00340"></a>00340 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion);
+<a name="l00341"></a>00341 cpl_image_delete(dist_x);
+<a name="l00342"></a>00342 cpl_image_delete(dist_y);
+<a name="l00343"></a>00343 <span class="keywordflow">for</span> (j=0 ; j<idet; j++) cpl_image_delete(corr[j]) ;
+<a name="l00344"></a>00344 <span class="keywordflow">return</span> -1 ;
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion);
+<a name="l00347"></a>00347 cpl_image_delete(dist_x) ;
+<a name="l00348"></a>00348 cpl_image_delete(dist_y);
+<a name="l00349"></a>00349 }
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 <span class="comment">/* Store the results */</span>
+<a name="l00352"></a>00352 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00353"></a>00353 {
+<a name="l00354"></a>00354 cpl_image_delete(ilist[idet]) ;
+<a name="l00355"></a>00355 ilist[idet] = corr[idet] ;
+<a name="l00356"></a>00356 }
+<a name="l00357"></a>00357
+<a name="l00358"></a>00358 <span class="comment">/* Return */</span>
+<a name="l00359"></a>00359 <span class="keywordflow">return</span> 0 ;
+<a name="l00360"></a>00360 }
+<a name="l00361"></a>00361
+<a name="l00362"></a>00362 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00369"></a>00369 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00370"></a>00370 cpl_image * <a class="code" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c" title="Apply the distortion correction to one chip.">hawki_distortion_correct_detector</a>
+<a name="l00371"></a><a class="code" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c">00371</a> (cpl_image * image,
+<a name="l00372"></a>00372 cpl_image * dist_x,
+<a name="l00373"></a>00373 cpl_image * dist_y)
+<a name="l00374"></a>00374 {
+<a name="l00375"></a>00375 cpl_image * corr;
+<a name="l00376"></a>00376 cpl_vector * profile ;
+<a name="l00377"></a>00377
+<a name="l00378"></a>00378 <span class="comment">/* Test entries */</span>
+<a name="l00379"></a>00379 <span class="keywordflow">if</span> (image == NULL) <span class="keywordflow">return</span> NULL;
+<a name="l00380"></a>00380 <span class="keywordflow">if</span> (dist_x == NULL) <span class="keywordflow">return</span> NULL;
+<a name="l00381"></a>00381 <span class="keywordflow">if</span> (dist_y == NULL) <span class="keywordflow">return</span> NULL;
+<a name="l00382"></a>00382
+<a name="l00383"></a>00383 <span class="comment">/* Create the output image */</span>
+<a name="l00384"></a>00384 corr = cpl_image_new(cpl_image_get_size_x(image),
+<a name="l00385"></a>00385 cpl_image_get_size_y(image), CPL_TYPE_FLOAT) ;
+<a name="l00386"></a>00386
+<a name="l00387"></a>00387 <span class="comment">/* Create the interpolation profile */</span>
+<a name="l00388"></a>00388 profile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES) ;
+<a name="l00389"></a>00389 cpl_vector_fill_kernel_profile(profile, CPL_KERNEL_DEFAULT,
+<a name="l00390"></a>00390 CPL_KERNEL_DEF_WIDTH) ;
+<a name="l00391"></a>00391
+<a name="l00392"></a>00392 <span class="comment">/* Apply the distortion */</span>
+<a name="l00393"></a>00393 <span class="keywordflow">if</span> (cpl_image_warp(corr, image, dist_x, dist_y, profile,
+<a name="l00394"></a>00394 CPL_KERNEL_DEF_WIDTH, profile,
+<a name="l00395"></a>00395 CPL_KERNEL_DEF_WIDTH) != CPL_ERROR_NONE)
+<a name="l00396"></a>00396 {
+<a name="l00397"></a>00397 cpl_msg_error(__func__, <span class="stringliteral">"Cannot warp the image"</span>) ;
+<a name="l00398"></a>00398 cpl_image_delete(corr) ;
+<a name="l00399"></a>00399 cpl_vector_delete(profile) ;
+<a name="l00400"></a>00400 <span class="keywordflow">return</span> NULL;
+<a name="l00401"></a>00401 }
+<a name="l00402"></a>00402 cpl_vector_delete(profile) ;
+<a name="l00403"></a>00403
+<a name="l00404"></a>00404 <span class="comment">/* Return */</span>
+<a name="l00405"></a>00405 <span class="keywordflow">return</span> corr;
+<a name="l00406"></a>00406 }
+<a name="l00407"></a>00407
+<a name="l00408"></a>00408 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00421"></a>00421 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00422"></a>00422 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e" title="Apply the distortion correction to one detector position.">hawki_distortion_correct_coords</a>
+<a name="l00423"></a><a class="code" href="group__hawki__distortion.html#ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e">00423</a> (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00424"></a>00424 <span class="keywordtype">double</span> x_pos,
+<a name="l00425"></a>00425 <span class="keywordtype">double</span> y_pos,
+<a name="l00426"></a>00426 <span class="keywordtype">double</span> * x_pos_distcorr,
+<a name="l00427"></a>00427 <span class="keywordtype">double</span> * y_pos_distcorr)
+<a name="l00428"></a>00428 {
+<a name="l00429"></a>00429 <span class="keywordtype">double</span> x_dist;
+<a name="l00430"></a>00430 <span class="keywordtype">double</span> y_dist;
+<a name="l00431"></a>00431
+<a name="l00432"></a>00432 <span class="keywordflow">if</span>(distortion == NULL)
+<a name="l00433"></a>00433 {
+<a name="l00434"></a>00434 cpl_error_set(<span class="stringliteral">"hawki_distortion_correct_coords"</span>, CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00435"></a>00435 <span class="keywordflow">return</span> -1;
+<a name="l00436"></a>00436 }
+<a name="l00437"></a>00437
+<a name="l00438"></a>00438 <a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d" title="Interpolates the distortion solution at a given position.">hawki_distortion_interpolate_distortion</a>
+<a name="l00439"></a>00439 (distortion, x_pos, y_pos, &x_dist, &y_dist);
+<a name="l00440"></a>00440
+<a name="l00441"></a>00441 *x_pos_distcorr = x_pos - x_dist;
+<a name="l00442"></a>00442 *y_pos_distcorr = y_pos - y_dist;
+<a name="l00443"></a>00443
+<a name="l00444"></a>00444 <span class="keywordflow">return</span> 0;
+<a name="l00445"></a>00445 }
+<a name="l00446"></a>00446
+<a name="l00447"></a>00447
+<a name="l00448"></a>00448 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00465"></a>00465 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00466"></a>00466 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga9462a4c3d7e6d3cac66f7bef27f6cbe3" title="Apply the inverse distortion correction to one detector position.">hawki_distortion_inverse_correct_coords</a>
+<a name="l00467"></a><a class="code" href="group__hawki__distortion.html#ga9462a4c3d7e6d3cac66f7bef27f6cbe3">00467</a> (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00468"></a>00468 <span class="keywordtype">double</span> x_pos,
+<a name="l00469"></a>00469 <span class="keywordtype">double</span> y_pos,
+<a name="l00470"></a>00470 <span class="keywordtype">double</span> * x_pos_distinvcorr,
+<a name="l00471"></a>00471 <span class="keywordtype">double</span> * y_pos_distinvcorr)
+<a name="l00472"></a>00472 {
+<a name="l00473"></a>00473 <span class="keywordtype">double</span> x_dist = 0;
+<a name="l00474"></a>00474 <span class="keywordtype">double</span> y_dist = 0;
+<a name="l00475"></a>00475 <span class="keywordtype">int</span> i;
+<a name="l00476"></a>00476 <span class="keywordtype">int</span> niter = 3;
+<a name="l00477"></a>00477
+<a name="l00478"></a>00478 <span class="keywordflow">if</span>(distortion == NULL)
+<a name="l00479"></a>00479 {
+<a name="l00480"></a>00480 cpl_error_set(<span class="stringliteral">"hawki_distortion_inverse_correct_coords"</span>, CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00481"></a>00481 <span class="keywordflow">return</span> -1;
+<a name="l00482"></a>00482 }
+<a name="l00483"></a>00483 <span class="keywordflow">for</span>(i = 0; i < niter; ++i)
+<a name="l00484"></a>00484 {
+<a name="l00485"></a>00485 <a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d" title="Interpolates the distortion solution at a given position.">hawki_distortion_interpolate_distortion</a>
+<a name="l00486"></a>00486 (distortion, x_pos + x_dist, y_pos + y_dist, &x_dist, &y_dist);
+<a name="l00487"></a>00487 }
+<a name="l00488"></a>00488
+<a name="l00489"></a>00489
+<a name="l00490"></a>00490 <span class="comment">/* Apply the correction in the inverse direction */</span>
+<a name="l00491"></a>00491 *x_pos_distinvcorr = x_pos + x_dist;
+<a name="l00492"></a>00492 *y_pos_distinvcorr = y_pos + y_dist;
+<a name="l00493"></a>00493
+<a name="l00494"></a>00494 <span class="keywordflow">return</span> 0;
+<a name="l00495"></a>00495 }
+<a name="l00496"></a>00496
+<a name="l00497"></a>00497 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00524"></a>00524 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00525"></a>00525 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d" title="Interpolates the distortion solution at a given position.">hawki_distortion_interpolate_distortion</a>
+<a name="l00526"></a><a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d">00526</a> (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00527"></a>00527 <span class="keywordtype">double</span> x_pos,
+<a name="l00528"></a>00528 <span class="keywordtype">double</span> y_pos,
+<a name="l00529"></a>00529 <span class="keywordtype">double</span> * x_dist,
+<a name="l00530"></a>00530 <span class="keywordtype">double</span> * y_dist)
+<a name="l00531"></a>00531 {
+<a name="l00532"></a>00532 <span class="keywordtype">int</span> ix1;
+<a name="l00533"></a>00533 <span class="keywordtype">int</span> ix2;
+<a name="l00534"></a>00534 <span class="keywordtype">int</span> iy1;
+<a name="l00535"></a>00535 <span class="keywordtype">int</span> iy2;
+<a name="l00536"></a>00536 <span class="keywordtype">int</span> nx;
+<a name="l00537"></a>00537 <span class="keywordtype">int</span> ny;
+<a name="l00538"></a>00538 <span class="keywordtype">double</span> x1_pos;
+<a name="l00539"></a>00539 <span class="keywordtype">double</span> x2_pos;
+<a name="l00540"></a>00540 <span class="keywordtype">double</span> y1_pos;
+<a name="l00541"></a>00541 <span class="keywordtype">double</span> y2_pos;
+<a name="l00542"></a>00542 <span class="keywordtype">double</span> dx11;
+<a name="l00543"></a>00543 <span class="keywordtype">double</span> dx12;
+<a name="l00544"></a>00544 <span class="keywordtype">double</span> dx21;
+<a name="l00545"></a>00545 <span class="keywordtype">double</span> dx22;
+<a name="l00546"></a>00546 <span class="keywordtype">double</span> dy11;
+<a name="l00547"></a>00547 <span class="keywordtype">double</span> dy12;
+<a name="l00548"></a>00548 <span class="keywordtype">double</span> dy21;
+<a name="l00549"></a>00549 <span class="keywordtype">double</span> dy22;
+<a name="l00550"></a>00550 <span class="keywordtype">int</span> isnull;
+<a name="l00551"></a>00551
+<a name="l00552"></a>00552 <span class="comment">/* Get the size of the distortion images */</span>
+<a name="l00553"></a>00553 nx = cpl_image_get_size_x(distortion->dist_x);
+<a name="l00554"></a>00554 ny = cpl_image_get_size_y(distortion->dist_x);
+<a name="l00555"></a>00555
+<a name="l00556"></a>00556 <span class="comment">//This uses bilinear interpolation</span>
+<a name="l00557"></a>00557 <span class="comment">//Get lower left corner. This assumes CRPIX? =1 and ix, iy start with 0</span>
+<a name="l00558"></a>00558 ix1 = (int)floor((x_pos - distortion->x_crval)/distortion->x_cdelt);
+<a name="l00559"></a>00559 iy1 = (int)floor((y_pos - distortion->y_crval)/distortion->y_cdelt);
+<a name="l00560"></a>00560 <span class="comment">//Handle extrapolation</span>
+<a name="l00561"></a>00561 <span class="keywordflow">if</span>(ix1 < 0)
+<a name="l00562"></a>00562 ix1 = 0;
+<a name="l00563"></a>00563 <span class="keywordflow">if</span>(ix1 >= nx - 1)
+<a name="l00564"></a>00564 ix1 = nx - 2;
+<a name="l00565"></a>00565 <span class="keywordflow">if</span>(iy1 < 0)
+<a name="l00566"></a>00566 iy1 = 0;
+<a name="l00567"></a>00567 <span class="keywordflow">if</span>(iy1 >= ny - 1)
+<a name="l00568"></a>00568 iy1 = ny - 2;
+<a name="l00569"></a>00569 <span class="comment">//Get upper right corner</span>
+<a name="l00570"></a>00570 ix2 = ix1 + 1;
+<a name="l00571"></a>00571 iy2 = iy1 + 1;
+<a name="l00572"></a>00572
+<a name="l00573"></a>00573 <span class="comment">//Get the position values</span>
+<a name="l00574"></a>00574 <span class="comment">//This implies that CRPIX? = 1 and that ix, iy start at 0.</span>
+<a name="l00575"></a>00575 x1_pos = ix1 * distortion->x_cdelt + distortion->x_crval;
+<a name="l00576"></a>00576 x2_pos = ix2 * distortion->x_cdelt + distortion->x_crval;
+<a name="l00577"></a>00577 y1_pos = iy1 * distortion->y_cdelt + distortion->y_crval;
+<a name="l00578"></a>00578 y2_pos = iy2 * distortion->y_cdelt + distortion->y_crval;
+<a name="l00579"></a>00579
+<a name="l00580"></a>00580 <span class="comment">//Get the values used to interpolate</span>
+<a name="l00581"></a>00581 <span class="comment">//The +1 is because cpl_image_get uses FITS convention</span>
+<a name="l00582"></a>00582 dx11 = cpl_image_get(distortion->dist_x, ix1 + 1, iy1 + 1, &isnull);
+<a name="l00583"></a>00583 dx21 = cpl_image_get(distortion->dist_x, ix2 + 1, iy1 + 1, &isnull);
+<a name="l00584"></a>00584 dx12 = cpl_image_get(distortion->dist_x, ix1 + 1, iy2 + 1, &isnull);
+<a name="l00585"></a>00585 dx22 = cpl_image_get(distortion->dist_x, ix2 + 1, iy2 + 1, &isnull);
+<a name="l00586"></a>00586 dy11 = cpl_image_get(distortion->dist_y, ix1 + 1, iy1 + 1, &isnull);
+<a name="l00587"></a>00587 dy21 = cpl_image_get(distortion->dist_y, ix2 + 1, iy1 + 1, &isnull);
+<a name="l00588"></a>00588 dy12 = cpl_image_get(distortion->dist_y, ix1 + 1, iy2 + 1, &isnull);
+<a name="l00589"></a>00589 dy22 = cpl_image_get(distortion->dist_y, ix2 + 1, iy2 + 1, &isnull);
+<a name="l00590"></a>00590
+<a name="l00591"></a>00591
+<a name="l00592"></a>00592 <span class="comment">//Compute the final values</span>
+<a name="l00593"></a>00593 *x_dist = dx11 * (x2_pos - x_pos) * (y2_pos - y_pos) +
+<a name="l00594"></a>00594 dx21 * (x_pos - x1_pos) * (y2_pos - y_pos) +
+<a name="l00595"></a>00595 dx12 * (x2_pos - x_pos) * (y_pos - y1_pos) +
+<a name="l00596"></a>00596 dx22 * (x_pos - x1_pos) * (y_pos - y1_pos);
+<a name="l00597"></a>00597 *x_dist = *x_dist / (x2_pos -x1_pos) / (y2_pos -y1_pos);
+<a name="l00598"></a>00598 *y_dist = dy11 * (x2_pos - x_pos) * (y2_pos - y_pos) +
+<a name="l00599"></a>00599 dy21 * (x_pos - x1_pos) * (y2_pos - y_pos) +
+<a name="l00600"></a>00600 dy12 * (x2_pos - x_pos) * (y_pos - y1_pos) +
+<a name="l00601"></a>00601 dy22 * (x_pos - x1_pos) * (y_pos - y1_pos);
+<a name="l00602"></a>00602 *y_dist = *y_dist / (x2_pos -x1_pos) / (y2_pos -y1_pos);
+<a name="l00603"></a>00603
+<a name="l00604"></a>00604 <span class="keywordflow">return</span> 0;
+<a name="l00605"></a>00605
+<a name="l00606"></a>00606 }
+<a name="l00607"></a>00607
+<a name="l00608"></a>00608 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00615"></a>00615 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00616"></a>00616 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga4ad09d8cbb7f3ed8fddeb451f3b2056f" title="Apply the distortion correction.">hawki_distortion_apply_maps</a>
+<a name="l00617"></a><a class="code" href="group__hawki__distortion.html#ga4ad09d8cbb7f3ed8fddeb451f3b2056f">00617</a> (cpl_imagelist * ilist,
+<a name="l00618"></a>00618 cpl_image ** dist_x,
+<a name="l00619"></a>00619 cpl_image ** dist_y)
+<a name="l00620"></a>00620 {
+<a name="l00621"></a>00621 cpl_image * corr[HAWKI_NB_DETECTORS] ;
+<a name="l00622"></a>00622 <span class="keywordtype">int</span> i, j ;
+<a name="l00623"></a>00623
+<a name="l00624"></a>00624 <span class="comment">/* Test entries */</span>
+<a name="l00625"></a>00625 <span class="keywordflow">if</span> (ilist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00626"></a>00626 <span class="keywordflow">if</span> (dist_x == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00627"></a>00627 <span class="keywordflow">if</span> (dist_y == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00628"></a>00628
+<a name="l00629"></a>00629 <span class="comment">/* Loop on the 4 chips */</span>
+<a name="l00630"></a>00630 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00631"></a>00631 {
+<a name="l00632"></a>00632 cpl_image * cur_image;
+<a name="l00633"></a>00633
+<a name="l00634"></a>00634 <span class="comment">/* Get the current image */</span>
+<a name="l00635"></a>00635 cur_image = cpl_imagelist_get(ilist, i);
+<a name="l00636"></a>00636
+<a name="l00637"></a>00637 <span class="comment">/* Correct this image */</span>
+<a name="l00638"></a>00638 corr[i] = <a class="code" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c" title="Apply the distortion correction to one chip.">hawki_distortion_correct_detector</a>(cur_image,dist_x[i],dist_y[i]);
+<a name="l00639"></a>00639 <span class="keywordflow">if</span>(corr[i] == NULL)
+<a name="l00640"></a>00640 {
+<a name="l00641"></a>00641 cpl_msg_error(__func__, <span class="stringliteral">"Cannot correct the distortion"</span>) ;
+<a name="l00642"></a>00642 <span class="keywordflow">for</span> (j=0 ; j<i ; j++) cpl_image_delete(corr[j]) ;
+<a name="l00643"></a>00643 <span class="keywordflow">return</span> -1 ;
+<a name="l00644"></a>00644 }
+<a name="l00645"></a>00645 }
+<a name="l00646"></a>00646
+<a name="l00647"></a>00647 <span class="comment">/* Store the results */</span>
+<a name="l00648"></a>00648 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00649"></a>00649 cpl_imagelist_set(ilist, corr[i], i);
+<a name="l00650"></a>00650
+<a name="l00651"></a>00651 <span class="comment">/* Return */</span>
+<a name="l00652"></a>00652 <span class="keywordflow">return</span> 0 ;
+<a name="l00653"></a>00653 }
+<a name="l00654"></a>00654
+<a name="l00657"></a>00657 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00665"></a>00665 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00666"></a>00666 <span class="keywordtype">int</span> hawki_distortion_create_maps_detector
+<a name="l00667"></a>00667 (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00668"></a>00668 cpl_image * dist_x,
+<a name="l00669"></a>00669 cpl_image * dist_y)
+<a name="l00670"></a>00670 {
+<a name="l00671"></a>00671 <span class="keywordtype">double</span> * pdx;
+<a name="l00672"></a>00672 <span class="keywordtype">double</span> * pdy;
+<a name="l00673"></a>00673 <span class="keywordtype">int</span> nx, ny;
+<a name="l00674"></a>00674 <span class="keywordtype">int</span> pos;
+<a name="l00675"></a>00675 <span class="keywordtype">int</span> i, j;
+<a name="l00676"></a>00676
+<a name="l00677"></a>00677 <span class="comment">/* Test entries */</span>
+<a name="l00678"></a>00678 <span class="keywordflow">if</span> (distortion == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00679"></a>00679 <span class="keywordflow">if</span> (dist_x == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00680"></a>00680 <span class="keywordflow">if</span> (dist_y == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00681"></a>00681
+<a name="l00682"></a>00682 <span class="comment">/* Initialise */</span>
+<a name="l00683"></a>00683 nx = cpl_image_get_size_x(dist_x) ;
+<a name="l00684"></a>00684 ny = cpl_image_get_size_y(dist_x) ;
+<a name="l00685"></a>00685 <span class="keywordflow">if</span> (cpl_image_get_size_x(dist_y) != nx) <span class="keywordflow">return</span> -1 ;
+<a name="l00686"></a>00686 <span class="keywordflow">if</span> (cpl_image_get_size_y(dist_y) != ny) <span class="keywordflow">return</span> -1 ;
+<a name="l00687"></a>00687
+<a name="l00688"></a>00688 <span class="comment">/* Access to the data */</span>
+<a name="l00689"></a>00689 pdx = cpl_image_get_data_double(dist_x) ;
+<a name="l00690"></a>00690 pdy = cpl_image_get_data_double(dist_y) ;
+<a name="l00691"></a>00691
+<a name="l00692"></a>00692 <span class="comment">/* Loop on the pixels */</span>
+<a name="l00693"></a>00693 <span class="keywordflow">for</span> (j=0 ; j<ny ; j++) {
+<a name="l00694"></a>00694 <span class="keywordflow">for</span> (i=0 ; i<nx ; i++) {
+<a name="l00695"></a>00695 <span class="keywordtype">double</span> x_dist;
+<a name="l00696"></a>00696 <span class="keywordtype">double</span> y_dist;
+<a name="l00697"></a>00697
+<a name="l00698"></a>00698 pos = i+j*nx ;
+<a name="l00699"></a>00699
+<a name="l00700"></a>00700 <a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d" title="Interpolates the distortion solution at a given position.">hawki_distortion_interpolate_distortion</a>
+<a name="l00701"></a>00701 (distortion, (<span class="keywordtype">double</span>)i, (<span class="keywordtype">double</span>)j, &x_dist, &y_dist);
+<a name="l00702"></a>00702
+<a name="l00703"></a>00703 pdx[pos] = x_dist;
+<a name="l00704"></a>00704 pdy[pos] = y_dist;
+<a name="l00705"></a>00705 }
+<a name="l00706"></a>00706 }
+<a name="l00707"></a>00707
+<a name="l00708"></a>00708 <span class="keywordflow">return</span> 0 ;
+<a name="l00709"></a>00709 }
+<a name="l00710"></a>00710
+<a name="l00711"></a>00711 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00735"></a>00735 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00736"></a>00736 hawki_distortion * hawki_distortion_compute_solution
+<a name="l00737"></a>00737 (<span class="keyword">const</span> cpl_table ** ref_catalogues,
+<a name="l00738"></a>00738 <span class="keyword">const</span> cpl_bivector * initial_offsets,
+<a name="l00739"></a>00739 <span class="keyword">const</span> cpl_table * matching_sets,
+<a name="l00740"></a>00740 <span class="keywordtype">int</span> ncats,
+<a name="l00741"></a>00741 <span class="keywordtype">int</span> detector_nx,
+<a name="l00742"></a>00742 <span class="keywordtype">int</span> detector_ny,
+<a name="l00743"></a>00743 <span class="keywordtype">int</span> grid_size,
+<a name="l00744"></a>00744 <span class="keyword">const</span> hawki_distortion * initial_guess,
+<a name="l00745"></a>00745 <span class="keywordtype">double</span> * rms)
+<a name="l00746"></a>00746 {
+<a name="l00747"></a>00747 <span class="preprocessor">#ifdef HAVE_LIBGSL</span>
+<a name="l00748"></a>00748 <span class="preprocessor"></span>
+<a name="l00749"></a>00749 hawki_distortion * distortion;
+<a name="l00750"></a>00750 cpl_bivector * offsets;
+<a name="l00751"></a>00751 gsl_multimin_fminimizer * minimizer;
+<a name="l00752"></a>00752 gsl_vector * step_size;
+<a name="l00753"></a>00753 gsl_vector * init_param;
+<a name="l00754"></a>00754 gsl_multimin_function minimize_function;
+<a name="l00755"></a>00755
+<a name="l00756"></a>00756 <span class="keywordtype">int</span> nfitparam = 0;
+<a name="l00757"></a>00757 <span class="keywordtype">int</span> iparam;
+<a name="l00758"></a>00758 <span class="keywordtype">double</span> tolerance = HAWKI_DISTORTION_TOLERANCE;
+<a name="l00759"></a>00759 <span class="keywordtype">double</span> tolerance2 = HAWKI_DISTORTION_TOLERANCE2;
+<a name="l00760"></a>00760 <span class="keywordtype">int</span> minimizer_status;
+<a name="l00761"></a>00761 <span class="keywordtype">int</span> iter = 0;
+<a name="l00762"></a>00762 <span class="keyword">struct </span><a class="code" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a> args;
+<a name="l00763"></a>00763
+<a name="l00764"></a>00764 <span class="comment">/* Initialize the distortion solution */</span>
+<a name="l00765"></a>00765 <span class="keywordflow">if</span>(initial_guess == NULL)
+<a name="l00766"></a>00766 {
+<a name="l00767"></a>00767 distortion = <a class="code" href="group__hawki__distortion.html#gae37defaaf5c0bd86686df3285b89763d" title="Allocate a new distortion solution.">hawki_distortion_grid_new</a>
+<a name="l00768"></a>00768 (detector_nx, detector_ny, grid_size);
+<a name="l00769"></a>00769 }
+<a name="l00770"></a>00770 <span class="keywordflow">else</span>
+<a name="l00771"></a>00771 {
+<a name="l00772"></a>00772 distortion = cpl_malloc(<span class="keyword">sizeof</span>(hawki_distortion));
+<a name="l00773"></a>00773 distortion->dist_x = cpl_image_duplicate(initial_guess->dist_x);
+<a name="l00774"></a>00774 distortion->dist_y = cpl_image_duplicate(initial_guess->dist_y);
+<a name="l00775"></a>00775 distortion->x_cdelt = initial_guess->x_cdelt;
+<a name="l00776"></a>00776 distortion->x_crval = initial_guess->x_crval;
+<a name="l00777"></a>00777 distortion->y_cdelt = initial_guess->y_cdelt;
+<a name="l00778"></a>00778 distortion->y_crval = initial_guess->y_crval;
+<a name="l00779"></a>00779 <span class="comment">//We have to fit all the distortion coefficients plus</span>
+<a name="l00780"></a>00780 <span class="comment">//the offsets of the catalogues</span>
+<a name="l00781"></a>00781 }
+<a name="l00782"></a>00782 <span class="comment">//We have to fit all the distortion coefficients plus</span>
+<a name="l00783"></a>00783 <span class="comment">//the offsets of the catalogues</span>
+<a name="l00784"></a>00784 nfitparam = grid_size * grid_size * 2 + ncats * 2;
+<a name="l00785"></a>00785 offsets = cpl_bivector_duplicate(initial_offsets);
+<a name="l00786"></a>00786 <span class="keywordflow">if</span>(cpl_table_get_nrow(matching_sets) * 2 < nfitparam)
+<a name="l00787"></a>00787 {
+<a name="l00788"></a>00788 cpl_msg_error(__func__,<span class="stringliteral">"Too few matches to compute distortion (< %d)"</span>,
+<a name="l00789"></a>00789 nfitparam);
+<a name="l00790"></a>00790 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion);
+<a name="l00791"></a>00791 <span class="keywordflow">return</span> NULL;
+<a name="l00792"></a>00792 }
+<a name="l00793"></a>00793
+<a name="l00794"></a>00794 <span class="comment">/* Setup function to minimize */</span>
+<a name="l00795"></a>00795 args.ref_catalogues = ref_catalogues;
+<a name="l00796"></a>00796 args.matching_sets = matching_sets;
+<a name="l00797"></a>00797 args.distortion = distortion;
+<a name="l00798"></a>00798 args.offsets = offsets;
+<a name="l00799"></a>00799 args.ncats = ncats;
+<a name="l00800"></a>00800
+<a name="l00801"></a>00801 minimize_function.f = hawki_distortion_gsl_obj_function;
+<a name="l00802"></a>00802 minimize_function.n = nfitparam;
+<a name="l00803"></a>00803 minimize_function.params = &args;
+<a name="l00804"></a>00804
+<a name="l00805"></a>00805 <span class="comment">/* Setup minimizer */</span>
+<a name="l00806"></a>00806 minimizer = gsl_multimin_fminimizer_alloc
+<a name="l00807"></a>00807 (gsl_multimin_fminimizer_nmsimplex, nfitparam);
+<a name="l00808"></a>00808 step_size = gsl_vector_alloc(nfitparam);
+<a name="l00809"></a>00809 init_param = gsl_vector_alloc(nfitparam);
+<a name="l00810"></a>00810 <span class="keywordflow">for</span>(iparam = 0; iparam < grid_size * grid_size * 2; ++iparam)
+<a name="l00811"></a>00811 gsl_vector_set(step_size, iparam, 5);
+<a name="l00812"></a>00812 <span class="keywordflow">for</span>(iparam = grid_size * grid_size * 2;
+<a name="l00813"></a>00813 iparam < nfitparam; ++iparam)
+<a name="l00814"></a>00814 gsl_vector_set(step_size, iparam, 1);
+<a name="l00815"></a>00815 hawki_distortion_update_param_from_solution(init_param, distortion);
+<a name="l00816"></a>00816 hawki_distortion_update_param_from_offsets(init_param, offsets);
+<a name="l00817"></a>00817 gsl_multimin_fminimizer_set(minimizer, &minimize_function,
+<a name="l00818"></a>00818 init_param, step_size);
+<a name="l00819"></a>00819
+<a name="l00820"></a>00820 <span class="keywordflow">do</span>
+<a name="l00821"></a>00821 {
+<a name="l00822"></a>00822 ++iter;
+<a name="l00823"></a>00823 minimizer_status = gsl_multimin_fminimizer_iterate (minimizer);
+<a name="l00824"></a>00824 <span class="keywordflow">if</span>(minimizer_status)
+<a name="l00825"></a>00825 <span class="keywordflow">break</span>;
+<a name="l00826"></a>00826 minimizer_status = gsl_multimin_test_size
+<a name="l00827"></a>00827 (gsl_multimin_fminimizer_size(minimizer), tolerance);
+<a name="l00828"></a>00828 cpl_msg_debug(__func__,<span class="stringliteral">"Iteration %d Minimum: %g"</span>,
+<a name="l00829"></a>00829 iter, gsl_multimin_fminimizer_minimum(minimizer));
+<a name="l00830"></a>00830 }
+<a name="l00831"></a>00831 <span class="keywordflow">while</span> (minimizer_status == GSL_CONTINUE && iter < HAWKI_DISTORTION_MAX_ITER);
+<a name="l00832"></a>00832
+<a name="l00833"></a>00833 cpl_msg_warning(__func__, <span class="stringliteral">"rms before computing %f"</span>, <a class="code" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea" title="This private function computes the rms, which is the objective function of the minimization algorithm...">hawki_distortion_compute_rms</a>(ref_catalogues, offsets,
+<a name="l00834"></a>00834 matching_sets, ncats, distortion));
+<a name="l00835"></a>00835
+<a name="l00836"></a>00836
+<a name="l00837"></a>00837 <span class="comment">//Do it again to avoid local minimum</span>
+<a name="l00838"></a>00838 gsl_multimin_fminimizer_set(minimizer, &minimize_function,
+<a name="l00839"></a>00839 gsl_multimin_fminimizer_x(minimizer), step_size);
+<a name="l00840"></a>00840 iter = 0;
+<a name="l00841"></a>00841 <span class="keywordflow">do</span>
+<a name="l00842"></a>00842 {
+<a name="l00843"></a>00843 ++iter;
+<a name="l00844"></a>00844 minimizer_status = gsl_multimin_fminimizer_iterate (minimizer);
+<a name="l00845"></a>00845 <span class="keywordflow">if</span>(minimizer_status)
+<a name="l00846"></a>00846 <span class="keywordflow">break</span>;
+<a name="l00847"></a>00847 minimizer_status = gsl_multimin_test_size
+<a name="l00848"></a>00848 (gsl_multimin_fminimizer_size(minimizer), tolerance2);
+<a name="l00849"></a>00849 cpl_msg_debug(__func__,<span class="stringliteral">"2nd run Iteration %d Minimum: %g"</span>,
+<a name="l00850"></a>00850 iter, gsl_multimin_fminimizer_minimum(minimizer));
+<a name="l00851"></a>00851 }
+<a name="l00852"></a>00852 <span class="keywordflow">while</span> (minimizer_status == GSL_CONTINUE && iter < HAWKI_DISTORTION_MAX_ITER2);
+<a name="l00853"></a>00853
+<a name="l00854"></a>00854 <span class="comment">/* Update the distortion solution */</span>
+<a name="l00855"></a>00855 hawki_distortion_update_solution_from_param
+<a name="l00856"></a>00856 (distortion, gsl_multimin_fminimizer_x(minimizer));
+<a name="l00857"></a>00857 hawki_distortion_update_offsets_from_param
+<a name="l00858"></a>00858 (offsets, gsl_multimin_fminimizer_x(minimizer));
+<a name="l00859"></a>00859
+<a name="l00860"></a>00860 *rms = <a class="code" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea" title="This private function computes the rms, which is the objective function of the minimization algorithm...">hawki_distortion_compute_rms</a>(ref_catalogues, offsets,
+<a name="l00861"></a>00861 matching_sets, ncats, distortion);
+<a name="l00862"></a>00862
+<a name="l00863"></a>00863 <span class="comment">/* Free and return */</span>
+<a name="l00864"></a>00864 gsl_multimin_fminimizer_free(minimizer);
+<a name="l00865"></a>00865 gsl_vector_free(init_param);
+<a name="l00866"></a>00866 gsl_vector_free(step_size);
+<a name="l00867"></a>00867 cpl_bivector_delete(offsets);
+<a name="l00868"></a>00868
+<a name="l00869"></a>00869 <span class="keywordflow">return</span> distortion;
+<a name="l00870"></a>00870 <span class="preprocessor">#else</span>
+<a name="l00871"></a>00871 <span class="preprocessor"></span> cpl_msg_error(__func__,<span class="stringliteral">"Not compiled with GSL support."</span>);
+<a name="l00872"></a>00872 <span class="keywordflow">return</span> NULL;
+<a name="l00873"></a>00873 <span class="preprocessor">#endif</span>
+<a name="l00874"></a>00874 <span class="preprocessor"></span>}
+<a name="l00875"></a>00875
+<a name="l00876"></a>00876 <span class="preprocessor">#ifdef HAVE_LIBGSL</span>
+<a name="l00877"></a>00877 <span class="preprocessor"></span><span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00885"></a>00885 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00886"></a>00886 <span class="keywordtype">double</span> hawki_distortion_gsl_obj_function
+<a name="l00887"></a>00887 (<span class="keyword">const</span> gsl_vector * dist_param,
+<a name="l00888"></a>00888 <span class="keywordtype">void</span> * args)
+<a name="l00889"></a>00889 {
+<a name="l00890"></a>00890 <span class="keyword">struct </span><a class="code" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a> args_struct;
+<a name="l00891"></a>00891 <span class="keyword">const</span> cpl_table ** ref_catalogues;
+<a name="l00892"></a>00892 <span class="keyword">const</span> cpl_table * matching_sets;
+<a name="l00893"></a>00893 hawki_distortion * distortion;
+<a name="l00894"></a>00894 cpl_bivector * offsets;
+<a name="l00895"></a>00895 <span class="keywordtype">int</span> ncats;
+<a name="l00896"></a>00896 <span class="keywordtype">double</span> rms;
+<a name="l00897"></a>00897 <span class="keywordtype">double</span> objective_function;
+<a name="l00898"></a>00898
+<a name="l00899"></a>00899
+<a name="l00900"></a>00900
+<a name="l00901"></a>00901 args_struct = *(<span class="keyword">struct </span><a class="code" href="struct__hawki__distortion__obj__function__args__.html">_hawki_distortion_obj_function_args_</a> * )args;
+<a name="l00902"></a>00902 ref_catalogues = args_struct.ref_catalogues;
+<a name="l00903"></a>00903 matching_sets = args_struct.matching_sets;
+<a name="l00904"></a>00904 distortion = args_struct.distortion;
+<a name="l00905"></a>00905 offsets = args_struct.offsets;
+<a name="l00906"></a>00906 ncats = args_struct.ncats;
+<a name="l00907"></a>00907
+<a name="l00908"></a>00908 hawki_distortion_update_solution_from_param(distortion, dist_param);
+<a name="l00909"></a>00909 hawki_distortion_update_offsets_from_param(offsets, dist_param);
+<a name="l00910"></a>00910
+<a name="l00911"></a>00911 rms = <a class="code" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea" title="This private function computes the rms, which is the objective function of the minimization algorithm...">hawki_distortion_compute_rms</a>(ref_catalogues, offsets,
+<a name="l00912"></a>00912 matching_sets, ncats, distortion);
+<a name="l00913"></a>00913
+<a name="l00914"></a>00914 objective_function = rms;
+<a name="l00915"></a>00915
+<a name="l00916"></a>00916
+<a name="l00917"></a>00917 cpl_msg_debug(__func__,<span class="stringliteral">"Objective function: %g"</span>, objective_function);
+<a name="l00918"></a>00918 <span class="keywordflow">return</span> objective_function;
+<a name="l00919"></a>00919 }
+<a name="l00920"></a>00920 <span class="preprocessor">#endif</span>
+<a name="l00921"></a>00921 <span class="preprocessor"></span>
+<a name="l00922"></a>00922 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00928"></a>00928 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00929"></a>00929 <span class="keywordtype">double</span> <a class="code" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea" title="This private function computes the rms, which is the objective function of the minimization algorithm...">hawki_distortion_compute_rms</a>
+<a name="l00930"></a><a class="code" href="group__hawki__distortion.html#ga8a38c008060d64d9e62198505617e5ea">00930</a> (<span class="keyword">const</span> cpl_table ** ref_catalogues,
+<a name="l00931"></a>00931 <span class="keyword">const</span> cpl_bivector * cat_offsets,
+<a name="l00932"></a>00932 <span class="keyword">const</span> cpl_table * matching_sets,
+<a name="l00933"></a>00933 <span class="keywordtype">int</span> ncats,
+<a name="l00934"></a>00934 hawki_distortion * distortion)
+<a name="l00935"></a>00935 {
+<a name="l00936"></a>00936 <span class="keywordtype">int</span> icat;
+<a name="l00937"></a>00937 <span class="keywordtype">int</span> imatch;
+<a name="l00938"></a>00938 <span class="keywordtype">int</span> nmatch;
+<a name="l00939"></a>00939 <span class="keywordtype">double</span> rms = 0;
+<a name="l00940"></a>00940 <span class="keyword">const</span> <span class="keywordtype">double</span> * x_cat_offsets;
+<a name="l00941"></a>00941 <span class="keyword">const</span> <span class="keywordtype">double</span> * y_cat_offsets;
+<a name="l00942"></a>00942 <span class="keyword">const</span> <span class="keywordtype">double</span> ** x_cat_cols;
+<a name="l00943"></a>00943 <span class="keyword">const</span> <span class="keywordtype">double</span> ** y_cat_cols;
+<a name="l00944"></a>00944 <span class="keyword">const</span> cpl_array ** match_arrays;
+<a name="l00945"></a>00945 <span class="keywordtype">double</span> ** x_pos_values;
+<a name="l00946"></a>00946 <span class="keywordtype">double</span> ** y_pos_values;
+<a name="l00947"></a>00947 <span class="keywordtype">int</span> ** pos_flag;
+<a name="l00948"></a>00948
+<a name="l00949"></a>00949
+<a name="l00950"></a>00950
+<a name="l00951"></a>00951 nmatch = cpl_table_get_nrow(matching_sets);
+<a name="l00952"></a>00952
+<a name="l00953"></a>00953 x_cat_offsets = cpl_vector_get_data_const
+<a name="l00954"></a>00954 (cpl_bivector_get_x_const(cat_offsets));
+<a name="l00955"></a>00955 y_cat_offsets = cpl_vector_get_data_const
+<a name="l00956"></a>00956 (cpl_bivector_get_y_const(cat_offsets));
+<a name="l00957"></a>00957
+<a name="l00958"></a>00958 x_cat_cols = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *) * ncats);
+<a name="l00959"></a>00959 y_cat_cols = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *) * ncats);
+<a name="l00960"></a>00960 <span class="keywordflow">for</span>(icat = 0; icat < ncats; ++icat)
+<a name="l00961"></a>00961 {
+<a name="l00962"></a>00962 x_cat_cols[icat] = cpl_table_get_data_double_const(ref_catalogues[icat],
+<a name="l00963"></a>00963 HAWKI_COL_OBJ_POSX);
+<a name="l00964"></a>00964 y_cat_cols[icat] = cpl_table_get_data_double_const(ref_catalogues[icat],
+<a name="l00965"></a>00965 HAWKI_COL_OBJ_POSY);
+<a name="l00966"></a>00966 }
+<a name="l00967"></a>00967
+<a name="l00968"></a>00968 match_arrays = cpl_malloc(<span class="keyword">sizeof</span>(cpl_array *) * nmatch);
+<a name="l00969"></a>00969 x_pos_values = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *) * nmatch);
+<a name="l00970"></a>00970 y_pos_values = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span> *) * nmatch);
+<a name="l00971"></a>00971 pos_flag = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span> *) * nmatch);
+<a name="l00972"></a>00972 <span class="keywordflow">for</span>(imatch = 0; imatch < nmatch; ++imatch)
+<a name="l00973"></a>00973 {
+<a name="l00974"></a>00974 match_arrays[imatch] = cpl_table_get_array(matching_sets,
+<a name="l00975"></a>00975 HAWKI_COL_MATCHING_SETS, imatch);
+<a name="l00976"></a>00976 x_pos_values[imatch] = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>) * ncats);
+<a name="l00977"></a>00977 y_pos_values[imatch] = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>) * ncats);
+<a name="l00978"></a>00978 pos_flag[imatch] = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>) * ncats);
+<a name="l00979"></a>00979 }
+<a name="l00980"></a>00980
+<a name="l00981"></a>00981 <span class="preprocessor">#ifdef _OPENMP </span>
+<a name="l00982"></a>00982 <span class="preprocessor"></span><span class="preprocessor">#pragma omp parallel for private(icat,imatch) reduction(+:rms)</span>
+<a name="l00983"></a>00983 <span class="preprocessor"></span><span class="preprocessor">#endif </span>
+<a name="l00984"></a>00984 <span class="preprocessor"></span> <span class="keywordflow">for</span>(imatch = 0; imatch < nmatch; ++imatch)
+<a name="l00985"></a>00985 {
+<a name="l00986"></a>00986 <span class="keywordtype">int</span> nstddev;
+<a name="l00987"></a>00987 <span class="keywordtype">double</span> var_x;
+<a name="l00988"></a>00988 <span class="keywordtype">double</span> var_y;
+<a name="l00989"></a>00989
+<a name="l00990"></a>00990 <span class="keywordflow">for</span>(icat = 0; icat < ncats; ++icat)
+<a name="l00991"></a>00991 {
+<a name="l00992"></a>00992 <span class="keywordtype">int</span> iobj;
+<a name="l00993"></a>00993 <span class="keywordtype">double</span> x_cat_offset;
+<a name="l00994"></a>00994 <span class="keywordtype">double</span> y_cat_offset;
+<a name="l00995"></a>00995
+<a name="l00996"></a>00996 x_cat_offset = x_cat_offsets[icat];
+<a name="l00997"></a>00997 y_cat_offset = y_cat_offsets[icat];
+<a name="l00998"></a>00998
+<a name="l00999"></a>00999 <span class="keywordflow">if</span>((iobj = cpl_array_get(match_arrays[imatch], icat, NULL)) != -1)
+<a name="l01000"></a>01000 {
+<a name="l01001"></a>01001 <span class="keywordtype">double</span> x_cat;
+<a name="l01002"></a>01002 <span class="keywordtype">double</span> y_cat;
+<a name="l01003"></a>01003 <span class="keywordtype">double</span> x_dist_corr;
+<a name="l01004"></a>01004 <span class="keywordtype">double</span> y_dist_corr;
+<a name="l01005"></a>01005 <span class="keywordtype">double</span> x_dist;
+<a name="l01006"></a>01006 <span class="keywordtype">double</span> y_dist;
+<a name="l01007"></a>01007 <span class="keywordtype">double</span> x_glob;
+<a name="l01008"></a>01008 <span class="keywordtype">double</span> y_glob;
+<a name="l01009"></a>01009
+<a name="l01010"></a>01010 x_cat = x_cat_cols[icat][iobj];
+<a name="l01011"></a>01011 y_cat = y_cat_cols[icat][iobj];
+<a name="l01012"></a>01012
+<a name="l01013"></a>01013
+<a name="l01014"></a>01014 <span class="comment">//These 4 lines of code are from hawki_distortion_correct_coords.</span>
+<a name="l01015"></a>01015 <span class="comment">//The are repeated here to avoid a cpl call, which is not thread-safe</span>
+<a name="l01016"></a>01016 <span class="comment">//Two checks to ensure thread-safety:</span>
+<a name="l01017"></a>01017 <span class="comment">//We have ensured outside the loop that distortion->dist_x and</span>
+<a name="l01018"></a>01018 <span class="comment">//distortion->dist_y are not null. </span>
+<a name="l01019"></a>01019 <span class="comment">//We have checked outside the loop the mask has all the points valid</span>
+<a name="l01020"></a>01020 <a class="code" href="group__hawki__distortion.html#ga27bd7baaf0df89d1d58b69968638b14d" title="Interpolates the distortion solution at a given position.">hawki_distortion_interpolate_distortion</a>
+<a name="l01021"></a>01021 (distortion, x_cat, y_cat, &x_dist, &y_dist);
+<a name="l01022"></a>01022 x_dist_corr = x_cat - x_dist;
+<a name="l01023"></a>01023 y_dist_corr = y_cat - y_dist;
+<a name="l01024"></a>01024
+<a name="l01025"></a>01025
+<a name="l01026"></a>01026 x_glob = x_dist_corr + x_cat_offset;
+<a name="l01027"></a>01027 y_glob = y_dist_corr + y_cat_offset;
+<a name="l01028"></a>01028 x_pos_values[imatch][icat] = x_glob;
+<a name="l01029"></a>01029 y_pos_values[imatch][icat] = y_glob;
+<a name="l01030"></a>01030 pos_flag[imatch][icat] = 1;
+<a name="l01031"></a>01031 }
+<a name="l01032"></a>01032 <span class="keywordflow">else</span>
+<a name="l01033"></a>01033 pos_flag[imatch][icat] = 0;
+<a name="l01034"></a>01034 }
+<a name="l01035"></a>01035
+<a name="l01036"></a>01036 <a class="code" href="group__hawki__distortion.html#gaa7dc1bd3e8cd954c453ecfdf2b0fe968" title="Compute the standard deviation of two vectors, not using flagged values.">hawki_distortion_get_flag_vars</a>(x_pos_values[imatch],
+<a name="l01037"></a>01037 y_pos_values[imatch], pos_flag[imatch],
+<a name="l01038"></a>01038 ncats, &nstddev, &var_x, &var_y);
+<a name="l01039"></a>01039
+<a name="l01040"></a>01040 <span class="comment">//The rms is counted as many times as this star is the list of catalogs.</span>
+<a name="l01041"></a>01041 rms += sqrt(var_x + var_y) * nstddev;
+<a name="l01042"></a>01042
+<a name="l01043"></a>01043 }
+<a name="l01044"></a>01044 cpl_free(x_cat_cols);
+<a name="l01045"></a>01045 cpl_free(y_cat_cols);
+<a name="l01046"></a>01046 <span class="keywordflow">for</span>(imatch = 0; imatch < nmatch; ++imatch)
+<a name="l01047"></a>01047 {
+<a name="l01048"></a>01048 cpl_free(x_pos_values[imatch]);
+<a name="l01049"></a>01049 cpl_free(y_pos_values[imatch]);
+<a name="l01050"></a>01050 cpl_free(pos_flag[imatch]);
+<a name="l01051"></a>01051 }
+<a name="l01052"></a>01052 cpl_free(x_pos_values);
+<a name="l01053"></a>01053 cpl_free(y_pos_values);
+<a name="l01054"></a>01054 cpl_free(pos_flag);
+<a name="l01055"></a>01055 cpl_free(match_arrays);
+<a name="l01056"></a>01056
+<a name="l01057"></a>01057 <span class="keywordflow">return</span> rms;
+<a name="l01058"></a>01058 }
+<a name="l01059"></a>01059
+<a name="l01060"></a>01060 <span class="preprocessor">#ifdef HAVE_LIBGSL</span>
+<a name="l01061"></a>01061 <span class="preprocessor"></span><span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01067"></a>01067 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01068"></a>01068 <span class="keywordtype">int</span> hawki_distortion_update_solution_from_param
+<a name="l01069"></a>01069 (hawki_distortion * distortion,
+<a name="l01070"></a>01070 <span class="keyword">const</span> gsl_vector * dist_param)
+<a name="l01071"></a>01071 {
+<a name="l01072"></a>01072 <span class="keywordtype">int</span> ipoint;
+<a name="l01073"></a>01073 <span class="keywordtype">int</span> ix;
+<a name="l01074"></a>01074 <span class="keywordtype">int</span> iy;
+<a name="l01075"></a>01075 <span class="keywordtype">int</span> nx;
+<a name="l01076"></a>01076 <span class="keywordtype">int</span> ny;
+<a name="l01077"></a>01077 <span class="keywordtype">double</span> x_dist_mean;
+<a name="l01078"></a>01078 <span class="keywordtype">double</span> y_dist_mean;
+<a name="l01079"></a>01079
+<a name="l01080"></a>01080 nx = cpl_image_get_size_x(distortion->dist_x);
+<a name="l01081"></a>01081 ny = cpl_image_get_size_y(distortion->dist_x);
+<a name="l01082"></a>01082 <span class="keywordflow">for</span>(ix = 0; ix < nx; ++ix)
+<a name="l01083"></a>01083 <span class="keywordflow">for</span>(iy = 0; iy < ny; ++iy)
+<a name="l01084"></a>01084 {
+<a name="l01085"></a>01085 ipoint = ix + iy * nx;
+<a name="l01086"></a>01086 cpl_image_set(distortion->dist_x, ix+1, iy+1,
+<a name="l01087"></a>01087 gsl_vector_get(dist_param, ipoint * 2));
+<a name="l01088"></a>01088 cpl_image_set(distortion->dist_y, ix+1, iy+1,
+<a name="l01089"></a>01089 gsl_vector_get(dist_param, ipoint * 2 + 1));
+<a name="l01090"></a>01090 }
+<a name="l01091"></a>01091
+<a name="l01092"></a>01092 <span class="comment">/* Normalize to mean(distorsion) = 0 */</span>
+<a name="l01093"></a>01093 x_dist_mean = cpl_image_get_mean(distortion->dist_x);
+<a name="l01094"></a>01094 y_dist_mean = cpl_image_get_mean(distortion->dist_y);
+<a name="l01095"></a>01095 cpl_image_subtract_scalar(distortion->dist_x, x_dist_mean);
+<a name="l01096"></a>01096 cpl_image_subtract_scalar(distortion->dist_y, y_dist_mean);
+<a name="l01097"></a>01097
+<a name="l01098"></a>01098 <span class="keywordflow">return</span> 0;
+<a name="l01099"></a>01099 }
+<a name="l01100"></a>01100
+<a name="l01101"></a>01101 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01107"></a>01107 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01108"></a>01108 <span class="keywordtype">int</span> hawki_distortion_update_offsets_from_param
+<a name="l01109"></a>01109 (cpl_bivector * offsets,
+<a name="l01110"></a>01110 <span class="keyword">const</span> gsl_vector * dist_param)
+<a name="l01111"></a>01111 {
+<a name="l01112"></a>01112 <span class="keywordtype">int</span> i;
+<a name="l01113"></a>01113 <span class="keywordtype">int</span> ncats;
+<a name="l01114"></a>01114 <span class="keywordtype">int</span> nparam;
+<a name="l01115"></a>01115
+<a name="l01116"></a>01116 ncats = cpl_bivector_get_size(offsets);
+<a name="l01117"></a>01117 nparam = dist_param->size;
+<a name="l01118"></a>01118 <span class="keywordflow">for</span>(i = 0; i < ncats; ++i)
+<a name="l01119"></a>01119 {
+<a name="l01120"></a>01120 cpl_vector_set(cpl_bivector_get_x(offsets), i,
+<a name="l01121"></a>01121 gsl_vector_get(dist_param, nparam - 2 * ncats + 2 * i));
+<a name="l01122"></a>01122 cpl_vector_set(cpl_bivector_get_y(offsets), i,
+<a name="l01123"></a>01123 gsl_vector_get(dist_param, nparam - 2 * ncats + 2 * i + 1));
+<a name="l01124"></a>01124 }
+<a name="l01125"></a>01125
+<a name="l01126"></a>01126 <span class="keywordflow">return</span> 0;
+<a name="l01127"></a>01127 }
+<a name="l01128"></a>01128
+<a name="l01129"></a>01129 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01135"></a>01135 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01136"></a>01136 <span class="keywordtype">int</span> hawki_distortion_update_param_from_solution
+<a name="l01137"></a>01137 (gsl_vector * dist_param,
+<a name="l01138"></a>01138 <span class="keyword">const</span> hawki_distortion * distortion)
+<a name="l01139"></a>01139 {
+<a name="l01140"></a>01140 <span class="keywordtype">int</span> ipoint;
+<a name="l01141"></a>01141 <span class="keywordtype">int</span> ix;
+<a name="l01142"></a>01142 <span class="keywordtype">int</span> iy;
+<a name="l01143"></a>01143 <span class="keywordtype">int</span> nx;
+<a name="l01144"></a>01144 <span class="keywordtype">int</span> ny;
+<a name="l01145"></a>01145 <span class="keywordtype">int</span> isnull;
+<a name="l01146"></a>01146
+<a name="l01147"></a>01147 nx = cpl_image_get_size_x(distortion->dist_x);
+<a name="l01148"></a>01148 ny = cpl_image_get_size_y(distortion->dist_y);
+<a name="l01149"></a>01149 <span class="keywordflow">for</span>(ix = 0; ix < nx; ++ix)
+<a name="l01150"></a>01150 <span class="keywordflow">for</span>(iy = 0; iy < ny; ++iy)
+<a name="l01151"></a>01151 {
+<a name="l01152"></a>01152 ipoint = ix + iy * nx;
+<a name="l01153"></a>01153 gsl_vector_set(dist_param, ipoint * 2,
+<a name="l01154"></a>01154 cpl_image_get(distortion->dist_x, ix+1, iy+1, &isnull));
+<a name="l01155"></a>01155 gsl_vector_set(dist_param, ipoint * 2 + 1,
+<a name="l01156"></a>01156 cpl_image_get(distortion->dist_y, ix+1, iy+1, &isnull));
+<a name="l01157"></a>01157 }
+<a name="l01158"></a>01158
+<a name="l01159"></a>01159 <span class="keywordflow">return</span> 0;
+<a name="l01160"></a>01160 }
+<a name="l01161"></a>01161
+<a name="l01162"></a>01162 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01167"></a>01167 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01168"></a>01168 <span class="keywordtype">int</span> hawki_distortion_update_param_from_offsets
+<a name="l01169"></a>01169 (gsl_vector * dist_param,
+<a name="l01170"></a>01170 <span class="keyword">const</span> cpl_bivector * offsets)
+<a name="l01171"></a>01171 {
+<a name="l01172"></a>01172 <span class="keywordtype">int</span> i;
+<a name="l01173"></a>01173 <span class="keywordtype">int</span> ncats;
+<a name="l01174"></a>01174 <span class="keywordtype">int</span> nparam;
+<a name="l01175"></a>01175
+<a name="l01176"></a>01176 ncats = cpl_bivector_get_size(offsets);
+<a name="l01177"></a>01177 nparam = dist_param->size;
+<a name="l01178"></a>01178 <span class="keywordflow">for</span>(i = 0; i < ncats; ++i)
+<a name="l01179"></a>01179 {
+<a name="l01180"></a>01180 gsl_vector_set(dist_param, nparam - 2 * ncats + 2 * i,
+<a name="l01181"></a>01181 cpl_vector_get(cpl_bivector_get_x_const(offsets), i));
+<a name="l01182"></a>01182 gsl_vector_set(dist_param, nparam - 2 * ncats + 2 * i + 1,
+<a name="l01183"></a>01183 cpl_vector_get(cpl_bivector_get_y_const(offsets), i));
+<a name="l01184"></a>01184 }
+<a name="l01185"></a>01185
+<a name="l01186"></a>01186 <span class="keywordflow">return</span> 0;
+<a name="l01187"></a>01187 }
+<a name="l01188"></a>01188 <span class="preprocessor">#endif</span>
+<a name="l01189"></a>01189 <span class="preprocessor"></span>
+<a name="l01190"></a>01190 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01196"></a>01196 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01197"></a>01197 <span class="keywordtype">void</span> <a class="code" href="group__hawki__distortion.html#gaa7dc1bd3e8cd954c453ecfdf2b0fe968" title="Compute the standard deviation of two vectors, not using flagged values.">hawki_distortion_get_flag_vars</a>
+<a name="l01198"></a><a class="code" href="group__hawki__distortion.html#gaa7dc1bd3e8cd954c453ecfdf2b0fe968">01198</a> (<span class="keywordtype">double</span> * x_val, <span class="keywordtype">double</span> * y_val, <span class="keywordtype">int</span> *pos_flag,
+<a name="l01199"></a>01199 <span class="keywordtype">int</span> nvals, <span class="keywordtype">int</span> *nvalid, <span class="keywordtype">double</span> *var_x, <span class="keywordtype">double</span> *var_y)
+<a name="l01200"></a>01200 {
+<a name="l01201"></a>01201 <span class="keywordtype">double</span> varsum_x = 0.0;
+<a name="l01202"></a>01202 <span class="keywordtype">double</span> varsum_y = 0.0;
+<a name="l01203"></a>01203 <span class="keywordtype">double</span> mean_x = 0.0;
+<a name="l01204"></a>01204 <span class="keywordtype">double</span> mean_y = 0.0;
+<a name="l01205"></a>01205 <span class="keywordtype">int</span> i;
+<a name="l01206"></a>01206
+<a name="l01207"></a>01207 *nvalid = 0;
+<a name="l01208"></a>01208 <span class="keywordflow">for</span> (i=0; i < nvals; i++)
+<a name="l01209"></a>01209 {
+<a name="l01210"></a>01210 <span class="keywordflow">if</span>(pos_flag[i] == 1)
+<a name="l01211"></a>01211 {
+<a name="l01212"></a>01212 <span class="keyword">const</span> <span class="keywordtype">double</span> delta_x = (double)x_val[i] - mean_x;
+<a name="l01213"></a>01213 <span class="keyword">const</span> <span class="keywordtype">double</span> delta_y = (double)y_val[i] - mean_y;
+<a name="l01214"></a>01214
+<a name="l01215"></a>01215 varsum_x += *nvalid * delta_x * delta_x / (*nvalid + 1.0);
+<a name="l01216"></a>01216 varsum_y += *nvalid * delta_y * delta_y / (*nvalid + 1.0);
+<a name="l01217"></a>01217 mean_x += delta_x / (*nvalid + 1.0);
+<a name="l01218"></a>01218 mean_y += delta_y / (*nvalid + 1.0);
+<a name="l01219"></a>01219 (*nvalid)++;
+<a name="l01220"></a>01220 }
+<a name="l01221"></a>01221 }
+<a name="l01222"></a>01222
+<a name="l01223"></a>01223 <span class="comment">/* Compute the bias-corrected standard deviation.</span>
+<a name="l01224"></a>01224 <span class="comment"> - With the recurrence relation rounding can likely not cause</span>
+<a name="l01225"></a>01225 <span class="comment"> the variance to become negative, but check just to be safe */</span>
+<a name="l01226"></a>01226 *var_x = varsum_x / (double) (*nvalid - 1);
+<a name="l01227"></a>01227 *var_y = varsum_y / (double) (*nvalid - 1);
+<a name="l01228"></a>01228 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__distortion_8h_source.html b/html/hawki__distortion_8h_source.html
new file mode 100644
index 0000000..b8bd14a
--- /dev/null
+++ b/html/hawki__distortion_8h_source.html
@@ -0,0 +1,181 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_distortion.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_distortion.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_distortion.h,v 1.12 2010/03/12 13:04:44 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/03/12 13:04:44 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.12 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_DISTORTION_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DISTORTION_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> Structures and typedefs</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="keyword">typedef</span> <span class="keyword">struct </span>_hawki_distortion_ hawki_distortion;
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="keyword">struct </span>_hawki_distortion_
+<a name="l00044"></a>00044 {
+<a name="l00045"></a>00045 cpl_image * dist_x;
+<a name="l00046"></a>00046 cpl_image * dist_y;
+<a name="l00047"></a>00047 <span class="keywordtype">double</span> x_crval;
+<a name="l00048"></a>00048 <span class="keywordtype">double</span> x_cdelt;
+<a name="l00049"></a>00049 <span class="keywordtype">double</span> y_crval;
+<a name="l00050"></a>00050 <span class="keywordtype">double</span> y_cdelt;
+<a name="l00051"></a>00051 };
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00054"></a>00054 <span class="comment"> Prototypes</span>
+<a name="l00055"></a>00055 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 hawki_distortion * <a class="code" href="group__hawki__distortion.html#gae37defaaf5c0bd86686df3285b89763d" title="Allocate a new distortion solution.">hawki_distortion_grid_new</a>
+<a name="l00058"></a>00058 (<span class="keywordtype">int</span> detector_nx,
+<a name="l00059"></a>00059 <span class="keywordtype">int</span> detector_ny,
+<a name="l00060"></a>00060 <span class="keywordtype">int</span> grid_size);
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>
+<a name="l00063"></a>00063 (hawki_distortion * distortion);
+<a name="l00064"></a>00064
+<a name="l00065"></a>00065 hawki_distortion * <a class="code" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7" title="Loads the distortion solution for one detector.">hawki_distortion_load</a>
+<a name="l00066"></a>00066 (<span class="keyword">const</span> cpl_frame * dist_x,
+<a name="l00067"></a>00067 <span class="keyword">const</span> cpl_frame * dist_y,
+<a name="l00068"></a>00068 <span class="keywordtype">int</span> idet);
+<a name="l00069"></a>00069
+<a name="l00070"></a>00070 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#gaaeaf96920122f1d4f64c164289588345" title="Gives the dimension in X of the distortion solution.">hawki_distortion_get_size_x</a>
+<a name="l00071"></a>00071 (<span class="keyword">const</span> hawki_distortion * distortion);
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga990c10037636042cfcc0b40332821e9c" title="Gives the dimension in Y of the distortion solution.">hawki_distortion_get_size_y</a>
+<a name="l00074"></a>00074 (<span class="keyword">const</span> hawki_distortion * distortion);
+<a name="l00075"></a>00075
+<a name="l00076"></a>00076 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga52da9acfab98a1592e65df9c6bfba484" title="Apply the distortion correction.">hawki_distortion_correct_alldetectors</a>
+<a name="l00077"></a>00077 (cpl_image ** alldetectors,
+<a name="l00078"></a>00078 <span class="keyword">const</span> cpl_frame * distortion_x,
+<a name="l00079"></a>00079 <span class="keyword">const</span> cpl_frame * distortion_y) ;
+<a name="l00080"></a>00080
+<a name="l00081"></a>00081 cpl_image * <a class="code" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c" title="Apply the distortion correction to one chip.">hawki_distortion_correct_detector</a>
+<a name="l00082"></a>00082 (cpl_image * image,
+<a name="l00083"></a>00083 cpl_image * dist_x,
+<a name="l00084"></a>00084 cpl_image * dist_y);
+<a name="l00085"></a>00085
+<a name="l00086"></a>00086 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga6ecd36fa4b8e69cf6f3c85a64b7a9c3e" title="Apply the distortion correction to one detector position.">hawki_distortion_correct_coords</a>
+<a name="l00087"></a>00087 (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00088"></a>00088 <span class="keywordtype">double</span> x_pos,
+<a name="l00089"></a>00089 <span class="keywordtype">double</span> y_pos,
+<a name="l00090"></a>00090 <span class="keywordtype">double</span> * x_pos_distcorr,
+<a name="l00091"></a>00091 <span class="keywordtype">double</span> * y_pos_distcorr);
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga9462a4c3d7e6d3cac66f7bef27f6cbe3" title="Apply the inverse distortion correction to one detector position.">hawki_distortion_inverse_correct_coords</a>
+<a name="l00094"></a>00094 (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00095"></a>00095 <span class="keywordtype">double</span> x_pos,
+<a name="l00096"></a>00096 <span class="keywordtype">double</span> y_pos,
+<a name="l00097"></a>00097 <span class="keywordtype">double</span> * x_pos_distdecorr,
+<a name="l00098"></a>00098 <span class="keywordtype">double</span> * y_pos_distdecorr);
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="keywordtype">int</span> <a class="code" href="group__hawki__distortion.html#ga4ad09d8cbb7f3ed8fddeb451f3b2056f" title="Apply the distortion correction.">hawki_distortion_apply_maps</a>
+<a name="l00101"></a>00101 (cpl_imagelist * ilist,
+<a name="l00102"></a>00102 cpl_image ** dist_x,
+<a name="l00103"></a>00103 cpl_image ** dist_y);
+<a name="l00104"></a>00104
+<a name="l00105"></a>00105 <span class="keywordtype">int</span> hawki_distortion_create_maps_detector
+<a name="l00106"></a>00106 (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00107"></a>00107 cpl_image * dist_detector_x,
+<a name="l00108"></a>00108 cpl_image * dist_detector_y);
+<a name="l00109"></a>00109
+<a name="l00110"></a>00110 <span class="keywordtype">int</span> hawki_distortion_create_maps
+<a name="l00111"></a>00111 (<span class="keyword">const</span> hawki_distortion * distortion,
+<a name="l00112"></a>00112 cpl_image ** dist_x,
+<a name="l00113"></a>00113 cpl_image ** dist_y);
+<a name="l00114"></a>00114
+<a name="l00115"></a>00115 hawki_distortion * hawki_distortion_compute_solution
+<a name="l00116"></a>00116 (<span class="keyword">const</span> cpl_table ** ref_catalogues,
+<a name="l00117"></a>00117 <span class="keyword">const</span> cpl_bivector * cat_offsets,
+<a name="l00118"></a>00118 <span class="keyword">const</span> cpl_table * matching_sets,
+<a name="l00119"></a>00119 <span class="keywordtype">int</span> ncats,
+<a name="l00120"></a>00120 <span class="keywordtype">int</span> detector_nx,
+<a name="l00121"></a>00121 <span class="keywordtype">int</span> detector_ny,
+<a name="l00122"></a>00122 <span class="keywordtype">int</span> grid_size,
+<a name="l00123"></a>00123 <span class="keyword">const</span> hawki_distortion * dist_initguess,
+<a name="l00124"></a>00124 <span class="keywordtype">double</span> * rms);
+<a name="l00125"></a>00125
+<a name="l00126"></a>00126
+<a name="l00127"></a>00127 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__image__stats_8c_source.html b/html/hawki__image__stats_8c_source.html
new file mode 100644
index 0000000..acbe4d2
--- /dev/null
+++ b/html/hawki__image__stats_8c_source.html
@@ -0,0 +1,621 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_image_stats.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_image_stats.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_image_stats.c,v 1.8 2012/05/03 10:42:32 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/05/03 10:42:32 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.8 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00043"></a>00043
+<a name="l00044"></a>00044 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00045"></a>00045 <span class="comment">/* Private functions */</span>
+<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00047"></a>00047 <span class="keywordtype">float</span> hawki_tools_get_kth_float(<span class="keywordtype">float</span> * a,
+<a name="l00048"></a>00048 <span class="keywordtype">int</span> n,
+<a name="l00049"></a>00049 <span class="keywordtype">int</span> k);
+<a name="l00050"></a>00050
+<a name="l00051"></a>00051 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00055"></a>00055 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00056"></a>00056
+<a name="l00059"></a>00059 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00068"></a>00068 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00069"></a>00069 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>
+<a name="l00070"></a><a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6">00070</a> (cpl_table ** raw_stats)
+<a name="l00071"></a>00071 {
+<a name="l00072"></a>00072 <span class="keywordtype">int</span> idet;
+<a name="l00073"></a>00073 <span class="comment">/* Error state variables */</span>
+<a name="l00074"></a>00074 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00075"></a>00075
+<a name="l00076"></a>00076 <span class="comment">/* Check inputs */</span>
+<a name="l00077"></a>00077 <span class="keywordflow">if</span>(raw_stats == NULL)
+<a name="l00078"></a>00078 <span class="keywordflow">return</span> -1;
+<a name="l00079"></a>00079 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00080"></a>00080 {
+<a name="l00081"></a>00081 <span class="keywordflow">if</span>(raw_stats[idet] == NULL)
+<a name="l00082"></a>00082 <span class="keywordflow">return</span> -1;
+<a name="l00083"></a>00083 }
+<a name="l00084"></a>00084
+<a name="l00085"></a>00085 <span class="comment">/* Creates the proper columns */</span>
+<a name="l00086"></a>00086 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00087"></a>00087 {
+<a name="l00088"></a>00088 cpl_table_new_column
+<a name="l00089"></a>00089 (raw_stats[idet],HAWKI_COL_STAT_MIN,CPL_TYPE_DOUBLE);
+<a name="l00090"></a>00090 cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MIN,<span class="stringliteral">"ADU"</span>);
+<a name="l00091"></a>00091 cpl_table_new_column
+<a name="l00092"></a>00092 (raw_stats[idet],HAWKI_COL_STAT_MAX,CPL_TYPE_DOUBLE);
+<a name="l00093"></a>00093 cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MAX,<span class="stringliteral">"ADU"</span>);
+<a name="l00094"></a>00094 cpl_table_new_column
+<a name="l00095"></a>00095 (raw_stats[idet],HAWKI_COL_STAT_MED,CPL_TYPE_DOUBLE);
+<a name="l00096"></a>00096 cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MED,<span class="stringliteral">"ADU"</span>);
+<a name="l00097"></a>00097 cpl_table_new_column
+<a name="l00098"></a>00098 (raw_stats[idet],HAWKI_COL_STAT_MEAN,CPL_TYPE_DOUBLE);
+<a name="l00099"></a>00099 cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_MEAN,<span class="stringliteral">"ADU"</span>);
+<a name="l00100"></a>00100 cpl_table_new_column
+<a name="l00101"></a>00101 (raw_stats[idet],HAWKI_COL_STAT_RMS,CPL_TYPE_DOUBLE);
+<a name="l00102"></a>00102 cpl_table_set_column_unit(raw_stats[idet],HAWKI_COL_STAT_RMS,<span class="stringliteral">"ADU"</span>);
+<a name="l00103"></a>00103 cpl_table_new_column
+<a name="l00104"></a>00104 (raw_stats[idet],HAWKI_COL_STAT_USED,CPL_TYPE_INT);
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 }
+<a name="l00107"></a>00107 <span class="comment">/* Check error status and exit */</span>
+<a name="l00108"></a>00108 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00109"></a>00109 <span class="keywordflow">return</span> -1;
+<a name="l00110"></a>00110 <span class="keywordflow">return</span> 0;
+<a name="l00111"></a>00111 }
+<a name="l00112"></a>00112
+<a name="l00113"></a>00113 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00135"></a>00135 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00136"></a>00136 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l00137"></a><a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f">00137</a> (cpl_table ** image_stats,
+<a name="l00138"></a>00138 <span class="keyword">const</span> cpl_image * image,
+<a name="l00139"></a>00139 <span class="keywordtype">int</span> llx,
+<a name="l00140"></a>00140 <span class="keywordtype">int</span> lly,
+<a name="l00141"></a>00141 <span class="keywordtype">int</span> urx,
+<a name="l00142"></a>00142 <span class="keywordtype">int</span> ury,
+<a name="l00143"></a>00143 <span class="keywordtype">int</span> idet,
+<a name="l00144"></a>00144 <span class="keywordtype">int</span> irow)
+<a name="l00145"></a>00145 {
+<a name="l00146"></a>00146 <span class="comment">/* stats variables */</span>
+<a name="l00147"></a>00147 <span class="keywordtype">double</span> minval;
+<a name="l00148"></a>00148 <span class="keywordtype">double</span> maxval;
+<a name="l00149"></a>00149 <span class="keywordtype">double</span> median;
+<a name="l00150"></a>00150 <span class="keywordtype">double</span> stdev;
+<a name="l00151"></a>00151 <span class="keywordtype">double</span> mean;
+<a name="l00152"></a>00152 cpl_stats * stats_ima ;
+<a name="l00153"></a>00153
+<a name="l00154"></a>00154 <span class="comment">/* Error state variables */</span>
+<a name="l00155"></a>00155 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00156"></a>00156
+<a name="l00157"></a>00157 <span class="comment">/* Checking input */</span>
+<a name="l00158"></a>00158 <span class="keywordflow">if</span>(image_stats == NULL || image == NULL)
+<a name="l00159"></a>00159 <span class="keywordflow">return</span> -1;
+<a name="l00160"></a>00160
+<a name="l00161"></a>00161 <span class="comment">/* Compute statistics */</span>
+<a name="l00162"></a>00162 stats_ima = cpl_stats_new_from_image_window
+<a name="l00163"></a>00163 (image, CPL_STATS_ALL, llx, lly, urx, ury) ;
+<a name="l00164"></a>00164 <span class="keywordflow">if</span>(stats_ima == NULL)
+<a name="l00165"></a>00165 <span class="keywordflow">return</span> -1;
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 <span class="comment">/* Get the stats from the storage structure */</span>
+<a name="l00168"></a>00168 minval = cpl_stats_get_min(stats_ima);
+<a name="l00169"></a>00169 maxval = cpl_stats_get_max(stats_ima);
+<a name="l00170"></a>00170 median = cpl_stats_get_median(stats_ima);
+<a name="l00171"></a>00171 stdev = cpl_stats_get_stdev(stats_ima);
+<a name="l00172"></a>00172 mean = cpl_stats_get_mean(stats_ima);
+<a name="l00173"></a>00173 cpl_stats_delete(stats_ima);
+<a name="l00174"></a>00174
+<a name="l00175"></a>00175 <span class="comment">/* Store in table */</span>
+<a name="l00176"></a>00176 cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MIN,
+<a name="l00177"></a>00177 irow, minval);
+<a name="l00178"></a>00178 cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MAX,
+<a name="l00179"></a>00179 irow, maxval);
+<a name="l00180"></a>00180 cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MED,
+<a name="l00181"></a>00181 irow, median);
+<a name="l00182"></a>00182 cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_MEAN,
+<a name="l00183"></a>00183 irow, mean);
+<a name="l00184"></a>00184 cpl_table_set_double(image_stats[idet], HAWKI_COL_STAT_RMS,
+<a name="l00185"></a>00185 irow, stdev) ;
+<a name="l00186"></a>00186 cpl_table_set_int(image_stats[idet], HAWKI_COL_STAT_USED,
+<a name="l00187"></a>00187 irow, 1) ;
+<a name="l00188"></a>00188
+<a name="l00189"></a>00189 <span class="comment">/* Check error status and exit */</span>
+<a name="l00190"></a>00190 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00191"></a>00191 <span class="keywordflow">return</span> -1;
+<a name="l00192"></a>00192 <span class="keywordflow">return</span> 0;
+<a name="l00193"></a>00193 }
+<a name="l00194"></a>00194
+<a name="l00195"></a>00195 <span class="keywordtype">int</span> hawki_image_stats_odd_even_column_row_fill_from_image
+<a name="l00196"></a>00196 (cpl_table ** odd_column_stats,
+<a name="l00197"></a>00197 cpl_table ** even_column_stats,
+<a name="l00198"></a>00198 cpl_table ** odd_row_stats,
+<a name="l00199"></a>00199 cpl_table ** even_row_stats,
+<a name="l00200"></a>00200 <span class="keyword">const</span> cpl_image * image,
+<a name="l00201"></a>00201 <span class="keywordtype">int</span> idet,
+<a name="l00202"></a>00202 <span class="keywordtype">int</span> irow)
+<a name="l00203"></a>00203 {
+<a name="l00204"></a>00204 <span class="comment">/* stats variables */</span>
+<a name="l00205"></a>00205 <span class="keywordtype">int</span> i;
+<a name="l00206"></a>00206 <span class="keywordtype">int</span> j;
+<a name="l00207"></a>00207 <span class="keywordtype">int</span> nx;
+<a name="l00208"></a>00208 <span class="keywordtype">int</span> ny;
+<a name="l00209"></a>00209 <span class="keywordtype">double</span> minval;
+<a name="l00210"></a>00210 <span class="keywordtype">double</span> maxval;
+<a name="l00211"></a>00211 <span class="keywordtype">double</span> median;
+<a name="l00212"></a>00212 <span class="keywordtype">double</span> stdev;
+<a name="l00213"></a>00213 <span class="keywordtype">double</span> mean;
+<a name="l00214"></a>00214 cpl_stats * stats_ima;
+<a name="l00215"></a>00215 cpl_image * tmp_ima;
+<a name="l00216"></a>00216 cpl_mask * mask;
+<a name="l00217"></a>00217
+<a name="l00218"></a>00218 <span class="comment">/* Error state variables */</span>
+<a name="l00219"></a>00219 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00220"></a>00220
+<a name="l00221"></a>00221 <span class="comment">/* Checking input */</span>
+<a name="l00222"></a>00222 <span class="keywordflow">if</span>(odd_column_stats == NULL ||
+<a name="l00223"></a>00223 even_column_stats == NULL ||
+<a name="l00224"></a>00224 odd_row_stats == NULL ||
+<a name="l00225"></a>00225 even_row_stats == NULL ||
+<a name="l00226"></a>00226 image == NULL)
+<a name="l00227"></a>00227 <span class="keywordflow">return</span> -1;
+<a name="l00228"></a>00228
+<a name="l00229"></a>00229 <span class="comment">/* Copying the target image */</span>
+<a name="l00230"></a>00230 tmp_ima = cpl_image_duplicate(image);
+<a name="l00231"></a>00231 nx = cpl_image_get_size_x(tmp_ima);
+<a name="l00232"></a>00232 ny = cpl_image_get_size_y(tmp_ima);
+<a name="l00233"></a>00233
+<a name="l00234"></a>00234 <span class="comment">/* Compute statistics odd column */</span>
+<a name="l00235"></a>00235 mask = cpl_image_get_bpm(tmp_ima);
+<a name="l00236"></a>00236 <span class="keywordflow">for</span>(i=0 ; i < nx ; ++i)
+<a name="l00237"></a>00237 {
+<a name="l00238"></a>00238 <span class="keywordflow">if</span>((i+1) % 2)
+<a name="l00239"></a>00239 <span class="keywordflow">for</span>(j=0 ; j < ny ; ++j)
+<a name="l00240"></a>00240 {
+<a name="l00241"></a>00241 cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+<a name="l00242"></a>00242 }
+<a name="l00243"></a>00243 }
+<a name="l00244"></a>00244 stats_ima = cpl_stats_new_from_image
+<a name="l00245"></a>00245 (tmp_ima, CPL_STATS_ALL);
+<a name="l00246"></a>00246 <span class="keywordflow">if</span>(stats_ima == NULL)
+<a name="l00247"></a>00247 {
+<a name="l00248"></a>00248 cpl_image_delete(tmp_ima);
+<a name="l00249"></a>00249 <span class="keywordflow">return</span> -1;
+<a name="l00250"></a>00250 }
+<a name="l00251"></a>00251
+<a name="l00252"></a>00252 <span class="comment">/* Get the stats from the storage structure */</span>
+<a name="l00253"></a>00253 minval = cpl_stats_get_min(stats_ima);
+<a name="l00254"></a>00254 maxval = cpl_stats_get_max(stats_ima);
+<a name="l00255"></a>00255 median = cpl_stats_get_median(stats_ima);
+<a name="l00256"></a>00256 stdev = cpl_stats_get_stdev(stats_ima);
+<a name="l00257"></a>00257 mean = cpl_stats_get_mean(stats_ima);
+<a name="l00258"></a>00258 cpl_stats_delete(stats_ima);
+<a name="l00259"></a>00259
+<a name="l00260"></a>00260 <span class="comment">/* Store in table */</span>
+<a name="l00261"></a>00261 cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MIN,
+<a name="l00262"></a>00262 irow, minval);
+<a name="l00263"></a>00263 cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MAX,
+<a name="l00264"></a>00264 irow, maxval);
+<a name="l00265"></a>00265 cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MED,
+<a name="l00266"></a>00266 irow, median);
+<a name="l00267"></a>00267 cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_MEAN,
+<a name="l00268"></a>00268 irow, mean);
+<a name="l00269"></a>00269 cpl_table_set_double(odd_column_stats[idet], HAWKI_COL_STAT_RMS,
+<a name="l00270"></a>00270 irow, stdev) ;
+<a name="l00271"></a>00271 cpl_table_set_int(odd_column_stats[idet], HAWKI_COL_STAT_USED,
+<a name="l00272"></a>00272 irow, 1) ;
+<a name="l00273"></a>00273
+<a name="l00274"></a>00274 <span class="comment">/* Compute statistics even column */</span>
+<a name="l00275"></a>00275 <span class="comment">//cpl_image_reject_from_mask();</span>
+<a name="l00276"></a>00276 cpl_image_accept_all(tmp_ima);
+<a name="l00277"></a>00277 mask = cpl_image_get_bpm(tmp_ima);
+<a name="l00278"></a>00278 <span class="keywordflow">for</span>(i=0 ; i < nx ; ++i)
+<a name="l00279"></a>00279 {
+<a name="l00280"></a>00280 <span class="keywordflow">if</span>(i % 2)
+<a name="l00281"></a>00281 <span class="keywordflow">for</span>(j=0 ; j < ny ; ++j)
+<a name="l00282"></a>00282 {
+<a name="l00283"></a>00283 cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+<a name="l00284"></a>00284 }
+<a name="l00285"></a>00285 }
+<a name="l00286"></a>00286 stats_ima = cpl_stats_new_from_image
+<a name="l00287"></a>00287 (tmp_ima, CPL_STATS_ALL);
+<a name="l00288"></a>00288 <span class="keywordflow">if</span>(stats_ima == NULL)
+<a name="l00289"></a>00289 {
+<a name="l00290"></a>00290 cpl_image_delete(tmp_ima);
+<a name="l00291"></a>00291 <span class="keywordflow">return</span> -1;
+<a name="l00292"></a>00292 }
+<a name="l00293"></a>00293
+<a name="l00294"></a>00294 <span class="comment">/* Get the stats from the storage structure */</span>
+<a name="l00295"></a>00295 minval = cpl_stats_get_min(stats_ima);
+<a name="l00296"></a>00296 maxval = cpl_stats_get_max(stats_ima);
+<a name="l00297"></a>00297 median = cpl_stats_get_median(stats_ima);
+<a name="l00298"></a>00298 stdev = cpl_stats_get_stdev(stats_ima);
+<a name="l00299"></a>00299 mean = cpl_stats_get_mean(stats_ima);
+<a name="l00300"></a>00300 cpl_stats_delete(stats_ima);
+<a name="l00301"></a>00301
+<a name="l00302"></a>00302 <span class="comment">/* Store in table */</span>
+<a name="l00303"></a>00303 cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MIN,
+<a name="l00304"></a>00304 irow, minval);
+<a name="l00305"></a>00305 cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MAX,
+<a name="l00306"></a>00306 irow, maxval);
+<a name="l00307"></a>00307 cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MED,
+<a name="l00308"></a>00308 irow, median);
+<a name="l00309"></a>00309 cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_MEAN,
+<a name="l00310"></a>00310 irow, mean);
+<a name="l00311"></a>00311 cpl_table_set_double(even_column_stats[idet], HAWKI_COL_STAT_RMS,
+<a name="l00312"></a>00312 irow, stdev) ;
+<a name="l00313"></a>00313 cpl_table_set_int(even_column_stats[idet], HAWKI_COL_STAT_USED,
+<a name="l00314"></a>00314 irow, 1) ;
+<a name="l00315"></a>00315
+<a name="l00316"></a>00316 <span class="comment">/* Compute statistics odd rows */</span>
+<a name="l00317"></a>00317 cpl_image_accept_all(tmp_ima);
+<a name="l00318"></a>00318 mask = cpl_image_get_bpm(tmp_ima);
+<a name="l00319"></a>00319 <span class="keywordflow">for</span>(j=0 ; j < ny ; ++j)
+<a name="l00320"></a>00320 {
+<a name="l00321"></a>00321 <span class="keywordflow">if</span>((j+1) % 2)
+<a name="l00322"></a>00322 <span class="keywordflow">for</span>(i=0 ; i < nx ; ++i)
+<a name="l00323"></a>00323 {
+<a name="l00324"></a>00324 cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+<a name="l00325"></a>00325 }
+<a name="l00326"></a>00326 }
+<a name="l00327"></a>00327 stats_ima = cpl_stats_new_from_image
+<a name="l00328"></a>00328 (tmp_ima, CPL_STATS_ALL) ;
+<a name="l00329"></a>00329 <span class="keywordflow">if</span>(stats_ima == NULL)
+<a name="l00330"></a>00330 {
+<a name="l00331"></a>00331 cpl_image_delete(tmp_ima);
+<a name="l00332"></a>00332 <span class="keywordflow">return</span> -1;
+<a name="l00333"></a>00333 }
+<a name="l00334"></a>00334
+<a name="l00335"></a>00335 <span class="comment">/* Get the stats from the storage structure */</span>
+<a name="l00336"></a>00336 minval = cpl_stats_get_min(stats_ima);
+<a name="l00337"></a>00337 maxval = cpl_stats_get_max(stats_ima);
+<a name="l00338"></a>00338 median = cpl_stats_get_median(stats_ima);
+<a name="l00339"></a>00339 stdev = cpl_stats_get_stdev(stats_ima);
+<a name="l00340"></a>00340 mean = cpl_stats_get_mean(stats_ima);
+<a name="l00341"></a>00341 cpl_stats_delete(stats_ima);
+<a name="l00342"></a>00342
+<a name="l00343"></a>00343 <span class="comment">/* Store in table */</span>
+<a name="l00344"></a>00344 cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MIN,
+<a name="l00345"></a>00345 irow, minval);
+<a name="l00346"></a>00346 cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MAX,
+<a name="l00347"></a>00347 irow, maxval);
+<a name="l00348"></a>00348 cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MED,
+<a name="l00349"></a>00349 irow, median);
+<a name="l00350"></a>00350 cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_MEAN,
+<a name="l00351"></a>00351 irow, mean);
+<a name="l00352"></a>00352 cpl_table_set_double(odd_row_stats[idet], HAWKI_COL_STAT_RMS,
+<a name="l00353"></a>00353 irow, stdev) ;
+<a name="l00354"></a>00354 cpl_table_set_int(odd_row_stats[idet], HAWKI_COL_STAT_USED,
+<a name="l00355"></a>00355 irow, 1) ;
+<a name="l00356"></a>00356
+<a name="l00357"></a>00357 <span class="comment">/* Compute statistics even row */</span>
+<a name="l00358"></a>00358 cpl_image_accept_all(tmp_ima);
+<a name="l00359"></a>00359 mask = cpl_image_get_bpm(tmp_ima);
+<a name="l00360"></a>00360 <span class="keywordflow">for</span>(j=0 ; j < ny ; ++j)
+<a name="l00361"></a>00361 {
+<a name="l00362"></a>00362 <span class="keywordflow">if</span>(j % 2)
+<a name="l00363"></a>00363 <span class="keywordflow">for</span>(i=0 ; i < nx ; ++i)
+<a name="l00364"></a>00364 {
+<a name="l00365"></a>00365 cpl_mask_set(mask, i + 1, j + 1, CPL_BINARY_1);
+<a name="l00366"></a>00366 }
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368 stats_ima = cpl_stats_new_from_image
+<a name="l00369"></a>00369 (tmp_ima, CPL_STATS_ALL) ;
+<a name="l00370"></a>00370 <span class="keywordflow">if</span>(stats_ima == NULL)
+<a name="l00371"></a>00371 {
+<a name="l00372"></a>00372 cpl_image_delete(tmp_ima);
+<a name="l00373"></a>00373 <span class="keywordflow">return</span> -1;
+<a name="l00374"></a>00374 }
+<a name="l00375"></a>00375
+<a name="l00376"></a>00376 <span class="comment">/* Get the stats from the storage structure */</span>
+<a name="l00377"></a>00377 minval = cpl_stats_get_min(stats_ima);
+<a name="l00378"></a>00378 maxval = cpl_stats_get_max(stats_ima);
+<a name="l00379"></a>00379 median = cpl_stats_get_median(stats_ima);
+<a name="l00380"></a>00380 stdev = cpl_stats_get_stdev(stats_ima);
+<a name="l00381"></a>00381 mean = cpl_stats_get_mean(stats_ima);
+<a name="l00382"></a>00382 cpl_stats_delete(stats_ima);
+<a name="l00383"></a>00383
+<a name="l00384"></a>00384 <span class="comment">/* Store in table */</span>
+<a name="l00385"></a>00385 cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MIN,
+<a name="l00386"></a>00386 irow, minval);
+<a name="l00387"></a>00387 cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MAX,
+<a name="l00388"></a>00388 irow, maxval);
+<a name="l00389"></a>00389 cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MED,
+<a name="l00390"></a>00390 irow, median);
+<a name="l00391"></a>00391 cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_MEAN,
+<a name="l00392"></a>00392 irow, mean);
+<a name="l00393"></a>00393 cpl_table_set_double(even_row_stats[idet], HAWKI_COL_STAT_RMS,
+<a name="l00394"></a>00394 irow, stdev) ;
+<a name="l00395"></a>00395 cpl_table_set_int(even_row_stats[idet], HAWKI_COL_STAT_USED,
+<a name="l00396"></a>00396 irow, 1) ;
+<a name="l00397"></a>00397
+<a name="l00398"></a>00398 <span class="comment">/* Free */</span>
+<a name="l00399"></a>00399 cpl_image_delete(tmp_ima);
+<a name="l00400"></a>00400
+<a name="l00401"></a>00401 <span class="comment">/* Check error status and exit */</span>
+<a name="l00402"></a>00402 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00403"></a>00403 <span class="keywordflow">return</span> -1;
+<a name="l00404"></a>00404 <span class="keywordflow">return</span> 0;
+<a name="l00405"></a>00405 }
+<a name="l00406"></a>00406
+<a name="l00407"></a>00407 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00428"></a>00428 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00429"></a>00429 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836" title="Fills a table with the statistics of the four detectors of a frame.">hawki_image_stats_fill_from_frame</a>
+<a name="l00430"></a><a class="code" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836">00430</a> (cpl_table ** image_stats,
+<a name="l00431"></a>00431 <span class="keyword">const</span> cpl_frame * frame,
+<a name="l00432"></a>00432 <span class="keywordtype">int</span> irow)
+<a name="l00433"></a>00433 {
+<a name="l00434"></a>00434 <span class="keywordtype">int</span> idet;
+<a name="l00435"></a>00435 cpl_imagelist * images;
+<a name="l00436"></a>00436
+<a name="l00437"></a>00437 <span class="comment">/* Loading the four chips */</span>
+<a name="l00438"></a>00438 images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(frame, CPL_TYPE_FLOAT);
+<a name="l00439"></a>00439 <span class="keywordflow">if</span>(images == NULL)
+<a name="l00440"></a>00440 {
+<a name="l00441"></a>00441 cpl_msg_error(__func__,<span class="stringliteral">"Could not read file %s"</span>,
+<a name="l00442"></a>00442 cpl_frame_get_filename(frame));
+<a name="l00443"></a>00443 <span class="keywordflow">return</span> -1;
+<a name="l00444"></a>00444 }
+<a name="l00445"></a>00445
+<a name="l00446"></a>00446 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00447"></a>00447 {
+<a name="l00448"></a>00448 <span class="keywordtype">int</span> nx, ny;
+<a name="l00449"></a>00449 nx = cpl_image_get_size_x(cpl_imagelist_get(images,idet));
+<a name="l00450"></a>00450 ny = cpl_image_get_size_y(cpl_imagelist_get(images,idet));
+<a name="l00451"></a>00451 <a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l00452"></a>00452 (image_stats,
+<a name="l00453"></a>00453 cpl_imagelist_get(images,idet),
+<a name="l00454"></a>00454 1, 1, nx, ny, idet, irow);
+<a name="l00455"></a>00455 }
+<a name="l00456"></a>00456
+<a name="l00457"></a>00457 <span class="comment">/* Free and exit */</span>
+<a name="l00458"></a>00458 cpl_imagelist_delete(images);
+<a name="l00459"></a>00459 <span class="keywordflow">return</span> 0;
+<a name="l00460"></a>00460 }
+<a name="l00461"></a>00461
+<a name="l00462"></a>00462 <span class="keywordtype">int</span> hawki_image_stats_print
+<a name="l00463"></a>00463 (cpl_table ** table_stats)
+<a name="l00464"></a>00464 {
+<a name="l00465"></a>00465 <span class="keywordtype">int</span> idet;
+<a name="l00466"></a>00466 <span class="keywordtype">int</span> istat;
+<a name="l00467"></a>00467
+<a name="l00468"></a>00468 <span class="comment">/* Print header */</span>
+<a name="l00469"></a>00469 cpl_msg_info(__func__, <span class="stringliteral">"Stats summary"</span>) ;
+<a name="l00470"></a>00470
+<a name="l00471"></a>00471 <span class="comment">/* Loop on detectors */</span>
+<a name="l00472"></a>00472 cpl_msg_indent_more();
+<a name="l00473"></a>00473 <span class="keywordflow">for</span>( idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00474"></a>00474 {
+<a name="l00475"></a>00475
+<a name="l00476"></a>00476 <span class="comment">/* Chip header */</span>
+<a name="l00477"></a>00477 cpl_msg_info(__func__, <span class="stringliteral">"Chip number %d"</span>, idet+1) ;
+<a name="l00478"></a>00478 cpl_msg_info(__func__, <span class="stringliteral">"image min max med rms"</span>) ;
+<a name="l00479"></a>00479 cpl_msg_info(__func__, <span class="stringliteral">"--------------------------------------------"</span>) ;
+<a name="l00480"></a>00480
+<a name="l00481"></a>00481 <span class="comment">/* Loop on images */</span>
+<a name="l00482"></a>00482 <span class="keywordflow">for</span>(istat = 0; istat < cpl_table_get_nrow(table_stats[idet]); ++istat)
+<a name="l00483"></a>00483 {
+<a name="l00484"></a>00484 cpl_msg_info(__func__, <span class="stringliteral">"%02d %10.2f %10.2f %10.2f %10.2f"</span>,
+<a name="l00485"></a>00485 istat+1,
+<a name="l00486"></a>00486 cpl_table_get_double(table_stats[idet],
+<a name="l00487"></a>00487 HAWKI_COL_STAT_MIN,istat,NULL),
+<a name="l00488"></a>00488 cpl_table_get_double(table_stats[idet],
+<a name="l00489"></a>00489 HAWKI_COL_STAT_MAX,istat,NULL),
+<a name="l00490"></a>00490 cpl_table_get_double(table_stats[idet],
+<a name="l00491"></a>00491 HAWKI_COL_STAT_MED,istat,NULL ),
+<a name="l00492"></a>00492 cpl_table_get_double(table_stats[idet],
+<a name="l00493"></a>00493 HAWKI_COL_STAT_RMS,istat,NULL ));
+<a name="l00494"></a>00494 }
+<a name="l00495"></a>00495 }
+<a name="l00496"></a>00496 cpl_msg_indent_less();
+<a name="l00497"></a>00497 <span class="keywordflow">return</span> 0;
+<a name="l00498"></a>00498 }
+<a name="l00499"></a>00499
+<a name="l00500"></a>00500 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00509"></a>00509 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00510"></a>00510
+<a name="l00511"></a>00511 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>
+<a name="l00512"></a><a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928">00512</a> (cpl_table ** image_stats,
+<a name="l00513"></a>00513 cpl_propertylist ** stats_stats)
+<a name="l00514"></a>00514 {
+<a name="l00515"></a>00515 cpl_array * col_names;
+<a name="l00516"></a>00516 <span class="keywordtype">int</span> idet;
+<a name="l00517"></a>00517 <span class="keywordtype">int</span> icol;
+<a name="l00518"></a>00518
+<a name="l00519"></a>00519 <span class="comment">/* Check entries */</span>
+<a name="l00520"></a>00520 <span class="keywordflow">if</span>(image_stats == NULL || stats_stats == NULL)
+<a name="l00521"></a>00521 <span class="keywordflow">return</span> -1;
+<a name="l00522"></a>00522
+<a name="l00523"></a>00523 <span class="comment">/* Fill the name of the interesting columns */</span>
+<a name="l00524"></a>00524 col_names = cpl_array_new(5, CPL_TYPE_STRING);
+<a name="l00525"></a>00525 cpl_array_set_string(col_names, 0, HAWKI_COL_STAT_MIN);
+<a name="l00526"></a>00526 cpl_array_set_string(col_names, 1, HAWKI_COL_STAT_MAX);
+<a name="l00527"></a>00527 cpl_array_set_string(col_names, 2, HAWKI_COL_STAT_MED);
+<a name="l00528"></a>00528 cpl_array_set_string(col_names, 3, HAWKI_COL_STAT_MEAN);
+<a name="l00529"></a>00529 cpl_array_set_string(col_names, 4, HAWKI_COL_STAT_RMS);
+<a name="l00530"></a>00530
+<a name="l00531"></a>00531 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00532"></a>00532 {
+<a name="l00533"></a>00533 <span class="keywordflow">for</span>(icol = 0;icol < 5; ++icol)
+<a name="l00534"></a>00534 {
+<a name="l00535"></a>00535 <span class="keyword">const</span> <span class="keywordtype">char</span> * this_col_name = cpl_array_get_string(col_names, icol);
+<a name="l00536"></a>00536 <span class="keywordtype">char</span> mean_col_name[256] = <span class="stringliteral">"ESO QC RAW "</span>;
+<a name="l00537"></a>00537 <span class="keywordtype">char</span> median_col_name[256] = <span class="stringliteral">"ESO QC RAW "</span>;
+<a name="l00538"></a>00538 <span class="keywordtype">char</span> minimum_col_name[256] = <span class="stringliteral">"ESO QC RAW "</span>;
+<a name="l00539"></a>00539 <span class="keywordtype">char</span> maximum_col_name[256] = <span class="stringliteral">"ESO QC RAW "</span>;
+<a name="l00540"></a>00540 <span class="keywordtype">char</span> stdev_col_name[256] = <span class="stringliteral">"ESO QC RAW "</span>;
+<a name="l00541"></a>00541 strncat(mean_col_name, this_col_name, 244);
+<a name="l00542"></a>00542 strncat(mean_col_name, <span class="stringliteral">" MEAN"</span>, 236);
+<a name="l00543"></a>00543 cpl_propertylist_append_double
+<a name="l00544"></a>00544 (stats_stats[idet], mean_col_name,
+<a name="l00545"></a>00545 cpl_table_get_column_mean(image_stats[idet],this_col_name));
+<a name="l00546"></a>00546 strncat(median_col_name, this_col_name, 255);
+<a name="l00547"></a>00547 strncat(median_col_name, <span class="stringliteral">" MEDIAN"</span>, 236);
+<a name="l00548"></a>00548 cpl_propertylist_append_double
+<a name="l00549"></a>00549 (stats_stats[idet], median_col_name,
+<a name="l00550"></a>00550 cpl_table_get_column_median(image_stats[idet],this_col_name));
+<a name="l00551"></a>00551 strncat(minimum_col_name, this_col_name, 255);
+<a name="l00552"></a>00552 strncat(minimum_col_name, <span class="stringliteral">" MINIMUM"</span>, 236);
+<a name="l00553"></a>00553 cpl_propertylist_append_double
+<a name="l00554"></a>00554 (stats_stats[idet], minimum_col_name,
+<a name="l00555"></a>00555 cpl_table_get_column_min(image_stats[idet],this_col_name));
+<a name="l00556"></a>00556 strncat(maximum_col_name, this_col_name, 255);
+<a name="l00557"></a>00557 strncat(maximum_col_name, <span class="stringliteral">" MAXIMUM"</span>, 236);
+<a name="l00558"></a>00558 cpl_propertylist_append_double
+<a name="l00559"></a>00559 (stats_stats[idet], maximum_col_name,
+<a name="l00560"></a>00560 cpl_table_get_column_max(image_stats[idet],this_col_name));
+<a name="l00561"></a>00561 strncat(stdev_col_name, this_col_name, 255);
+<a name="l00562"></a>00562 strncat(stdev_col_name, <span class="stringliteral">" STDEV"</span>, 236);
+<a name="l00563"></a>00563 cpl_propertylist_append_double
+<a name="l00564"></a>00564 (stats_stats[idet], stdev_col_name,
+<a name="l00565"></a>00565 cpl_table_get_column_stdev(image_stats[idet],this_col_name));
+<a name="l00566"></a>00566 }
+<a name="l00567"></a>00567 }
+<a name="l00568"></a>00568
+<a name="l00569"></a>00569 <span class="comment">/*Free and return */</span>
+<a name="l00570"></a>00570 cpl_array_delete(col_names);
+<a name="l00571"></a>00571 <span class="keywordflow">return</span> 0;
+<a name="l00572"></a>00572 }
+<a name="l00573"></a>00573
+<a name="l00574"></a>00574 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00581"></a>00581 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00582"></a><a class="code" href="group__hawki__image__stats.html#gade5ca3e76e59c9ab510cb85bc02dd651">00582</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__image__stats.html#gade5ca3e76e59c9ab510cb85bc02dd651" title="Get a robust estimation of the sigma based on the quartiles.">hawki_image_float_get_sigma_from_quartile</a>(cpl_image * image)
+<a name="l00583"></a>00583 {
+<a name="l00584"></a>00584 <span class="keywordtype">int</span> npixels;
+<a name="l00585"></a>00585 <span class="keywordtype">int</span> ipix_0_25;
+<a name="l00586"></a>00586 <span class="keywordtype">int</span> ipix_0_75;
+<a name="l00587"></a>00587 <span class="keywordtype">double</span> first_quartil;
+<a name="l00588"></a>00588 <span class="keywordtype">double</span> third_quartil;
+<a name="l00589"></a>00589 <span class="keywordtype">double</span> sigma_from_quartile;
+<a name="l00590"></a>00590 <span class="keywordtype">float</span> * data;
+<a name="l00591"></a>00591
+<a name="l00592"></a>00592 npixels = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+<a name="l00593"></a>00593 data = cpl_image_get_data(image);
+<a name="l00594"></a>00594 ipix_0_25 = (int)(npixels * 0.25);
+<a name="l00595"></a>00595 ipix_0_75 = (int)(npixels * 0.75);
+<a name="l00596"></a>00596
+<a name="l00597"></a>00597 first_quartil = hawki_tools_get_kth_float(data, npixels, ipix_0_25);
+<a name="l00598"></a>00598 third_quartil = hawki_tools_get_kth_float(data, npixels, ipix_0_75);
+<a name="l00599"></a>00599 sigma_from_quartile = (third_quartil - first_quartil) / 1.35;
+<a name="l00600"></a>00600 <span class="keywordflow">return</span> sigma_from_quartile;
+<a name="l00601"></a>00601 }
+<a name="l00602"></a>00602
+<a name="l00603"></a>00603
+<a name="l00604"></a>00604 <span class="comment">/* Swap macro */</span>
+<a name="l00605"></a>00605 <span class="preprocessor">#undef SWAP</span>
+<a name="l00606"></a>00606 <span class="preprocessor"></span><span class="preprocessor">#define SWAP(a,b) { register float t=(a);(a)=(b);(b)=t; }</span>
+<a name="l00607"></a>00607 <span class="preprocessor"></span>
+<a name="l00608"></a>00608 <span class="keywordtype">float</span> hawki_tools_get_kth_float(<span class="keywordtype">float</span> * a,
+<a name="l00609"></a>00609 <span class="keywordtype">int</span> n,
+<a name="l00610"></a>00610 <span class="keywordtype">int</span> k)
+<a name="l00611"></a>00611 {
+<a name="l00612"></a>00612 <span class="keyword">register</span> <span class="keywordtype">float</span> x;
+<a name="l00613"></a>00613 <span class="keyword">register</span> <span class="keywordtype">int</span> i, j, l, m;
+<a name="l00614"></a>00614
+<a name="l00615"></a>00615 cpl_ensure(a, CPL_ERROR_NULL_INPUT, 0.00);
+<a name="l00616"></a>00616
+<a name="l00617"></a>00617 l=0; m=n-1;
+<a name="l00618"></a>00618 <span class="keywordflow">while</span> (l<m) {
+<a name="l00619"></a>00619 x=a[k];
+<a name="l00620"></a>00620 i=l;
+<a name="l00621"></a>00621 j=m;
+<a name="l00622"></a>00622 <span class="keywordflow">do</span> {
+<a name="l00623"></a>00623 <span class="keywordflow">while</span> (a[i]<x) i++;
+<a name="l00624"></a>00624 <span class="keywordflow">while</span> (x<a[j]) j--;
+<a name="l00625"></a>00625 <span class="keywordflow">if</span> (i<=j) {
+<a name="l00626"></a>00626 SWAP(a[i],a[j]);
+<a name="l00627"></a>00627 i++; j--;
+<a name="l00628"></a>00628 }
+<a name="l00629"></a>00629 } <span class="keywordflow">while</span> (i<=j);
+<a name="l00630"></a>00630 <span class="keywordflow">if</span> (j<k) l=i;
+<a name="l00631"></a>00631 <span class="keywordflow">if</span> (k<i) m=j;
+<a name="l00632"></a>00632 }
+<a name="l00633"></a>00633 <span class="keywordflow">return</span> a[k];
+<a name="l00634"></a>00634 }
+<a name="l00635"></a>00635
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__image__stats_8h_source.html b/html/hawki__image__stats_8h_source.html
new file mode 100644
index 0000000..dd17b5a
--- /dev/null
+++ b/html/hawki__image__stats_8h_source.html
@@ -0,0 +1,121 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_image_stats.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_image_stats.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_image_stats.h,v 1.4 2009/11/25 16:24:13 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/11/25 16:24:13 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.4 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_IMAGE_STATS_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_IMAGE_STATS_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037
+<a name="l00038"></a>00038 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>
+<a name="l00039"></a>00039 (cpl_table ** raw_stats);
+<a name="l00040"></a>00040 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l00041"></a>00041 (cpl_table ** image_stats,
+<a name="l00042"></a>00042 <span class="keyword">const</span> cpl_image * image,
+<a name="l00043"></a>00043 <span class="keywordtype">int</span> llx,
+<a name="l00044"></a>00044 <span class="keywordtype">int</span> lly,
+<a name="l00045"></a>00045 <span class="keywordtype">int</span> urx,
+<a name="l00046"></a>00046 <span class="keywordtype">int</span> ury,
+<a name="l00047"></a>00047 <span class="keywordtype">int</span> idet,
+<a name="l00048"></a>00048 <span class="keywordtype">int</span> irow);
+<a name="l00049"></a>00049 <span class="keywordtype">int</span> hawki_image_stats_odd_even_column_row_fill_from_image
+<a name="l00050"></a>00050 (cpl_table ** odd_column_stats,
+<a name="l00051"></a>00051 cpl_table ** even_column_stats,
+<a name="l00052"></a>00052 cpl_table ** odd_row_stats,
+<a name="l00053"></a>00053 cpl_table ** even_row_stats,
+<a name="l00054"></a>00054 <span class="keyword">const</span> cpl_image * image,
+<a name="l00055"></a>00055 <span class="keywordtype">int</span> idet,
+<a name="l00056"></a>00056 <span class="keywordtype">int</span> irow);
+<a name="l00057"></a>00057 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836" title="Fills a table with the statistics of the four detectors of a frame.">hawki_image_stats_fill_from_frame</a>
+<a name="l00058"></a>00058 (cpl_table ** image_stats,
+<a name="l00059"></a>00059 <span class="keyword">const</span> cpl_frame * frame,
+<a name="l00060"></a>00060 <span class="keywordtype">int</span> irow);
+<a name="l00061"></a>00061 <span class="keywordtype">int</span> hawki_image_stats_print
+<a name="l00062"></a>00062 (cpl_table ** table_stats);
+<a name="l00063"></a>00063 <span class="keywordtype">int</span> <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>
+<a name="l00064"></a>00064 (cpl_table ** image_stats,
+<a name="l00065"></a>00065 cpl_propertylist ** stats_stats);
+<a name="l00066"></a>00066 <span class="keywordtype">double</span> <a class="code" href="group__hawki__image__stats.html#gade5ca3e76e59c9ab510cb85bc02dd651" title="Get a robust estimation of the sigma based on the quartiles.">hawki_image_float_get_sigma_from_quartile</a>(cpl_image * image);
+<a name="l00067"></a>00067 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__load_8c_source.html b/html/hawki__load_8c_source.html
new file mode 100644
index 0000000..fc08d6f
--- /dev/null
+++ b/html/hawki__load_8c_source.html
@@ -0,0 +1,833 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_load.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_load.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_load.c,v 1.40 2009/12/04 10:39:14 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/12/04 10:39:14 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.40 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00043"></a>00043
+<a name="l00044"></a>00044 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00049"></a>00049 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050
+<a name="l00053"></a>00053 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00062"></a>00062 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00063"></a><a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a">00063</a> cpl_frameset * <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(
+<a name="l00064"></a>00064 <span class="keyword">const</span> cpl_frameset * in,
+<a name="l00065"></a>00065 <span class="keyword">const</span> <span class="keywordtype">char</span> * tag)
+<a name="l00066"></a>00066 {
+<a name="l00067"></a>00067 cpl_frameset * out ;
+<a name="l00068"></a>00068 <span class="keyword">const</span> cpl_frame * cur_frame ;
+<a name="l00069"></a>00069 cpl_frame * loc_frame ;
+<a name="l00070"></a>00070 <span class="keywordtype">int</span> nbframes, nbext ;
+<a name="l00071"></a>00071 <span class="keywordtype">int</span> i ;
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="comment">/* Test entries */</span>
+<a name="l00074"></a>00074 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00075"></a>00075 <span class="keywordflow">if</span> (tag == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00076"></a>00076
+<a name="l00077"></a>00077 <span class="comment">/* Initialise */</span>
+<a name="l00078"></a>00078 nbframes = cpl_frameset_get_size(in) ;
+<a name="l00079"></a>00079
+<a name="l00080"></a>00080 <span class="comment">/* Count the frames with the tag */</span>
+<a name="l00081"></a>00081 <span class="keywordflow">if</span> ((nbext = cpl_frameset_count_tags(in, tag)) == 0) <span class="keywordflow">return</span> NULL ;
+<a name="l00082"></a>00082
+<a name="l00083"></a>00083 <span class="comment">/* Create the output frameset */</span>
+<a name="l00084"></a>00084 out = cpl_frameset_new() ;
+<a name="l00085"></a>00085
+<a name="l00086"></a>00086 <span class="comment">/* Loop on the requested frames and store them in out */</span>
+<a name="l00087"></a>00087 nbext = 0 ;
+<a name="l00088"></a>00088 <span class="keywordflow">for</span> (i=0 ; i<nbframes ; i++) {
+<a name="l00089"></a>00089 cur_frame = cpl_frameset_get_frame_const(in, i) ;
+<a name="l00090"></a>00090 <span class="keywordflow">if</span> (!strcmp(cpl_frame_get_tag(cur_frame), tag)) {
+<a name="l00091"></a>00091 loc_frame = cpl_frame_duplicate(cur_frame) ;
+<a name="l00092"></a>00092 cpl_frameset_insert(out, loc_frame) ;
+<a name="l00093"></a>00093 nbext ++ ;
+<a name="l00094"></a>00094 }
+<a name="l00095"></a>00095 }
+<a name="l00096"></a>00096 <span class="keywordflow">return</span> out ;
+<a name="l00097"></a>00097 }
+<a name="l00098"></a>00098
+<a name="l00099"></a>00099 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00109"></a>00109 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00110"></a><a class="code" href="group__hawki__load.html#gaf2bd8a92a7abfe4adc8eb7b6b917739a">00110</a> cpl_image * <a class="code" href="group__hawki__load.html#gaf2bd8a92a7abfe4adc8eb7b6b917739a" title="Load the quarter of a chip from a frameset in an image.">hawki_load_quadrant</a>(
+<a name="l00111"></a>00111 <span class="keyword">const</span> cpl_frameset * fset,
+<a name="l00112"></a>00112 <span class="keywordtype">int</span> fnum,
+<a name="l00113"></a>00113 <span class="keywordtype">int</span> chip,
+<a name="l00114"></a>00114 <span class="keywordtype">int</span> quad,
+<a name="l00115"></a>00115 cpl_type ptype)
+<a name="l00116"></a>00116 {
+<a name="l00117"></a>00117 <span class="keyword">const</span> cpl_frame * frame ;
+<a name="l00118"></a>00118 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00119"></a>00119 cpl_image * ima ;
+<a name="l00120"></a>00120
+<a name="l00121"></a>00121 <span class="comment">/* Test entries */</span>
+<a name="l00122"></a>00122 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00123"></a>00123 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00124"></a>00124 <span class="keywordflow">if</span> (quad < 1 || quad > 4) <span class="keywordflow">return</span> NULL ;
+<a name="l00125"></a>00125
+<a name="l00126"></a>00126 <span class="comment">/* Load the fnum frame */</span>
+<a name="l00127"></a>00127 frame = cpl_frameset_get_frame_const(fset, fnum) ;
+<a name="l00128"></a>00128 fname = cpl_frame_get_filename(frame) ;
+<a name="l00129"></a>00129
+<a name="l00130"></a>00130 <span class="comment">/* Load */</span>
+<a name="l00131"></a>00131 <span class="keywordflow">if</span> ((ima=<a class="code" href="group__hawki__load.html#ga686f0c5897e92abd1b6aff98636f56c7" title="Load the quarter of a chip from a file in an image.">hawki_load_quadrant_from_file</a>(fname, chip, quad, ptype)) == NULL) {
+<a name="l00132"></a>00132 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load %dth frame (chip %d quarter %d)"</span>,
+<a name="l00133"></a>00133 fnum+1, chip, quad) ;
+<a name="l00134"></a>00134 <span class="keywordflow">return</span> NULL ;
+<a name="l00135"></a>00135 }
+<a name="l00136"></a>00136 <span class="keywordflow">return</span> ima ;
+<a name="l00137"></a>00137 }
+<a name="l00138"></a>00138
+<a name="l00139"></a>00139 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00148"></a>00148 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00149"></a><a class="code" href="group__hawki__load.html#ga686f0c5897e92abd1b6aff98636f56c7">00149</a> cpl_image * <a class="code" href="group__hawki__load.html#ga686f0c5897e92abd1b6aff98636f56c7" title="Load the quarter of a chip from a file in an image.">hawki_load_quadrant_from_file</a>(
+<a name="l00150"></a>00150 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname,
+<a name="l00151"></a>00151 <span class="keywordtype">int</span> chip,
+<a name="l00152"></a>00152 <span class="keywordtype">int</span> quad,
+<a name="l00153"></a>00153 cpl_type ptype)
+<a name="l00154"></a>00154 {
+<a name="l00155"></a>00155 cpl_image * ima ;
+<a name="l00156"></a>00156 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00157"></a>00157 <span class="keywordtype">int</span> llx, lly, urx, ury ;
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 <span class="comment">/* Test entries */</span>
+<a name="l00160"></a>00160 <span class="keywordflow">if</span> (fname == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00161"></a>00161 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00162"></a>00162 <span class="keywordflow">if</span> (quad < 1 || quad > 4) <span class="keywordflow">return</span> NULL ;
+<a name="l00163"></a>00163
+<a name="l00164"></a>00164 <span class="comment">/* Define the window */</span>
+<a name="l00165"></a>00165 <span class="keywordflow">if</span> (quad == 1) {
+<a name="l00166"></a>00166 llx = lly = 1 ;
+<a name="l00167"></a>00167 urx = ury = 1024 ;
+<a name="l00168"></a>00168 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (quad == 2) {
+<a name="l00169"></a>00169 llx = 1025 ;
+<a name="l00170"></a>00170 lly = 1 ;
+<a name="l00171"></a>00171 urx = 2048 ;
+<a name="l00172"></a>00172 ury = 1024 ;
+<a name="l00173"></a>00173 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (quad == 3) {
+<a name="l00174"></a>00174 llx = 1 ;
+<a name="l00175"></a>00175 lly = 1025 ;
+<a name="l00176"></a>00176 urx = 1024 ;
+<a name="l00177"></a>00177 ury = 2048 ;
+<a name="l00178"></a>00178 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (quad == 4) {
+<a name="l00179"></a>00179 llx = lly = 1025 ;
+<a name="l00180"></a>00180 urx = ury = 2048 ;
+<a name="l00181"></a>00181 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> NULL ;
+<a name="l00182"></a>00182
+<a name="l00183"></a>00183 <span class="comment">/* Get the extension with the wished chip */</span>
+<a name="l00184"></a>00184 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(fname, chip)) == -1) {
+<a name="l00185"></a>00185 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with chip %d"</span>,
+<a name="l00186"></a>00186 chip+1) ;
+<a name="l00187"></a>00187 <span class="keywordflow">return</span> NULL ;
+<a name="l00188"></a>00188 }
+<a name="l00189"></a>00189
+<a name="l00190"></a>00190 <span class="comment">/* Load */</span>
+<a name="l00191"></a>00191 <span class="keywordflow">if</span> ((ima=cpl_image_load_window(fname, ptype, 0, ext_nb, llx, lly, urx,
+<a name="l00192"></a>00192 ury)) == NULL) {
+<a name="l00193"></a>00193 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load chip %d quarter %d from %s"</span>,
+<a name="l00194"></a>00194 chip, quad, fname) ;
+<a name="l00195"></a>00195 <span class="keywordflow">return</span> NULL ;
+<a name="l00196"></a>00196 }
+<a name="l00197"></a>00197 <span class="keywordflow">return</span> ima ;
+<a name="l00198"></a>00198 }
+<a name="l00199"></a>00199
+<a name="l00200"></a>00200 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00208"></a>00208 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00209"></a><a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895">00209</a> cpl_imagelist * <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(
+<a name="l00210"></a>00210 <span class="keyword">const</span> cpl_frameset * fset,
+<a name="l00211"></a>00211 <span class="keywordtype">int</span> chip,
+<a name="l00212"></a>00212 cpl_type ptype)
+<a name="l00213"></a>00213 {
+<a name="l00214"></a>00214 <span class="keywordtype">int</span> nframes ;
+<a name="l00215"></a>00215 cpl_imagelist * out ;
+<a name="l00216"></a>00216 <span class="keyword">const</span> cpl_frame * frame ;
+<a name="l00217"></a>00217 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00218"></a>00218 cpl_image * ima ;
+<a name="l00219"></a>00219 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00220"></a>00220 <span class="keywordtype">int</span> i ;
+<a name="l00221"></a>00221
+<a name="l00222"></a>00222 <span class="comment">/* Test entries */</span>
+<a name="l00223"></a>00223 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00224"></a>00224 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00225"></a>00225 nframes = cpl_frameset_get_size(fset) ;
+<a name="l00226"></a>00226
+<a name="l00227"></a>00227 <span class="comment">/* Create the output list */</span>
+<a name="l00228"></a>00228 out = cpl_imagelist_new() ;
+<a name="l00229"></a>00229
+<a name="l00230"></a>00230 <span class="comment">/* Loop on the frames */</span>
+<a name="l00231"></a>00231 <span class="keywordflow">for</span> (i=0 ; i<nframes ; i++) {
+<a name="l00232"></a>00232
+<a name="l00233"></a>00233 <span class="comment">/* Load the ith frame */</span>
+<a name="l00234"></a>00234 frame = cpl_frameset_get_frame_const(fset, i) ;
+<a name="l00235"></a>00235 fname = cpl_frame_get_filename(frame) ;
+<a name="l00236"></a>00236
+<a name="l00237"></a>00237 <span class="comment">/* Get the extension with the wished chip */</span>
+<a name="l00238"></a>00238 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(fname, chip)) == -1) {
+<a name="l00239"></a>00239 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with chip %d"</span>,
+<a name="l00240"></a>00240 chip) ;
+<a name="l00241"></a>00241 cpl_imagelist_delete(out);
+<a name="l00242"></a>00242 <span class="keywordflow">return</span> NULL ;
+<a name="l00243"></a>00243 }
+<a name="l00244"></a>00244 <span class="comment">/* Load */</span>
+<a name="l00245"></a>00245 <span class="keywordflow">if</span> ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL) {
+<a name="l00246"></a>00246 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load %dth frame (chip %d)"</span>,
+<a name="l00247"></a>00247 i+1, chip) ;
+<a name="l00248"></a>00248 cpl_imagelist_delete(out) ;
+<a name="l00249"></a>00249 <span class="keywordflow">return</span> NULL ;
+<a name="l00250"></a>00250 }
+<a name="l00251"></a>00251 cpl_imagelist_set(out, ima, i) ;
+<a name="l00252"></a>00252 }
+<a name="l00253"></a>00253 <span class="keywordflow">return</span> out ;
+<a name="l00254"></a>00254 }
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00264"></a>00264 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00265"></a>00265 cpl_imagelist * <a class="code" href="group__hawki__load.html#ga1cf51c1b905de7941d7fcf3e249e536d" title="Loads a given extension from a HAWKI frameset in an image list.">hawki_load_extensions</a>
+<a name="l00266"></a><a class="code" href="group__hawki__load.html#ga1cf51c1b905de7941d7fcf3e249e536d">00266</a> (<span class="keyword">const</span> cpl_frameset * fset,
+<a name="l00267"></a>00267 <span class="keywordtype">int</span> extension,
+<a name="l00268"></a>00268 cpl_type ptype)
+<a name="l00269"></a>00269 {
+<a name="l00270"></a>00270 <span class="keywordtype">int</span> nframes ;
+<a name="l00271"></a>00271 cpl_imagelist * out ;
+<a name="l00272"></a>00272 <span class="keyword">const</span> cpl_frame * frame ;
+<a name="l00273"></a>00273 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00274"></a>00274 cpl_image * ima ;
+<a name="l00275"></a>00275 <span class="keywordtype">int</span> iframe;
+<a name="l00276"></a>00276
+<a name="l00277"></a>00277 <span class="comment">/* Test entries */</span>
+<a name="l00278"></a>00278 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00279"></a>00279 nframes = cpl_frameset_get_size(fset) ;
+<a name="l00280"></a>00280
+<a name="l00281"></a>00281 <span class="comment">/* Create the output list */</span>
+<a name="l00282"></a>00282 out = cpl_imagelist_new() ;
+<a name="l00283"></a>00283
+<a name="l00284"></a>00284 <span class="comment">/* Loop on the frames */</span>
+<a name="l00285"></a>00285 <span class="keywordflow">for</span> (iframe=0 ; iframe<nframes ; iframe++) {
+<a name="l00286"></a>00286
+<a name="l00287"></a>00287 <span class="comment">/* Load the ith frame */</span>
+<a name="l00288"></a>00288 frame = cpl_frameset_get_frame_const(fset, iframe) ;
+<a name="l00289"></a>00289 fname = cpl_frame_get_filename(frame) ;
+<a name="l00290"></a>00290
+<a name="l00291"></a>00291 <span class="comment">/* Load */</span>
+<a name="l00292"></a>00292 <span class="keywordflow">if</span> ((ima=cpl_image_load(fname, ptype, 0, extension)) == NULL) {
+<a name="l00293"></a>00293 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load %dth frame (extension %d)"</span>,
+<a name="l00294"></a>00294 iframe+1, extension) ;
+<a name="l00295"></a>00295 cpl_imagelist_delete(out) ;
+<a name="l00296"></a>00296 <span class="keywordflow">return</span> NULL ;
+<a name="l00297"></a>00297 }
+<a name="l00298"></a>00298 cpl_imagelist_set(out, ima, iframe) ;
+<a name="l00299"></a>00299 }
+<a name="l00300"></a>00300 <span class="keywordflow">return</span> out ;
+<a name="l00301"></a>00301 }
+<a name="l00302"></a>00302
+<a name="l00303"></a>00303 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00312"></a>00312 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00313"></a><a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed">00313</a> cpl_image * <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(
+<a name="l00314"></a>00314 <span class="keyword">const</span> cpl_frameset * fset,
+<a name="l00315"></a>00315 <span class="keywordtype">int</span> fnum,
+<a name="l00316"></a>00316 <span class="keywordtype">int</span> chip,
+<a name="l00317"></a>00317 cpl_type ptype)
+<a name="l00318"></a>00318 {
+<a name="l00319"></a>00319 <span class="keyword">const</span> cpl_frame * frame ;
+<a name="l00320"></a>00320 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00321"></a>00321 cpl_image * ima ;
+<a name="l00322"></a>00322 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00323"></a>00323
+<a name="l00324"></a>00324 <span class="comment">/* Test entries */</span>
+<a name="l00325"></a>00325 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00326"></a>00326 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00327"></a>00327
+<a name="l00328"></a>00328 <span class="comment">/* Load the fnum frame */</span>
+<a name="l00329"></a>00329 frame = cpl_frameset_get_frame_const(fset, fnum) ;
+<a name="l00330"></a>00330 fname = cpl_frame_get_filename(frame) ;
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 <span class="comment">/* Check that the frame has the right number of extension */</span>
+<a name="l00333"></a>00333 <span class="keywordflow">if</span>(cpl_frame_get_nextensions(frame) != HAWKI_NB_DETECTORS)
+<a name="l00334"></a>00334 {
+<a name="l00335"></a>00335 cpl_msg_error(__func__, <span class="stringliteral">"File %s contains less than %d extensions"</span>,
+<a name="l00336"></a>00336 fname, HAWKI_NB_DETECTORS);
+<a name="l00337"></a>00337 <span class="keywordflow">return</span> NULL ;
+<a name="l00338"></a>00338 }
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/* Get the extension with the wished chip */</span>
+<a name="l00341"></a>00341 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(fname, chip)) == -1) {
+<a name="l00342"></a>00342 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with chip %d"</span>,
+<a name="l00343"></a>00343 chip+1) ;
+<a name="l00344"></a>00344 <span class="keywordflow">return</span> NULL ;
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346 <span class="comment">/* Load */</span>
+<a name="l00347"></a>00347 <span class="keywordflow">if</span> ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL) {
+<a name="l00348"></a>00348 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load %dth frame (chip %d)"</span>,
+<a name="l00349"></a>00349 fnum+1, chip) ;
+<a name="l00350"></a>00350 <span class="keywordflow">return</span> NULL ;
+<a name="l00351"></a>00351 }
+<a name="l00352"></a>00352 <span class="keywordflow">return</span> ima ;
+<a name="l00353"></a>00353 }
+<a name="l00354"></a>00354
+<a name="l00355"></a>00355 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00364"></a>00364 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00365"></a><a class="code" href="group__hawki__load.html#gad5cbc1d866e88c8776ed605e5afa9438">00365</a> cpl_imagelist * <a class="code" href="group__hawki__load.html#gad5cbc1d866e88c8776ed605e5afa9438" title="Load the quarter of a chip from a frameset in an image list.">hawki_load_quadrants</a>(
+<a name="l00366"></a>00366 <span class="keyword">const</span> cpl_frameset * fset,
+<a name="l00367"></a>00367 <span class="keywordtype">int</span> chip,
+<a name="l00368"></a>00368 <span class="keywordtype">int</span> quad,
+<a name="l00369"></a>00369 cpl_type ptype)
+<a name="l00370"></a>00370 {
+<a name="l00371"></a>00371 cpl_imagelist * out ;
+<a name="l00372"></a>00372 cpl_image * ima ;
+<a name="l00373"></a>00373 <span class="keywordtype">int</span> i ;
+<a name="l00374"></a>00374
+<a name="l00375"></a>00375 <span class="comment">/* Test entries */</span>
+<a name="l00376"></a>00376 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00377"></a>00377 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00378"></a>00378 <span class="keywordflow">if</span> (quad < 1 || quad > 4) <span class="keywordflow">return</span> NULL ;
+<a name="l00379"></a>00379
+<a name="l00380"></a>00380 <span class="comment">/* Create the output imagelist */</span>
+<a name="l00381"></a>00381 out = cpl_imagelist_new() ;
+<a name="l00382"></a>00382
+<a name="l00383"></a>00383 <span class="comment">/* Loop on the frames */</span>
+<a name="l00384"></a>00384 <span class="keywordflow">for</span> (i=0 ; i<cpl_frameset_get_size(fset) ; i++) {
+<a name="l00385"></a>00385 ima = <a class="code" href="group__hawki__load.html#gaf2bd8a92a7abfe4adc8eb7b6b917739a" title="Load the quarter of a chip from a frameset in an image.">hawki_load_quadrant</a>(fset, i, chip, quad, ptype) ;
+<a name="l00386"></a>00386 <span class="keywordflow">if</span> (ima == NULL) {
+<a name="l00387"></a>00387 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load %dth frame (chip %d, quad %d)"</span>,
+<a name="l00388"></a>00388 i+1, chip, quad) ;
+<a name="l00389"></a>00389 cpl_imagelist_delete(out) ;
+<a name="l00390"></a>00390 <span class="keywordflow">return</span> NULL ;
+<a name="l00391"></a>00391 }
+<a name="l00392"></a>00392 cpl_imagelist_set(out, ima, i) ;
+<a name="l00393"></a>00393 }
+<a name="l00394"></a>00394 <span class="keywordflow">return</span> out ;
+<a name="l00395"></a>00395 }
+<a name="l00396"></a>00396
+<a name="l00397"></a>00397 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00406"></a>00406 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00407"></a><a class="code" href="group__hawki__load.html#gacfb4bdd556642042208b93924ee13a32">00407</a> cpl_imagelist * <a class="code" href="group__hawki__load.html#gacfb4bdd556642042208b93924ee13a32" title="Load the chip of HAWKI images from a frameset in an image list.">hawki_load_frameset</a>(
+<a name="l00408"></a>00408 <span class="keyword">const</span> cpl_frameset * fset,
+<a name="l00409"></a>00409 <span class="keywordtype">int</span> chip,
+<a name="l00410"></a>00410 cpl_type ptype)
+<a name="l00411"></a>00411 {
+<a name="l00412"></a>00412 cpl_imagelist * out ;
+<a name="l00413"></a>00413 cpl_image * ima ;
+<a name="l00414"></a>00414 <span class="keywordtype">int</span> i ;
+<a name="l00415"></a>00415
+<a name="l00416"></a>00416 <span class="comment">/* Test entries */</span>
+<a name="l00417"></a>00417 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00418"></a>00418 <span class="keywordflow">if</span> (chip < 1 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> NULL ;
+<a name="l00419"></a>00419
+<a name="l00420"></a>00420 <span class="comment">/* Create the output imagelist */</span>
+<a name="l00421"></a>00421 out = cpl_imagelist_new() ;
+<a name="l00422"></a>00422
+<a name="l00423"></a>00423 <span class="comment">/* Loop on the frames */</span>
+<a name="l00424"></a>00424 <span class="keywordflow">for</span> (i=0 ; i<cpl_frameset_get_size(fset) ; i++) {
+<a name="l00425"></a>00425 ima = <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(fset, i, chip, ptype) ;
+<a name="l00426"></a>00426 <span class="keywordflow">if</span> (ima == NULL) {
+<a name="l00427"></a>00427 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load %dth frame (chip %d)"</span>,
+<a name="l00428"></a>00428 i+1, chip) ;
+<a name="l00429"></a>00429 cpl_imagelist_delete(out) ;
+<a name="l00430"></a>00430 <span class="keywordflow">return</span> NULL ;
+<a name="l00431"></a>00431 }
+<a name="l00432"></a>00432 cpl_imagelist_set(out, ima, i) ;
+<a name="l00433"></a>00433 }
+<a name="l00434"></a>00434 <span class="keywordflow">return</span> out ;
+<a name="l00435"></a>00435 }
+<a name="l00436"></a>00436
+<a name="l00444"></a>00444 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00445"></a><a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751">00445</a> cpl_imagelist * <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(
+<a name="l00446"></a>00446 <span class="keyword">const</span> cpl_frame * frame,
+<a name="l00447"></a>00447 cpl_type ptype)
+<a name="l00448"></a>00448 {
+<a name="l00449"></a>00449 cpl_imagelist * out;
+<a name="l00450"></a>00450 cpl_image * ima;
+<a name="l00451"></a>00451 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname;
+<a name="l00452"></a>00452 <span class="keywordtype">int</span> idet;
+<a name="l00453"></a>00453 <span class="keywordtype">int</span> ext_nb;
+<a name="l00454"></a>00454 <span class="keywordtype">int</span> * ext_chip_mapping;
+<a name="l00455"></a>00455
+<a name="l00456"></a>00456 <span class="comment">/* Test entries */</span>
+<a name="l00457"></a>00457 <span class="keywordflow">if</span> (frame == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 <span class="comment">/* Create the output imagelist */</span>
+<a name="l00460"></a>00460 out = cpl_imagelist_new() ;
+<a name="l00461"></a>00461
+<a name="l00462"></a>00462 <span class="comment">/* Get the filename */</span>
+<a name="l00463"></a>00463 fname = cpl_frame_get_filename(frame);
+<a name="l00464"></a>00464
+<a name="l00465"></a>00465 <span class="comment">/* Check that the frame has the right number of extension */</span>
+<a name="l00466"></a>00466 <span class="keywordflow">if</span>(cpl_frame_get_nextensions(frame) != HAWKI_NB_DETECTORS)
+<a name="l00467"></a>00467 {
+<a name="l00468"></a>00468 cpl_msg_error(__func__, <span class="stringliteral">"File %s contains less than %d extensions"</span>,
+<a name="l00469"></a>00469 fname, HAWKI_NB_DETECTORS);
+<a name="l00470"></a>00470 cpl_imagelist_delete(out);
+<a name="l00471"></a>00471 <span class="keywordflow">return</span> NULL ;
+<a name="l00472"></a>00472 }
+<a name="l00473"></a>00473
+<a name="l00474"></a>00474 <span class="comment">/* Get the extension-chip mapping */</span>
+<a name="l00475"></a>00475 ext_chip_mapping = <a class="code" href="group__hawki__load.html#ga509bd22f6e838f82f7b2c6bc97ccc3a9" title="Get the mapping between extensions and detectors.">hawki_get_ext_detector_mapping</a>(fname);
+<a name="l00476"></a>00476 <span class="keywordflow">if</span> (ext_chip_mapping == NULL)
+<a name="l00477"></a>00477 {
+<a name="l00478"></a>00478 cpl_msg_error(__func__,<span class="stringliteral">"Cannot get mapping between extension and chip"</span>);
+<a name="l00479"></a>00479 cpl_imagelist_delete(out);
+<a name="l00480"></a>00480 <span class="keywordflow">return</span> NULL;
+<a name="l00481"></a>00481 }
+<a name="l00482"></a>00482
+<a name="l00483"></a>00483 <span class="comment">/* Loop on the chips */</span>
+<a name="l00484"></a>00484 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00485"></a>00485 {
+<a name="l00486"></a>00486 <span class="comment">/* Get the extension */</span>
+<a name="l00487"></a>00487 ext_nb = ext_chip_mapping[idet];
+<a name="l00488"></a>00488
+<a name="l00489"></a>00489 <span class="comment">/* Load */</span>
+<a name="l00490"></a>00490 <span class="keywordflow">if</span> ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL)
+<a name="l00491"></a>00491 {
+<a name="l00492"></a>00492 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load frame (detector %d)"</span>,
+<a name="l00493"></a>00493 idet);
+<a name="l00494"></a>00494 cpl_imagelist_delete(out);
+<a name="l00495"></a>00495 <span class="keywordflow">return</span> NULL;
+<a name="l00496"></a>00496 }
+<a name="l00497"></a>00497 cpl_imagelist_set(out, ima, idet);
+<a name="l00498"></a>00498 }
+<a name="l00499"></a>00499
+<a name="l00500"></a>00500 <span class="comment">/* Free */</span>
+<a name="l00501"></a>00501 cpl_free(ext_chip_mapping);
+<a name="l00502"></a>00502 <span class="keywordflow">return</span> out;
+<a name="l00503"></a>00503 }
+<a name="l00504"></a>00504
+<a name="l00512"></a>00512 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00513"></a><a class="code" href="group__hawki__load.html#ga43ebac74ab2f9da7a452f23ec76803ef">00513</a> cpl_image * <a class="code" href="group__hawki__load.html#ga43ebac74ab2f9da7a452f23ec76803ef" title="Load one the extensions of HAWKI images from a frame into an image.">hawki_load_frame_extension</a>(
+<a name="l00514"></a>00514 <span class="keyword">const</span> cpl_frame * frame,
+<a name="l00515"></a>00515 <span class="keywordtype">int</span> iextension,
+<a name="l00516"></a>00516 cpl_type ptype)
+<a name="l00517"></a>00517 {
+<a name="l00518"></a>00518 cpl_image * ima;
+<a name="l00519"></a>00519 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname;
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="comment">/* Test entries */</span>
+<a name="l00522"></a>00522 <span class="keywordflow">if</span> (frame == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00523"></a>00523
+<a name="l00524"></a>00524 <span class="comment">/* Get filename */</span>
+<a name="l00525"></a>00525 fname = cpl_frame_get_filename(frame);
+<a name="l00526"></a>00526
+<a name="l00527"></a>00527 <span class="comment">/* Load */</span>
+<a name="l00528"></a>00528 <span class="keywordflow">if</span> ((ima=cpl_image_load(fname, ptype, 0, iextension)) == NULL)
+<a name="l00529"></a>00529 {
+<a name="l00530"></a>00530 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load frame (extension %d)"</span>,
+<a name="l00531"></a>00531 iextension) ;
+<a name="l00532"></a>00532 <span class="keywordflow">return</span> NULL ;
+<a name="l00533"></a>00533 }
+<a name="l00534"></a>00534
+<a name="l00535"></a>00535 <span class="comment">/* Return */</span>
+<a name="l00536"></a>00536 <span class="keywordflow">return</span> ima;
+<a name="l00537"></a>00537 }
+<a name="l00538"></a>00538
+<a name="l00546"></a>00546 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00547"></a><a class="code" href="group__hawki__load.html#gada33a0608b91dc44f69f821e6f40b8d1">00547</a> cpl_image * <a class="code" href="group__hawki__load.html#gada33a0608b91dc44f69f821e6f40b8d1" title="Load one the chips of HAWKI images from a frame into an image.">hawki_load_frame_detector</a>(
+<a name="l00548"></a>00548 <span class="keyword">const</span> cpl_frame * frame,
+<a name="l00549"></a>00549 <span class="keywordtype">int</span> idet,
+<a name="l00550"></a>00550 cpl_type ptype)
+<a name="l00551"></a>00551 {
+<a name="l00552"></a>00552 cpl_image * ima;
+<a name="l00553"></a>00553 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname;
+<a name="l00554"></a>00554 <span class="keywordtype">int</span> ext_nb;
+<a name="l00555"></a>00555
+<a name="l00556"></a>00556 <span class="comment">/* Test entries */</span>
+<a name="l00557"></a>00557 <span class="keywordflow">if</span> (frame == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00558"></a>00558
+<a name="l00559"></a>00559 <span class="comment">/* Get filename */</span>
+<a name="l00560"></a>00560 fname = cpl_frame_get_filename(frame);
+<a name="l00561"></a>00561
+<a name="l00562"></a>00562 <span class="comment">/* Get the extension with the wished chip */</span>
+<a name="l00563"></a>00563 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(fname, idet)) == -1)
+<a name="l00564"></a>00564 {
+<a name="l00565"></a>00565 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with chip %d"</span>,
+<a name="l00566"></a>00566 idet) ;
+<a name="l00567"></a>00567 <span class="keywordflow">return</span> NULL ;
+<a name="l00568"></a>00568 }
+<a name="l00569"></a>00569 <span class="comment">/* Load */</span>
+<a name="l00570"></a>00570 <span class="keywordflow">if</span> ((ima=cpl_image_load(fname, ptype, 0, ext_nb)) == NULL)
+<a name="l00571"></a>00571 {
+<a name="l00572"></a>00572 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load frame (chip %d)"</span>,
+<a name="l00573"></a>00573 idet) ;
+<a name="l00574"></a>00574 <span class="keywordflow">return</span> NULL ;
+<a name="l00575"></a>00575 }
+<a name="l00576"></a>00576
+<a name="l00577"></a>00577 <span class="comment">/* Return */</span>
+<a name="l00578"></a>00578 <span class="keywordflow">return</span> ima;
+<a name="l00579"></a>00579 }
+<a name="l00580"></a>00580
+<a name="l00588"></a>00588 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00589"></a><a class="code" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0">00589</a> cpl_table ** <a class="code" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0" title="Load a table with four extensions, one for each chip.">hawki_load_tables</a>(<span class="keyword">const</span> cpl_frame * frame)
+<a name="l00590"></a>00590 {
+<a name="l00591"></a>00591 cpl_table ** tables;
+<a name="l00592"></a>00592 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename;
+<a name="l00593"></a>00593 <span class="keywordtype">int</span> idet;
+<a name="l00594"></a>00594 <span class="keywordtype">int</span> j;
+<a name="l00595"></a>00595 <span class="keywordtype">int</span> ext_nb;
+<a name="l00596"></a>00596
+<a name="l00597"></a>00597 <span class="comment">/* Allocate the set of tables */</span>
+<a name="l00598"></a>00598 tables = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00599"></a>00599
+<a name="l00600"></a>00600 <span class="comment">/* Get the filename */</span>
+<a name="l00601"></a>00601 filename = cpl_frame_get_filename(frame);
+<a name="l00602"></a>00602 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00603"></a>00603 {
+<a name="l00604"></a>00604 <span class="comment">/* Get the extension with the wished chip */</span>
+<a name="l00605"></a>00605 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(filename, idet+1)) == -1)
+<a name="l00606"></a>00606 {
+<a name="l00607"></a>00607 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the extension with detector %d"</span>,
+<a name="l00608"></a>00608 idet+1) ;
+<a name="l00609"></a>00609 <span class="keywordflow">return</span> NULL ;
+<a name="l00610"></a>00610 }
+<a name="l00611"></a>00611 <span class="comment">/* Load the table */</span>
+<a name="l00612"></a>00612 <span class="keywordflow">if</span>((tables[idet] = cpl_table_load(filename, ext_nb, 0) ) == NULL)
+<a name="l00613"></a>00613 {
+<a name="l00614"></a>00614 <span class="keywordflow">for</span> (j=0 ; j< idet ; j++)
+<a name="l00615"></a>00615 {
+<a name="l00616"></a>00616 cpl_table_delete(tables[j]);
+<a name="l00617"></a>00617 }
+<a name="l00618"></a>00618 cpl_free(tables);
+<a name="l00619"></a>00619 <span class="keywordflow">return</span> NULL;
+<a name="l00620"></a>00620 }
+<a name="l00621"></a>00621 }
+<a name="l00622"></a>00622
+<a name="l00623"></a>00623 <span class="keywordflow">return</span> tables;
+<a name="l00624"></a>00624 }
+<a name="l00625"></a>00625
+<a name="l00632"></a>00632 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00633"></a><a class="code" href="group__hawki__load.html#gaf91b09d357b426f387123767e4a4fec1">00633</a> cpl_bivector ** <a class="code" href="group__hawki__load.html#gaf91b09d357b426f387123767e4a4fec1" title="Load a table containing refined offsets.">hawki_load_refined_offsets</a>(<span class="keyword">const</span> cpl_frame * offsets_frame)
+<a name="l00634"></a>00634 {
+<a name="l00635"></a>00635 cpl_errorstate previous_state;
+<a name="l00636"></a>00636 cpl_table ** offsets_tables;
+<a name="l00637"></a>00637 cpl_bivector ** offsets;
+<a name="l00638"></a>00638 <span class="keywordtype">int</span> idet;
+<a name="l00639"></a>00639
+<a name="l00640"></a>00640 <span class="comment">/* Get the error state */</span>
+<a name="l00641"></a>00641 previous_state = cpl_errorstate_get();
+<a name="l00642"></a>00642
+<a name="l00643"></a>00643 <span class="comment">/* Read the offsets table */</span>
+<a name="l00644"></a>00644 <span class="keywordflow">if</span>((offsets_tables = <a class="code" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0" title="Load a table with four extensions, one for each chip.">hawki_load_tables</a>(offsets_frame)) == NULL)
+<a name="l00645"></a>00645 <span class="keywordflow">return</span> NULL;
+<a name="l00646"></a>00646
+<a name="l00647"></a>00647 <span class="comment">/* Convert the table to offsets bivectors */</span>
+<a name="l00648"></a>00648 offsets = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_bivector *));
+<a name="l00649"></a>00649 <span class="keywordflow">if</span>(offsets == NULL)
+<a name="l00650"></a>00650 {
+<a name="l00651"></a>00651 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00652"></a>00652 cpl_table_delete(offsets_tables[idet]);
+<a name="l00653"></a>00653 <span class="keywordflow">return</span> NULL;
+<a name="l00654"></a>00654 }
+<a name="l00655"></a>00655 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00656"></a>00656 {
+<a name="l00657"></a>00657 cpl_vector * off_x;
+<a name="l00658"></a>00658 cpl_vector * off_y;
+<a name="l00659"></a>00659 <span class="keywordtype">int</span> noff;
+<a name="l00660"></a>00660 <span class="keywordtype">int</span> ioff;
+<a name="l00661"></a>00661 <span class="keywordtype">int</span> jdet;
+<a name="l00662"></a>00662
+<a name="l00663"></a>00663 noff = cpl_table_get_nrow(offsets_tables[idet]);
+<a name="l00664"></a>00664 offsets[idet] = cpl_bivector_new(noff);
+<a name="l00665"></a>00665 <span class="keywordflow">if</span>(offsets[idet] == NULL)
+<a name="l00666"></a>00666 {
+<a name="l00667"></a>00667 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00668"></a>00668 cpl_table_delete(offsets_tables[idet]);
+<a name="l00669"></a>00669 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00670"></a>00670 cpl_bivector_delete(offsets[jdet]);
+<a name="l00671"></a>00671 cpl_free(offsets[jdet]);
+<a name="l00672"></a>00672 <span class="keywordflow">return</span> NULL;
+<a name="l00673"></a>00673 }
+<a name="l00674"></a>00674 off_x = cpl_bivector_get_x(offsets[idet]);
+<a name="l00675"></a>00675 off_y = cpl_bivector_get_y(offsets[idet]);
+<a name="l00676"></a>00676 <span class="keywordflow">for</span>(ioff = 0; ioff < noff; ++ioff)
+<a name="l00677"></a>00677 {
+<a name="l00678"></a>00678 <span class="keywordtype">double</span> xoffset, yoffset;
+<a name="l00679"></a>00679 xoffset = cpl_table_get
+<a name="l00680"></a>00680 (offsets_tables[idet], HAWKI_COL_OFFSET_X, ioff, NULL);
+<a name="l00681"></a>00681 yoffset = cpl_table_get
+<a name="l00682"></a>00682 (offsets_tables[idet], HAWKI_COL_OFFSET_Y, ioff, NULL);
+<a name="l00683"></a>00683 cpl_vector_set(off_x, ioff, xoffset);
+<a name="l00684"></a>00684 cpl_vector_set(off_y, ioff, yoffset);
+<a name="l00685"></a>00685 }
+<a name="l00686"></a>00686 }
+<a name="l00687"></a>00687
+<a name="l00688"></a>00688 <span class="comment">/* Check error state */</span>
+<a name="l00689"></a>00689 <span class="keywordflow">if</span>(cpl_errorstate_get() != previous_state)
+<a name="l00690"></a>00690 {
+<a name="l00691"></a>00691 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00692"></a>00692 {
+<a name="l00693"></a>00693 cpl_table_delete(offsets_tables[idet]);
+<a name="l00694"></a>00694 cpl_bivector_delete(offsets[idet]);
+<a name="l00695"></a>00695 }
+<a name="l00696"></a>00696 cpl_free(offsets);
+<a name="l00697"></a>00697 <span class="keywordflow">return</span> NULL;
+<a name="l00698"></a>00698 }
+<a name="l00699"></a>00699
+<a name="l00700"></a>00700 <span class="comment">/* Free and exit */</span>
+<a name="l00701"></a>00701 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00702"></a>00702 cpl_table_delete(offsets_tables[idet]);
+<a name="l00703"></a>00703 cpl_free(offsets_tables);
+<a name="l00704"></a>00704
+<a name="l00705"></a>00705 <span class="keywordflow">return</span> offsets;
+<a name="l00706"></a>00706 }
+<a name="l00707"></a>00707
+<a name="l00708"></a>00708 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00717"></a>00717 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00718"></a><a class="code" href="group__hawki__load.html#ga0ee685ab967af593a9fd9f5f90cc7dd0">00718</a> cpl_image * <a class="code" href="group__hawki__load.html#ga0ee685ab967af593a9fd9f5f90cc7dd0" title="Rebuild the 4 chips.">hawki_rebuild_detectors</a>(
+<a name="l00719"></a>00719 <span class="keyword">const</span> cpl_image * ima1,
+<a name="l00720"></a>00720 <span class="keyword">const</span> cpl_image * ima2,
+<a name="l00721"></a>00721 <span class="keyword">const</span> cpl_image * ima3,
+<a name="l00722"></a>00722 <span class="keyword">const</span> cpl_image * ima4)
+<a name="l00723"></a>00723 {
+<a name="l00724"></a>00724 cpl_image * ima ;
+<a name="l00725"></a>00725
+<a name="l00726"></a>00726 <span class="comment">/* Test entries */</span>
+<a name="l00727"></a>00727 <span class="keywordflow">if</span> (ima1 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00728"></a>00728 <span class="keywordflow">if</span> (ima2 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00729"></a>00729 <span class="keywordflow">if</span> (ima3 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00730"></a>00730 <span class="keywordflow">if</span> (ima4 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00731"></a>00731 <span class="keywordflow">if</span> (cpl_image_get_type(ima1)!=cpl_image_get_type(ima2)) <span class="keywordflow">return</span> NULL ;
+<a name="l00732"></a>00732 <span class="keywordflow">if</span> (cpl_image_get_type(ima1)!=cpl_image_get_type(ima3)) <span class="keywordflow">return</span> NULL ;
+<a name="l00733"></a>00733 <span class="keywordflow">if</span> (cpl_image_get_type(ima1)!=cpl_image_get_type(ima4)) <span class="keywordflow">return</span> NULL ;
+<a name="l00734"></a>00734
+<a name="l00735"></a>00735 <span class="comment">/* Create the image */</span>
+<a name="l00736"></a>00736 ima = cpl_image_new(4096, 4096, cpl_image_get_type(ima1)) ;
+<a name="l00737"></a>00737
+<a name="l00738"></a>00738 <span class="comment">/* Paste the input images */</span>
+<a name="l00739"></a>00739 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima1, 1, 1) != CPL_ERROR_NONE) {
+<a name="l00740"></a>00740 cpl_image_delete(ima) ;
+<a name="l00741"></a>00741 <span class="keywordflow">return</span> NULL ;
+<a name="l00742"></a>00742 }
+<a name="l00743"></a>00743 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima2, 2049, 1) != CPL_ERROR_NONE) {
+<a name="l00744"></a>00744 cpl_image_delete(ima) ;
+<a name="l00745"></a>00745 <span class="keywordflow">return</span> NULL ;
+<a name="l00746"></a>00746 }
+<a name="l00747"></a>00747 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima3, 2049, 2049) != CPL_ERROR_NONE) {
+<a name="l00748"></a>00748 cpl_image_delete(ima) ;
+<a name="l00749"></a>00749 <span class="keywordflow">return</span> NULL ;
+<a name="l00750"></a>00750 }
+<a name="l00751"></a>00751 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima4, 1, 2049) != CPL_ERROR_NONE) {
+<a name="l00752"></a>00752 cpl_image_delete(ima) ;
+<a name="l00753"></a>00753 <span class="keywordflow">return</span> NULL ;
+<a name="l00754"></a>00754 }
+<a name="l00755"></a>00755 <span class="keywordflow">return</span> ima ;
+<a name="l00756"></a>00756 }
+<a name="l00757"></a>00757
+<a name="l00758"></a>00758
+<a name="l00759"></a>00759 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00768"></a>00768 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00769"></a><a class="code" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df">00769</a> cpl_image * <a class="code" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df" title="Rebuild the 4 quadrants.">hawki_rebuild_quadrants</a>(
+<a name="l00770"></a>00770 <span class="keyword">const</span> cpl_image * ima1,
+<a name="l00771"></a>00771 <span class="keyword">const</span> cpl_image * ima2,
+<a name="l00772"></a>00772 <span class="keyword">const</span> cpl_image * ima3,
+<a name="l00773"></a>00773 <span class="keyword">const</span> cpl_image * ima4)
+<a name="l00774"></a>00774 {
+<a name="l00775"></a>00775 cpl_image * ima ;
+<a name="l00776"></a>00776
+<a name="l00777"></a>00777 <span class="comment">/* Test entries */</span>
+<a name="l00778"></a>00778 <span class="keywordflow">if</span> (ima1 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00779"></a>00779 <span class="keywordflow">if</span> (ima2 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00780"></a>00780 <span class="keywordflow">if</span> (ima3 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00781"></a>00781 <span class="keywordflow">if</span> (ima4 == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00782"></a>00782 <span class="keywordflow">if</span> (cpl_image_get_type(ima1)!=cpl_image_get_type(ima2)) <span class="keywordflow">return</span> NULL ;
+<a name="l00783"></a>00783 <span class="keywordflow">if</span> (cpl_image_get_type(ima1)!=cpl_image_get_type(ima3)) <span class="keywordflow">return</span> NULL ;
+<a name="l00784"></a>00784 <span class="keywordflow">if</span> (cpl_image_get_type(ima1)!=cpl_image_get_type(ima4)) <span class="keywordflow">return</span> NULL ;
+<a name="l00785"></a>00785
+<a name="l00786"></a>00786 <span class="comment">/* Create the image */</span>
+<a name="l00787"></a>00787 ima = cpl_image_new(2048, 2048, cpl_image_get_type(ima1)) ;
+<a name="l00788"></a>00788
+<a name="l00789"></a>00789 <span class="comment">/* Paste the input images */</span>
+<a name="l00790"></a>00790 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima1, 1, 1) != CPL_ERROR_NONE) {
+<a name="l00791"></a>00791 cpl_image_delete(ima) ;
+<a name="l00792"></a>00792 <span class="keywordflow">return</span> NULL ;
+<a name="l00793"></a>00793 }
+<a name="l00794"></a>00794 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima2, 1025, 1) != CPL_ERROR_NONE) {
+<a name="l00795"></a>00795 cpl_image_delete(ima) ;
+<a name="l00796"></a>00796 <span class="keywordflow">return</span> NULL ;
+<a name="l00797"></a>00797 }
+<a name="l00798"></a>00798 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima3, 1, 1025) != CPL_ERROR_NONE) {
+<a name="l00799"></a>00799 cpl_image_delete(ima) ;
+<a name="l00800"></a>00800 <span class="keywordflow">return</span> NULL ;
+<a name="l00801"></a>00801 }
+<a name="l00802"></a>00802 <span class="keywordflow">if</span> (cpl_image_copy(ima, ima4, 1025, 1025) != CPL_ERROR_NONE) {
+<a name="l00803"></a>00803 cpl_image_delete(ima) ;
+<a name="l00804"></a>00804 <span class="keywordflow">return</span> NULL ;
+<a name="l00805"></a>00805 }
+<a name="l00806"></a>00806 <span class="keywordflow">return</span> ima ;
+<a name="l00807"></a>00807 }
+<a name="l00808"></a>00808
+<a name="l00809"></a>00809 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00816"></a>00816 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00817"></a><a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756">00817</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(
+<a name="l00818"></a>00818 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname,
+<a name="l00819"></a>00819 <span class="keywordtype">int</span> ext)
+<a name="l00820"></a>00820 {
+<a name="l00821"></a>00821 cpl_propertylist * plist ;
+<a name="l00822"></a>00822 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00823"></a>00823 <span class="keywordtype">int</span> chip ;
+<a name="l00824"></a>00824
+<a name="l00825"></a>00825 <span class="comment">/* Test entries */</span>
+<a name="l00826"></a>00826 <span class="keywordflow">if</span> (ext <= 0 || ext > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> -1 ;
+<a name="l00827"></a>00827
+<a name="l00828"></a>00828 <span class="comment">/* Load the extension */</span>
+<a name="l00829"></a>00829 plist=cpl_propertylist_load(fname, ext) ;
+<a name="l00830"></a>00830 <span class="keywordflow">if</span> (plist == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00831"></a>00831 sval = <a class="code" href="group__hawki__pfits.html#ga5161743d5b650a637d543959b5bd54ea" title="find out the extname">hawki_pfits_get_extname</a>(plist) ;
+<a name="l00832"></a>00832 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"CHIP%d.INT1"</span>, &chip) != 1) chip = -1 ;
+<a name="l00833"></a>00833 cpl_propertylist_delete(plist) ;
+<a name="l00834"></a>00834
+<a name="l00835"></a>00835 <span class="keywordflow">return</span> chip ;
+<a name="l00836"></a>00836 }
+<a name="l00837"></a>00837
+<a name="l00838"></a>00838 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00845"></a>00845 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00846"></a><a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1">00846</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(
+<a name="l00847"></a>00847 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname,
+<a name="l00848"></a>00848 <span class="keywordtype">int</span> chip)
+<a name="l00849"></a>00849 {
+<a name="l00850"></a>00850 cpl_propertylist * plist ;
+<a name="l00851"></a>00851 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00852"></a>00852 <span class="keywordtype">char</span> chipval[512] ;
+<a name="l00853"></a>00853 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00854"></a>00854 <span class="keywordtype">int</span> iext;
+<a name="l00855"></a>00855
+<a name="l00856"></a>00856 <span class="comment">/* Test entries */</span>
+<a name="l00857"></a>00857 <span class="keywordflow">if</span> (fname == NULL) <span class="keywordflow">return</span> -1;
+<a name="l00858"></a>00858 <span class="keywordflow">if</span> (chip <= 0 || chip > HAWKI_NB_DETECTORS) <span class="keywordflow">return</span> -1 ;
+<a name="l00859"></a>00859
+<a name="l00860"></a>00860 <span class="comment">/* Initialise */</span>
+<a name="l00861"></a>00861 ext_nb = -1 ;
+<a name="l00862"></a>00862
+<a name="l00863"></a>00863 <span class="comment">/* Create the wished chipval */</span>
+<a name="l00864"></a>00864 snprintf(chipval, 512, <span class="stringliteral">"CHIP%d.INT1"</span>, chip) ;
+<a name="l00865"></a>00865
+<a name="l00866"></a>00866 <span class="comment">/* Loop on the HAWKI_NB_DETECTORS extensions */</span>
+<a name="l00867"></a>00867 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+<a name="l00868"></a>00868 <span class="comment">/* Load the propertylist of the current extension */</span>
+<a name="l00869"></a>00869 <span class="keywordflow">if</span> ((plist = cpl_propertylist_load(fname, iext+1)) == NULL) {
+<a name="l00870"></a>00870 cpl_msg_error(__func__, <span class="stringliteral">"Cannot read the Extname keyword"</span>) ;
+<a name="l00871"></a>00871 <span class="keywordflow">return</span> -1 ;
+<a name="l00872"></a>00872 }
+<a name="l00873"></a>00873 <span class="keywordflow">if</span> ((sval = <a class="code" href="group__hawki__pfits.html#ga5161743d5b650a637d543959b5bd54ea" title="find out the extname">hawki_pfits_get_extname</a>(plist)) == NULL) {
+<a name="l00874"></a>00874 cpl_msg_error(__func__, <span class="stringliteral">"Cannot read the Extname keyword"</span>) ;
+<a name="l00875"></a>00875 cpl_propertylist_delete(plist) ;
+<a name="l00876"></a>00876 <span class="keywordflow">return</span> -1 ;
+<a name="l00877"></a>00877 }
+<a name="l00878"></a>00878 <span class="comment">/* Check if the chip is found */</span>
+<a name="l00879"></a>00879 <span class="keywordflow">if</span> (!strcmp(chipval, sval)) {
+<a name="l00880"></a>00880 ext_nb = iext+1 ;
+<a name="l00881"></a>00881 cpl_propertylist_delete(plist) ;
+<a name="l00882"></a>00882 <span class="keywordflow">break</span>;
+<a name="l00883"></a>00883 }
+<a name="l00884"></a>00884 cpl_propertylist_delete(plist) ;
+<a name="l00885"></a>00885 }
+<a name="l00886"></a>00886 <span class="keywordflow">return</span> ext_nb ;
+<a name="l00887"></a>00887 }
+<a name="l00888"></a>00888
+<a name="l00889"></a>00889 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00895"></a>00895 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00896"></a>00896 <span class="keywordtype">int</span> * <a class="code" href="group__hawki__load.html#ga509bd22f6e838f82f7b2c6bc97ccc3a9" title="Get the mapping between extensions and detectors.">hawki_get_ext_detector_mapping</a>
+<a name="l00897"></a><a class="code" href="group__hawki__load.html#ga509bd22f6e838f82f7b2c6bc97ccc3a9">00897</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> * fname)
+<a name="l00898"></a>00898 {
+<a name="l00899"></a>00899 <span class="keywordtype">int</span> iext;
+<a name="l00900"></a>00900 <span class="keywordtype">int</span> * ext_chip_mapping;
+<a name="l00901"></a>00901
+<a name="l00902"></a>00902
+<a name="l00903"></a>00903 <span class="comment">/* Test entries */</span>
+<a name="l00904"></a>00904 <span class="keywordflow">if</span> (fname == NULL) <span class="keywordflow">return</span> NULL;
+<a name="l00905"></a>00905
+<a name="l00906"></a>00906 <span class="comment">/* Initialise */</span>
+<a name="l00907"></a>00907 ext_chip_mapping = cpl_malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>) * HAWKI_NB_DETECTORS);
+<a name="l00908"></a>00908
+<a name="l00909"></a>00909 <span class="comment">/* Loop on the HAWKI_NB_DETECTORS extensions */</span>
+<a name="l00910"></a>00910 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+<a name="l00911"></a>00911 <span class="keywordtype">int</span> ichip = <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(fname, iext + 1);
+<a name="l00912"></a>00912 ext_chip_mapping[ichip-1] = iext + 1;
+<a name="l00913"></a>00913 }
+<a name="l00914"></a>00914 <span class="keywordflow">return</span> ext_chip_mapping;
+<a name="l00915"></a>00915 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__load_8h_source.html b/html/hawki__load_8h_source.html
new file mode 100644
index 0000000..5772b1f
--- /dev/null
+++ b/html/hawki__load_8h_source.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_load.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_load.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_load.h,v 1.21 2009/10/12 16:59:22 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/10/12 16:59:22 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.21 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_LOAD_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_LOAD_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Functions prototypes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 cpl_frameset * <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keyword">const</span> <span class="keywordtype">char</span> *) ;
+<a name="l00036"></a>00036 cpl_imagelist * <a class="code" href="group__hawki__load.html#gacfb4bdd556642042208b93924ee13a32" title="Load the chip of HAWKI images from a frameset in an image list.">hawki_load_frameset</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00037"></a>00037 cpl_imagelist * <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(<span class="keyword">const</span> cpl_frame *, cpl_type) ;
+<a name="l00038"></a>00038 cpl_image * <a class="code" href="group__hawki__load.html#gada33a0608b91dc44f69f821e6f40b8d1" title="Load one the chips of HAWKI images from a frame into an image.">hawki_load_frame_detector</a>(<span class="keyword">const</span> cpl_frame *, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00039"></a>00039 cpl_image * <a class="code" href="group__hawki__load.html#ga43ebac74ab2f9da7a452f23ec76803ef" title="Load one the extensions of HAWKI images from a frame into an image.">hawki_load_frame_extension</a>(<span class="keyword">const</span> cpl_frame *, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00040"></a>00040 cpl_image * <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00041"></a>00041 cpl_imagelist * <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00042"></a>00042 cpl_imagelist * <a class="code" href="group__hawki__load.html#ga1cf51c1b905de7941d7fcf3e249e536d" title="Loads a given extension from a HAWKI frameset in an image list.">hawki_load_extensions</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00043"></a>00043 cpl_imagelist * <a class="code" href="group__hawki__load.html#gad5cbc1d866e88c8776ed605e5afa9438" title="Load the quarter of a chip from a frameset in an image list.">hawki_load_quadrants</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00044"></a>00044 cpl_image * <a class="code" href="group__hawki__load.html#gaf2bd8a92a7abfe4adc8eb7b6b917739a" title="Load the quarter of a chip from a frameset in an image.">hawki_load_quadrant</a>(<span class="keyword">const</span> cpl_frameset *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00045"></a>00045 cpl_image * <a class="code" href="group__hawki__load.html#ga686f0c5897e92abd1b6aff98636f56c7" title="Load the quarter of a chip from a file in an image.">hawki_load_quadrant_from_file</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>, cpl_type) ;
+<a name="l00046"></a>00046 cpl_table ** <a class="code" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0" title="Load a table with four extensions, one for each chip.">hawki_load_tables</a>(<span class="keyword">const</span> cpl_frame * frame);
+<a name="l00047"></a>00047 cpl_bivector ** <a class="code" href="group__hawki__load.html#gaf91b09d357b426f387123767e4a4fec1" title="Load a table containing refined offsets.">hawki_load_refined_offsets</a>(<span class="keyword">const</span> cpl_frame * offsets_frame);
+<a name="l00048"></a>00048 cpl_image * <a class="code" href="group__hawki__load.html#ga2e96e882a8e61743837030dcc2db02df" title="Rebuild the 4 quadrants.">hawki_rebuild_quadrants</a>(<span class="keyword">const</span> cpl_image *, <span class="keyword">const</span> cpl_image *,
+<a name="l00049"></a>00049 <span class="keyword">const</span> cpl_image *, <span class="keyword">const</span> cpl_image *) ;
+<a name="l00050"></a>00050 cpl_image * <a class="code" href="group__hawki__load.html#ga0ee685ab967af593a9fd9f5f90cc7dd0" title="Rebuild the 4 chips.">hawki_rebuild_detectors</a>(<span class="keyword">const</span> cpl_image *, <span class="keyword">const</span> cpl_image *,
+<a name="l00051"></a>00051 <span class="keyword">const</span> cpl_image *, <span class="keyword">const</span> cpl_image *) ;
+<a name="l00052"></a>00052 <span class="keywordtype">int</span> <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>) ;
+<a name="l00053"></a>00053 <span class="keywordtype">int</span> <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span>) ;
+<a name="l00054"></a>00054 <span class="keywordtype">int</span> * <a class="code" href="group__hawki__load.html#ga509bd22f6e838f82f7b2c6bc97ccc3a9" title="Get the mapping between extensions and detectors.">hawki_get_ext_detector_mapping</a>
+<a name="l00055"></a>00055 (<span class="keyword">const</span> <span class="keywordtype">char</span> * fname);
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__mask_8c_source.html b/html/hawki__mask_8c_source.html
new file mode 100644
index 0000000..2c123ae
--- /dev/null
+++ b/html/hawki__mask_8c_source.html
@@ -0,0 +1,176 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_mask.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_mask.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_mask.c,v 1.3 2010/03/12 12:55:17 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/03/12 12:55:17 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.3 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl_mask.h></span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include <cpl_matrix.h></span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_mask.h"</span>
+<a name="l00043"></a>00043
+<a name="l00044"></a>00044 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00049"></a>00049 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050
+<a name="l00056"></a><a class="code" href="group__hawki__mask.html#ga6154878d3444c3d4204a2a6132719e69">00056</a> cpl_error_code <a class="code" href="group__hawki__mask.html#ga6154878d3444c3d4204a2a6132719e69">hawki_mask_convolve</a>(
+<a name="l00057"></a>00057 cpl_mask * in,
+<a name="l00058"></a>00058 <span class="keyword">const</span> cpl_matrix * ker)
+<a name="l00059"></a>00059 {
+<a name="l00060"></a>00060 cpl_mask * out;
+<a name="l00061"></a>00061 <span class="keyword">const</span> <span class="keywordtype">double</span> * ker_arr;
+<a name="l00062"></a>00062 <span class="keywordtype">int</span> nc, nr;
+<a name="l00063"></a>00063 <span class="keywordtype">int</span> hsx, hsy;
+<a name="l00064"></a>00064 <span class="keywordtype">int</span> curr_pos, im_pos, filt_pos;
+<a name="l00065"></a>00065 <span class="keywordtype">int</span> i, j, k, l;
+<a name="l00066"></a>00066 <span class="keywordtype">double</span> sum;
+<a name="l00067"></a>00067 <span class="keywordtype">int</span> nx;
+<a name="l00068"></a>00068 <span class="keywordtype">int</span> ny;
+<a name="l00069"></a>00069 cpl_binary * in_data;
+<a name="l00070"></a>00070 cpl_binary * out_data;
+<a name="l00071"></a>00071
+<a name="l00072"></a>00072 <span class="comment">/* Test entries */</span>
+<a name="l00073"></a>00073 cpl_ensure_code(in && ker, CPL_ERROR_NULL_INPUT);
+<a name="l00074"></a>00074
+<a name="l00075"></a>00075 <span class="comment">/* Get kernel informations */</span>
+<a name="l00076"></a>00076 nr = cpl_matrix_get_nrow(ker);
+<a name="l00077"></a>00077 nc = cpl_matrix_get_ncol(ker);
+<a name="l00078"></a>00078 ker_arr = cpl_matrix_get_data_const(ker);
+<a name="l00079"></a>00079
+<a name="l00080"></a>00080 <span class="comment">/* Test the kernel validity */</span>
+<a name="l00081"></a>00081 cpl_ensure_code(nc%2 && nr%2, CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00082"></a>00082 cpl_ensure_code(nc<=31 && nr<=31, CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 <span class="comment">/* Initialise */</span>
+<a name="l00085"></a>00085 hsx = (nc-1) / 2;
+<a name="l00086"></a>00086 hsy = (nr-1) / 2;
+<a name="l00087"></a>00087
+<a name="l00088"></a>00088 <span class="comment">/* Create a tmp binary image */</span>
+<a name="l00089"></a>00089 nx = cpl_mask_get_size_x(in);
+<a name="l00090"></a>00090 ny = cpl_mask_get_size_y(in);
+<a name="l00091"></a>00091 out = cpl_mask_new(nx, ny);
+<a name="l00092"></a>00092 in_data = cpl_mask_get_data(in);
+<a name="l00093"></a>00093 out_data = cpl_mask_get_data(out);
+<a name="l00094"></a>00094
+<a name="l00095"></a>00095 <span class="comment">/* Main filter loop */</span>
+<a name="l00096"></a>00096 <span class="keywordflow">for</span> (j=0; j<ny; j++) {
+<a name="l00097"></a>00097 <span class="keywordflow">for</span> (i=0; i<nx; i++) {
+<a name="l00098"></a>00098 <span class="comment">/* Curent pixel position */</span>
+<a name="l00099"></a>00099 curr_pos = i + j*nx;
+<a name="l00100"></a>00100 <span class="comment">/* Edges are not computed */</span>
+<a name="l00101"></a>00101 <span class="keywordflow">if</span> ((i<hsx) || (i>=nx-hsx) || (j<hsy) || (j>=ny-hsy)) {
+<a name="l00102"></a>00102 (out_data)[curr_pos] = CPL_BINARY_0;
+<a name="l00103"></a>00103 } <span class="keywordflow">else</span> {
+<a name="l00104"></a>00104 <span class="comment">/* Initialise */</span>
+<a name="l00105"></a>00105 (out_data)[curr_pos] = CPL_BINARY_0;
+<a name="l00106"></a>00106 <span class="comment">/* Go into upper left corner of current pixel */</span>
+<a name="l00107"></a>00107 im_pos = curr_pos - hsx + hsy*nx;
+<a name="l00108"></a>00108 filt_pos = 0;
+<a name="l00109"></a>00109 sum = 0;
+<a name="l00110"></a>00110 <span class="keywordflow">for</span> (k=0; k<nr; k++) {
+<a name="l00111"></a>00111 <span class="keywordflow">for</span> (l=0; l<nc; l++) {
+<a name="l00112"></a>00112 <span class="keywordflow">if</span> (((in_data)[im_pos] == CPL_BINARY_1) &&
+<a name="l00113"></a>00113 (fabs(ker_arr[filt_pos]) > FLT_MIN))
+<a name="l00114"></a>00114 sum+=fabs(ker_arr[filt_pos]);
+<a name="l00115"></a>00115 <span class="comment">/* Next col */</span>
+<a name="l00116"></a>00116 filt_pos++;
+<a name="l00117"></a>00117 im_pos++;
+<a name="l00118"></a>00118 }
+<a name="l00119"></a>00119 <span class="comment">/* Next row */</span>
+<a name="l00120"></a>00120 im_pos -= nx + nc;
+<a name="l00121"></a>00121 }
+<a name="l00122"></a>00122 <span class="keywordflow">if</span>(sum>0.5)
+<a name="l00123"></a>00123 (out_data)[curr_pos] = CPL_BINARY_1;
+<a name="l00124"></a>00124 }
+<a name="l00125"></a>00125 }
+<a name="l00126"></a>00126 }
+<a name="l00127"></a>00127 memcpy(in_data, out_data, nx * ny * <span class="keyword">sizeof</span>(cpl_binary));
+<a name="l00128"></a>00128 cpl_mask_delete(out);
+<a name="l00129"></a>00129 <span class="keywordflow">return</span> CPL_ERROR_NONE;
+<a name="l00130"></a>00130 }
+<a name="l00131"></a>00131
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__mask_8h_source.html b/html/hawki__mask_8h_source.html
new file mode 100644
index 0000000..5614183
--- /dev/null
+++ b/html/hawki__mask_8h_source.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_mask.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_mask.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_mask.h,v 1.1 2009/11/26 09:51:54 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/11/26 09:51:54 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_MASK_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_MASK_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="preprocessor">#include "cpl.h"</span>
+<a name="l00032"></a>00032 <span class="preprocessor">#include "cpl_mask.h"</span>
+<a name="l00033"></a>00033 <span class="preprocessor">#include "cpl_matrix.h"</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00036"></a>00036 <span class="comment"> Functions prototypes</span>
+<a name="l00037"></a>00037 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 cpl_error_code <a class="code" href="group__hawki__mask.html#ga6154878d3444c3d4204a2a6132719e69">hawki_mask_convolve</a>(
+<a name="l00040"></a>00040 cpl_mask * in,
+<a name="l00041"></a>00041 <span class="keyword">const</span> cpl_matrix * ker);
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__match__cats_8c_source.html b/html/hawki__match__cats_8c_source.html
new file mode 100644
index 0000000..46d8040
--- /dev/null
+++ b/html/hawki__match__cats_8c_source.html
@@ -0,0 +1,134 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_match_cats.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_match_cats.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_match_cats.c,v 1.1 2009/11/26 09:52:32 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/11/26 09:52:32 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_match_cats.h"</span>
+<a name="l00045"></a>00045
+<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00054"></a>00054 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00075"></a>00075 <span class="keywordtype">int</span> <a class="code" href="group__hawki__obj__det.html#ga7255ba5ecf2bd6539c02c1f7d765e593" title="Compare two objects positions and determine whetherthey are within a 5 pix tolerance.">hawki_match_condition_5_pix</a>
+<a name="l00076"></a><a class="code" href="group__hawki__obj__det.html#ga7255ba5ecf2bd6539c02c1f7d765e593">00076</a> (cpl_table * catalogue1,
+<a name="l00077"></a>00077 cpl_table * catalogue2,
+<a name="l00078"></a>00078 <span class="keywordtype">int</span> iobj1,
+<a name="l00079"></a>00079 <span class="keywordtype">int</span> iobj2)
+<a name="l00080"></a>00080 {
+<a name="l00081"></a>00081 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> max_dist2 = 25;
+<a name="l00082"></a>00082
+<a name="l00083"></a>00083 <span class="keywordtype">int</span> null;
+<a name="l00084"></a>00084 <span class="keywordtype">double</span> posx1;
+<a name="l00085"></a>00085 <span class="keywordtype">double</span> posy1;
+<a name="l00086"></a>00086 <span class="keywordtype">double</span> posx2;
+<a name="l00087"></a>00087 <span class="keywordtype">double</span> posy2;
+<a name="l00088"></a>00088 <span class="keywordtype">double</span> dist2;
+<a name="l00089"></a>00089
+<a name="l00090"></a>00090 posx1 =
+<a name="l00091"></a>00091 cpl_table_get_double(catalogue1, HAWKI_COL_OBJ_POSX, iobj1, &null);
+<a name="l00092"></a>00092 posy1 =
+<a name="l00093"></a>00093 cpl_table_get_double(catalogue1, HAWKI_COL_OBJ_POSY, iobj1, &null);
+<a name="l00094"></a>00094 posx2 =
+<a name="l00095"></a>00095 cpl_table_get_double(catalogue2, HAWKI_COL_OBJ_POSX, iobj2, &null);
+<a name="l00096"></a>00096 posy2 =
+<a name="l00097"></a>00097 cpl_table_get_double(catalogue2, HAWKI_COL_OBJ_POSY, iobj2, &null);
+<a name="l00098"></a>00098
+<a name="l00099"></a>00099 dist2 = (posx1 - posx2) * (posx1 - posx2) + (posy1 - posy2) * (posy1 - posy2);
+<a name="l00100"></a>00100 <span class="keywordflow">if</span>(dist2 <= max_dist2)
+<a name="l00101"></a>00101 <span class="keywordflow">return</span> 1;
+<a name="l00102"></a>00102
+<a name="l00103"></a>00103 <span class="keywordflow">return</span> 0;
+<a name="l00104"></a>00104 }
+<a name="l00105"></a>00105
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__match__cats_8h_source.html b/html/hawki__match__cats_8h_source.html
new file mode 100644
index 0000000..1014677
--- /dev/null
+++ b/html/hawki__match__cats_8h_source.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_match_cats.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_match_cats.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_match_cats.h,v 1.1 2009/11/26 09:52:32 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/11/26 09:52:32 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_MATCH_CATS_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_MATCH_CATS_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="keywordtype">int</span> <a class="code" href="group__hawki__obj__det.html#ga7255ba5ecf2bd6539c02c1f7d765e593" title="Compare two objects positions and determine whetherthey are within a 5 pix tolerance.">hawki_match_condition_5_pix</a>
+<a name="l00038"></a>00038 (cpl_table * catalogue1,
+<a name="l00039"></a>00039 cpl_table * catalogue2,
+<a name="l00040"></a>00040 <span class="keywordtype">int</span> iobj1,
+<a name="l00041"></a>00041 <span class="keywordtype">int</span> iobj2);
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__obj__det_8c_source.html b/html/hawki__obj__det_8c_source.html
new file mode 100644
index 0000000..887487e
--- /dev/null
+++ b/html/hawki__obj__det_8c_source.html
@@ -0,0 +1,157 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_obj_det.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_obj_det.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_obj_det.c,v 1.2 2009/09/29 09:13:00 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/09/29 09:13:00 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.2 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_obj_det.h"</span>
+<a name="l00045"></a>00045
+<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00054"></a>00054 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00067"></a>00067 <span class="keywordtype">int</span> <a class="code" href="group__hawki__obj__det.html#ga0968e63931fcc72c55c4bc0e34f71dbb" title="Compute statistics on the object properties.">hawki_obj_prop_stats</a>
+<a name="l00068"></a><a class="code" href="group__hawki__obj__det.html#ga0968e63931fcc72c55c4bc0e34f71dbb">00068</a> (cpl_table ** objs_prop, cpl_propertylist ** objs_prop_stats)
+<a name="l00069"></a>00069 {
+<a name="l00070"></a>00070 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00071"></a>00071 <span class="keywordtype">int</span> idet;
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="comment">/* Checking input */</span>
+<a name="l00074"></a>00074 <span class="keywordflow">if</span>(objs_prop == NULL || objs_prop_stats == NULL)
+<a name="l00075"></a>00075 {
+<a name="l00076"></a>00076 cpl_msg_error(__func__, <span class="stringliteral">"The property list or the tel table is null"</span>);
+<a name="l00077"></a>00077 <span class="keywordflow">return</span> -1;
+<a name="l00078"></a>00078 }
+<a name="l00079"></a>00079
+<a name="l00080"></a>00080 <span class="comment">/* Compute the statistics */</span>
+<a name="l00081"></a>00081 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00082"></a>00082 {
+<a name="l00083"></a>00083 cpl_propertylist_append_double
+<a name="l00084"></a>00084 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ANGLE MEAN"</span>,
+<a name="l00085"></a>00085 cpl_table_get_column_mean(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+<a name="l00086"></a>00086 cpl_propertylist_append_double
+<a name="l00087"></a>00087 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ANGLE MED"</span>,
+<a name="l00088"></a>00088 cpl_table_get_column_median(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+<a name="l00089"></a>00089 cpl_propertylist_append_double
+<a name="l00090"></a>00090 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ANGLE MIN"</span>,
+<a name="l00091"></a>00091 cpl_table_get_column_min(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+<a name="l00092"></a>00092 cpl_propertylist_append_double
+<a name="l00093"></a>00093 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ANGLE MAX"</span>,
+<a name="l00094"></a>00094 cpl_table_get_column_max(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+<a name="l00095"></a>00095 cpl_propertylist_append_double
+<a name="l00096"></a>00096 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ANGLE STDEV"</span>,
+<a name="l00097"></a>00097 cpl_table_get_column_stdev(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
+<a name="l00098"></a>00098
+<a name="l00099"></a>00099 cpl_propertylist_append_double
+<a name="l00100"></a>00100 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ELLIP MEAN"</span>,
+<a name="l00101"></a>00101 cpl_table_get_column_mean(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+<a name="l00102"></a>00102 cpl_propertylist_append_double
+<a name="l00103"></a>00103 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ELLIP MED"</span>,
+<a name="l00104"></a>00104 cpl_table_get_column_median(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+<a name="l00105"></a>00105 cpl_propertylist_append_double
+<a name="l00106"></a>00106 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ELLIP MIN"</span>,
+<a name="l00107"></a>00107 cpl_table_get_column_min(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+<a name="l00108"></a>00108 cpl_propertylist_append_double
+<a name="l00109"></a>00109 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ELLIP MAX"</span>,
+<a name="l00110"></a>00110 cpl_table_get_column_max(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+<a name="l00111"></a>00111 cpl_propertylist_append_double
+<a name="l00112"></a>00112 (objs_prop_stats[idet], <span class="stringliteral">"ESO QC OBJ ELLIP STDEV"</span>,
+<a name="l00113"></a>00113 cpl_table_get_column_stdev(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
+<a name="l00114"></a>00114 }
+<a name="l00115"></a>00115
+<a name="l00116"></a>00116 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00117"></a>00117 <span class="keywordflow">return</span> -1;
+<a name="l00118"></a>00118 <span class="keywordflow">return</span> 0;
+<a name="l00119"></a>00119 }
+<a name="l00120"></a>00120
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__obj__det_8h_source.html b/html/hawki__obj__det_8h_source.html
new file mode 100644
index 0000000..d05ec5a
--- /dev/null
+++ b/html/hawki__obj__det_8h_source.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_obj_det.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_obj_det.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_obj_det.h,v 1.1 2008/10/22 10:42:04 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2008/10/22 10:42:04 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_OBJ_DET_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_OBJ_DET_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="keywordtype">int</span> <a class="code" href="group__hawki__obj__det.html#ga0968e63931fcc72c55c4bc0e34f71dbb" title="Compute statistics on the object properties.">hawki_obj_prop_stats</a>
+<a name="l00038"></a>00038 (cpl_table ** objs_prop, cpl_propertylist ** objs_prop_stats);
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__pfits_8c_source.html b/html/hawki__pfits_8c_source.html
new file mode 100644
index 0000000..6003fce
--- /dev/null
+++ b/html/hawki__pfits_8c_source.html
@@ -0,0 +1,499 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_pfits.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_pfits.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_pfits.c,v 1.18 2010/02/23 10:58:44 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/02/23 10:58:44 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.18 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00047"></a>00047
+<a name="l00050"></a>00050 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00051"></a>00051 <span class="comment"> Function codes</span>
+<a name="l00052"></a>00052 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00053"></a>00053
+<a name="l00054"></a>00054 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00060"></a>00060 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00061"></a><a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df">00061</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00062"></a>00062 {
+<a name="l00063"></a>00063 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AIRM START"</span>) ;
+<a name="l00064"></a>00064 }
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00072"></a>00072 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00073"></a><a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3">00073</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00074"></a>00074 {
+<a name="l00075"></a>00075 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AIRM END"</span>) ;
+<a name="l00076"></a>00076 }
+<a name="l00077"></a>00077
+<a name="l00078"></a>00078 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00084"></a>00084 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00085"></a><a class="code" href="group__hawki__pfits.html#ga643c35f35f7f49a3e1c6bafd022e364a">00085</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga643c35f35f7f49a3e1c6bafd022e364a" title="find out the humidity level">hawki_pfits_get_humidity_level</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00086"></a>00086 {
+<a name="l00087"></a>00087 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI RHUM"</span>) ;
+<a name="l00088"></a>00088 }
+<a name="l00089"></a>00089
+<a name="l00090"></a>00090 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00096"></a>00096 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00097"></a><a class="code" href="group__hawki__pfits.html#gad9c95c0d3bc75d347bf9acbcb8fe549d">00097</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#gad9c95c0d3bc75d347bf9acbcb8fe549d" title="find out the PRO.CATG">hawki_pfits_get_procatg</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00098"></a>00098 {
+<a name="l00099"></a>00099 <span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> *) cpl_propertylist_get_string(plist, <span class="stringliteral">"ESO PRO CATG"</span>);
+<a name="l00100"></a>00100 }
+<a name="l00101"></a>00101
+<a name="l00102"></a>00102 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00110"></a>00110 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00111"></a><a class="code" href="group__hawki__pfits.html#ga36892dc77006059ba553e9a98c9b55fc">00111</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga36892dc77006059ba553e9a98c9b55fc" title="find out the target RA">hawki_pfits_get_targ_alpha</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00112"></a>00112 {
+<a name="l00113"></a>00113 <span class="keywordtype">double</span> alpha_coded;
+<a name="l00114"></a>00114 <span class="keywordtype">double</span> ra_hh, ra_mm, ra_ss;
+<a name="l00115"></a>00115 <span class="keywordtype">double</span> ra_deg;
+<a name="l00116"></a>00116 alpha_coded = cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL TARG ALPHA"</span>);
+<a name="l00117"></a>00117 ra_hh = (int)(alpha_coded / 10000);
+<a name="l00118"></a>00118 ra_mm = (int)((alpha_coded - ra_hh * 10000) / 100);
+<a name="l00119"></a>00119 ra_ss = alpha_coded - ra_hh * 10000 - ra_mm * 100;
+<a name="l00120"></a>00120 ra_deg = ra_hh * 15. + ra_mm / 4. + ra_ss / 240.;
+<a name="l00121"></a>00121 <span class="keywordflow">return</span> ra_deg;
+<a name="l00122"></a>00122 }
+<a name="l00123"></a>00123
+<a name="l00124"></a>00124 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00132"></a>00132 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00133"></a><a class="code" href="group__hawki__pfits.html#ga0330c53376304376257417ea4edbee5c">00133</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga0330c53376304376257417ea4edbee5c" title="find out the target DEC">hawki_pfits_get_targ_delta</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00134"></a>00134 {
+<a name="l00135"></a>00135 <span class="keywordtype">double</span> delta_coded;
+<a name="l00136"></a>00136 <span class="keywordtype">double</span> dec_dd, dec_mm, dec_ss;
+<a name="l00137"></a>00137 <span class="keywordtype">double</span> dec_deg;
+<a name="l00138"></a>00138 delta_coded = cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL TARG DELTA"</span>);
+<a name="l00139"></a>00139 dec_dd = (int)(delta_coded / 10000);
+<a name="l00140"></a>00140 dec_mm = (int)((delta_coded - dec_dd * 10000) / 100);
+<a name="l00141"></a>00141 dec_ss = delta_coded - dec_dd * 10000 - dec_mm * 100;
+<a name="l00142"></a>00142 dec_deg = dec_dd + dec_mm / 60. + dec_ss / 3600.;
+<a name="l00143"></a>00143 <span class="keywordflow">return</span> dec_deg;
+<a name="l00144"></a>00144 }
+<a name="l00145"></a>00145
+<a name="l00146"></a>00146 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00153"></a>00153 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00154"></a><a class="code" href="group__hawki__pfits.html#ga662be8ce410cbfa244f51ec8e5f0baad">00154</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga662be8ce410cbfa244f51ec8e5f0baad" title="find out the target equinox">hawki_pfits_get_targ_equinox</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00155"></a>00155 {
+<a name="l00156"></a>00156 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL TARG EQUINOX"</span>) ;
+<a name="l00157"></a>00157 }
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00166"></a>00166 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00167"></a><a class="code" href="group__hawki__pfits.html#ga07110c618d0772882174838d8ce9a168">00167</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga07110c618d0772882174838d8ce9a168" title="find out the target epoch">hawki_pfits_get_targ_epoch</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00168"></a>00168 {
+<a name="l00169"></a>00169 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL TARG EPOCH"</span>) ;
+<a name="l00170"></a>00170 }
+<a name="l00171"></a>00171
+<a name="l00172"></a>00172 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00178"></a>00178 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00179"></a><a class="code" href="group__hawki__pfits.html#ga6f490d48a329331dc3b1bc48c1e9ed1d">00179</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga6f490d48a329331dc3b1bc48c1e9ed1d" title="find out the RA">hawki_pfits_get_ra</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00180"></a>00180 {
+<a name="l00181"></a>00181 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"RA"</span>) ;
+<a name="l00182"></a>00182 }
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00190"></a>00190 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00191"></a><a class="code" href="group__hawki__pfits.html#gaca47ff94f05c2bb322ea83ce4cf9b4d4">00191</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaca47ff94f05c2bb322ea83ce4cf9b4d4" title="find out the DEC">hawki_pfits_get_dec</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00192"></a>00192 {
+<a name="l00193"></a>00193 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"DEC"</span>) ;
+<a name="l00194"></a>00194 }
+<a name="l00195"></a>00195
+<a name="l00196"></a>00196 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00202"></a>00202 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00203"></a><a class="code" href="group__hawki__pfits.html#ga5161743d5b650a637d543959b5bd54ea">00203</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#ga5161743d5b650a637d543959b5bd54ea" title="find out the extname">hawki_pfits_get_extname</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00204"></a>00204 {
+<a name="l00205"></a>00205 <span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> *) cpl_propertylist_get_string(plist, <span class="stringliteral">"EXTNAME"</span>);
+<a name="l00206"></a>00206 }
+<a name="l00207"></a>00207
+<a name="l00208"></a>00208 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00214"></a>00214 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00215"></a><a class="code" href="group__hawki__pfits.html#gae4f45ff97625d37b9354392b0c5e1056">00215</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#gae4f45ff97625d37b9354392b0c5e1056" title="find out the arcfile">hawki_pfits_get_arcfile</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00216"></a>00216 {
+<a name="l00217"></a>00217 <span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> *) cpl_propertylist_get_string(plist, <span class="stringliteral">"ARCFILE"</span>);
+<a name="l00218"></a>00218 }
+<a name="l00219"></a>00219
+<a name="l00220"></a>00220 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00226"></a>00226 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00227"></a><a class="code" href="group__hawki__pfits.html#ga87aca0d821694845e43e06dca5ace1a0">00227</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#ga87aca0d821694845e43e06dca5ace1a0" title="find out the date of observation">hawki_pfits_get_date_obs</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00228"></a>00228 {
+<a name="l00229"></a>00229 <span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> *) cpl_propertylist_get_string(plist, <span class="stringliteral">"DATE-OBS"</span>) ;
+<a name="l00230"></a>00230 }
+<a name="l00231"></a>00231
+<a name="l00232"></a>00232 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00238"></a>00238 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00239"></a><a class="code" href="group__hawki__pfits.html#gae157c2c48d5b4e41ffafef1348c939d2">00239</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#gae157c2c48d5b4e41ffafef1348c939d2" title="find out the NEXP value">hawki_pfits_get_nexp</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00240"></a>00240 {
+<a name="l00241"></a>00241 <span class="keywordflow">return</span> cpl_propertylist_get_int(plist, <span class="stringliteral">"ESO TPL NEXP"</span>) ;
+<a name="l00242"></a>00242 }
+<a name="l00243"></a>00243
+<a name="l00244"></a>00244 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00250"></a>00250 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00251"></a><a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f">00251</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00252"></a>00252 {
+<a name="l00253"></a>00253 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO DET DIT"</span>) ;
+<a name="l00254"></a>00254 }
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00262"></a>00262 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00263"></a><a class="code" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788">00263</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788" title="find out the NDIT value">hawki_pfits_get_ndit</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00264"></a>00264 {
+<a name="l00265"></a>00265 <span class="keywordflow">return</span> cpl_propertylist_get_int(plist, <span class="stringliteral">"ESO DET NDIT"</span>) ;
+<a name="l00266"></a>00266 }
+<a name="l00267"></a>00267
+<a name="l00268"></a>00268 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00274"></a>00274 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00275"></a><a class="code" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190">00275</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190" title="find out the NDSAMPLES value">hawki_pfits_get_ndsamples</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00276"></a>00276 {
+<a name="l00277"></a>00277 <span class="keywordflow">return</span> cpl_propertylist_get_int(plist, <span class="stringliteral">"ESO DET NDSAMPLES"</span>) ;
+<a name="l00278"></a>00278 }
+<a name="l00279"></a>00279
+<a name="l00280"></a>00280 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00286"></a>00286 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00287"></a><a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b">00287</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b" title="find out the pixel scale">hawki_pfits_get_pixscale</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00288"></a>00288 {
+<a name="l00289"></a>00289 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO INS PIXSCALE"</span>) ;
+<a name="l00290"></a>00290 }
+<a name="l00291"></a>00291
+<a name="l00292"></a>00292 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00298"></a>00298 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00299"></a><a class="code" href="group__hawki__pfits.html#ga509576593bbfc282745eae7d29a89102">00299</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#ga509576593bbfc282745eae7d29a89102" title="Get the number of pixels in axis 1.">hawki_pfits_get_naxis1</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00300"></a>00300 {
+<a name="l00301"></a>00301 <span class="keywordflow">return</span> cpl_propertylist_get_int(plist, <span class="stringliteral">"NAXIS1"</span>) ;
+<a name="l00302"></a>00302 }
+<a name="l00303"></a>00303
+<a name="l00304"></a>00304 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00310"></a>00310 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00311"></a><a class="code" href="group__hawki__pfits.html#gaabcefe7bbad8cb43ad652970057d0356">00311</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#gaabcefe7bbad8cb43ad652970057d0356" title="Get the number of pixels in axis 2.">hawki_pfits_get_naxis2</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00312"></a>00312 {
+<a name="l00313"></a>00313 <span class="keywordflow">return</span> cpl_propertylist_get_int(plist, <span class="stringliteral">"NAXIS2"</span>) ;
+<a name="l00314"></a>00314 }
+<a name="l00315"></a>00315
+<a name="l00316"></a>00316 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00322"></a>00322 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00323"></a><a class="code" href="group__hawki__pfits.html#ga98f777c6f085878ba095b1ccd40ef6ea">00323</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga98f777c6f085878ba095b1ccd40ef6ea" title="find out the value in WCS coordinates of the reference pixel (axe 1)">hawki_pfits_get_crval1</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00324"></a>00324 {
+<a name="l00325"></a>00325 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"CRVAL1"</span>) ;
+<a name="l00326"></a>00326 }
+<a name="l00327"></a>00327
+<a name="l00328"></a>00328 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00334"></a>00334 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00335"></a><a class="code" href="group__hawki__pfits.html#ga7fbf6de80172c991e4a9d7f427741692">00335</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga7fbf6de80172c991e4a9d7f427741692" title="find out the value in WCS coordinates of the reference pixel (axe 2)">hawki_pfits_get_crval2</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00336"></a>00336 {
+<a name="l00337"></a>00337 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"CRVAL2"</span>) ;
+<a name="l00338"></a>00338 }
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00346"></a>00346 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00347"></a><a class="code" href="group__hawki__pfits.html#gaaeee5723004e441f48fb8cc804370f80">00347</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaaeee5723004e441f48fb8cc804370f80" title="find out the reference pixel in axe 1">hawki_pfits_get_crpix1</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00348"></a>00348 {
+<a name="l00349"></a>00349 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"CRPIX1"</span>) ;
+<a name="l00350"></a>00350 }
+<a name="l00351"></a>00351
+<a name="l00352"></a>00352 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00358"></a>00358 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00359"></a><a class="code" href="group__hawki__pfits.html#gaab4e70f9071230674a49cb8df1975f10">00359</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaab4e70f9071230674a49cb8df1975f10" title="find out the reference pixel in axe 1">hawki_pfits_get_crpix2</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00360"></a>00360 {
+<a name="l00361"></a>00361 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"CRPIX2"</span>) ;
+<a name="l00362"></a>00362 }
+<a name="l00363"></a>00363
+<a name="l00364"></a>00364 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00370"></a>00370 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00371"></a><a class="code" href="group__hawki__pfits.html#ga39d06faa1dcc2d3601e07e79064f9e78">00371</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga39d06faa1dcc2d3601e07e79064f9e78" title="find out the increment of coordinate in one pixel (axe 1)">hawki_pfits_get_cdelta1</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00372"></a>00372 {
+<a name="l00373"></a>00373 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"CDELTA1"</span>) ;
+<a name="l00374"></a>00374 }
+<a name="l00375"></a>00375
+<a name="l00376"></a>00376 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00382"></a>00382 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00383"></a><a class="code" href="group__hawki__pfits.html#gaeea4d2dba260fc663a4aa5d5a616086c">00383</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaeea4d2dba260fc663a4aa5d5a616086c" title="find out the increment of coordinate in one pixel (axe 2)">hawki_pfits_get_cdelta2</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00384"></a>00384 {
+<a name="l00385"></a>00385 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"CDELTA2"</span>) ;
+<a name="l00386"></a>00386 }
+<a name="l00387"></a>00387
+<a name="l00388"></a>00388 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00394"></a>00394 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00395"></a><a class="code" href="group__hawki__pfits.html#ga62ff6ef5b06d163b64e8eff779e5fb53">00395</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga62ff6ef5b06d163b64e8eff779e5fb53" title="find out the cumulative offset in alpha">hawki_pfits_get_cumoffseta</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00396"></a>00396 {
+<a name="l00397"></a>00397 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO SEQ CUMOFFSETA"</span>) ;
+<a name="l00398"></a>00398 }
+<a name="l00399"></a>00399
+<a name="l00400"></a>00400 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00406"></a>00406 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00407"></a><a class="code" href="group__hawki__pfits.html#ga0f4a0efe2116535b882eddeeb272042d">00407</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga0f4a0efe2116535b882eddeeb272042d" title="find out the cumulative offset in delta">hawki_pfits_get_cumoffsetd</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00408"></a>00408 {
+<a name="l00409"></a>00409 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO SEQ CUMOFFSETD"</span>) ;
+<a name="l00410"></a>00410 }
+<a name="l00411"></a>00411
+<a name="l00412"></a>00412 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00418"></a>00418 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00419"></a><a class="code" href="group__hawki__pfits.html#ga8074b7ef4524abfeb10bef68c4cfdf5e">00419</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga8074b7ef4524abfeb10bef68c4cfdf5e" title="find out the cumulative offset in X">hawki_pfits_get_cumoffsetx</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00420"></a>00420 {
+<a name="l00421"></a>00421 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO SEQ CUMOFFSETX"</span>) ;
+<a name="l00422"></a>00422 }
+<a name="l00423"></a>00423
+<a name="l00424"></a>00424 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00430"></a>00430 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00431"></a><a class="code" href="group__hawki__pfits.html#ga21f640e98b8f695ac6229e9f15d46aca">00431</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga21f640e98b8f695ac6229e9f15d46aca" title="find out the cumulative offset in Y">hawki_pfits_get_cumoffsety</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00432"></a>00432 {
+<a name="l00433"></a>00433 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO SEQ CUMOFFSETY"</span>) ;
+<a name="l00434"></a>00434 }
+<a name="l00435"></a>00435
+<a name="l00436"></a>00436 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00442"></a>00442 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00443"></a><a class="code" href="group__hawki__pfits.html#ga88a2db02738f3881bad0e2bde2768951">00443</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga88a2db02738f3881bad0e2bde2768951" title="find out the position angle">hawki_pfits_get_posangle</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00444"></a>00444 {
+<a name="l00445"></a>00445 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO ADA POSANG"</span>) ;
+<a name="l00446"></a>00446 }
+<a name="l00447"></a>00447
+<a name="l00448"></a>00448 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00454"></a>00454 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00455"></a><a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501">00455</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501" title="find out which wave band is active">hawki_pfits_get_filter</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00456"></a>00456 {
+<a name="l00457"></a>00457 <span class="keyword">const</span> <span class="keywordtype">char</span> * val ;
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 val = cpl_propertylist_get_string(plist, <span class="stringliteral">"ESO INS FILT1 NAME"</span>) ;
+<a name="l00460"></a>00460 <span class="keywordflow">if</span> (val == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00461"></a>00461 <span class="comment">/* If FILT1 is not open, return its value */</span>
+<a name="l00462"></a>00462 <span class="keywordflow">if</span> (strcmp(val, <span class="stringliteral">"open"</span>) && strcmp(val, <span class="stringliteral">"OPEN"</span>)) <span class="keywordflow">return</span> val ;
+<a name="l00463"></a>00463 <span class="comment">/* FILT1 is open, return value from FILT2 */</span>
+<a name="l00464"></a>00464 val = cpl_propertylist_get_string(plist, <span class="stringliteral">"ESO INS FILT2 NAME"</span>) ;
+<a name="l00465"></a>00465 <span class="keywordflow">if</span> (val == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00466"></a>00466 <span class="keywordflow">if</span> (strcmp(val, <span class="stringliteral">"open"</span>) && strcmp(val, <span class="stringliteral">"OPEN"</span>)) <span class="keywordflow">return</span> val ;
+<a name="l00467"></a>00467 <span class="keywordflow">return</span> NULL ;
+<a name="l00468"></a>00468 }
+<a name="l00469"></a>00469
+<a name="l00470"></a>00470 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00476"></a>00476 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00477"></a><a class="code" href="group__hawki__pfits.html#ga1cd57f592c68d5e084ee049bdbe979a4">00477</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga1cd57f592c68d5e084ee049bdbe979a4" title="find out the focus position of M2">hawki_pfits_get_focus</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00478"></a>00478 {
+<a name="l00479"></a>00479 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL FOCU VALUE"</span>) ;
+<a name="l00480"></a>00480 }
+<a name="l00481"></a>00481
+<a name="l00482"></a>00482 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00488"></a>00488 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00489"></a><a class="code" href="group__hawki__pfits.html#ga965d40d225307d5a40d697a0a532f246">00489</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga965d40d225307d5a40d697a0a532f246" title="find out the telescope altitude">hawki_pfits_get_elevation</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00490"></a>00490 {
+<a name="l00491"></a>00491 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL ALT"</span>) ;
+<a name="l00492"></a>00492 }
+<a name="l00493"></a>00493
+<a name="l00494"></a>00494 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00500"></a>00500 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00501"></a><a class="code" href="group__hawki__pfits.html#gaf18030b75b198e924f296cdd13356b58">00501</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaf18030b75b198e924f296cdd13356b58" title="find out the telescope azimut">hawki_pfits_get_azimut</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00502"></a>00502 {
+<a name="l00503"></a>00503 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AZ"</span>) ;
+<a name="l00504"></a>00504 }
+<a name="l00505"></a>00505
+<a name="l00506"></a>00506 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00512"></a>00512 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00513"></a><a class="code" href="group__hawki__pfits.html#gafc9299ed697db3ecfd1bb4c7e548cf3b">00513</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gafc9299ed697db3ecfd1bb4c7e548cf3b" title="find out the relative humidity">hawki_pfits_get_relhum</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00514"></a>00514 {
+<a name="l00515"></a>00515 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI RHUM"</span>) ;
+<a name="l00516"></a>00516 }
+<a name="l00517"></a>00517
+<a name="l00518"></a>00518 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00524"></a>00524 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00525"></a><a class="code" href="group__hawki__pfits.html#gaab1203aaa32935d1e81db6bb0aeec96b">00525</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaab1203aaa32935d1e81db6bb0aeec96b" title="find out the average coherence time">hawki_pfits_get_tau0</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00526"></a>00526 {
+<a name="l00527"></a>00527 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI TAU0"</span>) ;
+<a name="l00528"></a>00528 }
+<a name="l00529"></a>00529
+<a name="l00530"></a>00530 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00536"></a>00536 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00537"></a><a class="code" href="group__hawki__pfits.html#gae4c54267b67c5efdcf93afb99ecaeb3b">00537</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gae4c54267b67c5efdcf93afb99ecaeb3b" title="find out the ambient temperatur">hawki_pfits_get_obs_temp</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00538"></a>00538 {
+<a name="l00539"></a>00539 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI TEMP"</span>) ;
+<a name="l00540"></a>00540 }
+<a name="l00541"></a>00541
+<a name="l00542"></a>00542 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00548"></a>00548 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00549"></a><a class="code" href="group__hawki__pfits.html#ga7bd674c51f4cd62ce34c208888cea125">00549</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga7bd674c51f4cd62ce34c208888cea125" title="find out the wind direction">hawki_pfits_get_wind_dir</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00550"></a>00550 {
+<a name="l00551"></a>00551 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI WINDDIR"</span>) ;
+<a name="l00552"></a>00552 }
+<a name="l00553"></a>00553
+<a name="l00554"></a>00554 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00560"></a>00560 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00561"></a><a class="code" href="group__hawki__pfits.html#ga45e0b30ba22df26f4d061dee26735708">00561</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga45e0b30ba22df26f4d061dee26735708" title="find out the wind speed">hawki_pfits_get_wind_speed</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00562"></a>00562 {
+<a name="l00563"></a>00563 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI WINDSP"</span>) ;
+<a name="l00564"></a>00564 }
+<a name="l00565"></a>00565
+<a name="l00566"></a>00566 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00572"></a>00572 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00573"></a><a class="code" href="group__hawki__pfits.html#gac9b88815381f3f61c10dc88730d77121">00573</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gac9b88815381f3f61c10dc88730d77121" title="find out the fwhm from the AO system">hawki_pfits_get_ao_fwhm</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00574"></a>00574 {
+<a name="l00575"></a>00575 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL IA FWHM"</span>) ;
+<a name="l00576"></a>00576 }
+<a name="l00577"></a>00577
+<a name="l00578"></a>00578 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00584"></a>00584 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00585"></a><a class="code" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2">00585</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2" title="find out the absolute rotator position at start">hawki_pfits_get_rotator_start</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00586"></a>00586 {
+<a name="l00587"></a>00587 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO ADA ABSROT START"</span>) ;
+<a name="l00588"></a>00588 }
+<a name="l00589"></a>00589
+<a name="l00590"></a>00590 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00596"></a>00596 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00597"></a><a class="code" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2">00597</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2" title="find out the absolute rotator position at end">hawki_pfits_get_rotator_end</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00598"></a>00598 {
+<a name="l00599"></a>00599 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO ADA ABSROT END"</span>) ;
+<a name="l00600"></a>00600 }
+<a name="l00601"></a>00601
+<a name="l00602"></a>00602 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00608"></a>00608 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00609"></a><a class="code" href="group__hawki__pfits.html#gae005518fe79a76ee9b1cea2c3403a259">00609</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gae005518fe79a76ee9b1cea2c3403a259" title="find out the observatory seeing at start">hawki_pfits_get_obs_seeing_start</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00610"></a>00610 {
+<a name="l00611"></a>00611 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI FWHM START"</span>) ;
+<a name="l00612"></a>00612 }
+<a name="l00613"></a>00613
+<a name="l00614"></a>00614 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00620"></a>00620 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00621"></a><a class="code" href="group__hawki__pfits.html#gaa400a879086340c841865fc6c2a1cc21">00621</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaa400a879086340c841865fc6c2a1cc21" title="find out the observatory seeing at end">hawki_pfits_get_obs_seeing_end</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00622"></a>00622 {
+<a name="l00623"></a>00623 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI FWHM END"</span>) ;
+<a name="l00624"></a>00624 }
+<a name="l00625"></a>00625
+<a name="l00626"></a>00626 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00632"></a>00632 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00633"></a><a class="code" href="group__hawki__pfits.html#ga87d6ba1cd310181f2eab02fc4688bad4">00633</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga87d6ba1cd310181f2eab02fc4688bad4" title="find out the observatory atmospheric pressure at start">hawki_pfits_get_pressure_start</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00634"></a>00634 {
+<a name="l00635"></a>00635 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI PRES START"</span>) ;
+<a name="l00636"></a>00636 }
+<a name="l00637"></a>00637
+<a name="l00638"></a>00638 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00644"></a>00644 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00645"></a><a class="code" href="group__hawki__pfits.html#ga11eecff7f4c8031ff6ea929e15c20813">00645</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga11eecff7f4c8031ff6ea929e15c20813" title="find out the observatory atmospheric pressure at end">hawki_pfits_get_pressure_end</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00646"></a>00646 {
+<a name="l00647"></a>00647 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL AMBI PRES END"</span>) ;
+<a name="l00648"></a>00648 }
+<a name="l00649"></a>00649
+<a name="l00650"></a>00650 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00656"></a>00656 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00657"></a><a class="code" href="group__hawki__pfits.html#ga2dc1b31621ecbeec49d3e390ad601274">00657</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga2dc1b31621ecbeec49d3e390ad601274" title="find out the paralactic angle at start">hawki_pfits_get_parangle_start</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00658"></a>00658 {
+<a name="l00659"></a>00659 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL PARANG START"</span>) ;
+<a name="l00660"></a>00660 }
+<a name="l00661"></a>00661
+<a name="l00662"></a>00662 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00668"></a>00668 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00669"></a><a class="code" href="group__hawki__pfits.html#ga3465a5cbb9e21e8cbd7680affc75355b">00669</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga3465a5cbb9e21e8cbd7680affc75355b" title="find out the paralactic angle at start">hawki_pfits_get_parangle_end</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00670"></a>00670 {
+<a name="l00671"></a>00671 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO TEL PARANG END"</span>) ;
+<a name="l00672"></a>00672 }
+<a name="l00673"></a>00673
+<a name="l00674"></a>00674 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00680"></a>00680 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00681"></a>00681
+<a name="l00682"></a><a class="code" href="group__hawki__pfits.html#ga24483514187ce9bcf0860cc654b8508c">00682</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga24483514187ce9bcf0860cc654b8508c" title="find out the cumulative X offset of the combined image">hawki_pfits_get_comb_cumoffsetx</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00683"></a>00683 {
+<a name="l00684"></a>00684 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO QC COMBINED CUMOFFSETX"</span>);
+<a name="l00685"></a>00685 }
+<a name="l00686"></a>00686
+<a name="l00687"></a>00687 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00693"></a>00693 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00694"></a><a class="code" href="group__hawki__pfits.html#gadc1b3f141f5474486b5b32502634b29a">00694</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gadc1b3f141f5474486b5b32502634b29a" title="find out the cumulative Y offset of the combined image">hawki_pfits_get_comb_cumoffsety</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00695"></a>00695 {
+<a name="l00696"></a>00696 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO QC COMBINED CUMOFFSETY"</span>);
+<a name="l00697"></a>00697 }
+<a name="l00698"></a>00698
+<a name="l00699"></a>00699 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00705"></a>00705 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00706"></a><a class="code" href="group__hawki__pfits.html#ga88f1a9b44888686b6489fba06921f5a1">00706</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga88f1a9b44888686b6489fba06921f5a1" title="find out the relative X offset of the combined image wrt first image">hawki_pfits_get_comb_posx</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00707"></a>00707 {
+<a name="l00708"></a>00708 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO QC COMBINED POSX"</span>);
+<a name="l00709"></a>00709 }
+<a name="l00710"></a>00710
+<a name="l00711"></a>00711 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00717"></a>00717 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00718"></a><a class="code" href="group__hawki__pfits.html#ga5408b902329bdad15fd408d73fa6376e">00718</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga5408b902329bdad15fd408d73fa6376e" title="find out the relative Y offset of the combined image wrt first image">hawki_pfits_get_comb_posy</a>(<span class="keyword">const</span> cpl_propertylist * plist)
+<a name="l00719"></a>00719 {
+<a name="l00720"></a>00720 <span class="keywordflow">return</span> cpl_propertylist_get_double(plist, <span class="stringliteral">"ESO QC COMBINED POSY"</span>);
+<a name="l00721"></a>00721 }
+<a name="l00722"></a>00722
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__pfits_8h_source.html b/html/hawki__pfits_8h_source.html
new file mode 100644
index 0000000..7fc7393
--- /dev/null
+++ b/html/hawki__pfits_8h_source.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_pfits.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_pfits.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_pfits.h,v 1.14 2010/02/23 10:58:49 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/02/23 10:58:49 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.14 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_PFITS_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PFITS_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> Functions prototypes</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#ga5161743d5b650a637d543959b5bd54ea" title="find out the extname">hawki_pfits_get_extname</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00042"></a>00042 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00043"></a>00043 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00044"></a>00044 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga643c35f35f7f49a3e1c6bafd022e364a" title="find out the humidity level">hawki_pfits_get_humidity_level</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00045"></a>00045 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga36892dc77006059ba553e9a98c9b55fc" title="find out the target RA">hawki_pfits_get_targ_alpha</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00046"></a>00046 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga0330c53376304376257417ea4edbee5c" title="find out the target DEC">hawki_pfits_get_targ_delta</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00047"></a>00047 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga662be8ce410cbfa244f51ec8e5f0baad" title="find out the target equinox">hawki_pfits_get_targ_equinox</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00048"></a>00048 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga07110c618d0772882174838d8ce9a168" title="find out the target epoch">hawki_pfits_get_targ_epoch</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00049"></a>00049 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga6f490d48a329331dc3b1bc48c1e9ed1d" title="find out the RA">hawki_pfits_get_ra</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00050"></a>00050 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaca47ff94f05c2bb322ea83ce4cf9b4d4" title="find out the DEC">hawki_pfits_get_dec</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00051"></a>00051 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#gae4f45ff97625d37b9354392b0c5e1056" title="find out the arcfile">hawki_pfits_get_arcfile</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00052"></a>00052 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#gad9c95c0d3bc75d347bf9acbcb8fe549d" title="find out the PRO.CATG">hawki_pfits_get_procatg</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00053"></a>00053 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#ga87aca0d821694845e43e06dca5ace1a0" title="find out the date of observation">hawki_pfits_get_date_obs</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00054"></a>00054 <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#ga509576593bbfc282745eae7d29a89102" title="Get the number of pixels in axis 1.">hawki_pfits_get_naxis1</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00055"></a>00055 <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#gaabcefe7bbad8cb43ad652970057d0356" title="Get the number of pixels in axis 2.">hawki_pfits_get_naxis2</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00056"></a>00056 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga98f777c6f085878ba095b1ccd40ef6ea" title="find out the value in WCS coordinates of the reference pixel (axe 1)">hawki_pfits_get_crval1</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00057"></a>00057 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga7fbf6de80172c991e4a9d7f427741692" title="find out the value in WCS coordinates of the reference pixel (axe 2)">hawki_pfits_get_crval2</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00058"></a>00058 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaaeee5723004e441f48fb8cc804370f80" title="find out the reference pixel in axe 1">hawki_pfits_get_crpix1</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00059"></a>00059 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaab4e70f9071230674a49cb8df1975f10" title="find out the reference pixel in axe 1">hawki_pfits_get_crpix2</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00060"></a>00060 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga39d06faa1dcc2d3601e07e79064f9e78" title="find out the increment of coordinate in one pixel (axe 1)">hawki_pfits_get_cdelta1</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00061"></a>00061 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaeea4d2dba260fc663a4aa5d5a616086c" title="find out the increment of coordinate in one pixel (axe 2)">hawki_pfits_get_cdelta2</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00062"></a>00062 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b" title="find out the pixel scale">hawki_pfits_get_pixscale</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00063"></a>00063 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga62ff6ef5b06d163b64e8eff779e5fb53" title="find out the cumulative offset in alpha">hawki_pfits_get_cumoffseta</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00064"></a>00064 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga0f4a0efe2116535b882eddeeb272042d" title="find out the cumulative offset in delta">hawki_pfits_get_cumoffsetd</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00065"></a>00065 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga8074b7ef4524abfeb10bef68c4cfdf5e" title="find out the cumulative offset in X">hawki_pfits_get_cumoffsetx</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00066"></a>00066 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga21f640e98b8f695ac6229e9f15d46aca" title="find out the cumulative offset in Y">hawki_pfits_get_cumoffsety</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00067"></a>00067 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga88a2db02738f3881bad0e2bde2768951" title="find out the position angle">hawki_pfits_get_posangle</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00068"></a>00068 <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#gae157c2c48d5b4e41ffafef1348c939d2" title="find out the NEXP value">hawki_pfits_get_nexp</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00069"></a>00069 <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788" title="find out the NDIT value">hawki_pfits_get_ndit</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00070"></a>00070 <span class="keywordtype">int</span> <a class="code" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190" title="find out the NDSAMPLES value">hawki_pfits_get_ndsamples</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00071"></a>00071 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00072"></a>00072 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501" title="find out which wave band is active">hawki_pfits_get_filter</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00073"></a>00073 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga1cd57f592c68d5e084ee049bdbe979a4" title="find out the focus position of M2">hawki_pfits_get_focus</a>(<span class="keyword">const</span> cpl_propertylist * plist) ;
+<a name="l00074"></a>00074 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga965d40d225307d5a40d697a0a532f246" title="find out the telescope altitude">hawki_pfits_get_elevation</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00075"></a>00075 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaf18030b75b198e924f296cdd13356b58" title="find out the telescope azimut">hawki_pfits_get_azimut</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00076"></a>00076 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gafc9299ed697db3ecfd1bb4c7e548cf3b" title="find out the relative humidity">hawki_pfits_get_relhum</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00077"></a>00077 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaab1203aaa32935d1e81db6bb0aeec96b" title="find out the average coherence time">hawki_pfits_get_tau0</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00078"></a>00078 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gae4c54267b67c5efdcf93afb99ecaeb3b" title="find out the ambient temperatur">hawki_pfits_get_obs_temp</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00079"></a>00079 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga7bd674c51f4cd62ce34c208888cea125" title="find out the wind direction">hawki_pfits_get_wind_dir</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00080"></a>00080 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga45e0b30ba22df26f4d061dee26735708" title="find out the wind speed">hawki_pfits_get_wind_speed</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00081"></a>00081 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gac9b88815381f3f61c10dc88730d77121" title="find out the fwhm from the AO system">hawki_pfits_get_ao_fwhm</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00082"></a>00082 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2" title="find out the absolute rotator position at start">hawki_pfits_get_rotator_start</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00083"></a>00083 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2" title="find out the absolute rotator position at end">hawki_pfits_get_rotator_end</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00084"></a>00084 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gae005518fe79a76ee9b1cea2c3403a259" title="find out the observatory seeing at start">hawki_pfits_get_obs_seeing_start</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00085"></a>00085 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gaa400a879086340c841865fc6c2a1cc21" title="find out the observatory seeing at end">hawki_pfits_get_obs_seeing_end</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00086"></a>00086 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga87d6ba1cd310181f2eab02fc4688bad4" title="find out the observatory atmospheric pressure at start">hawki_pfits_get_pressure_start</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00087"></a>00087 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga11eecff7f4c8031ff6ea929e15c20813" title="find out the observatory atmospheric pressure at end">hawki_pfits_get_pressure_end</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00088"></a>00088 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga2dc1b31621ecbeec49d3e390ad601274" title="find out the paralactic angle at start">hawki_pfits_get_parangle_start</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00089"></a>00089 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga3465a5cbb9e21e8cbd7680affc75355b" title="find out the paralactic angle at start">hawki_pfits_get_parangle_end</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00090"></a>00090 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga24483514187ce9bcf0860cc654b8508c" title="find out the cumulative X offset of the combined image">hawki_pfits_get_comb_cumoffsetx</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00091"></a>00091 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#gadc1b3f141f5474486b5b32502634b29a" title="find out the cumulative Y offset of the combined image">hawki_pfits_get_comb_cumoffsety</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00092"></a>00092 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga88f1a9b44888686b6489fba06921f5a1" title="find out the relative X offset of the combined image wrt first image">hawki_pfits_get_comb_posx</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00093"></a>00093 <span class="keywordtype">double</span> <a class="code" href="group__hawki__pfits.html#ga5408b902329bdad15fd408d73fa6376e" title="find out the relative Y offset of the combined image wrt first image">hawki_pfits_get_comb_posy</a>(<span class="keyword">const</span> cpl_propertylist * plist);
+<a name="l00094"></a>00094
+<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__properties__tel_8c_source.html b/html/hawki__properties__tel_8c_source.html
new file mode 100644
index 0000000..ccd1bcc
--- /dev/null
+++ b/html/hawki__properties__tel_8c_source.html
@@ -0,0 +1,846 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_properties_tel.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_properties_tel.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_properties_tel.c,v 1.2 2008/07/08 14:23:18 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2008/07/08 14:23:18 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.2 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_properties_tel.h"</span>
+<a name="l00044"></a>00044
+<a name="l00045"></a>00045 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00049"></a>00049 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050
+<a name="l00053"></a>00053 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00070"></a>00070 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00071"></a>00071
+<a name="l00072"></a><a class="code" href="group__hawki__properties__tel.html#ga2895d7c995564a2bbbdcab5c195cfac9">00072</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__properties__tel.html#ga2895d7c995564a2bbbdcab5c195cfac9" title="Initialize the table with all the telescope data columns.">hawki_prop_tel_initialize</a>(cpl_table * telescope_prop)
+<a name="l00073"></a>00073 {
+<a name="l00074"></a>00074 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00075"></a>00075 cpl_table_new_column(telescope_prop,
+<a name="l00076"></a>00076 HAWKI_COL_RAW_JITTER_QC_TEL_ALT,
+<a name="l00077"></a>00077 CPL_TYPE_DOUBLE);
+<a name="l00078"></a>00078 cpl_table_new_column(telescope_prop,
+<a name="l00079"></a>00079 HAWKI_COL_RAW_JITTER_QC_TEL_AZ,
+<a name="l00080"></a>00080 CPL_TYPE_DOUBLE);
+<a name="l00081"></a>00081 cpl_table_new_column(telescope_prop,
+<a name="l00082"></a>00082 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM,
+<a name="l00083"></a>00083 CPL_TYPE_DOUBLE);
+<a name="l00084"></a>00084 cpl_table_new_column(telescope_prop,
+<a name="l00085"></a>00085 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0,
+<a name="l00086"></a>00086 CPL_TYPE_DOUBLE);
+<a name="l00087"></a>00087 cpl_table_new_column(telescope_prop,
+<a name="l00088"></a>00088 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP,
+<a name="l00089"></a>00089 CPL_TYPE_DOUBLE);
+<a name="l00090"></a>00090 cpl_table_new_column(telescope_prop,
+<a name="l00091"></a>00091 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR,
+<a name="l00092"></a>00092 CPL_TYPE_DOUBLE);
+<a name="l00093"></a>00093 cpl_table_new_column(telescope_prop,
+<a name="l00094"></a>00094 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP,
+<a name="l00095"></a>00095 CPL_TYPE_DOUBLE);
+<a name="l00096"></a>00096 cpl_table_new_column(telescope_prop,
+<a name="l00097"></a>00097 HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM,
+<a name="l00098"></a>00098 CPL_TYPE_DOUBLE);
+<a name="l00099"></a>00099 cpl_table_new_column(telescope_prop,
+<a name="l00100"></a>00100 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START,
+<a name="l00101"></a>00101 CPL_TYPE_DOUBLE);
+<a name="l00102"></a>00102 cpl_table_new_column(telescope_prop,
+<a name="l00103"></a>00103 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END,
+<a name="l00104"></a>00104 CPL_TYPE_DOUBLE);
+<a name="l00105"></a>00105 cpl_table_new_column(telescope_prop,
+<a name="l00106"></a>00106 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA,
+<a name="l00107"></a>00107 CPL_TYPE_DOUBLE);
+<a name="l00108"></a>00108 cpl_table_new_column(telescope_prop,
+<a name="l00109"></a>00109 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START,
+<a name="l00110"></a>00110 CPL_TYPE_DOUBLE);
+<a name="l00111"></a>00111 cpl_table_new_column(telescope_prop,
+<a name="l00112"></a>00112 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END,
+<a name="l00113"></a>00113 CPL_TYPE_DOUBLE);
+<a name="l00114"></a>00114 cpl_table_new_column(telescope_prop,
+<a name="l00115"></a>00115 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM,
+<a name="l00116"></a>00116 CPL_TYPE_DOUBLE);
+<a name="l00117"></a>00117 cpl_table_new_column(telescope_prop,
+<a name="l00118"></a>00118 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START,
+<a name="l00119"></a>00119 CPL_TYPE_DOUBLE);
+<a name="l00120"></a>00120 cpl_table_new_column(telescope_prop,
+<a name="l00121"></a>00121 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END,
+<a name="l00122"></a>00122 CPL_TYPE_DOUBLE);
+<a name="l00123"></a>00123 cpl_table_new_column(telescope_prop,
+<a name="l00124"></a>00124 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM,
+<a name="l00125"></a>00125 CPL_TYPE_DOUBLE);
+<a name="l00126"></a>00126 cpl_table_new_column(telescope_prop,
+<a name="l00127"></a>00127 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START,
+<a name="l00128"></a>00128 CPL_TYPE_DOUBLE);
+<a name="l00129"></a>00129 cpl_table_new_column(telescope_prop,
+<a name="l00130"></a>00130 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END,
+<a name="l00131"></a>00131 CPL_TYPE_DOUBLE);
+<a name="l00132"></a>00132 cpl_table_new_column(telescope_prop,
+<a name="l00133"></a>00133 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES,
+<a name="l00134"></a>00134 CPL_TYPE_DOUBLE);
+<a name="l00135"></a>00135 cpl_table_new_column(telescope_prop,
+<a name="l00136"></a>00136 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START,
+<a name="l00137"></a>00137 CPL_TYPE_DOUBLE);
+<a name="l00138"></a>00138 cpl_table_new_column(telescope_prop,
+<a name="l00139"></a>00139 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END,
+<a name="l00140"></a>00140 CPL_TYPE_DOUBLE);
+<a name="l00141"></a>00141 cpl_table_new_column(telescope_prop,
+<a name="l00142"></a>00142 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG,
+<a name="l00143"></a>00143 CPL_TYPE_DOUBLE);
+<a name="l00144"></a>00144 cpl_table_new_column(telescope_prop,
+<a name="l00145"></a>00145 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA,
+<a name="l00146"></a>00146 CPL_TYPE_DOUBLE);
+<a name="l00147"></a>00147 cpl_table_new_column(telescope_prop,
+<a name="l00148"></a>00148 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA,
+<a name="l00149"></a>00149 CPL_TYPE_DOUBLE);
+<a name="l00150"></a>00150 cpl_table_new_column(telescope_prop,
+<a name="l00151"></a>00151 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD,
+<a name="l00152"></a>00152 CPL_TYPE_DOUBLE);
+<a name="l00153"></a>00153 cpl_table_new_column(telescope_prop,
+<a name="l00154"></a>00154 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX,
+<a name="l00155"></a>00155 CPL_TYPE_DOUBLE);
+<a name="l00156"></a>00156 cpl_table_new_column(telescope_prop,
+<a name="l00157"></a>00157 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY,
+<a name="l00158"></a>00158 CPL_TYPE_DOUBLE);
+<a name="l00159"></a>00159 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00160"></a>00160 <span class="keywordflow">return</span> -1;
+<a name="l00161"></a>00161 <span class="keywordflow">return</span> 0;
+<a name="l00162"></a>00162 }
+<a name="l00163"></a>00163
+<a name="l00164"></a>00164 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00186"></a>00186 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00187"></a>00187 <span class="keywordtype">int</span> <a class="code" href="group__hawki__properties__tel.html#gaedbe52365a410453e02d6b36d9d1b612" title="Extracts all the QC keywords and append them to the table.">hawki_extract_prop_tel_qc</a>
+<a name="l00188"></a><a class="code" href="group__hawki__properties__tel.html#gaedbe52365a410453e02d6b36d9d1b612">00188</a> (<span class="keyword">const</span> cpl_propertylist * all_property_list,
+<a name="l00189"></a>00189 cpl_table * telescope_prop,
+<a name="l00190"></a>00190 <span class="keywordtype">int</span> irow)
+<a name="l00191"></a>00191 {
+<a name="l00192"></a>00192 <span class="keywordtype">int</span> ncol;
+<a name="l00193"></a>00193 <span class="keywordtype">int</span> nused;
+<a name="l00194"></a>00194 <span class="keywordtype">double</span> temp_val;
+<a name="l00195"></a>00195 <span class="keywordtype">double</span> temp_start;
+<a name="l00196"></a>00196 <span class="keywordtype">double</span> temp_end;
+<a name="l00197"></a>00197 cpl_errorstate prestate;
+<a name="l00198"></a>00198
+<a name="l00199"></a>00199 <span class="comment">/* Error check */</span>
+<a name="l00200"></a>00200 prestate = cpl_errorstate_get();
+<a name="l00201"></a>00201
+<a name="l00202"></a>00202 <span class="comment">/* Checking input */</span>
+<a name="l00203"></a>00203 <span class="keywordflow">if</span>(all_property_list == NULL || telescope_prop == NULL)
+<a name="l00204"></a>00204 {
+<a name="l00205"></a>00205 cpl_msg_error(__func__, <span class="stringliteral">"The property list or the tel table is null"</span>);
+<a name="l00206"></a>00206 <span class="keywordflow">return</span> -1;
+<a name="l00207"></a>00207 }
+<a name="l00208"></a>00208
+<a name="l00209"></a>00209 <span class="comment">/* Checking columns in the table */</span>
+<a name="l00210"></a>00210 ncol = 0;
+<a name="l00211"></a>00211 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00212"></a>00212 HAWKI_COL_RAW_JITTER_QC_TEL_ALT);
+<a name="l00213"></a>00213 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00214"></a>00214 HAWKI_COL_RAW_JITTER_QC_TEL_AZ);
+<a name="l00215"></a>00215 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00216"></a>00216 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM);
+<a name="l00217"></a>00217 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00218"></a>00218 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0);
+<a name="l00219"></a>00219 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00220"></a>00220 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP);
+<a name="l00221"></a>00221 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00222"></a>00222 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR);
+<a name="l00223"></a>00223 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00224"></a>00224 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP);
+<a name="l00225"></a>00225 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00226"></a>00226 HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM);
+<a name="l00227"></a>00227 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00228"></a>00228 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START);
+<a name="l00229"></a>00229 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00230"></a>00230 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END);
+<a name="l00231"></a>00231 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00232"></a>00232 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA);
+<a name="l00233"></a>00233 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00234"></a>00234 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START);
+<a name="l00235"></a>00235 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00236"></a>00236 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END);
+<a name="l00237"></a>00237 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00238"></a>00238 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM);
+<a name="l00239"></a>00239 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00240"></a>00240 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START);
+<a name="l00241"></a>00241 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00242"></a>00242 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END);
+<a name="l00243"></a>00243 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00244"></a>00244 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM);
+<a name="l00245"></a>00245 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00246"></a>00246 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START);
+<a name="l00247"></a>00247 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00248"></a>00248 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END);
+<a name="l00249"></a>00249 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00250"></a>00250 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES);
+<a name="l00251"></a>00251 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00252"></a>00252 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START);
+<a name="l00253"></a>00253 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00254"></a>00254 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END);
+<a name="l00255"></a>00255 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00256"></a>00256 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG);
+<a name="l00257"></a>00257 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00258"></a>00258 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA);
+<a name="l00259"></a>00259 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00260"></a>00260 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA);
+<a name="l00261"></a>00261 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00262"></a>00262 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD);
+<a name="l00263"></a>00263 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00264"></a>00264 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX);
+<a name="l00265"></a>00265 ncol += cpl_table_has_column(telescope_prop,
+<a name="l00266"></a>00266 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY);
+<a name="l00267"></a>00267 <span class="keywordflow">if</span>(ncol != 28)
+<a name="l00268"></a>00268 {
+<a name="l00269"></a>00269 cpl_msg_error(__func__,<span class="stringliteral">"Table does not have the proper format"</span>);
+<a name="l00270"></a>00270 <span class="keywordflow">return</span> -1;
+<a name="l00271"></a>00271 }
+<a name="l00272"></a>00272
+<a name="l00273"></a>00273
+<a name="l00274"></a>00274 <span class="comment">/* Getting and saving the keywords */</span>
+<a name="l00275"></a>00275 cpl_table_set_double(telescope_prop,
+<a name="l00276"></a>00276 HAWKI_COL_RAW_JITTER_QC_TEL_ALT,
+<a name="l00277"></a>00277 irow,
+<a name="l00278"></a>00278 <a class="code" href="group__hawki__pfits.html#ga965d40d225307d5a40d697a0a532f246" title="find out the telescope altitude">hawki_pfits_get_elevation</a>(all_property_list));
+<a name="l00279"></a>00279 cpl_table_set_double(telescope_prop,
+<a name="l00280"></a>00280 HAWKI_COL_RAW_JITTER_QC_TEL_AZ,
+<a name="l00281"></a>00281 irow,
+<a name="l00282"></a>00282 <a class="code" href="group__hawki__pfits.html#gaf18030b75b198e924f296cdd13356b58" title="find out the telescope azimut">hawki_pfits_get_azimut</a>(all_property_list));
+<a name="l00283"></a>00283 cpl_table_set_double(telescope_prop,
+<a name="l00284"></a>00284 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM,
+<a name="l00285"></a>00285 irow,
+<a name="l00286"></a>00286 <a class="code" href="group__hawki__pfits.html#gafc9299ed697db3ecfd1bb4c7e548cf3b" title="find out the relative humidity">hawki_pfits_get_relhum</a>(all_property_list));
+<a name="l00287"></a>00287 cpl_table_set_double(telescope_prop,
+<a name="l00288"></a>00288 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0,
+<a name="l00289"></a>00289 irow,
+<a name="l00290"></a>00290 <a class="code" href="group__hawki__pfits.html#gaab1203aaa32935d1e81db6bb0aeec96b" title="find out the average coherence time">hawki_pfits_get_tau0</a>(all_property_list));
+<a name="l00291"></a>00291 cpl_table_set_double(telescope_prop,
+<a name="l00292"></a>00292 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP,
+<a name="l00293"></a>00293 irow,
+<a name="l00294"></a>00294 <a class="code" href="group__hawki__pfits.html#gae4c54267b67c5efdcf93afb99ecaeb3b" title="find out the ambient temperatur">hawki_pfits_get_obs_temp</a>(all_property_list));
+<a name="l00295"></a>00295 cpl_table_set_double(telescope_prop,
+<a name="l00296"></a>00296 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR,
+<a name="l00297"></a>00297 irow,
+<a name="l00298"></a>00298 <a class="code" href="group__hawki__pfits.html#ga7bd674c51f4cd62ce34c208888cea125" title="find out the wind direction">hawki_pfits_get_wind_dir</a>(all_property_list));
+<a name="l00299"></a>00299 cpl_table_set_double(telescope_prop,
+<a name="l00300"></a>00300 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP,
+<a name="l00301"></a>00301 irow,
+<a name="l00302"></a>00302 <a class="code" href="group__hawki__pfits.html#ga45e0b30ba22df26f4d061dee26735708" title="find out the wind speed">hawki_pfits_get_wind_speed</a>(all_property_list));
+<a name="l00303"></a>00303 cpl_table_set_double(telescope_prop,
+<a name="l00304"></a>00304 HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM,
+<a name="l00305"></a>00305 irow,
+<a name="l00306"></a>00306 <a class="code" href="group__hawki__pfits.html#gac9b88815381f3f61c10dc88730d77121" title="find out the fwhm from the AO system">hawki_pfits_get_ao_fwhm</a>(all_property_list));
+<a name="l00307"></a>00307 cpl_table_set_double(telescope_prop,
+<a name="l00308"></a>00308 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START,
+<a name="l00309"></a>00309 irow,
+<a name="l00310"></a>00310 <a class="code" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2" title="find out the absolute rotator position at start">hawki_pfits_get_rotator_start</a>(all_property_list));
+<a name="l00311"></a>00311 cpl_table_set_double(telescope_prop,
+<a name="l00312"></a>00312 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END,
+<a name="l00313"></a>00313 irow,
+<a name="l00314"></a>00314 <a class="code" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2" title="find out the absolute rotator position at end">hawki_pfits_get_rotator_end</a>(all_property_list));
+<a name="l00315"></a>00315 cpl_table_set_double(telescope_prop,
+<a name="l00316"></a>00316 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START,
+<a name="l00317"></a>00317 irow,
+<a name="l00318"></a>00318 <a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(all_property_list));
+<a name="l00319"></a>00319 cpl_table_set_double(telescope_prop,
+<a name="l00320"></a>00320 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END,
+<a name="l00321"></a>00321 irow,
+<a name="l00322"></a>00322 <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(all_property_list));
+<a name="l00323"></a>00323 cpl_table_set_double(telescope_prop,
+<a name="l00324"></a>00324 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START,
+<a name="l00325"></a>00325 irow,
+<a name="l00326"></a>00326 <a class="code" href="group__hawki__pfits.html#gae005518fe79a76ee9b1cea2c3403a259" title="find out the observatory seeing at start">hawki_pfits_get_obs_seeing_start</a>(all_property_list));
+<a name="l00327"></a>00327 cpl_table_set_double(telescope_prop,
+<a name="l00328"></a>00328 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END,
+<a name="l00329"></a>00329 irow,
+<a name="l00330"></a>00330 <a class="code" href="group__hawki__pfits.html#gaa400a879086340c841865fc6c2a1cc21" title="find out the observatory seeing at end">hawki_pfits_get_obs_seeing_end</a>(all_property_list));
+<a name="l00331"></a>00331 cpl_table_set_double(telescope_prop,
+<a name="l00332"></a>00332 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START,
+<a name="l00333"></a>00333 irow,
+<a name="l00334"></a>00334 <a class="code" href="group__hawki__pfits.html#ga87d6ba1cd310181f2eab02fc4688bad4" title="find out the observatory atmospheric pressure at start">hawki_pfits_get_pressure_start</a>(all_property_list));
+<a name="l00335"></a>00335 cpl_table_set_double(telescope_prop,
+<a name="l00336"></a>00336 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END,
+<a name="l00337"></a>00337 irow,
+<a name="l00338"></a>00338 <a class="code" href="group__hawki__pfits.html#ga11eecff7f4c8031ff6ea929e15c20813" title="find out the observatory atmospheric pressure at end">hawki_pfits_get_pressure_end</a>(all_property_list));
+<a name="l00339"></a>00339 cpl_table_set_double(telescope_prop,
+<a name="l00340"></a>00340 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START,
+<a name="l00341"></a>00341 irow,
+<a name="l00342"></a>00342 <a class="code" href="group__hawki__pfits.html#ga2dc1b31621ecbeec49d3e390ad601274" title="find out the paralactic angle at start">hawki_pfits_get_parangle_start</a>(all_property_list));
+<a name="l00343"></a>00343 cpl_table_set_double(telescope_prop,
+<a name="l00344"></a>00344 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END,
+<a name="l00345"></a>00345 irow,
+<a name="l00346"></a>00346 <a class="code" href="group__hawki__pfits.html#ga3465a5cbb9e21e8cbd7680affc75355b" title="find out the paralactic angle at start">hawki_pfits_get_parangle_end</a>(all_property_list));
+<a name="l00347"></a>00347 cpl_table_set_double(telescope_prop,
+<a name="l00348"></a>00348 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETA,
+<a name="l00349"></a>00349 irow,
+<a name="l00350"></a>00350 <a class="code" href="group__hawki__pfits.html#ga62ff6ef5b06d163b64e8eff779e5fb53" title="find out the cumulative offset in alpha">hawki_pfits_get_cumoffseta</a>(all_property_list));
+<a name="l00351"></a>00351 cpl_table_set_double(telescope_prop,
+<a name="l00352"></a>00352 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETD,
+<a name="l00353"></a>00353 irow,
+<a name="l00354"></a>00354 <a class="code" href="group__hawki__pfits.html#ga0f4a0efe2116535b882eddeeb272042d" title="find out the cumulative offset in delta">hawki_pfits_get_cumoffsetd</a>(all_property_list));
+<a name="l00355"></a>00355 cpl_table_set_double(telescope_prop,
+<a name="l00356"></a>00356 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETX,
+<a name="l00357"></a>00357 irow,
+<a name="l00358"></a>00358 <a class="code" href="group__hawki__pfits.html#ga8074b7ef4524abfeb10bef68c4cfdf5e" title="find out the cumulative offset in X">hawki_pfits_get_cumoffsetx</a>(all_property_list));
+<a name="l00359"></a>00359 cpl_table_set_double(telescope_prop,
+<a name="l00360"></a>00360 HAWKI_COL_RAW_JITTER_QC_SEQ_CUMOFFSETY,
+<a name="l00361"></a>00361 irow,
+<a name="l00362"></a>00362 <a class="code" href="group__hawki__pfits.html#ga21f640e98b8f695ac6229e9f15d46aca" title="find out the cumulative offset in Y">hawki_pfits_get_cumoffsety</a>(all_property_list));
+<a name="l00363"></a>00363
+<a name="l00364"></a>00364
+<a name="l00365"></a>00365 <span class="comment">/* Compute and write derived quantities */</span>
+<a name="l00366"></a>00366 temp_val = <a class="code" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2" title="find out the absolute rotator position at end">hawki_pfits_get_rotator_end</a>(all_property_list) -
+<a name="l00367"></a>00367 <a class="code" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2" title="find out the absolute rotator position at start">hawki_pfits_get_rotator_start</a>(all_property_list);
+<a name="l00368"></a>00368 cpl_table_set_double(telescope_prop,
+<a name="l00369"></a>00369 HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA,
+<a name="l00370"></a>00370 irow,
+<a name="l00371"></a>00371 temp_val);
+<a name="l00372"></a>00372
+<a name="l00373"></a>00373 temp_val = (<a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(all_property_list) +
+<a name="l00374"></a>00374 <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(all_property_list) ) / 2.0;
+<a name="l00375"></a>00375 cpl_table_set_double(telescope_prop,
+<a name="l00376"></a>00376 HAWKI_COL_RAW_JITTER_QC_TEL_AIRM,
+<a name="l00377"></a>00377 irow,
+<a name="l00378"></a>00378 temp_val);
+<a name="l00379"></a>00379
+<a name="l00380"></a>00380 <span class="comment">//The "mean" FWHM is computed rejecting one of the values if </span>
+<a name="l00381"></a>00381 <span class="comment">//is equal to -1. If both are -1, the mean FWHM is -1.</span>
+<a name="l00382"></a>00382 temp_start = <a class="code" href="group__hawki__pfits.html#gae005518fe79a76ee9b1cea2c3403a259" title="find out the observatory seeing at start">hawki_pfits_get_obs_seeing_start</a>(all_property_list);
+<a name="l00383"></a>00383 temp_end = <a class="code" href="group__hawki__pfits.html#gaa400a879086340c841865fc6c2a1cc21" title="find out the observatory seeing at end">hawki_pfits_get_obs_seeing_end</a>(all_property_list);
+<a name="l00384"></a>00384 temp_val = 0;
+<a name="l00385"></a>00385 nused = 0;
+<a name="l00386"></a>00386 <span class="keywordflow">if</span>(temp_start != -1)
+<a name="l00387"></a>00387 {
+<a name="l00388"></a>00388 temp_val += temp_start;
+<a name="l00389"></a>00389 nused++;
+<a name="l00390"></a>00390 }
+<a name="l00391"></a>00391 <span class="keywordflow">if</span>(temp_end != -1)
+<a name="l00392"></a>00392 {
+<a name="l00393"></a>00393 temp_val += temp_end;
+<a name="l00394"></a>00394 nused++;
+<a name="l00395"></a>00395 }
+<a name="l00396"></a>00396 <span class="keywordflow">if</span>(nused != 0)
+<a name="l00397"></a>00397 temp_val = temp_val / nused;
+<a name="l00398"></a>00398 <span class="keywordflow">else</span>
+<a name="l00399"></a>00399 temp_val = -1;
+<a name="l00400"></a>00400 cpl_table_set_double(telescope_prop,
+<a name="l00401"></a>00401 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM,
+<a name="l00402"></a>00402 irow,
+<a name="l00403"></a>00403 temp_val);
+<a name="l00404"></a>00404
+<a name="l00405"></a>00405 temp_val = (<a class="code" href="group__hawki__pfits.html#ga87d6ba1cd310181f2eab02fc4688bad4" title="find out the observatory atmospheric pressure at start">hawki_pfits_get_pressure_start</a>(all_property_list) +
+<a name="l00406"></a>00406 <a class="code" href="group__hawki__pfits.html#ga11eecff7f4c8031ff6ea929e15c20813" title="find out the observatory atmospheric pressure at end">hawki_pfits_get_pressure_end</a>(all_property_list) ) / 2.0;
+<a name="l00407"></a>00407 cpl_table_set_double(telescope_prop,
+<a name="l00408"></a>00408 HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES,
+<a name="l00409"></a>00409 irow,
+<a name="l00410"></a>00410 temp_val);
+<a name="l00411"></a>00411
+<a name="l00412"></a>00412 temp_val = (<a class="code" href="group__hawki__pfits.html#ga2dc1b31621ecbeec49d3e390ad601274" title="find out the paralactic angle at start">hawki_pfits_get_parangle_start</a>(all_property_list) +
+<a name="l00413"></a>00413 <a class="code" href="group__hawki__pfits.html#ga3465a5cbb9e21e8cbd7680affc75355b" title="find out the paralactic angle at start">hawki_pfits_get_parangle_end</a>(all_property_list) ) / 2.0;
+<a name="l00414"></a>00414 cpl_table_set_double(telescope_prop,
+<a name="l00415"></a>00415 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG,
+<a name="l00416"></a>00416 irow,
+<a name="l00417"></a>00417 temp_val);
+<a name="l00418"></a>00418
+<a name="l00419"></a>00419 temp_val = <a class="code" href="group__hawki__pfits.html#gac8b9879cdc3c2e82f3b169eef3355ef2" title="find out the absolute rotator position at end">hawki_pfits_get_rotator_end</a>(all_property_list) -
+<a name="l00420"></a>00420 <a class="code" href="group__hawki__pfits.html#gaa91a5e47c4661209f97f4399cbceb9d2" title="find out the absolute rotator position at start">hawki_pfits_get_rotator_start</a>(all_property_list);
+<a name="l00421"></a>00421 cpl_table_set_double(telescope_prop,
+<a name="l00422"></a>00422 HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA,
+<a name="l00423"></a>00423 irow,
+<a name="l00424"></a>00424 temp_val);
+<a name="l00425"></a>00425
+<a name="l00426"></a>00426
+<a name="l00427"></a>00427 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00428"></a>00428 <span class="keywordflow">return</span> -1;
+<a name="l00429"></a>00429
+<a name="l00430"></a>00430 <span class="keywordflow">return</span> 0;
+<a name="l00431"></a>00431 }
+<a name="l00432"></a>00432
+<a name="l00433"></a>00433 <span class="keywordtype">int</span> hawki_compute_prop_tel_qc_stats
+<a name="l00434"></a>00434 (<span class="keyword">const</span> cpl_table * telescope_prop,
+<a name="l00435"></a>00435 cpl_propertylist * stats_prop)
+<a name="l00436"></a>00436 {
+<a name="l00437"></a>00437 cpl_errorstate prestate = cpl_errorstate_get();
+<a name="l00438"></a>00438 <span class="comment">/* Checking input */</span>
+<a name="l00439"></a>00439 <span class="keywordflow">if</span>(telescope_prop == NULL || stats_prop == NULL)
+<a name="l00440"></a>00440 {
+<a name="l00441"></a>00441 cpl_msg_error(__func__, <span class="stringliteral">"The property list or the tel table is null"</span>);
+<a name="l00442"></a>00442 <span class="keywordflow">return</span> -1;
+<a name="l00443"></a>00443 }
+<a name="l00444"></a>00444
+<a name="l00445"></a>00445 <span class="comment">/* Compute the statistics */</span>
+<a name="l00446"></a>00446 cpl_propertylist_append_double
+<a name="l00447"></a>00447 (stats_prop, <span class="stringliteral">"ESO QC TEL ALT MEAN"</span>,cpl_table_get_column_mean
+<a name="l00448"></a>00448 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+<a name="l00449"></a>00449 cpl_propertylist_append_double
+<a name="l00450"></a>00450 (stats_prop, <span class="stringliteral">"ESO QC TEL ALT MED"</span>,cpl_table_get_column_median
+<a name="l00451"></a>00451 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+<a name="l00452"></a>00452 cpl_propertylist_append_double
+<a name="l00453"></a>00453 (stats_prop, <span class="stringliteral">"ESO QC TEL ALT MIN"</span>,cpl_table_get_column_min
+<a name="l00454"></a>00454 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+<a name="l00455"></a>00455 cpl_propertylist_append_double
+<a name="l00456"></a>00456 (stats_prop, <span class="stringliteral">"ESO QC TEL ALT MAX"</span>,cpl_table_get_column_max
+<a name="l00457"></a>00457 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+<a name="l00458"></a>00458 cpl_propertylist_append_double
+<a name="l00459"></a>00459 (stats_prop, <span class="stringliteral">"ESO QC TEL ALT STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00460"></a>00460 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_ALT));
+<a name="l00461"></a>00461
+<a name="l00462"></a>00462 cpl_propertylist_append_double
+<a name="l00463"></a>00463 (stats_prop, <span class="stringliteral">"ESO QC TEL AZ MEAN"</span>,cpl_table_get_column_mean
+<a name="l00464"></a>00464 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+<a name="l00465"></a>00465 cpl_propertylist_append_double
+<a name="l00466"></a>00466 (stats_prop, <span class="stringliteral">"ESO QC TEL AZ MED"</span>,cpl_table_get_column_median
+<a name="l00467"></a>00467 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+<a name="l00468"></a>00468 cpl_propertylist_append_double
+<a name="l00469"></a>00469 (stats_prop, <span class="stringliteral">"ESO QC TEL AZ MIN"</span>,cpl_table_get_column_min
+<a name="l00470"></a>00470 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+<a name="l00471"></a>00471 cpl_propertylist_append_double
+<a name="l00472"></a>00472 (stats_prop, <span class="stringliteral">"ESO QC TEL AZ MAX"</span>,cpl_table_get_column_max
+<a name="l00473"></a>00473 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+<a name="l00474"></a>00474 cpl_propertylist_append_double
+<a name="l00475"></a>00475 (stats_prop, <span class="stringliteral">"ESO QC TEL AZ STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00476"></a>00476 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AZ));
+<a name="l00477"></a>00477
+<a name="l00478"></a>00478 cpl_propertylist_append_double
+<a name="l00479"></a>00479 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI RHUM MEAN"</span>,cpl_table_get_column_mean
+<a name="l00480"></a>00480 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+<a name="l00481"></a>00481 cpl_propertylist_append_double
+<a name="l00482"></a>00482 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI RHUM MED"</span>,cpl_table_get_column_median
+<a name="l00483"></a>00483 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+<a name="l00484"></a>00484 cpl_propertylist_append_double
+<a name="l00485"></a>00485 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI RHUM MIN"</span>,cpl_table_get_column_min
+<a name="l00486"></a>00486 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+<a name="l00487"></a>00487 cpl_propertylist_append_double
+<a name="l00488"></a>00488 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI RHUM MAX"</span>,cpl_table_get_column_max
+<a name="l00489"></a>00489 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+<a name="l00490"></a>00490 cpl_propertylist_append_double
+<a name="l00491"></a>00491 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI RHUM STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00492"></a>00492 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_RHUM));
+<a name="l00493"></a>00493
+<a name="l00494"></a>00494 cpl_propertylist_append_double
+<a name="l00495"></a>00495 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TAU0 MEAN"</span>,cpl_table_get_column_mean
+<a name="l00496"></a>00496 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+<a name="l00497"></a>00497 cpl_propertylist_append_double
+<a name="l00498"></a>00498 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TAU0 MED"</span>,cpl_table_get_column_median
+<a name="l00499"></a>00499 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+<a name="l00500"></a>00500 cpl_propertylist_append_double
+<a name="l00501"></a>00501 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TAU0 MIN"</span>,cpl_table_get_column_min
+<a name="l00502"></a>00502 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+<a name="l00503"></a>00503 cpl_propertylist_append_double
+<a name="l00504"></a>00504 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TAU0 MAX"</span>,cpl_table_get_column_max
+<a name="l00505"></a>00505 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+<a name="l00506"></a>00506 cpl_propertylist_append_double
+<a name="l00507"></a>00507 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TAU0 STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00508"></a>00508 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TAU0));
+<a name="l00509"></a>00509
+<a name="l00510"></a>00510 cpl_propertylist_append_double
+<a name="l00511"></a>00511 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TEMP MEAN"</span>,cpl_table_get_column_mean
+<a name="l00512"></a>00512 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+<a name="l00513"></a>00513 cpl_propertylist_append_double
+<a name="l00514"></a>00514 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TEMP MED"</span>,cpl_table_get_column_median
+<a name="l00515"></a>00515 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+<a name="l00516"></a>00516 cpl_propertylist_append_double
+<a name="l00517"></a>00517 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TEMP MIN"</span>,cpl_table_get_column_min
+<a name="l00518"></a>00518 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+<a name="l00519"></a>00519 cpl_propertylist_append_double
+<a name="l00520"></a>00520 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TEMP MAX"</span>,cpl_table_get_column_max
+<a name="l00521"></a>00521 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+<a name="l00522"></a>00522 cpl_propertylist_append_double
+<a name="l00523"></a>00523 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI TEMP STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00524"></a>00524 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_TEMP));
+<a name="l00525"></a>00525
+<a name="l00526"></a>00526 cpl_propertylist_append_double
+<a name="l00527"></a>00527 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDDIR MEAN"</span>,cpl_table_get_column_mean
+<a name="l00528"></a>00528 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+<a name="l00529"></a>00529 cpl_propertylist_append_double
+<a name="l00530"></a>00530 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDDIR MED"</span>,cpl_table_get_column_median
+<a name="l00531"></a>00531 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+<a name="l00532"></a>00532 cpl_propertylist_append_double
+<a name="l00533"></a>00533 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDDIR MIN"</span>,cpl_table_get_column_min
+<a name="l00534"></a>00534 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+<a name="l00535"></a>00535 cpl_propertylist_append_double
+<a name="l00536"></a>00536 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDDIR MAX"</span>,cpl_table_get_column_max
+<a name="l00537"></a>00537 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+<a name="l00538"></a>00538 cpl_propertylist_append_double
+<a name="l00539"></a>00539 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDDIR STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00540"></a>00540 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDDIR));
+<a name="l00541"></a>00541
+<a name="l00542"></a>00542 cpl_propertylist_append_double
+<a name="l00543"></a>00543 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDSP MEAN"</span>,cpl_table_get_column_mean
+<a name="l00544"></a>00544 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+<a name="l00545"></a>00545 cpl_propertylist_append_double
+<a name="l00546"></a>00546 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDSP MED"</span>,cpl_table_get_column_median
+<a name="l00547"></a>00547 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+<a name="l00548"></a>00548 cpl_propertylist_append_double
+<a name="l00549"></a>00549 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDSP MIN"</span>,cpl_table_get_column_min
+<a name="l00550"></a>00550 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+<a name="l00551"></a>00551 cpl_propertylist_append_double
+<a name="l00552"></a>00552 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDSP MAX"</span>,cpl_table_get_column_max
+<a name="l00553"></a>00553 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+<a name="l00554"></a>00554 cpl_propertylist_append_double
+<a name="l00555"></a>00555 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI WINDSP STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00556"></a>00556 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_WINDSP));
+<a name="l00557"></a>00557
+<a name="l00558"></a>00558 cpl_propertylist_append_double
+<a name="l00559"></a>00559 (stats_prop, <span class="stringliteral">"ESO QC TEL IA FWHM MEAN"</span>,cpl_table_get_column_mean
+<a name="l00560"></a>00560 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+<a name="l00561"></a>00561 cpl_propertylist_append_double
+<a name="l00562"></a>00562 (stats_prop, <span class="stringliteral">"ESO QC TEL IA FWHM MED"</span>,cpl_table_get_column_median
+<a name="l00563"></a>00563 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+<a name="l00564"></a>00564 cpl_propertylist_append_double
+<a name="l00565"></a>00565 (stats_prop, <span class="stringliteral">"ESO QC TEL IA FWHM MIN"</span>,cpl_table_get_column_min
+<a name="l00566"></a>00566 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+<a name="l00567"></a>00567 cpl_propertylist_append_double
+<a name="l00568"></a>00568 (stats_prop, <span class="stringliteral">"ESO QC TEL IA FWHM MAX"</span>,cpl_table_get_column_max
+<a name="l00569"></a>00569 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+<a name="l00570"></a>00570 cpl_propertylist_append_double
+<a name="l00571"></a>00571 (stats_prop, <span class="stringliteral">"ESO QC TEL IA FWHM STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00572"></a>00572 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_IA_FWHM));
+<a name="l00573"></a>00573
+<a name="l00574"></a>00574 cpl_propertylist_append_double
+<a name="l00575"></a>00575 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT DELTA MEAN"</span>,cpl_table_get_column_mean
+<a name="l00576"></a>00576 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+<a name="l00577"></a>00577 cpl_propertylist_append_double
+<a name="l00578"></a>00578 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT DELTA MED"</span>,cpl_table_get_column_median
+<a name="l00579"></a>00579 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+<a name="l00580"></a>00580 cpl_propertylist_append_double
+<a name="l00581"></a>00581 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT DELTA MIN"</span>,cpl_table_get_column_min
+<a name="l00582"></a>00582 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+<a name="l00583"></a>00583 cpl_propertylist_append_double
+<a name="l00584"></a>00584 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT DELTA MAX"</span>,cpl_table_get_column_max
+<a name="l00585"></a>00585 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+<a name="l00586"></a>00586 cpl_propertylist_append_double
+<a name="l00587"></a>00587 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT DELTA STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00588"></a>00588 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_DELTA));
+<a name="l00589"></a>00589
+<a name="l00590"></a>00590 cpl_propertylist_append_double
+<a name="l00591"></a>00591 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT START MEAN"</span>,cpl_table_get_column_mean
+<a name="l00592"></a>00592 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+<a name="l00593"></a>00593 cpl_propertylist_append_double
+<a name="l00594"></a>00594 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT START MED"</span>,cpl_table_get_column_median
+<a name="l00595"></a>00595 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+<a name="l00596"></a>00596 cpl_propertylist_append_double
+<a name="l00597"></a>00597 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT START MIN"</span>,cpl_table_get_column_min
+<a name="l00598"></a>00598 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+<a name="l00599"></a>00599 cpl_propertylist_append_double
+<a name="l00600"></a>00600 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT START MAX"</span>,cpl_table_get_column_max
+<a name="l00601"></a>00601 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+<a name="l00602"></a>00602 cpl_propertylist_append_double
+<a name="l00603"></a>00603 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT START STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00604"></a>00604 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_START));
+<a name="l00605"></a>00605
+<a name="l00606"></a>00606 cpl_propertylist_append_double
+<a name="l00607"></a>00607 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT END MEAN"</span>,cpl_table_get_column_mean
+<a name="l00608"></a>00608 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+<a name="l00609"></a>00609 cpl_propertylist_append_double
+<a name="l00610"></a>00610 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT END MED"</span>,cpl_table_get_column_median
+<a name="l00611"></a>00611 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+<a name="l00612"></a>00612 cpl_propertylist_append_double
+<a name="l00613"></a>00613 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT END MIN"</span>,cpl_table_get_column_min
+<a name="l00614"></a>00614 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+<a name="l00615"></a>00615 cpl_propertylist_append_double
+<a name="l00616"></a>00616 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT END MAX"</span>,cpl_table_get_column_max
+<a name="l00617"></a>00617 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+<a name="l00618"></a>00618 cpl_propertylist_append_double
+<a name="l00619"></a>00619 (stats_prop, <span class="stringliteral">"ESO QC ADA ABSROT END STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00620"></a>00620 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_ADA_ABSROT_END));
+<a name="l00621"></a>00621
+<a name="l00622"></a>00622 cpl_propertylist_append_double
+<a name="l00623"></a>00623 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM MEAN"</span>,cpl_table_get_column_mean
+<a name="l00624"></a>00624 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+<a name="l00625"></a>00625 cpl_propertylist_append_double
+<a name="l00626"></a>00626 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM MED"</span>,cpl_table_get_column_median
+<a name="l00627"></a>00627 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+<a name="l00628"></a>00628 cpl_propertylist_append_double
+<a name="l00629"></a>00629 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM MIN"</span>,cpl_table_get_column_min
+<a name="l00630"></a>00630 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+<a name="l00631"></a>00631 cpl_propertylist_append_double
+<a name="l00632"></a>00632 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM MAX"</span>,cpl_table_get_column_max
+<a name="l00633"></a>00633 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+<a name="l00634"></a>00634 cpl_propertylist_append_double
+<a name="l00635"></a>00635 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00636"></a>00636 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM));
+<a name="l00637"></a>00637
+<a name="l00638"></a>00638 cpl_propertylist_append_double
+<a name="l00639"></a>00639 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM START MEAN"</span>,cpl_table_get_column_mean
+<a name="l00640"></a>00640 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+<a name="l00641"></a>00641 cpl_propertylist_append_double
+<a name="l00642"></a>00642 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM START MED"</span>,cpl_table_get_column_median
+<a name="l00643"></a>00643 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+<a name="l00644"></a>00644 cpl_propertylist_append_double
+<a name="l00645"></a>00645 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM START MIN"</span>,cpl_table_get_column_min
+<a name="l00646"></a>00646 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+<a name="l00647"></a>00647 cpl_propertylist_append_double
+<a name="l00648"></a>00648 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM START MAX"</span>,cpl_table_get_column_max
+<a name="l00649"></a>00649 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+<a name="l00650"></a>00650 cpl_propertylist_append_double
+<a name="l00651"></a>00651 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM START STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00652"></a>00652 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_START));
+<a name="l00653"></a>00653
+<a name="l00654"></a>00654 cpl_propertylist_append_double
+<a name="l00655"></a>00655 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM END MEAN"</span>,cpl_table_get_column_mean
+<a name="l00656"></a>00656 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+<a name="l00657"></a>00657 cpl_propertylist_append_double
+<a name="l00658"></a>00658 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM END MED"</span>,cpl_table_get_column_median
+<a name="l00659"></a>00659 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+<a name="l00660"></a>00660 cpl_propertylist_append_double
+<a name="l00661"></a>00661 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM END MIN"</span>,cpl_table_get_column_min
+<a name="l00662"></a>00662 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+<a name="l00663"></a>00663 cpl_propertylist_append_double
+<a name="l00664"></a>00664 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM END MAX"</span>,cpl_table_get_column_max
+<a name="l00665"></a>00665 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+<a name="l00666"></a>00666 cpl_propertylist_append_double
+<a name="l00667"></a>00667 (stats_prop, <span class="stringliteral">"ESO QC TEL AIRM END STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00668"></a>00668 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AIRM_END));
+<a name="l00669"></a>00669
+<a name="l00670"></a>00670 cpl_propertylist_append_double
+<a name="l00671"></a>00671 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM MEAN"</span>,cpl_table_get_column_mean
+<a name="l00672"></a>00672 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+<a name="l00673"></a>00673 cpl_propertylist_append_double
+<a name="l00674"></a>00674 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM MED"</span>,cpl_table_get_column_median
+<a name="l00675"></a>00675 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+<a name="l00676"></a>00676 cpl_propertylist_append_double
+<a name="l00677"></a>00677 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM MIN"</span>,cpl_table_get_column_min
+<a name="l00678"></a>00678 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+<a name="l00679"></a>00679 cpl_propertylist_append_double
+<a name="l00680"></a>00680 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM MAX"</span>,cpl_table_get_column_max
+<a name="l00681"></a>00681 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+<a name="l00682"></a>00682 cpl_propertylist_append_double
+<a name="l00683"></a>00683 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00684"></a>00684 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM));
+<a name="l00685"></a>00685
+<a name="l00686"></a>00686 cpl_propertylist_append_double
+<a name="l00687"></a>00687 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM START MEAN"</span>,cpl_table_get_column_mean
+<a name="l00688"></a>00688 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+<a name="l00689"></a>00689 cpl_propertylist_append_double
+<a name="l00690"></a>00690 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM START MED"</span>,cpl_table_get_column_median
+<a name="l00691"></a>00691 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+<a name="l00692"></a>00692 cpl_propertylist_append_double
+<a name="l00693"></a>00693 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM START MIN"</span>,cpl_table_get_column_min
+<a name="l00694"></a>00694 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+<a name="l00695"></a>00695 cpl_propertylist_append_double
+<a name="l00696"></a>00696 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM START MAX"</span>,cpl_table_get_column_max
+<a name="l00697"></a>00697 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+<a name="l00698"></a>00698 cpl_propertylist_append_double
+<a name="l00699"></a>00699 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM START STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00700"></a>00700 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_START));
+<a name="l00701"></a>00701
+<a name="l00702"></a>00702 cpl_propertylist_append_double
+<a name="l00703"></a>00703 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM END MEAN"</span>,cpl_table_get_column_mean
+<a name="l00704"></a>00704 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+<a name="l00705"></a>00705 cpl_propertylist_append_double
+<a name="l00706"></a>00706 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM END MED"</span>,cpl_table_get_column_median
+<a name="l00707"></a>00707 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+<a name="l00708"></a>00708 cpl_propertylist_append_double
+<a name="l00709"></a>00709 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM END MIN"</span>,cpl_table_get_column_min
+<a name="l00710"></a>00710 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+<a name="l00711"></a>00711 cpl_propertylist_append_double
+<a name="l00712"></a>00712 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM END MAX"</span>,cpl_table_get_column_max
+<a name="l00713"></a>00713 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+<a name="l00714"></a>00714 cpl_propertylist_append_double
+<a name="l00715"></a>00715 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI FWHM END STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00716"></a>00716 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_FWHM_END));
+<a name="l00717"></a>00717
+<a name="l00718"></a>00718 cpl_propertylist_append_double
+<a name="l00719"></a>00719 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES MEAN"</span>,cpl_table_get_column_mean
+<a name="l00720"></a>00720 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+<a name="l00721"></a>00721 cpl_propertylist_append_double
+<a name="l00722"></a>00722 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES MED"</span>,cpl_table_get_column_median
+<a name="l00723"></a>00723 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+<a name="l00724"></a>00724 cpl_propertylist_append_double
+<a name="l00725"></a>00725 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES MIN"</span>,cpl_table_get_column_min
+<a name="l00726"></a>00726 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+<a name="l00727"></a>00727 cpl_propertylist_append_double
+<a name="l00728"></a>00728 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES MAX"</span>,cpl_table_get_column_max
+<a name="l00729"></a>00729 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+<a name="l00730"></a>00730 cpl_propertylist_append_double
+<a name="l00731"></a>00731 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00732"></a>00732 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES));
+<a name="l00733"></a>00733
+<a name="l00734"></a>00734 cpl_propertylist_append_double
+<a name="l00735"></a>00735 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES START MEAN"</span>,cpl_table_get_column_mean
+<a name="l00736"></a>00736 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+<a name="l00737"></a>00737 cpl_propertylist_append_double
+<a name="l00738"></a>00738 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES START MED"</span>,cpl_table_get_column_median
+<a name="l00739"></a>00739 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+<a name="l00740"></a>00740 cpl_propertylist_append_double
+<a name="l00741"></a>00741 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES START MIN"</span>,cpl_table_get_column_min
+<a name="l00742"></a>00742 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+<a name="l00743"></a>00743 cpl_propertylist_append_double
+<a name="l00744"></a>00744 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES START MAX"</span>,cpl_table_get_column_max
+<a name="l00745"></a>00745 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+<a name="l00746"></a>00746 cpl_propertylist_append_double
+<a name="l00747"></a>00747 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES START STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00748"></a>00748 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_START));
+<a name="l00749"></a>00749
+<a name="l00750"></a>00750 cpl_propertylist_append_double
+<a name="l00751"></a>00751 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES END MEAN"</span>,cpl_table_get_column_mean
+<a name="l00752"></a>00752 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+<a name="l00753"></a>00753 cpl_propertylist_append_double
+<a name="l00754"></a>00754 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES END MED"</span>,cpl_table_get_column_median
+<a name="l00755"></a>00755 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+<a name="l00756"></a>00756 cpl_propertylist_append_double
+<a name="l00757"></a>00757 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES END MIN"</span>,cpl_table_get_column_min
+<a name="l00758"></a>00758 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+<a name="l00759"></a>00759 cpl_propertylist_append_double
+<a name="l00760"></a>00760 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES END MAX"</span>,cpl_table_get_column_max
+<a name="l00761"></a>00761 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+<a name="l00762"></a>00762 cpl_propertylist_append_double
+<a name="l00763"></a>00763 (stats_prop, <span class="stringliteral">"ESO QC TEL AMBI PRES END STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00764"></a>00764 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_AMBI_PRES_END));
+<a name="l00765"></a>00765
+<a name="l00766"></a>00766 cpl_propertylist_append_double
+<a name="l00767"></a>00767 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG MEAN"</span>,cpl_table_get_column_mean
+<a name="l00768"></a>00768 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+<a name="l00769"></a>00769 cpl_propertylist_append_double
+<a name="l00770"></a>00770 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG MED"</span>,cpl_table_get_column_median
+<a name="l00771"></a>00771 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+<a name="l00772"></a>00772 cpl_propertylist_append_double
+<a name="l00773"></a>00773 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG MIN"</span>,cpl_table_get_column_min
+<a name="l00774"></a>00774 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+<a name="l00775"></a>00775 cpl_propertylist_append_double
+<a name="l00776"></a>00776 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG MAX"</span>,cpl_table_get_column_max
+<a name="l00777"></a>00777 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+<a name="l00778"></a>00778 cpl_propertylist_append_double
+<a name="l00779"></a>00779 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00780"></a>00780 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG));
+<a name="l00781"></a>00781
+<a name="l00782"></a>00782 cpl_propertylist_append_double
+<a name="l00783"></a>00783 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG START MEAN"</span>,cpl_table_get_column_mean
+<a name="l00784"></a>00784 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+<a name="l00785"></a>00785 cpl_propertylist_append_double
+<a name="l00786"></a>00786 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG START MED"</span>,cpl_table_get_column_median
+<a name="l00787"></a>00787 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+<a name="l00788"></a>00788 cpl_propertylist_append_double
+<a name="l00789"></a>00789 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG START MIN"</span>,cpl_table_get_column_min
+<a name="l00790"></a>00790 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+<a name="l00791"></a>00791 cpl_propertylist_append_double
+<a name="l00792"></a>00792 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG START MAX"</span>,cpl_table_get_column_max
+<a name="l00793"></a>00793 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+<a name="l00794"></a>00794 cpl_propertylist_append_double
+<a name="l00795"></a>00795 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG START STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00796"></a>00796 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_START));
+<a name="l00797"></a>00797
+<a name="l00798"></a>00798 cpl_propertylist_append_double
+<a name="l00799"></a>00799 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG END MEAN"</span>,cpl_table_get_column_mean
+<a name="l00800"></a>00800 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+<a name="l00801"></a>00801 cpl_propertylist_append_double
+<a name="l00802"></a>00802 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG END MED"</span>,cpl_table_get_column_median
+<a name="l00803"></a>00803 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+<a name="l00804"></a>00804 cpl_propertylist_append_double
+<a name="l00805"></a>00805 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG END MIN"</span>,cpl_table_get_column_min
+<a name="l00806"></a>00806 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+<a name="l00807"></a>00807 cpl_propertylist_append_double
+<a name="l00808"></a>00808 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG END MAX"</span>,cpl_table_get_column_max
+<a name="l00809"></a>00809 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+<a name="l00810"></a>00810 cpl_propertylist_append_double
+<a name="l00811"></a>00811 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG END STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00812"></a>00812 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_END));
+<a name="l00813"></a>00813
+<a name="l00814"></a>00814 cpl_propertylist_append_double
+<a name="l00815"></a>00815 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG DELTA MEAN"</span>,cpl_table_get_column_mean
+<a name="l00816"></a>00816 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+<a name="l00817"></a>00817 cpl_propertylist_append_double
+<a name="l00818"></a>00818 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG DELTA MED"</span>,cpl_table_get_column_median
+<a name="l00819"></a>00819 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+<a name="l00820"></a>00820 cpl_propertylist_append_double
+<a name="l00821"></a>00821 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG DELTA MIN"</span>,cpl_table_get_column_min
+<a name="l00822"></a>00822 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+<a name="l00823"></a>00823 cpl_propertylist_append_double
+<a name="l00824"></a>00824 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG DELTA MAX"</span>,cpl_table_get_column_max
+<a name="l00825"></a>00825 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+<a name="l00826"></a>00826 cpl_propertylist_append_double
+<a name="l00827"></a>00827 (stats_prop, <span class="stringliteral">"ESO QC TEL PARANG DELTA STDEV"</span>,cpl_table_get_column_stdev
+<a name="l00828"></a>00828 (telescope_prop, HAWKI_COL_RAW_JITTER_QC_TEL_PARANG_DELTA));
+<a name="l00829"></a>00829
+<a name="l00830"></a>00830 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(prestate))
+<a name="l00831"></a>00831 <span class="keywordflow">return</span> -1;
+<a name="l00832"></a>00832 <span class="keywordflow">return</span> 0;
+<a name="l00833"></a>00833 }
+<a name="l00834"></a>00834
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__properties__tel_8h_source.html b/html/hawki__properties__tel_8h_source.html
new file mode 100644
index 0000000..272447b
--- /dev/null
+++ b/html/hawki__properties__tel_8h_source.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_properties_tel.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_properties_tel.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_properties_tel.h,v 1.1 2008/06/25 13:04:25 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2008/06/25 13:04:25 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_PROPERTIES_TEL_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PROPERTIES_TEL_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037
+<a name="l00038"></a>00038 <span class="keywordtype">int</span> <a class="code" href="group__hawki__properties__tel.html#ga2895d7c995564a2bbbdcab5c195cfac9" title="Initialize the table with all the telescope data columns.">hawki_prop_tel_initialize</a>
+<a name="l00039"></a>00039 (cpl_table * telescope_prop);
+<a name="l00040"></a>00040 <span class="keywordtype">int</span> <a class="code" href="group__hawki__properties__tel.html#gaedbe52365a410453e02d6b36d9d1b612" title="Extracts all the QC keywords and append them to the table.">hawki_extract_prop_tel_qc</a>
+<a name="l00041"></a>00041 (<span class="keyword">const</span> cpl_propertylist * all_property_list,
+<a name="l00042"></a>00042 cpl_table * telescope_prop,
+<a name="l00043"></a>00043 <span class="keywordtype">int</span> irow);
+<a name="l00044"></a>00044 <span class="keywordtype">int</span> hawki_compute_prop_tel_qc_stats
+<a name="l00045"></a>00045 (<span class="keyword">const</span> cpl_table * telescope_prop,
+<a name="l00046"></a>00046 cpl_propertylist * stats_prop);
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__saa_8c_source.html b/html/hawki__saa_8c_source.html
new file mode 100644
index 0000000..6cd6ab2
--- /dev/null
+++ b/html/hawki__saa_8c_source.html
@@ -0,0 +1,173 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_saa.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_saa.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_saa.c,v 1.10 2010/03/08 16:20:54 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/03/08 16:20:54 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.10 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_saa.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00053"></a>00053 <span class="keywordtype">int</span> hawki_geom_refine_images_offsets
+<a name="l00054"></a>00054 (cpl_imagelist * in,
+<a name="l00055"></a>00055 cpl_bivector * approx_offsets,
+<a name="l00056"></a>00056 cpl_bivector * reference_objects,
+<a name="l00057"></a>00057 <span class="keywordtype">int</span> s_hx,
+<a name="l00058"></a>00058 <span class="keywordtype">int</span> s_hy,
+<a name="l00059"></a>00059 <span class="keywordtype">int</span> m_hx,
+<a name="l00060"></a>00060 <span class="keywordtype">int</span> m_hy,
+<a name="l00061"></a>00061 cpl_bivector * refined_offsets,
+<a name="l00062"></a>00062 cpl_vector * correl)
+<a name="l00063"></a>00063 {
+<a name="l00064"></a>00064 cpl_bivector * offs_ref ;
+<a name="l00065"></a>00065 <span class="keywordtype">double</span> * offs_ref_x ;
+<a name="l00066"></a>00066 <span class="keywordtype">double</span> * offs_ref_y ;
+<a name="l00067"></a>00067 <span class="keywordtype">double</span> * correl_data ;
+<a name="l00068"></a>00068 <span class="keywordtype">int</span> nimages;
+<a name="l00069"></a>00069 <span class="keywordtype">int</span> ngood;
+<a name="l00070"></a>00070 <span class="keywordtype">int</span> i;
+<a name="l00071"></a>00071
+<a name="l00072"></a>00072 <span class="comment">/* Check entries */</span>
+<a name="l00073"></a>00073 <span class="keywordflow">if</span> (approx_offsets == NULL) <span class="keywordflow">return</span> -1;
+<a name="l00074"></a>00074 <span class="keywordflow">if</span> (refined_offsets == NULL) <span class="keywordflow">return</span> -1;
+<a name="l00075"></a>00075
+<a name="l00076"></a>00076 <span class="comment">/* Get the number of images */</span>
+<a name="l00077"></a>00077 nimages = cpl_imagelist_get_size(in) ;
+<a name="l00078"></a>00078 <span class="keywordflow">if</span> (cpl_bivector_get_size(approx_offsets) != nimages)
+<a name="l00079"></a>00079 {
+<a name="l00080"></a>00080 cpl_msg_error(__func__, <span class="stringliteral">"Invalid input objects sizes"</span>) ;
+<a name="l00081"></a>00081 <span class="keywordflow">return</span> -1;
+<a name="l00082"></a>00082 }
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 <span class="comment">/* Refine the offsets */</span>
+<a name="l00085"></a>00085 cpl_msg_info(__func__, <span class="stringliteral">"Refine the offsets"</span>) ;
+<a name="l00086"></a>00086 cpl_msg_indent_more() ;
+<a name="l00087"></a>00087 <span class="keywordflow">if</span> ((offs_ref = cpl_geom_img_offset_fine
+<a name="l00088"></a>00088 (in, approx_offsets, reference_objects,
+<a name="l00089"></a>00089 s_hx, s_hy, m_hx, m_hy, correl)) == NULL)
+<a name="l00090"></a>00090 {
+<a name="l00091"></a>00091 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot refine the offsets"</span>);
+<a name="l00092"></a>00092 cpl_vector_delete(correl) ;
+<a name="l00093"></a>00093 <span class="keywordflow">return</span> -1;
+<a name="l00094"></a>00094 }
+<a name="l00095"></a>00095
+<a name="l00096"></a>00096 <span class="comment">/* Display the results */</span>
+<a name="l00097"></a>00097 offs_ref_x = cpl_bivector_get_x_data(offs_ref) ;
+<a name="l00098"></a>00098 offs_ref_y = cpl_bivector_get_y_data(offs_ref) ;
+<a name="l00099"></a>00099 correl_data = cpl_vector_get_data(correl) ;
+<a name="l00100"></a>00100 cpl_msg_info(cpl_func, <span class="stringliteral">"Refined relative offsets [correlation factor]"</span>) ;
+<a name="l00101"></a>00101 ngood = 0 ;
+<a name="l00102"></a>00102 <span class="keywordflow">for</span> (i=0 ; i<nimages ; i++)
+<a name="l00103"></a>00103 {
+<a name="l00104"></a>00104 cpl_msg_info(cpl_func, <span class="stringliteral">"#%02d: %8.2f %8.2f [%12.2f]"</span>,
+<a name="l00105"></a>00105 i+1, offs_ref_x[i], offs_ref_y[i], correl_data[i]) ;
+<a name="l00106"></a>00106 <span class="keywordflow">if</span> (correl_data[i] > -0.5) ngood++ ;
+<a name="l00107"></a>00107 }
+<a name="l00108"></a>00108 <span class="keywordflow">if</span> (ngood == 0)
+<a name="l00109"></a>00109 {
+<a name="l00110"></a>00110 cpl_msg_error(__func__, <span class="stringliteral">"No frame correctly correlated"</span>) ;
+<a name="l00111"></a>00111 cpl_bivector_delete(offs_ref) ;
+<a name="l00112"></a>00112 cpl_vector_delete(correl) ;
+<a name="l00113"></a>00113 <span class="keywordflow">return</span> -1;
+<a name="l00114"></a>00114 }
+<a name="l00115"></a>00115 cpl_msg_indent_less();
+<a name="l00116"></a>00116
+<a name="l00117"></a>00117 <span class="comment">/* Copy the result */</span>
+<a name="l00118"></a>00118 cpl_vector_copy(cpl_bivector_get_x(refined_offsets),
+<a name="l00119"></a>00119 cpl_bivector_get_x(offs_ref));
+<a name="l00120"></a>00120 cpl_vector_copy(cpl_bivector_get_y(refined_offsets),
+<a name="l00121"></a>00121 cpl_bivector_get_y(offs_ref));
+<a name="l00122"></a>00122
+<a name="l00123"></a>00123 <span class="comment">/* Free and return */</span>
+<a name="l00124"></a>00124 cpl_bivector_delete(offs_ref);
+<a name="l00125"></a>00125 cpl_msg_indent_less() ;
+<a name="l00126"></a>00126 <span class="keywordflow">return</span> 0;
+<a name="l00127"></a>00127 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__saa_8h_source.html b/html/hawki__saa_8h_source.html
new file mode 100644
index 0000000..ce1c73a
--- /dev/null
+++ b/html/hawki__saa_8h_source.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_saa.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_saa.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_saa.h,v 1.5 2009/02/05 12:51:14 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/02/05 12:51:14 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.5 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_SAA_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_SAA_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> Prototypes</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="keywordtype">int</span> hawki_geom_refine_images_offsets
+<a name="l00042"></a>00042 (cpl_imagelist * in,
+<a name="l00043"></a>00043 cpl_bivector * approx_offsets,
+<a name="l00044"></a>00044 cpl_bivector * reference_objects,
+<a name="l00045"></a>00045 <span class="keywordtype">int</span> s_hx,
+<a name="l00046"></a>00046 <span class="keywordtype">int</span> s_hy,
+<a name="l00047"></a>00047 <span class="keywordtype">int</span> m_hx,
+<a name="l00048"></a>00048 <span class="keywordtype">int</span> m_hy,
+<a name="l00049"></a>00049 cpl_bivector * refined_offsets,
+<a name="l00050"></a>00050 cpl_vector * correl);
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__save_8c_source.html b/html/hawki__save_8c_source.html
new file mode 100644
index 0000000..ccf4ec6
--- /dev/null
+++ b/html/hawki__save_8c_source.html
@@ -0,0 +1,651 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_save.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_save.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_save.c,v 1.11 2010/11/29 03:37:15 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2010/11/29 03:37:15 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.11 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00045"></a>00045
+<a name="l00046"></a>00046 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052
+<a name="l00055"></a>00055 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00071"></a>00071 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00072"></a><a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d">00072</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(
+<a name="l00073"></a>00073 cpl_frameset * allframes,
+<a name="l00074"></a>00074 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00075"></a>00075 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00076"></a>00076 <span class="keyword">const</span> cpl_imagelist * images,
+<a name="l00077"></a>00077 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00078"></a>00078 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00079"></a>00079 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00080"></a>00080 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00081"></a>00081 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00082"></a>00082 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00083"></a>00083 {
+<a name="l00084"></a>00084 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname;
+<a name="l00085"></a>00085 cpl_propertylist * pro_list;
+<a name="l00086"></a>00086 cpl_type_bpp pixeltype;
+<a name="l00087"></a>00087 <span class="keywordtype">char</span> sval[16];
+<a name="l00088"></a>00088 <span class="keywordtype">int</span> chip_nb;
+<a name="l00089"></a>00089 <span class="keywordtype">int</span> iext;
+<a name="l00090"></a>00090
+<a name="l00091"></a>00091 <span class="comment">/* Test entries */</span>
+<a name="l00092"></a>00092 <span class="keywordflow">if</span> (allframes == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00093"></a>00093
+<a name="l00094"></a>00094 <span class="comment">/* Get a suitable reference frame */</span>
+<a name="l00095"></a>00095 <span class="keywordflow">if</span>((fname = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(allframes)) == NULL)
+<a name="l00096"></a>00096 {
+<a name="l00097"></a>00097 cpl_msg_error(__func__, <span class="stringliteral">"Could not find a suitable reference frame"</span>);
+<a name="l00098"></a>00098 <span class="keywordflow">return</span> -1;
+<a name="l00099"></a>00099 }
+<a name="l00100"></a>00100
+<a name="l00101"></a>00101 <span class="comment">/* Add the PRO keys */</span>
+<a name="l00102"></a>00102 <span class="keywordflow">if</span> (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+<a name="l00103"></a>00103 <span class="keywordflow">else</span> pro_list = cpl_propertylist_new() ;
+<a name="l00104"></a>00104 <span class="keywordflow">if</span> (protype != NULL)
+<a name="l00105"></a>00105 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+<a name="l00106"></a>00106 <span class="keywordflow">if</span> (procat != NULL)
+<a name="l00107"></a>00107 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+<a name="l00108"></a>00108
+<a name="l00109"></a>00109 <span class="comment">/* File with extensions */</span>
+<a name="l00110"></a>00110 <span class="keywordflow">if</span> (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+<a name="l00111"></a>00111 CPL_BPP_IEEE_FLOAT, recipe, pro_list, NULL,
+<a name="l00112"></a>00112 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00113"></a>00113 filename) != CPL_ERROR_NONE) {
+<a name="l00114"></a>00114 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the empty primary HDU of file %s"</span>,
+<a name="l00115"></a>00115 filename);
+<a name="l00116"></a>00116 cpl_propertylist_delete(pro_list);
+<a name="l00117"></a>00117 <span class="keywordflow">return</span> -1 ;
+<a name="l00118"></a>00118 }
+<a name="l00119"></a>00119
+<a name="l00120"></a>00120 <span class="comment">/* Delete PRO LIST */</span>
+<a name="l00121"></a>00121 cpl_propertylist_delete(pro_list);
+<a name="l00122"></a>00122
+<a name="l00123"></a>00123 <span class="comment">/* Get the file type */</span>
+<a name="l00124"></a>00124 <span class="keywordflow">if</span> (cpl_image_get_type(cpl_imagelist_get_const(images, 0)) == CPL_TYPE_INT)
+<a name="l00125"></a>00125 pixeltype = CPL_BPP_32_SIGNED ;
+<a name="l00126"></a>00126 <span class="keywordflow">else</span>
+<a name="l00127"></a>00127 pixeltype = CPL_BPP_IEEE_FLOAT ;
+<a name="l00128"></a>00128
+<a name="l00129"></a>00129 <span class="comment">/* Save the extensions */</span>
+<a name="l00130"></a>00130 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+<a name="l00131"></a>00131 cpl_propertylist * qc_ext_list;
+<a name="l00132"></a>00132
+<a name="l00133"></a>00133 <span class="comment">/* Get the chip number to store in this extension */</span>
+<a name="l00134"></a>00134 <span class="keywordflow">if</span> ((chip_nb = <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(fname, iext+1)) == -1) {
+<a name="l00135"></a>00135 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the chip for extension %d when "</span>
+<a name="l00136"></a>00136 <span class="stringliteral">"writing file %s"</span>, iext+1, filename);
+<a name="l00137"></a>00137 <span class="keywordflow">return</span> -1 ;
+<a name="l00138"></a>00138 }
+<a name="l00139"></a>00139 <span class="keywordflow">if</span> ((applists != NULL) && (applists[chip_nb-1] != NULL))
+<a name="l00140"></a>00140 qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+<a name="l00141"></a>00141 <span class="keywordflow">else</span>
+<a name="l00142"></a>00142 qc_ext_list = cpl_propertylist_new() ;
+<a name="l00143"></a>00143
+<a name="l00144"></a>00144 snprintf(sval, 16, <span class="stringliteral">"CHIP%d.INT1"</span>, chip_nb) ;
+<a name="l00145"></a>00145 cpl_propertylist_prepend_string(qc_ext_list, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00146"></a>00146 <span class="keywordflow">if</span>(cpl_image_save(cpl_imagelist_get_const(images, chip_nb-1), filename,
+<a name="l00147"></a>00147 pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+<a name="l00148"></a>00148 {
+<a name="l00149"></a>00149 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save extension %d of file %s"</span>,
+<a name="l00150"></a>00150 iext+1, filename);
+<a name="l00151"></a>00151 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00152"></a>00152 <span class="keywordflow">return</span> -1;
+<a name="l00153"></a>00153 }
+<a name="l00154"></a>00154 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00155"></a>00155 }
+<a name="l00156"></a>00156
+<a name="l00157"></a>00157 <span class="keywordflow">return</span> 0 ;
+<a name="l00158"></a>00158 }
+<a name="l00159"></a>00159
+<a name="l00160"></a>00160 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00176"></a>00176 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00177"></a>00177 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>
+<a name="l00178"></a><a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54">00178</a> (cpl_frameset * allframes,
+<a name="l00179"></a>00179 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00180"></a>00180 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00181"></a>00181 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00182"></a>00182 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00183"></a>00183 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00184"></a>00184 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00185"></a>00185 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00186"></a>00186 {
+<a name="l00187"></a>00187 cpl_propertylist * pro_list;
+<a name="l00188"></a>00188
+<a name="l00189"></a>00189 <span class="comment">/* Test entries */</span>
+<a name="l00190"></a>00190 <span class="keywordflow">if</span> (allframes == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00191"></a>00191
+<a name="l00192"></a>00192 <span class="comment">/* Add the PRO keys */</span>
+<a name="l00193"></a>00193 <span class="keywordflow">if</span> (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+<a name="l00194"></a>00194 <span class="keywordflow">else</span> pro_list = cpl_propertylist_new() ;
+<a name="l00195"></a>00195 <span class="keywordflow">if</span> (protype != NULL)
+<a name="l00196"></a>00196 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+<a name="l00197"></a>00197 <span class="keywordflow">if</span> (procat != NULL)
+<a name="l00198"></a>00198 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+<a name="l00199"></a>00199
+<a name="l00200"></a>00200 <span class="comment">/* File with extensions */</span>
+<a name="l00201"></a>00201 <span class="keywordflow">if</span> (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+<a name="l00202"></a>00202 CPL_BPP_IEEE_FLOAT, recipe, pro_list, NULL,
+<a name="l00203"></a>00203 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00204"></a>00204 filename) != CPL_ERROR_NONE) {
+<a name="l00205"></a>00205 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the empty primary HDU of file %s"</span>,
+<a name="l00206"></a>00206 filename);
+<a name="l00207"></a>00207 cpl_propertylist_delete(pro_list);
+<a name="l00208"></a>00208 <span class="keywordflow">return</span> -1 ;
+<a name="l00209"></a>00209 }
+<a name="l00210"></a>00210
+<a name="l00211"></a>00211 <span class="comment">/* Delete PRO LIST */</span>
+<a name="l00212"></a>00212 cpl_propertylist_delete(pro_list);
+<a name="l00213"></a>00213
+<a name="l00214"></a>00214 <span class="keywordflow">return</span> 0 ;
+<a name="l00215"></a>00215 }
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00225"></a>00225 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00226"></a>00226 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>
+<a name="l00227"></a><a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc">00227</a> (<span class="keyword">const</span> cpl_frameset * allframes,
+<a name="l00228"></a>00228 <span class="keyword">const</span> cpl_image * image,
+<a name="l00229"></a>00229 <span class="keywordtype">int</span> iext,
+<a name="l00230"></a>00230 <span class="keyword">const</span> cpl_propertylist * ext_prop_list,
+<a name="l00231"></a>00231 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00232"></a>00232 {
+<a name="l00233"></a>00233 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname;
+<a name="l00234"></a>00234 cpl_type_bpp pixeltype;
+<a name="l00235"></a>00235 cpl_propertylist * ext_prop;
+<a name="l00236"></a>00236 <span class="keywordtype">char</span> sval[16];
+<a name="l00237"></a>00237 <span class="keywordtype">int</span> idet;
+<a name="l00238"></a>00238
+<a name="l00239"></a>00239 <span class="comment">/* Test entries */</span>
+<a name="l00240"></a>00240 <span class="keywordflow">if</span> (allframes == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00241"></a>00241
+<a name="l00242"></a>00242 <span class="comment">/* Get a suitable reference frame */</span>
+<a name="l00243"></a>00243 <span class="keywordflow">if</span>((fname = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(allframes)) == NULL)
+<a name="l00244"></a>00244 {
+<a name="l00245"></a>00245 cpl_msg_error(__func__, <span class="stringliteral">"Could not find a suitable reference frame"</span>);
+<a name="l00246"></a>00246 <span class="keywordflow">return</span> -1;
+<a name="l00247"></a>00247 }
+<a name="l00248"></a>00248
+<a name="l00249"></a>00249 <span class="comment">/* Get the file type */</span>
+<a name="l00250"></a>00250 <span class="keywordflow">if</span> (cpl_image_get_type(image) == CPL_TYPE_INT)
+<a name="l00251"></a>00251 pixeltype = CPL_BPP_32_SIGNED ;
+<a name="l00252"></a>00252 <span class="keywordflow">else</span>
+<a name="l00253"></a>00253 pixeltype = CPL_BPP_IEEE_FLOAT ;
+<a name="l00254"></a>00254
+<a name="l00255"></a>00255 <span class="comment">/* Save the extension */</span>
+<a name="l00256"></a>00256 <span class="comment">/* Get the chip number to store in this extension */</span>
+<a name="l00257"></a>00257 <span class="keywordflow">if</span> ((idet = <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(fname, iext)) == -1) {
+<a name="l00258"></a>00258 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the chip id for extension %d "</span>
+<a name="l00259"></a>00259 <span class="stringliteral">"when saving %s"</span>, iext, filename);
+<a name="l00260"></a>00260 <span class="keywordflow">return</span> -1;
+<a name="l00261"></a>00261 }
+<a name="l00262"></a>00262 <span class="keywordflow">if</span> (ext_prop_list != NULL)
+<a name="l00263"></a>00263 ext_prop = cpl_propertylist_duplicate(ext_prop_list) ;
+<a name="l00264"></a>00264 <span class="keywordflow">else</span>
+<a name="l00265"></a>00265 ext_prop = cpl_propertylist_new() ;
+<a name="l00266"></a>00266
+<a name="l00267"></a>00267 snprintf(sval, 16, <span class="stringliteral">"CHIP%d.INT1"</span>, idet) ;
+<a name="l00268"></a>00268 cpl_propertylist_prepend_string(ext_prop, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00269"></a>00269 <span class="keywordflow">if</span>(cpl_image_save(image, filename,
+<a name="l00270"></a>00270 pixeltype, ext_prop, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+<a name="l00271"></a>00271 {
+<a name="l00272"></a>00272 cpl_msg_error(__func__,<span class="stringliteral">"Could not save extension %d of file %s"</span>,
+<a name="l00273"></a>00273 iext, filename);
+<a name="l00274"></a>00274 cpl_propertylist_delete(ext_prop);
+<a name="l00275"></a>00275 <span class="keywordflow">return</span> -1;
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277 cpl_propertylist_delete(ext_prop) ;
+<a name="l00278"></a>00278
+<a name="l00279"></a>00279 <span class="keywordflow">return</span> 0 ;
+<a name="l00280"></a>00280 }
+<a name="l00281"></a>00281
+<a name="l00282"></a>00282 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00301"></a>00301 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00302"></a><a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4">00302</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>(
+<a name="l00303"></a>00303 cpl_frameset * allframes,
+<a name="l00304"></a>00304 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00305"></a>00305 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00306"></a>00306 <span class="keyword">const</span> cpl_image ** images,
+<a name="l00307"></a>00307 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00308"></a>00308 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00309"></a>00309 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00310"></a>00310 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00311"></a>00311 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00312"></a>00312 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00313"></a>00313 {
+<a name="l00314"></a>00314 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00315"></a>00315 cpl_propertylist * pro_list ;
+<a name="l00316"></a>00316 cpl_type_bpp pixeltype ;
+<a name="l00317"></a>00317 cpl_propertylist * qc_ext_list ;
+<a name="l00318"></a>00318 <span class="keywordtype">char</span> sval[16] ;
+<a name="l00319"></a>00319 <span class="keywordtype">int</span> chip_nb ;
+<a name="l00320"></a>00320 <span class="keywordtype">int</span> iext;
+<a name="l00321"></a>00321
+<a name="l00322"></a>00322 <span class="comment">/* Test entries */</span>
+<a name="l00323"></a>00323 <span class="keywordflow">if</span> (allframes == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00324"></a>00324
+<a name="l00325"></a>00325 <span class="comment">/* Get a suitable reference frame */</span>
+<a name="l00326"></a>00326 <span class="keywordflow">if</span>((fname = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(allframes)) == NULL)
+<a name="l00327"></a>00327 {
+<a name="l00328"></a>00328 cpl_msg_error(__func__, <span class="stringliteral">"Could not find a suitable reference frame"</span>);
+<a name="l00329"></a>00329 <span class="keywordflow">return</span> -1;
+<a name="l00330"></a>00330 }
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 <span class="comment">/* Add the PRO keys */</span>
+<a name="l00333"></a>00333 <span class="keywordflow">if</span> (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+<a name="l00334"></a>00334 <span class="keywordflow">else</span> pro_list = cpl_propertylist_new() ;
+<a name="l00335"></a>00335 <span class="keywordflow">if</span> (protype != NULL)
+<a name="l00336"></a>00336 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+<a name="l00337"></a>00337 <span class="keywordflow">if</span> (procat != NULL)
+<a name="l00338"></a>00338 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/* File with extensions */</span>
+<a name="l00341"></a>00341 <span class="keywordflow">if</span> (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+<a name="l00342"></a>00342 CPL_BPP_IEEE_FLOAT, recipe, pro_list, NULL,
+<a name="l00343"></a>00343 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00344"></a>00344 filename) != CPL_ERROR_NONE) {
+<a name="l00345"></a>00345 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the empty primary HDU of file %s"</span>,
+<a name="l00346"></a>00346 filename);
+<a name="l00347"></a>00347 cpl_propertylist_delete(pro_list) ;
+<a name="l00348"></a>00348 <span class="keywordflow">return</span> -1 ;
+<a name="l00349"></a>00349 }
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 <span class="comment">/* Delete PRO LIST */</span>
+<a name="l00352"></a>00352 cpl_propertylist_delete(pro_list) ;
+<a name="l00353"></a>00353
+<a name="l00354"></a>00354 <span class="comment">/* Get the file type */</span>
+<a name="l00355"></a>00355 <span class="keywordflow">if</span> (cpl_image_get_type(images[0]) == CPL_TYPE_INT)
+<a name="l00356"></a>00356 pixeltype = CPL_BPP_32_SIGNED ;
+<a name="l00357"></a>00357 <span class="keywordflow">else</span>
+<a name="l00358"></a>00358 pixeltype = CPL_BPP_IEEE_FLOAT ;
+<a name="l00359"></a>00359
+<a name="l00360"></a>00360 <span class="comment">/* Save the extensions */</span>
+<a name="l00361"></a>00361 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+<a name="l00362"></a>00362 <span class="comment">/* Get the chip number to store in this extension */</span>
+<a name="l00363"></a>00363 <span class="keywordflow">if</span> ((chip_nb = <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(fname, iext+1)) == -1) {
+<a name="l00364"></a>00364 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the chip for extension %d "</span>
+<a name="l00365"></a>00365 <span class="stringliteral">"when saving file %s"</span>, iext+1, filename);
+<a name="l00366"></a>00366 <span class="keywordflow">return</span> -1 ;
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368 <span class="comment">/* Get the QC list */</span>
+<a name="l00369"></a>00369 <span class="keywordflow">if</span> ((applists != NULL) && (applists[chip_nb-1] != NULL))
+<a name="l00370"></a>00370 qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+<a name="l00371"></a>00371 <span class="keywordflow">else</span>
+<a name="l00372"></a>00372 qc_ext_list = cpl_propertylist_new() ;
+<a name="l00373"></a>00373
+<a name="l00374"></a>00374 snprintf(sval, 16, <span class="stringliteral">"CHIP%d.INT1"</span>, chip_nb) ;
+<a name="l00375"></a>00375 cpl_propertylist_prepend_string(qc_ext_list, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00376"></a>00376 <span class="keywordflow">if</span>(cpl_image_save(images[chip_nb-1], filename,
+<a name="l00377"></a>00377 pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+<a name="l00378"></a>00378 {
+<a name="l00379"></a>00379 cpl_msg_error(__func__,<span class="stringliteral">"Cannot save extension %d of file %s"</span>,
+<a name="l00380"></a>00380 iext+1, filename);
+<a name="l00381"></a>00381 cpl_propertylist_delete(qc_ext_list);
+<a name="l00382"></a>00382 <span class="keywordflow">return</span> -1;
+<a name="l00383"></a>00383 }
+<a name="l00384"></a>00384 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00385"></a>00385 }
+<a name="l00386"></a>00386 <span class="keywordflow">return</span> 0 ;
+<a name="l00387"></a>00387 }
+<a name="l00388"></a>00388
+<a name="l00389"></a>00389 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00405"></a>00405 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00406"></a><a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9">00406</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(
+<a name="l00407"></a>00407 cpl_frameset * allframes,
+<a name="l00408"></a>00408 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00409"></a>00409 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00410"></a>00410 <span class="keyword">const</span> cpl_table ** tables,
+<a name="l00411"></a>00411 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00412"></a>00412 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00413"></a>00413 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00414"></a>00414 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00415"></a>00415 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00416"></a>00416 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00417"></a>00417 {
+<a name="l00418"></a>00418 cpl_propertylist * qc_ext_list ;
+<a name="l00419"></a>00419 cpl_propertylist * pro_list ;
+<a name="l00420"></a>00420 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00421"></a>00421 <span class="keywordtype">char</span> sval[16] ;
+<a name="l00422"></a>00422 <span class="keywordtype">int</span> chip_nb ;
+<a name="l00423"></a>00423 <span class="keywordtype">int</span> iext;
+<a name="l00424"></a>00424
+<a name="l00425"></a>00425 <span class="comment">/* Test entries */</span>
+<a name="l00426"></a>00426 <span class="keywordflow">if</span> (allframes == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00427"></a>00427
+<a name="l00428"></a>00428 <span class="comment">/* Get a suitable reference frame */</span>
+<a name="l00429"></a>00429 <span class="keywordflow">if</span>((fname = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(allframes)) == NULL)
+<a name="l00430"></a>00430 {
+<a name="l00431"></a>00431 cpl_msg_error(__func__, <span class="stringliteral">"Could not find a suitable reference frame"</span>);
+<a name="l00432"></a>00432 <span class="keywordflow">return</span> -1;
+<a name="l00433"></a>00433 }
+<a name="l00434"></a>00434
+<a name="l00435"></a>00435 <span class="comment">/* Add the PRO keys */</span>
+<a name="l00436"></a>00436 <span class="keywordflow">if</span> (applist != NULL) pro_list = cpl_propertylist_duplicate(applist) ;
+<a name="l00437"></a>00437 <span class="keywordflow">else</span> pro_list = cpl_propertylist_new() ;
+<a name="l00438"></a>00438 <span class="keywordflow">if</span> (protype != NULL)
+<a name="l00439"></a>00439 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_TYPE, protype) ;
+<a name="l00440"></a>00440 <span class="keywordflow">if</span> (procat != NULL)
+<a name="l00441"></a>00441 cpl_propertylist_append_string(pro_list, CPL_DFS_PRO_CATG, procat) ;
+<a name="l00442"></a>00442
+<a name="l00443"></a>00443 <span class="comment">/* File with extensions */</span>
+<a name="l00444"></a>00444 <span class="keywordflow">if</span> ((applists != NULL) && (applists[0] != NULL))
+<a name="l00445"></a>00445 qc_ext_list = cpl_propertylist_duplicate(applists[0]) ;
+<a name="l00446"></a>00446 <span class="keywordflow">else</span>
+<a name="l00447"></a>00447 qc_ext_list = cpl_propertylist_new() ;
+<a name="l00448"></a>00448 cpl_propertylist_prepend_string(qc_ext_list, <span class="stringliteral">"EXTNAME"</span>, <span class="stringliteral">"CHIP1.INT1"</span>) ;
+<a name="l00449"></a>00449 <span class="keywordflow">if</span> (cpl_dfs_save_table(allframes, NULL, parlist, usedframes, NULL, tables[0],
+<a name="l00450"></a>00450 qc_ext_list, recipe, pro_list, NULL,
+<a name="l00451"></a>00451 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00452"></a>00452 filename) != CPL_ERROR_NONE) {
+<a name="l00453"></a>00453 cpl_msg_error(__func__,
+<a name="l00454"></a>00454 <span class="stringliteral">"Cannot save the first extension table of file %s"</span>, filename);
+<a name="l00455"></a>00455 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00456"></a>00456 cpl_propertylist_delete(pro_list) ;
+<a name="l00457"></a>00457 <span class="keywordflow">return</span> -1 ;
+<a name="l00458"></a>00458 }
+<a name="l00459"></a>00459 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00460"></a>00460 cpl_propertylist_delete(pro_list) ;
+<a name="l00461"></a>00461
+<a name="l00462"></a>00462 <span class="comment">/* Save the extensions */</span>
+<a name="l00463"></a>00463 <span class="keywordflow">for</span> (iext=1 ; iext<HAWKI_NB_DETECTORS; iext++) {
+<a name="l00464"></a>00464 <span class="comment">/* Get the chip number to store in this extension */</span>
+<a name="l00465"></a>00465 <span class="keywordflow">if</span> ((chip_nb = <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(fname, iext+1)) == -1) {
+<a name="l00466"></a>00466 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the chip for extension %d "</span>
+<a name="l00467"></a>00467 <span class="stringliteral">"when writing file %s"</span>, iext+1, filename);
+<a name="l00468"></a>00468 <span class="keywordflow">return</span> -1 ;
+<a name="l00469"></a>00469 }
+<a name="l00470"></a>00470 <span class="keywordflow">if</span> ((applists != NULL) && (applists[chip_nb-1] != NULL))
+<a name="l00471"></a>00471 qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+<a name="l00472"></a>00472 <span class="keywordflow">else</span>
+<a name="l00473"></a>00473 qc_ext_list = cpl_propertylist_new() ;
+<a name="l00474"></a>00474
+<a name="l00475"></a>00475 snprintf(sval, 16, <span class="stringliteral">"CHIP%d.INT1"</span>, chip_nb) ;
+<a name="l00476"></a>00476 cpl_propertylist_prepend_string(qc_ext_list, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00477"></a>00477 <span class="keywordflow">if</span>(cpl_table_save(tables[chip_nb-1], NULL, qc_ext_list, filename,
+<a name="l00478"></a>00478 CPL_IO_EXTEND) != CPL_ERROR_NONE)
+<a name="l00479"></a>00479 {
+<a name="l00480"></a>00480 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save extension %d of table %s"</span>,
+<a name="l00481"></a>00481 iext+1, filename);
+<a name="l00482"></a>00482 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00483"></a>00483 <span class="keywordflow">return</span> -1;
+<a name="l00484"></a>00484 }
+<a name="l00485"></a>00485
+<a name="l00486"></a>00486 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00487"></a>00487 }
+<a name="l00488"></a>00488
+<a name="l00489"></a>00489 <span class="keywordflow">return</span> 0 ;
+<a name="l00490"></a>00490 }
+<a name="l00491"></a>00491
+<a name="l00492"></a>00492 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00512"></a>00512 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00513"></a>00513 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga7dd654e4062ef0cf42274ebf274f0089" title="Save a HAWKI_NB_DETECTORS extensions HAWKI distortion images.">hawki_distortion_save</a>
+<a name="l00514"></a><a class="code" href="group__hawki__save.html#ga7dd654e4062ef0cf42274ebf274f0089">00514</a> (cpl_frameset * allframes,
+<a name="l00515"></a>00515 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00516"></a>00516 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00517"></a>00517 <span class="keyword">const</span> hawki_distortion ** distortion,
+<a name="l00518"></a>00518 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00519"></a>00519 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00520"></a>00520 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00521"></a>00521 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_x,
+<a name="l00522"></a>00522 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_y)
+<a name="l00523"></a>00523 {
+<a name="l00524"></a>00524 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ;
+<a name="l00525"></a>00525 cpl_propertylist * pro_list_x;
+<a name="l00526"></a>00526 cpl_propertylist * pro_list_y;
+<a name="l00527"></a>00527 cpl_type_bpp pixeltype ;
+<a name="l00528"></a>00528 cpl_propertylist * qc_ext_list ;
+<a name="l00529"></a>00529 <span class="keywordtype">char</span> sval[16] ;
+<a name="l00530"></a>00530 <span class="keywordtype">int</span> chip_nb ;
+<a name="l00531"></a>00531 <span class="keywordtype">int</span> iext;
+<a name="l00532"></a>00532
+<a name="l00533"></a>00533 <span class="comment">/* Test entries */</span>
+<a name="l00534"></a>00534 <span class="keywordflow">if</span> (allframes == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00535"></a>00535
+<a name="l00536"></a>00536 <span class="comment">/* Get a suitable reference frame */</span>
+<a name="l00537"></a>00537 <span class="keywordflow">if</span>((fname = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(allframes)) == NULL)
+<a name="l00538"></a>00538 {
+<a name="l00539"></a>00539 cpl_msg_error(__func__, <span class="stringliteral">"Could not find a suitable reference frame"</span>);
+<a name="l00540"></a>00540 <span class="keywordflow">return</span> -1;
+<a name="l00541"></a>00541 }
+<a name="l00542"></a>00542
+<a name="l00543"></a>00543 <span class="comment">/* Add the PRO keys */</span>
+<a name="l00544"></a>00544 <span class="keywordflow">if</span>(applist != NULL)
+<a name="l00545"></a>00545 pro_list_x = cpl_propertylist_duplicate(applist);
+<a name="l00546"></a>00546 <span class="keywordflow">else</span>
+<a name="l00547"></a>00547 pro_list_x = cpl_propertylist_new();
+<a name="l00548"></a>00548 <span class="keywordflow">if</span>(applist != NULL)
+<a name="l00549"></a>00549 pro_list_y = cpl_propertylist_duplicate(applist);
+<a name="l00550"></a>00550 <span class="keywordflow">else</span>
+<a name="l00551"></a>00551 pro_list_y = cpl_propertylist_new();
+<a name="l00552"></a>00552
+<a name="l00553"></a>00553 cpl_propertylist_append_string(pro_list_x, CPL_DFS_PRO_TYPE,
+<a name="l00554"></a>00554 HAWKI_PROTYPE_DISTORTION_X);
+<a name="l00555"></a>00555 cpl_propertylist_append_string(pro_list_y, CPL_DFS_PRO_TYPE,
+<a name="l00556"></a>00556 HAWKI_PROTYPE_DISTORTION_Y);
+<a name="l00557"></a>00557 cpl_propertylist_append_string(pro_list_x, CPL_DFS_PRO_CATG,
+<a name="l00558"></a>00558 HAWKI_CALPRO_DISTORTION_X);
+<a name="l00559"></a>00559 cpl_propertylist_append_string(pro_list_y, CPL_DFS_PRO_CATG,
+<a name="l00560"></a>00560 HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00561"></a>00561
+<a name="l00562"></a>00562 <span class="comment">/* File with extensions */</span>
+<a name="l00563"></a>00563 <span class="keywordflow">if</span> (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+<a name="l00564"></a>00564 CPL_BPP_IEEE_FLOAT, recipe, pro_list_x, NULL,
+<a name="l00565"></a>00565 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00566"></a>00566 filename_x) != CPL_ERROR_NONE) {
+<a name="l00567"></a>00567 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the empty primary HDU of file %s"</span>,
+<a name="l00568"></a>00568 filename_x);
+<a name="l00569"></a>00569 cpl_propertylist_delete(pro_list_x);
+<a name="l00570"></a>00570 cpl_propertylist_delete(pro_list_y);
+<a name="l00571"></a>00571 <span class="keywordflow">return</span> -1 ;
+<a name="l00572"></a>00572 }
+<a name="l00573"></a>00573 <span class="keywordflow">if</span> (cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, NULL,
+<a name="l00574"></a>00574 CPL_BPP_IEEE_FLOAT, recipe, pro_list_y, NULL,
+<a name="l00575"></a>00575 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00576"></a>00576 filename_y) != CPL_ERROR_NONE) {
+<a name="l00577"></a>00577 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the empty primary HDU of file %s"</span>,
+<a name="l00578"></a>00578 filename_y);
+<a name="l00579"></a>00579 cpl_propertylist_delete(pro_list_x);
+<a name="l00580"></a>00580 cpl_propertylist_delete(pro_list_y);
+<a name="l00581"></a>00581 <span class="keywordflow">return</span> -1 ;
+<a name="l00582"></a>00582 }
+<a name="l00583"></a>00583
+<a name="l00584"></a>00584 <span class="comment">/* Delete PRO LIST */</span>
+<a name="l00585"></a>00585 cpl_propertylist_delete(pro_list_x);
+<a name="l00586"></a>00586 cpl_propertylist_delete(pro_list_y);
+<a name="l00587"></a>00587
+<a name="l00588"></a>00588 <span class="comment">/* Get the file type */</span>
+<a name="l00589"></a>00589 <span class="keywordflow">if</span> (cpl_image_get_type(distortion[0]->dist_x) == CPL_TYPE_INT)
+<a name="l00590"></a>00590 pixeltype = CPL_BPP_32_SIGNED ;
+<a name="l00591"></a>00591 <span class="keywordflow">else</span>
+<a name="l00592"></a>00592 pixeltype = CPL_BPP_IEEE_FLOAT ;
+<a name="l00593"></a>00593
+<a name="l00594"></a>00594 <span class="comment">/* Save the extensions */</span>
+<a name="l00595"></a>00595 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++) {
+<a name="l00596"></a>00596 <span class="comment">/* Get the chip number to store in this extension */</span>
+<a name="l00597"></a>00597 <span class="keywordflow">if</span> ((chip_nb = <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(fname, iext+1)) == -1) {
+<a name="l00598"></a>00598 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get the chip for extension %d "</span>
+<a name="l00599"></a>00599 <span class="stringliteral">"when saving %s and %s"</span>, iext+1, filename_x, filename_y);
+<a name="l00600"></a>00600 <span class="keywordflow">return</span> -1 ;
+<a name="l00601"></a>00601 }
+<a name="l00602"></a>00602 <span class="comment">/* Get the QC list */</span>
+<a name="l00603"></a>00603 <span class="keywordflow">if</span> ((applists != NULL) && (applists[chip_nb-1] != NULL))
+<a name="l00604"></a>00604 qc_ext_list = cpl_propertylist_duplicate(applists[chip_nb-1]) ;
+<a name="l00605"></a>00605 <span class="keywordflow">else</span>
+<a name="l00606"></a>00606 qc_ext_list = cpl_propertylist_new() ;
+<a name="l00607"></a>00607
+<a name="l00608"></a>00608 <span class="comment">/* Add the CR* keywords */</span>
+<a name="l00609"></a>00609 cpl_propertylist_prepend_double(qc_ext_list, <span class="stringliteral">"CRPIX2"</span>, 1);
+<a name="l00610"></a>00610 cpl_propertylist_prepend_double(qc_ext_list, <span class="stringliteral">"CDELT2"</span>,
+<a name="l00611"></a>00611 distortion[chip_nb-1]->y_cdelt);
+<a name="l00612"></a>00612 cpl_propertylist_prepend_double(qc_ext_list, <span class="stringliteral">"CRVAL2"</span>,
+<a name="l00613"></a>00613 distortion[chip_nb-1]->y_crval);
+<a name="l00614"></a>00614 cpl_propertylist_prepend_double(qc_ext_list, <span class="stringliteral">"CRPIX1"</span>, 1);
+<a name="l00615"></a>00615 cpl_propertylist_prepend_double(qc_ext_list, <span class="stringliteral">"CDELT1"</span>,
+<a name="l00616"></a>00616 distortion[chip_nb-1]->x_cdelt);
+<a name="l00617"></a>00617 cpl_propertylist_prepend_double(qc_ext_list, <span class="stringliteral">"CRVAL1"</span>,
+<a name="l00618"></a>00618 distortion[chip_nb-1]->x_crval);
+<a name="l00619"></a>00619
+<a name="l00620"></a>00620 snprintf(sval, 16, <span class="stringliteral">"CHIP%d.INT1"</span>, chip_nb) ;
+<a name="l00621"></a>00621 cpl_propertylist_prepend_string(qc_ext_list, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00622"></a>00622 <span class="keywordflow">if</span>(cpl_image_save(distortion[chip_nb-1]->dist_x, filename_x,
+<a name="l00623"></a>00623 pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+<a name="l00624"></a>00624 {
+<a name="l00625"></a>00625 cpl_msg_error(__func__,<span class="stringliteral">"Cannot save extension %d of file %s"</span>,
+<a name="l00626"></a>00626 iext+1, filename_x);
+<a name="l00627"></a>00627 cpl_propertylist_delete(qc_ext_list);
+<a name="l00628"></a>00628 <span class="keywordflow">return</span> -1;
+<a name="l00629"></a>00629 }
+<a name="l00630"></a>00630 <span class="keywordflow">if</span>(cpl_image_save(distortion[chip_nb-1]->dist_y, filename_y,
+<a name="l00631"></a>00631 pixeltype, qc_ext_list, CPL_IO_EXTEND) != CPL_ERROR_NONE)
+<a name="l00632"></a>00632 {
+<a name="l00633"></a>00633 cpl_msg_error(__func__,<span class="stringliteral">"Cannot save extension %d of file %s"</span>,
+<a name="l00634"></a>00634 iext+1, filename_y);
+<a name="l00635"></a>00635 cpl_propertylist_delete(qc_ext_list);
+<a name="l00636"></a>00636 <span class="keywordflow">return</span> -1;
+<a name="l00637"></a>00637 }
+<a name="l00638"></a>00638 cpl_propertylist_delete(qc_ext_list) ;
+<a name="l00639"></a>00639 }
+<a name="l00640"></a>00640
+<a name="l00641"></a>00641 <span class="keywordflow">return</span> 0 ;
+<a name="l00642"></a>00642 }
+<a name="l00643"></a>00643
+<a name="l00644"></a>00644 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00654"></a>00654 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00655"></a>00655
+<a name="l00656"></a><a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536">00656</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(<span class="keyword">const</span> cpl_frameset * frameset)
+<a name="l00657"></a>00657 {
+<a name="l00658"></a>00658 <span class="keywordtype">int</span> iframe;
+<a name="l00659"></a>00659 <span class="keyword">const</span> <span class="keywordtype">char</span> * fname = NULL;
+<a name="l00660"></a>00660
+<a name="l00661"></a>00661 <span class="keywordflow">for</span>(iframe = 0 ; iframe < cpl_frameset_get_size(frameset); ++iframe)
+<a name="l00662"></a>00662 {
+<a name="l00663"></a>00663 <span class="keyword">const</span> cpl_frame * frame;
+<a name="l00664"></a>00664
+<a name="l00665"></a>00665 frame = cpl_frameset_get_frame_const(frameset, iframe);
+<a name="l00666"></a>00666 <span class="comment">/* Check that it belongs to the raw frames</span>
+<a name="l00667"></a>00667 <span class="comment"> * and then check if there are 4 extensions</span>
+<a name="l00668"></a>00668 <span class="comment"> */</span>
+<a name="l00669"></a>00669 <span class="keywordflow">if</span>(cpl_frame_get_group(frame) == CPL_FRAME_GROUP_RAW &&
+<a name="l00670"></a>00670 cpl_frame_get_nextensions(frame) == HAWKI_NB_DETECTORS)
+<a name="l00671"></a>00671 {
+<a name="l00672"></a>00672 fname = cpl_frame_get_filename(frame);
+<a name="l00673"></a>00673 <span class="keywordflow">return</span> fname;
+<a name="l00674"></a>00674 }
+<a name="l00675"></a>00675 }
+<a name="l00676"></a>00676 <span class="comment">//Now look into the products, in case that there is no actual raw</span>
+<a name="l00677"></a>00677 <span class="comment">//reference frame. This is kind of a hack for hawki_util_gendist,</span>
+<a name="l00678"></a>00678 <span class="comment">//which allows to save the distortion images using the distortion</span>
+<a name="l00679"></a>00679 <span class="comment">//table as a reference</span>
+<a name="l00680"></a>00680 <span class="keywordflow">for</span>(iframe = 0 ; iframe < cpl_frameset_get_size(frameset); ++iframe)
+<a name="l00681"></a>00681 {
+<a name="l00682"></a>00682 <span class="keyword">const</span> cpl_frame * frame;
+<a name="l00683"></a>00683
+<a name="l00684"></a>00684 frame = cpl_frameset_get_frame_const(frameset, iframe);
+<a name="l00685"></a>00685 <span class="comment">/* Check that it belongs to the raw frames</span>
+<a name="l00686"></a>00686 <span class="comment"> * and then check if there are 4 extensions</span>
+<a name="l00687"></a>00687 <span class="comment"> */</span>
+<a name="l00688"></a>00688 <span class="keywordflow">if</span>(cpl_frame_get_group(frame) == CPL_FRAME_GROUP_PRODUCT &&
+<a name="l00689"></a>00689 cpl_frame_get_nextensions(frame) == HAWKI_NB_DETECTORS)
+<a name="l00690"></a>00690 {
+<a name="l00691"></a>00691 fname = cpl_frame_get_filename(frame);
+<a name="l00692"></a>00692 <span class="keywordflow">return</span> fname;
+<a name="l00693"></a>00693 }
+<a name="l00694"></a>00694 }
+<a name="l00695"></a>00695 <span class="comment">//And if it didn't suceed, use the first frame:</span>
+<a name="l00696"></a>00696 fname = cpl_frame_get_filename(cpl_frameset_get_first_const(frameset));
+<a name="l00697"></a>00697
+<a name="l00698"></a>00698 <span class="keywordflow">return</span> fname;
+<a name="l00699"></a>00699 }
+<a name="l00700"></a>00700
+<a name="l00701"></a>00701
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__save_8h_source.html b/html/hawki__save_8h_source.html
new file mode 100644
index 0000000..a6c06bc
--- /dev/null
+++ b/html/hawki__save_8h_source.html
@@ -0,0 +1,155 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_save.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_save.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_save.h,v 1.4 2009/11/25 16:25:08 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/11/25 16:25:08 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.4 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_SAVE_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_SAVE_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> Functions prototypes</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>
+<a name="l00042"></a>00042 (cpl_frameset * allframes,
+<a name="l00043"></a>00043 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00044"></a>00044 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00045"></a>00045 <span class="keyword">const</span> cpl_imagelist * images,
+<a name="l00046"></a>00046 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00047"></a>00047 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00048"></a>00048 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00049"></a>00049 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00050"></a>00050 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00051"></a>00051 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename);
+<a name="l00052"></a>00052 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>
+<a name="l00053"></a>00053 (cpl_frameset * allframes,
+<a name="l00054"></a>00054 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00055"></a>00055 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00056"></a>00056 <span class="keyword">const</span> cpl_image ** images,
+<a name="l00057"></a>00057 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00058"></a>00058 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00059"></a>00059 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00060"></a>00060 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00061"></a>00061 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00062"></a>00062 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename);
+<a name="l00063"></a>00063 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>
+<a name="l00064"></a>00064 (cpl_frameset * allframes,
+<a name="l00065"></a>00065 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00066"></a>00066 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00067"></a>00067 <span class="keyword">const</span> cpl_table ** tables,
+<a name="l00068"></a>00068 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00069"></a>00069 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00070"></a>00070 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00071"></a>00071 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00072"></a>00072 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00073"></a>00073 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename);
+<a name="l00074"></a>00074 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#ga7dd654e4062ef0cf42274ebf274f0089" title="Save a HAWKI_NB_DETECTORS extensions HAWKI distortion images.">hawki_distortion_save</a>
+<a name="l00075"></a>00075 (cpl_frameset * allframes,
+<a name="l00076"></a>00076 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00077"></a>00077 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00078"></a>00078 <span class="keyword">const</span> hawki_distortion ** distortion,
+<a name="l00079"></a>00079 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00080"></a>00080 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00081"></a>00081 <span class="keyword">const</span> cpl_propertylist ** applists,
+<a name="l00082"></a>00082 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_x,
+<a name="l00083"></a>00083 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_y);
+<a name="l00084"></a>00084 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>
+<a name="l00085"></a>00085 (cpl_frameset * allframes,
+<a name="l00086"></a>00086 <span class="keyword">const</span> cpl_parameterlist * parlist,
+<a name="l00087"></a>00087 <span class="keyword">const</span> cpl_frameset * usedframes,
+<a name="l00088"></a>00088 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe,
+<a name="l00089"></a>00089 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00090"></a>00090 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00091"></a>00091 <span class="keyword">const</span> cpl_propertylist * applist,
+<a name="l00092"></a>00092 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename);
+<a name="l00093"></a>00093 <span class="keywordtype">int</span> <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>
+<a name="l00094"></a>00094 (<span class="keyword">const</span> cpl_frameset * allframes,
+<a name="l00095"></a>00095 <span class="keyword">const</span> cpl_image * image,
+<a name="l00096"></a>00096 <span class="keywordtype">int</span> iext,
+<a name="l00097"></a>00097 <span class="keyword">const</span> cpl_propertylist * ext_prop_list,
+<a name="l00098"></a>00098 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename);
+<a name="l00099"></a>00099 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(<span class="keyword">const</span> cpl_frameset *);
+<a name="l00100"></a>00100
+<a name="l00101"></a>00101 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__sci__jitter_8c_source.html b/html/hawki__sci__jitter_8c_source.html
new file mode 100644
index 0000000..0f762ff
--- /dev/null
+++ b/html/hawki__sci__jitter_8c_source.html
@@ -0,0 +1,2163 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_sci_jitter.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_sci_jitter.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_sci_jitter.c,v 1.30 2011/12/22 15:27:06 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/12/22 15:27:06 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.30 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <string.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_calib.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_saa.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_bkg.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "hawki_properties_tel.h"</span>
+<a name="l00053"></a>00053 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00054"></a>00054 <span class="preprocessor">#include "hawki_obj_det.h"</span>
+<a name="l00055"></a>00055
+<a name="l00056"></a>00056 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00057"></a>00057 <span class="comment"> Define</span>
+<a name="l00058"></a>00058 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00059"></a>00059
+<a name="l00060"></a>00060 <span class="preprocessor">#define NEGLIG_OFF_DIFF 0.1</span>
+<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define SQR(x) ((x)*(x))</span>
+<a name="l00062"></a>00062 <span class="preprocessor"></span>
+<a name="l00063"></a>00063 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00064"></a>00064 <span class="comment"> Functions prototypes</span>
+<a name="l00065"></a>00065 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00066"></a>00066
+<a name="l00067"></a>00067 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_create(cpl_plugin *) ;
+<a name="l00068"></a>00068 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_exec(cpl_plugin *) ;
+<a name="l00069"></a>00069 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_destroy(cpl_plugin *) ;
+<a name="l00070"></a>00070 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00071"></a>00071
+<a name="l00072"></a>00072 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_retrieve_input_param
+<a name="l00073"></a>00073 (cpl_parameterlist * parlist);
+<a name="l00074"></a>00074 <span class="keyword">static</span> cpl_image ** hawki_sci_jitter_reduce
+<a name="l00075"></a>00075 (cpl_frameset * jitters,
+<a name="l00076"></a>00076 cpl_frameset * sky,
+<a name="l00077"></a>00077 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00078"></a>00078 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark,
+<a name="l00079"></a>00079 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00080"></a>00080 cpl_table ** bkg_stats);
+<a name="l00081"></a>00081 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_sky
+<a name="l00082"></a>00082 (cpl_imagelist * jitters,
+<a name="l00083"></a>00083 cpl_imagelist * skys,
+<a name="l00084"></a>00084 cpl_table ** bkg_stats,
+<a name="l00085"></a>00085 <span class="keywordtype">int</span> idet);
+<a name="l00086"></a>00086 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_sky_running
+<a name="l00087"></a>00087 (cpl_imagelist * in,
+<a name="l00088"></a>00088 cpl_table ** bkg_stats,
+<a name="l00089"></a>00089 <span class="keywordtype">int</span> idet);
+<a name="l00090"></a>00090 <span class="keyword">static</span> cpl_image ** hawki_sci_jitter_saa(cpl_imagelist **, cpl_bivector *,
+<a name="l00091"></a>00091 <span class="keywordtype">double</span> *, <span class="keywordtype">double</span> *);
+<a name="l00092"></a>00092 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_qc
+<a name="l00093"></a>00093 (cpl_frameset * science_frames,
+<a name="l00094"></a>00094 cpl_image ** combined,
+<a name="l00095"></a>00095 cpl_table ** obj_charac);
+<a name="l00096"></a>00096 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_read_calib
+<a name="l00097"></a>00097 (<span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00098"></a>00098 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark,
+<a name="l00099"></a>00099 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00100"></a>00100 cpl_image ** flat_image,
+<a name="l00101"></a>00101 cpl_image ** dark_image,
+<a name="l00102"></a>00102 cpl_image ** bpm_image,
+<a name="l00103"></a>00103 <span class="keywordtype">int</span> idet);
+<a name="l00104"></a>00104 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_save
+<a name="l00105"></a>00105 (cpl_image ** combined,
+<a name="l00106"></a>00106 cpl_image * stitched,
+<a name="l00107"></a>00107 cpl_table ** objs_charac,
+<a name="l00108"></a>00108 cpl_table ** raw_jitter_stats,
+<a name="l00109"></a>00109 cpl_table ** bkg_stats,
+<a name="l00110"></a>00110 <span class="keyword">const</span> cpl_table * raw_obj_tel_info,
+<a name="l00111"></a>00111 cpl_frameset * science_frames,
+<a name="l00112"></a>00112 cpl_frameset * calib_frames,
+<a name="l00113"></a>00113 cpl_parameterlist * parlist,
+<a name="l00114"></a>00114 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00115"></a>00115 <span class="keywordtype">int</span> hawki_sci_jitter_whole_image_algo
+<a name="l00116"></a>00116 (cpl_frameset * obj,
+<a name="l00117"></a>00117 cpl_table ** raw_jitter_stats,
+<a name="l00118"></a>00118 cpl_table * raw_obj_tel_info,
+<a name="l00119"></a>00119 cpl_parameterlist * parlist,
+<a name="l00120"></a>00120 cpl_frameset * recipe_set);
+<a name="l00121"></a>00121 <span class="keywordtype">int</span> hawki_sci_jitter_save_stats
+<a name="l00122"></a>00122 (cpl_table ** raw_jitter_stats,
+<a name="l00123"></a>00123 cpl_table * raw_obj_tel_info,
+<a name="l00124"></a>00124 cpl_frameset * jitter_frames,
+<a name="l00125"></a>00125 cpl_parameterlist * parlist,
+<a name="l00126"></a>00126 cpl_frameset * recipe_set);
+<a name="l00127"></a>00127
+<a name="l00128"></a>00128 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00129"></a>00129 <span class="comment"> Static variables</span>
+<a name="l00130"></a>00130 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00131"></a>00131
+<a name="l00132"></a>00132 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00133"></a>00133 {
+<a name="l00134"></a>00134 <span class="comment">/* Inputs */</span>
+<a name="l00135"></a>00135 <span class="keyword">const</span> <span class="keywordtype">char</span> * offsets ;
+<a name="l00136"></a>00136 <span class="keyword">const</span> <span class="keywordtype">char</span> * objects ;
+<a name="l00137"></a>00137 <span class="keywordtype">int</span> offset_max ;
+<a name="l00138"></a>00138 <span class="keywordtype">int</span> sky_minnb ;
+<a name="l00139"></a>00139 <span class="keywordtype">int</span> sky_halfw ;
+<a name="l00140"></a>00140 <span class="keywordtype">int</span> sky_rejmin ;
+<a name="l00141"></a>00141 <span class="keywordtype">int</span> sky_rejmax ;
+<a name="l00142"></a>00142 <span class="keywordtype">int</span> refine ;
+<a name="l00143"></a>00143 <span class="keywordtype">int</span> sx ;
+<a name="l00144"></a>00144 <span class="keywordtype">int</span> sy ;
+<a name="l00145"></a>00145 <span class="keywordtype">int</span> mx ;
+<a name="l00146"></a>00146 <span class="keywordtype">int</span> my ;
+<a name="l00147"></a>00147 <span class="keywordtype">int</span> borders ;
+<a name="l00148"></a>00148 cpl_geom_combine comb_meth ;
+<a name="l00149"></a>00149 <span class="keywordtype">int</span> rej_low ;
+<a name="l00150"></a>00150 <span class="keywordtype">int</span> rej_high ;
+<a name="l00151"></a>00151 <span class="keywordtype">int</span> max_njitter;
+<a name="l00152"></a>00152 } hawki_sci_jitter_config;
+<a name="l00153"></a>00153
+<a name="l00154"></a>00154 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00155"></a>00155 {
+<a name="l00156"></a>00156 <span class="comment">/* Outputs */</span>
+<a name="l00157"></a>00157 <span class="keywordtype">double</span> pixscale;
+<a name="l00158"></a>00158 <span class="keywordtype">double</span> dit;
+<a name="l00159"></a>00159 <span class="keywordtype">double</span> mean_airmass;
+<a name="l00160"></a>00160 <span class="keywordtype">double</span> iq[HAWKI_NB_DETECTORS];
+<a name="l00161"></a>00161 <span class="keywordtype">int</span> nbobjs[HAWKI_NB_DETECTORS];
+<a name="l00162"></a>00162 <span class="keywordtype">double</span> fwhm_pix[HAWKI_NB_DETECTORS];
+<a name="l00163"></a>00163 <span class="keywordtype">double</span> fwhm_arcsec[HAWKI_NB_DETECTORS];
+<a name="l00164"></a>00164 <span class="keywordtype">double</span> fwhm_mode[HAWKI_NB_DETECTORS];
+<a name="l00165"></a>00165 <span class="keywordtype">double</span> combined_pos_x[HAWKI_NB_DETECTORS];
+<a name="l00166"></a>00166 <span class="keywordtype">double</span> combined_pos_y[HAWKI_NB_DETECTORS];
+<a name="l00167"></a>00167 <span class="keywordtype">double</span> combined_cumoffset_x[HAWKI_NB_DETECTORS];
+<a name="l00168"></a>00168 <span class="keywordtype">double</span> combined_cumoffset_y[HAWKI_NB_DETECTORS];
+<a name="l00169"></a>00169 <span class="keywordtype">int</span> ncomb[HAWKI_NB_DETECTORS];
+<a name="l00170"></a>00170 } hawki_sci_jitter_output;
+<a name="l00171"></a>00171
+<a name="l00172"></a>00172 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_sci_jitter_description[] =
+<a name="l00173"></a>00173 <span class="stringliteral">"hawki_sci_jitter -- hawki imaging jitter recipe.\n\n"</span>
+<a name="l00174"></a>00174 <span class="stringliteral">"The input of the recipe files listed in the Set Of Frames (sof-file)\n"</span>
+<a name="l00175"></a>00175 <span class="stringliteral">"must be tagged as:\n"</span>
+<a name="l00176"></a>00176 <span class="stringliteral">"raw-file.fits "</span>HAWKI_IMG_JITTER_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00177"></a>00177 <span class="stringliteral">"raw-file.fits "</span>HAWKI_IMG_JITTER_SKY_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00178"></a>00178 <span class="stringliteral">"flat-file.fits "</span>HAWKI_CALPRO_FLAT<span class="stringliteral">" or\n"</span>
+<a name="l00179"></a>00179 <span class="stringliteral">"dark-file.fits "</span>HAWKI_CALPRO_DARK<span class="stringliteral">" \n"</span>
+<a name="l00180"></a>00180 <span class="stringliteral">"bpm-file.fits "</span>HAWKI_CALPRO_BPM<span class="stringliteral">"\n"</span>
+<a name="l00181"></a>00181 <span class="stringliteral">"distortion_x-file.fits "</span>HAWKI_CALPRO_DISTORTION_X<span class="stringliteral">"\n"</span>
+<a name="l00182"></a>00182 <span class="stringliteral">"distortion_y-file.fits "</span>HAWKI_CALPRO_DISTORTION_Y<span class="stringliteral">"\n\n"</span>
+<a name="l00183"></a>00183 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00184"></a>00184 <span class="stringliteral">"hawki_sci_jitter.fits ("</span>HAWKI_CALPRO_COMBINED<span class="stringliteral">")\n"</span>
+<a name="l00185"></a>00185 <span class="stringliteral">"hawki_sci_jitter_stitched.fits ("</span>HAWKI_CALPRO_STITCHED<span class="stringliteral">")\n"</span>
+<a name="l00186"></a>00186 <span class="stringliteral">"hawki_sci_jitter_stars.fits ("</span>HAWKI_CALPRO_OBJ_PARAM<span class="stringliteral">"): Detected objects properties\n"</span>
+<a name="l00187"></a>00187 <span class="stringliteral">"hawki_sci_jitter_stats.fits ("</span>HAWKI_CALPRO_JITTER_STATS<span class="stringliteral">"): Stats of the individual images\n"</span>
+<a name="l00188"></a>00188 <span class="stringliteral">"hawki_sci_jitter_bkg_stats.fits ("</span>HAWKI_CALPRO_JITTER_BKG_STATS<span class="stringliteral">"): Statistics on the bkg\n\n"</span>
+<a name="l00189"></a>00189 <span class="stringliteral">"The recipe performs the following steps:\n"</span>
+<a name="l00190"></a>00190 <span class="stringliteral">"1) Frame statistics\n"</span>
+<a name="l00191"></a>00191 <span class="stringliteral">"2) Basic reduction (using "</span>HAWKI_CALPRO_FLAT<span class="stringliteral">" and "</span>HAWKI_CALPRO_BPM<span class="stringliteral">")\n"</span>
+<a name="l00192"></a>00192 <span class="stringliteral">"3) Background computation (the algorithm depends on parameter --sky_par) \n"</span>
+<a name="l00193"></a>00193 <span class="stringliteral">"4) Offset refinement (uses parameters --off, --refine and --xcorr)\n"</span>
+<a name="l00194"></a>00194 <span class="stringliteral">"5) Stacking of jitter frames (uses --comb_meth, --rej,\n"</span>
+<a name="l00195"></a>00195 <span class="stringliteral">" --offset_max, --borders, --max_njitter)\n"</span>
+<a name="l00196"></a>00196 <span class="stringliteral">"6) Stitching of the four detectors into one image\n"</span>
+<a name="l00197"></a>00197 <span class="stringliteral">"7) Object detection in the stacked image\n\n"</span>
+<a name="l00198"></a>00198 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00199"></a>00199 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00200"></a>00200 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00201"></a>00201
+<a name="l00202"></a>00202 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00203"></a>00203 <span class="comment"> Functions code</span>
+<a name="l00204"></a>00204 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00205"></a>00205
+<a name="l00206"></a>00206 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00214"></a>00214 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00215"></a>00215 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00216"></a>00216 {
+<a name="l00217"></a>00217 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00218"></a>00218 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00219"></a>00219
+<a name="l00220"></a>00220 cpl_plugin_init(plugin,
+<a name="l00221"></a>00221 CPL_PLUGIN_API,
+<a name="l00222"></a>00222 HAWKI_BINARY_VERSION,
+<a name="l00223"></a>00223 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00224"></a>00224 <span class="stringliteral">"hawki_sci_jitter"</span>,
+<a name="l00225"></a>00225 <span class="stringliteral">"Jitter recipe"</span>,
+<a name="l00226"></a>00226 hawki_sci_jitter_description,
+<a name="l00227"></a>00227 <span class="stringliteral">"Cesar Enrique Garcia"</span>,
+<a name="l00228"></a>00228 PACKAGE_BUGREPORT,
+<a name="l00229"></a>00229 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00230"></a>00230 hawki_sci_jitter_create,
+<a name="l00231"></a>00231 hawki_sci_jitter_exec,
+<a name="l00232"></a>00232 hawki_sci_jitter_destroy) ;
+<a name="l00233"></a>00233
+<a name="l00234"></a>00234 cpl_pluginlist_append(list, plugin) ;
+<a name="l00235"></a>00235
+<a name="l00236"></a>00236 <span class="keywordflow">return</span> 0;
+<a name="l00237"></a>00237 }
+<a name="l00238"></a>00238
+<a name="l00239"></a>00239 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00248"></a>00248 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00249"></a>00249 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_create(cpl_plugin * plugin)
+<a name="l00250"></a>00250 {
+<a name="l00251"></a>00251 cpl_recipe * recipe ;
+<a name="l00252"></a>00252 cpl_parameter * p ;
+<a name="l00253"></a>00253
+<a name="l00254"></a>00254 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00255"></a>00255 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00256"></a>00256 recipe = (cpl_recipe *)plugin ;
+<a name="l00257"></a>00257 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00258"></a>00258
+<a name="l00259"></a>00259 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00260"></a>00260 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00261"></a>00261 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00262"></a>00262 <span class="keywordflow">return</span> 1;
+<a name="l00263"></a>00263
+<a name="l00264"></a>00264 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00265"></a>00265 <span class="comment">/* --offsets */</span>
+<a name="l00266"></a>00266 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.offsets"</span>,
+<a name="l00267"></a>00267 CPL_TYPE_STRING, <span class="stringliteral">"offsets file"</span>, <span class="stringliteral">"hawki.hawki_sci_jitter"</span>, NULL) ;
+<a name="l00268"></a>00268 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"offsets"</span>) ;
+<a name="l00269"></a>00269 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00270"></a>00270 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00271"></a>00271
+<a name="l00272"></a>00272 <span class="comment">/* --objects */</span>
+<a name="l00273"></a>00273 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.objects"</span>,
+<a name="l00274"></a>00274 CPL_TYPE_STRING, <span class="stringliteral">"objects file"</span>, <span class="stringliteral">"hawki.hawki_sci_jitter"</span>, NULL) ;
+<a name="l00275"></a>00275 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"objects"</span>) ;
+<a name="l00276"></a>00276 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00277"></a>00277 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00278"></a>00278
+<a name="l00279"></a>00279 <span class="comment">/* --offset_max */</span>
+<a name="l00280"></a>00280 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.offset_max"</span>,
+<a name="l00281"></a>00281 CPL_TYPE_INT,
+<a name="l00282"></a>00282 <span class="stringliteral">"Maximum offset allowed"</span>,
+<a name="l00283"></a>00283 <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00284"></a>00284 1500) ;
+<a name="l00285"></a>00285 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"offset_max"</span>) ;
+<a name="l00286"></a>00286 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00287"></a>00287 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00288"></a>00288
+<a name="l00289"></a>00289 <span class="comment">/* --sky_par */</span>
+<a name="l00290"></a>00290 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.sky_par"</span>,
+<a name="l00291"></a>00291 CPL_TYPE_STRING,
+<a name="l00292"></a>00292 <span class="stringliteral">"Rejection parameters for sky filtering"</span>,
+<a name="l00293"></a>00293 <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00294"></a>00294 <span class="stringliteral">"10,7,3,3"</span>) ;
+<a name="l00295"></a>00295 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sky_par"</span>) ;
+<a name="l00296"></a>00296 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00297"></a>00297 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00298"></a>00298
+<a name="l00299"></a>00299 <span class="comment">/* --refine */</span>
+<a name="l00300"></a>00300 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.refine"</span>,
+<a name="l00301"></a>00301 CPL_TYPE_BOOL, <span class="stringliteral">"refine offsets"</span>, <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00302"></a>00302 FALSE);
+<a name="l00303"></a>00303 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"refine"</span>) ;
+<a name="l00304"></a>00304 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00305"></a>00305 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00306"></a>00306
+<a name="l00307"></a>00307 <span class="comment">/* --xcorr */</span>
+<a name="l00308"></a>00308 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.xcorr"</span>,
+<a name="l00309"></a>00309 CPL_TYPE_STRING,
+<a name="l00310"></a>00310 <span class="stringliteral">"Cross correlation search and measure sizes"</span>,
+<a name="l00311"></a>00311 <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00312"></a>00312 <span class="stringliteral">"20,20,25,25"</span>) ;
+<a name="l00313"></a>00313 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"xcorr"</span>) ;
+<a name="l00314"></a>00314 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00315"></a>00315 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00316"></a>00316
+<a name="l00317"></a>00317 <span class="comment">/* --comb_meth */</span>
+<a name="l00318"></a>00318 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.comb_meth"</span>,
+<a name="l00319"></a>00319 CPL_TYPE_STRING, <span class="stringliteral">"union / inter / first"</span>, <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00320"></a>00320 <span class="stringliteral">"union"</span>) ;
+<a name="l00321"></a>00321 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"comb_meth"</span>) ;
+<a name="l00322"></a>00322 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00323"></a>00323 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00324"></a>00324
+<a name="l00325"></a>00325 <span class="comment">/* --rej */</span>
+<a name="l00326"></a>00326 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.rej"</span>,
+<a name="l00327"></a>00327 CPL_TYPE_STRING,
+<a name="l00328"></a>00328 <span class="stringliteral">"Low and high number of rejected values"</span>,
+<a name="l00329"></a>00329 <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00330"></a>00330 <span class="stringliteral">"1,1"</span>) ;
+<a name="l00331"></a>00331 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"rej"</span>) ;
+<a name="l00332"></a>00332 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00333"></a>00333 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00334"></a>00334
+<a name="l00335"></a>00335 <span class="comment">/* --borders */</span>
+<a name="l00336"></a>00336 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.borders"</span>,
+<a name="l00337"></a>00337 CPL_TYPE_INT,
+<a name="l00338"></a>00338 <span class="stringliteral">"Borders rejected"</span>,
+<a name="l00339"></a>00339 <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00340"></a>00340 4) ;
+<a name="l00341"></a>00341 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"borders"</span>) ;
+<a name="l00342"></a>00342 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00343"></a>00343 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00344"></a>00344
+<a name="l00345"></a>00345 <span class="comment">/* --max_njitter */</span>
+<a name="l00346"></a>00346 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_sci_jitter.max_njitter"</span>,
+<a name="l00347"></a>00347 CPL_TYPE_INT,
+<a name="l00348"></a>00348 <span class="stringliteral">"Maximum numbers of jitter frames to combine"</span>,
+<a name="l00349"></a>00349 <span class="stringliteral">"hawki.hawki_sci_jitter"</span>,
+<a name="l00350"></a>00350 -1);
+<a name="l00351"></a>00351 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"max_njitter"</span>);
+<a name="l00352"></a>00352 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00353"></a>00353 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00354"></a>00354
+<a name="l00355"></a>00355 <span class="comment">/* Return */</span>
+<a name="l00356"></a>00356 <span class="keywordflow">return</span> 0;
+<a name="l00357"></a>00357 }
+<a name="l00358"></a>00358
+<a name="l00359"></a>00359 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00365"></a>00365 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00366"></a>00366 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_exec(cpl_plugin * plugin)
+<a name="l00367"></a>00367 {
+<a name="l00368"></a>00368 cpl_recipe * recipe ;
+<a name="l00369"></a>00369
+<a name="l00370"></a>00370 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00371"></a>00371 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00372"></a>00372 recipe = (cpl_recipe *)plugin ;
+<a name="l00373"></a>00373 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00374"></a>00374
+<a name="l00375"></a>00375 <span class="comment">/* Issue a banner */</span>
+<a name="l00376"></a>00376 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00377"></a>00377
+<a name="l00378"></a>00378 <span class="keywordflow">return</span> hawki_sci_jitter(recipe->parameters, recipe->frames) ;
+<a name="l00379"></a>00379 }
+<a name="l00380"></a>00380
+<a name="l00381"></a>00381 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00387"></a>00387 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00388"></a>00388 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_destroy(cpl_plugin * plugin)
+<a name="l00389"></a>00389 {
+<a name="l00390"></a>00390 cpl_recipe * recipe ;
+<a name="l00391"></a>00391
+<a name="l00392"></a>00392 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00393"></a>00393 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00394"></a>00394 recipe = (cpl_recipe *)plugin ;
+<a name="l00395"></a>00395 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00396"></a>00396
+<a name="l00397"></a>00397 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00398"></a>00398 <span class="keywordflow">return</span> 0 ;
+<a name="l00399"></a>00399 }
+<a name="l00400"></a>00400
+<a name="l00401"></a>00401 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00408"></a>00408 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00409"></a>00409 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter(
+<a name="l00410"></a>00410 cpl_parameterlist * parlist,
+<a name="l00411"></a>00411 cpl_frameset * framelist)
+<a name="l00412"></a>00412 {
+<a name="l00413"></a>00413 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat;
+<a name="l00414"></a>00414 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark;
+<a name="l00415"></a>00415 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm;
+<a name="l00416"></a>00416 <span class="keyword">const</span> cpl_frame * distx;
+<a name="l00417"></a>00417 <span class="keyword">const</span> cpl_frame * disty;
+<a name="l00418"></a>00418 cpl_frameset * jitterframes ;
+<a name="l00419"></a>00419 cpl_frameset * skyframes ;
+<a name="l00420"></a>00420 cpl_frameset * science_frames;
+<a name="l00421"></a>00421 cpl_frameset * calib_frames;
+<a name="l00422"></a>00422 cpl_image ** combined ;
+<a name="l00423"></a>00423 cpl_table ** obj_charac;
+<a name="l00424"></a>00424 cpl_table ** raw_jitter_stats;
+<a name="l00425"></a>00425 cpl_table ** bkg_stats;
+<a name="l00426"></a>00426 cpl_table * raw_obj_tel_info;
+<a name="l00427"></a>00427 cpl_image * stitched ;
+<a name="l00428"></a>00428 <span class="keywordtype">int</span> i;
+<a name="l00429"></a>00429
+<a name="l00430"></a>00430 <span class="comment">/* Initialise */</span>
+<a name="l00431"></a>00431 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00432"></a>00432 {
+<a name="l00433"></a>00433 hawki_sci_jitter_output.iq[i] = -1.0 ;
+<a name="l00434"></a>00434 hawki_sci_jitter_output.nbobjs[i] = -1 ;
+<a name="l00435"></a>00435 hawki_sci_jitter_output.fwhm_pix[i] = -1.0 ;
+<a name="l00436"></a>00436 hawki_sci_jitter_output.fwhm_arcsec[i] = -1.0 ;
+<a name="l00437"></a>00437 hawki_sci_jitter_output.fwhm_mode[i] = -1.0 ;
+<a name="l00438"></a>00438 hawki_sci_jitter_output.combined_pos_x[i] = -1.0 ;
+<a name="l00439"></a>00439 hawki_sci_jitter_output.combined_pos_y[i] = -1.0 ;
+<a name="l00440"></a>00440 hawki_sci_jitter_output.combined_cumoffset_x[i] = -1.0 ;
+<a name="l00441"></a>00441 hawki_sci_jitter_output.combined_cumoffset_y[i] = -1.0 ;
+<a name="l00442"></a>00442 }
+<a name="l00443"></a>00443 hawki_sci_jitter_output.pixscale = -1.0 ;
+<a name="l00444"></a>00444 hawki_sci_jitter_output.dit = -1.0 ;
+<a name="l00445"></a>00445 hawki_sci_jitter_config.offsets = NULL ;
+<a name="l00446"></a>00446 hawki_sci_jitter_config.objects = NULL ;
+<a name="l00447"></a>00447 calib_frames = cpl_frameset_new();
+<a name="l00448"></a>00448
+<a name="l00449"></a>00449 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00450"></a>00450 <span class="keywordflow">if</span>(hawki_sci_jitter_retrieve_input_param(parlist))
+<a name="l00451"></a>00451 {
+<a name="l00452"></a>00452 cpl_msg_error(cpl_func, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00453"></a>00453 cpl_frameset_delete(calib_frames);
+<a name="l00454"></a>00454 <span class="keywordflow">return</span> -1;
+<a name="l00455"></a>00455 }
+<a name="l00456"></a>00456
+<a name="l00457"></a>00457 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00458"></a>00458 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00459"></a>00459 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00460"></a>00460 cpl_frameset_delete(calib_frames);
+<a name="l00461"></a>00461 <span class="keywordflow">return</span> -1 ;
+<a name="l00462"></a>00462 }
+<a name="l00463"></a>00463
+<a name="l00464"></a>00464 <span class="comment">/* Retrieve calibration data */</span>
+<a name="l00465"></a>00465 flat = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_FLAT) ;
+<a name="l00466"></a>00466 dark = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_DARK);
+<a name="l00467"></a>00467 bpm = <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(framelist, HAWKI_CALPRO_BPM) ;
+<a name="l00468"></a>00468 distx = cpl_frameset_find_const(framelist, HAWKI_CALPRO_DISTORTION_X);
+<a name="l00469"></a>00469 disty = cpl_frameset_find_const(framelist, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00470"></a>00470 <span class="keywordflow">if</span>((distx == NULL && disty !=NULL) || (distx != NULL && disty ==NULL))
+<a name="l00471"></a>00471 {
+<a name="l00472"></a>00472 cpl_msg_error(cpl_func, <span class="stringliteral">"Both distortion in X (%s) and Y (%s) must be provided"</span>,
+<a name="l00473"></a>00473 HAWKI_CALPRO_DISTORTION_X, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00474"></a>00474 cpl_frameset_delete(calib_frames);
+<a name="l00475"></a>00475 <span class="keywordflow">return</span> -1 ;
+<a name="l00476"></a>00476 }
+<a name="l00477"></a>00477 <span class="keywordflow">if</span>(flat)
+<a name="l00478"></a>00478 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+<a name="l00479"></a>00479 cpl_frameset_find_const(framelist, HAWKI_CALPRO_FLAT)));
+<a name="l00480"></a>00480 <span class="keywordflow">if</span>(dark)
+<a name="l00481"></a>00481 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+<a name="l00482"></a>00482 cpl_frameset_find_const(framelist, HAWKI_CALPRO_DARK)));
+<a name="l00483"></a>00483 <span class="keywordflow">if</span>(bpm)
+<a name="l00484"></a>00484 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+<a name="l00485"></a>00485 cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM)));
+<a name="l00486"></a>00486 <span class="keywordflow">if</span>(distx)
+<a name="l00487"></a>00487 {
+<a name="l00488"></a>00488 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(distx));
+<a name="l00489"></a>00489 cpl_frameset_insert(calib_frames, cpl_frame_duplicate(disty));
+<a name="l00490"></a>00490 }
+<a name="l00491"></a>00491
+<a name="l00492"></a>00492
+<a name="l00493"></a>00493 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00494"></a>00494 jitterframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_IMG_JITTER_RAW) ;
+<a name="l00495"></a>00495 <span class="keywordflow">if</span> (jitterframes == NULL) {
+<a name="l00496"></a>00496 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot find jitter frames in the input list (%s)"</span>,
+<a name="l00497"></a>00497 HAWKI_IMG_JITTER_RAW);
+<a name="l00498"></a>00498 cpl_frameset_delete(calib_frames);
+<a name="l00499"></a>00499 <span class="keywordflow">return</span> -1 ;
+<a name="l00500"></a>00500 }
+<a name="l00501"></a>00501 science_frames = cpl_frameset_duplicate(jitterframes);
+<a name="l00502"></a>00502 skyframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_IMG_JITTER_SKY_RAW) ;
+<a name="l00503"></a>00503 <span class="keywordflow">if</span> (skyframes != NULL)
+<a name="l00504"></a>00504 {
+<a name="l00505"></a>00505 <span class="keywordtype">int</span> isky;
+<a name="l00506"></a>00506 <span class="keywordflow">for</span>(isky = 0; isky< cpl_frameset_get_size(skyframes); ++isky)
+<a name="l00507"></a>00507 cpl_frameset_insert(science_frames,
+<a name="l00508"></a>00508 cpl_frame_duplicate(cpl_frameset_get_frame(skyframes, isky)));
+<a name="l00509"></a>00509 }
+<a name="l00510"></a>00510
+<a name="l00511"></a>00511 <span class="comment">/* Create the statistics table */</span>
+<a name="l00512"></a>00512 raw_jitter_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00513"></a>00513 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00514"></a>00514 {
+<a name="l00515"></a>00515 raw_jitter_stats[i] = cpl_table_new(cpl_frameset_get_size(jitterframes));
+<a name="l00516"></a>00516 }
+<a name="l00517"></a>00517 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(raw_jitter_stats);
+<a name="l00518"></a>00518 bkg_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00519"></a>00519 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00520"></a>00520 {
+<a name="l00521"></a>00521 bkg_stats[i] = cpl_table_new(cpl_frameset_get_size(jitterframes));
+<a name="l00522"></a>00522 }
+<a name="l00523"></a>00523 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(bkg_stats);
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 <span class="comment">/* Create the telescope statistics parameters from the raw images */</span>
+<a name="l00526"></a>00526 raw_obj_tel_info = cpl_table_new(cpl_frameset_get_size(jitterframes));
+<a name="l00527"></a>00527 <span class="comment">/* Add the proper columns of the pcs table */</span>
+<a name="l00528"></a>00528 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__properties__tel.html#ga2895d7c995564a2bbbdcab5c195cfac9" title="Initialize the table with all the telescope data columns.">hawki_prop_tel_initialize</a>(raw_obj_tel_info))
+<a name="l00529"></a>00529 {
+<a name="l00530"></a>00530 cpl_msg_error(cpl_func,<span class="stringliteral">"Could not initialize the pcs table"</span>);
+<a name="l00531"></a>00531 cpl_frameset_delete(jitterframes) ;
+<a name="l00532"></a>00532 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00533"></a>00533 {
+<a name="l00534"></a>00534 cpl_table_delete(raw_jitter_stats[i]) ;
+<a name="l00535"></a>00535 cpl_table_delete(bkg_stats[i]) ;
+<a name="l00536"></a>00536 }
+<a name="l00537"></a>00537 cpl_free(raw_jitter_stats) ;
+<a name="l00538"></a>00538 cpl_free(bkg_stats) ;
+<a name="l00539"></a>00539 cpl_table_delete(raw_obj_tel_info);
+<a name="l00540"></a>00540 <span class="keywordflow">if</span> (skyframes) cpl_frameset_delete(skyframes) ;
+<a name="l00541"></a>00541 cpl_frameset_delete(calib_frames);
+<a name="l00542"></a>00542 cpl_msg_indent_less() ;
+<a name="l00543"></a>00543 <span class="keywordflow">return</span> -1;
+<a name="l00544"></a>00544 }
+<a name="l00545"></a>00545
+<a name="l00546"></a>00546 <span class="comment">/* Do the algorithms that need the whole image */</span>
+<a name="l00547"></a>00547 hawki_sci_jitter_whole_image_algo(jitterframes,
+<a name="l00548"></a>00548 raw_jitter_stats,
+<a name="l00549"></a>00549 raw_obj_tel_info,
+<a name="l00550"></a>00550 parlist,
+<a name="l00551"></a>00551 framelist);
+<a name="l00552"></a>00552
+<a name="l00553"></a>00553 <span class="comment">/* Apply the reduction */</span>
+<a name="l00554"></a>00554 <span class="comment">/* Do the algorithms that can be applied to subsection of the images */</span>
+<a name="l00555"></a>00555 cpl_msg_info(cpl_func, <span class="stringliteral">"Apply the data combination"</span>) ;
+<a name="l00556"></a>00556 cpl_msg_indent_more() ;
+<a name="l00557"></a>00557 <span class="keywordflow">if</span> ((combined = hawki_sci_jitter_reduce(jitterframes, skyframes, flat, dark,
+<a name="l00558"></a>00558 bpm, bkg_stats)) == NULL)
+<a name="l00559"></a>00559 {
+<a name="l00560"></a>00560 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot recombine the data"</span>);
+<a name="l00561"></a>00561 cpl_frameset_delete(jitterframes);
+<a name="l00562"></a>00562 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00563"></a>00563 {
+<a name="l00564"></a>00564 cpl_table_delete(raw_jitter_stats[i]) ;
+<a name="l00565"></a>00565 cpl_table_delete(bkg_stats[i]) ;
+<a name="l00566"></a>00566 }
+<a name="l00567"></a>00567 cpl_free(raw_jitter_stats) ;
+<a name="l00568"></a>00568 cpl_free(bkg_stats) ;
+<a name="l00569"></a>00569 cpl_table_delete(raw_obj_tel_info);
+<a name="l00570"></a>00570 <span class="keywordflow">if</span> (skyframes) cpl_frameset_delete(skyframes) ;
+<a name="l00571"></a>00571 cpl_frameset_delete(calib_frames);
+<a name="l00572"></a>00572 cpl_msg_indent_less() ;
+<a name="l00573"></a>00573 <span class="keywordflow">return</span> -1 ;
+<a name="l00574"></a>00574 }
+<a name="l00575"></a>00575 cpl_msg_indent_less() ;
+<a name="l00576"></a>00576
+<a name="l00577"></a>00577 <span class="comment">/* Compute QC parameters from the combined image */</span>
+<a name="l00578"></a>00578 cpl_msg_info(cpl_func, <span class="stringliteral">"Compute QC parameters from the combined images"</span>) ;
+<a name="l00579"></a>00579 cpl_msg_indent_more() ;
+<a name="l00580"></a>00580 obj_charac = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table*)) ;
+<a name="l00581"></a>00581 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00582"></a>00582 {
+<a name="l00583"></a>00583 obj_charac[i] = cpl_table_new(0);
+<a name="l00584"></a>00584 }
+<a name="l00585"></a>00585 <span class="keywordflow">if</span> ((hawki_sci_jitter_qc(jitterframes, combined, obj_charac)) != 0)
+<a name="l00586"></a>00586 {
+<a name="l00587"></a>00587 cpl_msg_warning(cpl_func, <span class="stringliteral">"Cannot compute all parameters"</span>) ;
+<a name="l00588"></a>00588 }
+<a name="l00589"></a>00589 cpl_msg_indent_less();
+<a name="l00590"></a>00590 cpl_frameset_delete(jitterframes);
+<a name="l00591"></a>00591 <span class="keywordflow">if</span> (skyframes) cpl_frameset_delete(skyframes);
+<a name="l00592"></a>00592
+<a name="l00593"></a>00593
+<a name="l00594"></a>00594 <span class="comment">/* Correct for the distortion */</span>
+<a name="l00595"></a>00595 <span class="keywordflow">if</span> (distx && disty)
+<a name="l00596"></a>00596 {
+<a name="l00597"></a>00597 cpl_msg_info(cpl_func, <span class="stringliteral">"Applying the distortion correction"</span>) ;
+<a name="l00598"></a>00598 cpl_msg_indent_more() ;
+<a name="l00599"></a>00599 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__distortion.html#ga52da9acfab98a1592e65df9c6bfba484" title="Apply the distortion correction.">hawki_distortion_correct_alldetectors</a>(combined, distx, disty) == -1)
+<a name="l00600"></a>00600 {
+<a name="l00601"></a>00601 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot correct the distortion"</span>) ;
+<a name="l00602"></a>00602 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00603"></a>00603 cpl_image_delete(combined[i]) ;
+<a name="l00604"></a>00604 cpl_free(combined) ;
+<a name="l00605"></a>00605 <span class="keywordflow">if</span> (obj_charac) {
+<a name="l00606"></a>00606 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00607"></a>00607 cpl_table_delete(obj_charac[i]) ;
+<a name="l00608"></a>00608 cpl_free(obj_charac);
+<a name="l00609"></a>00609 }
+<a name="l00610"></a>00610 cpl_table_delete(raw_obj_tel_info);
+<a name="l00611"></a>00611 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00612"></a>00612 {
+<a name="l00613"></a>00613 cpl_table_delete(raw_jitter_stats[i]);
+<a name="l00614"></a>00614 cpl_table_delete(bkg_stats[i]);
+<a name="l00615"></a>00615 }
+<a name="l00616"></a>00616 cpl_free(raw_jitter_stats);
+<a name="l00617"></a>00617 cpl_free(bkg_stats);
+<a name="l00618"></a>00618 cpl_frameset_delete(calib_frames);
+<a name="l00619"></a>00619 cpl_frameset_delete(science_frames);
+<a name="l00620"></a>00620 cpl_msg_indent_less() ;
+<a name="l00621"></a>00621 <span class="keywordflow">return</span> -1;
+<a name="l00622"></a>00622 }
+<a name="l00623"></a>00623 cpl_msg_indent_less() ;
+<a name="l00624"></a>00624 }
+<a name="l00625"></a>00625
+<a name="l00626"></a>00626 <span class="comment">/* Compute the stitched image */</span>
+<a name="l00627"></a>00627 cpl_msg_info(cpl_func, <span class="stringliteral">"Compute the stiched image"</span>) ;
+<a name="l00628"></a>00628 <span class="keywordflow">if</span> ((stitched = <a class="code" href="group__hawki__utils.html#ga7f6d3694df0e3a441b20267a1e5894db" title="Apply the stitching.">hawki_images_stitch</a>(combined,
+<a name="l00629"></a>00629 hawki_sci_jitter_output.combined_pos_x,
+<a name="l00630"></a>00630 hawki_sci_jitter_output.combined_pos_y)) == NULL)
+<a name="l00631"></a>00631 {
+<a name="l00632"></a>00632 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot stitch the images"</span>) ;
+<a name="l00633"></a>00633 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00634"></a>00634 cpl_image_delete(combined[i]) ;
+<a name="l00635"></a>00635 cpl_free(combined) ;
+<a name="l00636"></a>00636 <span class="keywordflow">if</span> (obj_charac) {
+<a name="l00637"></a>00637 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00638"></a>00638 cpl_table_delete(obj_charac[i]) ;
+<a name="l00639"></a>00639 cpl_free(obj_charac);
+<a name="l00640"></a>00640 }
+<a name="l00641"></a>00641 cpl_table_delete(raw_obj_tel_info);
+<a name="l00642"></a>00642 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00643"></a>00643 {
+<a name="l00644"></a>00644 cpl_table_delete(raw_jitter_stats[i]);
+<a name="l00645"></a>00645 cpl_table_delete(bkg_stats[i]);
+<a name="l00646"></a>00646 }
+<a name="l00647"></a>00647 cpl_free(raw_jitter_stats);
+<a name="l00648"></a>00648 cpl_free(bkg_stats);
+<a name="l00649"></a>00649 cpl_frameset_delete(calib_frames);
+<a name="l00650"></a>00650 cpl_frameset_delete(science_frames);
+<a name="l00651"></a>00651 <span class="keywordflow">return</span> -1;
+<a name="l00652"></a>00652 }
+<a name="l00653"></a>00653
+<a name="l00654"></a>00654 <span class="comment">/* Save the products */</span>
+<a name="l00655"></a>00655 cpl_msg_info(cpl_func, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00656"></a>00656 cpl_msg_indent_more() ;
+<a name="l00657"></a>00657 <span class="keywordflow">if</span> (hawki_sci_jitter_save(combined, stitched, obj_charac,
+<a name="l00658"></a>00658 raw_jitter_stats, bkg_stats,
+<a name="l00659"></a>00659 raw_obj_tel_info,
+<a name="l00660"></a>00660 science_frames,
+<a name="l00661"></a>00661 calib_frames,
+<a name="l00662"></a>00662 parlist, framelist) == -1)
+<a name="l00663"></a>00663 cpl_msg_warning(cpl_func,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00664"></a>00664 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00665"></a>00665
+<a name="l00666"></a>00666 <span class="comment">/* Return */</span>
+<a name="l00667"></a>00667 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00668"></a>00668 cpl_image_delete(combined[i]) ;
+<a name="l00669"></a>00669 cpl_free(combined) ;
+<a name="l00670"></a>00670 <span class="keywordflow">if</span> (obj_charac) {
+<a name="l00671"></a>00671 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00672"></a>00672 cpl_table_delete(obj_charac[i]) ;
+<a name="l00673"></a>00673 cpl_free(obj_charac);
+<a name="l00674"></a>00674 }
+<a name="l00675"></a>00675 <span class="keywordflow">if</span> (stitched) cpl_image_delete(stitched) ;
+<a name="l00676"></a>00676 cpl_table_delete(raw_obj_tel_info);
+<a name="l00677"></a>00677 <span class="keywordflow">for</span>( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00678"></a>00678 {
+<a name="l00679"></a>00679 cpl_table_delete(raw_jitter_stats[i]);
+<a name="l00680"></a>00680 cpl_table_delete(bkg_stats[i]);
+<a name="l00681"></a>00681 }
+<a name="l00682"></a>00682 cpl_free(raw_jitter_stats);
+<a name="l00683"></a>00683 cpl_free(bkg_stats);
+<a name="l00684"></a>00684 cpl_frameset_delete(calib_frames);
+<a name="l00685"></a>00685 cpl_frameset_delete(science_frames);
+<a name="l00686"></a>00686 cpl_msg_indent_less() ;
+<a name="l00687"></a>00687
+<a name="l00688"></a>00688 <span class="comment">/* Return */</span>
+<a name="l00689"></a>00689 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00690"></a>00690 {
+<a name="l00691"></a>00691 cpl_msg_error(cpl_func,
+<a name="l00692"></a>00692 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00693"></a>00693 <span class="keywordflow">return</span> -1 ;
+<a name="l00694"></a>00694 }
+<a name="l00695"></a>00695 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00696"></a>00696 }
+<a name="l00697"></a>00697
+<a name="l00698"></a>00698 <span class="keywordtype">int</span> hawki_sci_jitter_retrieve_input_param
+<a name="l00699"></a>00699 (cpl_parameterlist * parlist)
+<a name="l00700"></a>00700 {
+<a name="l00701"></a>00701 cpl_parameter * par ;
+<a name="l00702"></a>00702 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00703"></a>00703 par = NULL ;
+<a name="l00704"></a>00704 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.offsets"</span>);
+<a name="l00705"></a>00705 hawki_sci_jitter_config.offsets = cpl_parameter_get_string(par);
+<a name="l00706"></a>00706 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.objects"</span>);
+<a name="l00707"></a>00707 hawki_sci_jitter_config.objects = cpl_parameter_get_string(par);
+<a name="l00708"></a>00708 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.offset_max"</span>);
+<a name="l00709"></a>00709 hawki_sci_jitter_config.offset_max = cpl_parameter_get_int(par);
+<a name="l00710"></a>00710 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.sky_par"</span>);
+<a name="l00711"></a>00711 sval = cpl_parameter_get_string(par);
+<a name="l00712"></a>00712 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d,%d,%d"</span>,
+<a name="l00713"></a>00713 &hawki_sci_jitter_config.sky_minnb,
+<a name="l00714"></a>00714 &hawki_sci_jitter_config.sky_halfw,
+<a name="l00715"></a>00715 &hawki_sci_jitter_config.sky_rejmin,
+<a name="l00716"></a>00716 &hawki_sci_jitter_config.sky_rejmax)!=4)
+<a name="l00717"></a>00717 {
+<a name="l00718"></a>00718 <span class="keywordflow">return</span> -1;
+<a name="l00719"></a>00719 }
+<a name="l00720"></a>00720 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.xcorr"</span>);
+<a name="l00721"></a>00721 sval = cpl_parameter_get_string(par);
+<a name="l00722"></a>00722 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d,%d,%d"</span>,
+<a name="l00723"></a>00723 &hawki_sci_jitter_config.sx,
+<a name="l00724"></a>00724 &hawki_sci_jitter_config.sy,
+<a name="l00725"></a>00725 &hawki_sci_jitter_config.mx,
+<a name="l00726"></a>00726 &hawki_sci_jitter_config.my)!=4)
+<a name="l00727"></a>00727 {
+<a name="l00728"></a>00728 <span class="keywordflow">return</span> -1;
+<a name="l00729"></a>00729 }
+<a name="l00730"></a>00730 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.refine"</span>);
+<a name="l00731"></a>00731 hawki_sci_jitter_config.refine = cpl_parameter_get_bool(par);
+<a name="l00732"></a>00732 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.comb_meth"</span>);
+<a name="l00733"></a>00733 sval = cpl_parameter_get_string(par);
+<a name="l00734"></a>00734 <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"union"</span>))
+<a name="l00735"></a>00735 hawki_sci_jitter_config.comb_meth = CPL_GEOM_UNION;
+<a name="l00736"></a>00736 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"inter"</span>))
+<a name="l00737"></a>00737 hawki_sci_jitter_config.comb_meth = CPL_GEOM_INTERSECT;
+<a name="l00738"></a>00738 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"first"</span>))
+<a name="l00739"></a>00739 hawki_sci_jitter_config.comb_meth = CPL_GEOM_FIRST;
+<a name="l00740"></a>00740 <span class="keywordflow">else</span>
+<a name="l00741"></a>00741 {
+<a name="l00742"></a>00742 cpl_msg_error(cpl_func, <span class="stringliteral">"Invalid combine method specified"</span>);
+<a name="l00743"></a>00743 <span class="keywordflow">return</span> -1;
+<a name="l00744"></a>00744 }
+<a name="l00745"></a>00745 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.borders"</span>);
+<a name="l00746"></a>00746 hawki_sci_jitter_config.borders = cpl_parameter_get_int(par);
+<a name="l00747"></a>00747 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.rej"</span>);
+<a name="l00748"></a>00748 sval = cpl_parameter_get_string(par);
+<a name="l00749"></a>00749 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d"</span>,
+<a name="l00750"></a>00750 &hawki_sci_jitter_config.rej_low,
+<a name="l00751"></a>00751 &hawki_sci_jitter_config.rej_high)!=2)
+<a name="l00752"></a>00752 {
+<a name="l00753"></a>00753 <span class="keywordflow">return</span> -1;
+<a name="l00754"></a>00754 }
+<a name="l00755"></a>00755 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_sci_jitter.max_njitter"</span>);
+<a name="l00756"></a>00756 hawki_sci_jitter_config.max_njitter = cpl_parameter_get_int(par);
+<a name="l00757"></a>00757 <span class="keywordflow">return</span> 0;
+<a name="l00758"></a>00758 }
+<a name="l00759"></a>00759
+<a name="l00760"></a>00760
+<a name="l00761"></a>00761
+<a name="l00762"></a>00762 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00773"></a>00773 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00774"></a>00774 <span class="keyword">static</span> cpl_image ** hawki_sci_jitter_reduce
+<a name="l00775"></a>00775 (cpl_frameset * jitters,
+<a name="l00776"></a>00776 cpl_frameset * sky,
+<a name="l00777"></a>00777 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00778"></a>00778 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark,
+<a name="l00779"></a>00779 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00780"></a>00780 cpl_table ** bkg_stats)
+<a name="l00781"></a>00781 {
+<a name="l00782"></a>00782 cpl_frame * frame ;
+<a name="l00783"></a>00783 cpl_propertylist * plist ;
+<a name="l00784"></a>00784 cpl_image ** comb_chip ;
+<a name="l00785"></a>00785 cpl_image ** combined ;
+<a name="l00786"></a>00786 cpl_bivector * offsets ;
+<a name="l00787"></a>00787 cpl_vector * offset_x_sort;
+<a name="l00788"></a>00788 cpl_vector * offset_y_sort;
+<a name="l00789"></a>00789 <span class="keywordtype">double</span> * offs_est_x ;
+<a name="l00790"></a>00790 <span class="keywordtype">double</span> * offs_est_y ;
+<a name="l00791"></a>00791 <span class="keywordtype">double</span> off_0_x;
+<a name="l00792"></a>00792 <span class="keywordtype">double</span> off_0_y;
+<a name="l00793"></a>00793 <span class="keywordtype">double</span> max_x, max_y ;
+<a name="l00794"></a>00794 <span class="keywordtype">int</span> idet;
+<a name="l00795"></a>00795 <span class="keywordtype">int</span> ioff;
+<a name="l00796"></a>00796
+<a name="l00797"></a>00797 <span class="comment">/* Get the header infos */</span>
+<a name="l00798"></a>00798 frame = cpl_frameset_get_frame(jitters, 0) ;
+<a name="l00799"></a>00799 plist=cpl_propertylist_load(cpl_frame_get_filename(frame), 0) ;
+<a name="l00800"></a>00800 hawki_sci_jitter_output.pixscale = <a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b" title="find out the pixel scale">hawki_pfits_get_pixscale</a>(plist) ;
+<a name="l00801"></a>00801 hawki_sci_jitter_output.dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist) ;
+<a name="l00802"></a>00802 cpl_propertylist_delete(plist) ;
+<a name="l00803"></a>00803 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00804"></a>00804 cpl_msg_error(cpl_func, <span class="stringliteral">"Missing keyword in FITS header"</span>) ;
+<a name="l00805"></a>00805 <span class="keywordflow">return</span> NULL ;
+<a name="l00806"></a>00806 }
+<a name="l00807"></a>00807
+<a name="l00808"></a>00808 <span class="comment">/* Check that DIT/NDIT and NDSAMPLES are the same for all the frames */</span>
+<a name="l00809"></a>00809 <span class="keywordflow">if</span>(!<a class="code" href="group__hawki__utils.html#ga4c041169d43f161a8c9d7f23d7fc57a7" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_double_keys</a>(jitters, &<a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>) ||
+<a name="l00810"></a>00810 !<a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_int_keys</a>(jitters, &<a class="code" href="group__hawki__pfits.html#ga7c2b338fdf41bdeb1149b60af82c0788" title="find out the NDIT value">hawki_pfits_get_ndit</a>)||
+<a name="l00811"></a>00811 !<a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_int_keys</a>(jitters, &<a class="code" href="group__hawki__pfits.html#ga0d1ccf97334b28566b2bc8fe17786190" title="find out the NDSAMPLES value">hawki_pfits_get_ndsamples</a>))
+<a name="l00812"></a>00812 {
+<a name="l00813"></a>00813 cpl_msg_error(__func__, <span class="stringliteral">"Not all input science have the same "</span>
+<a name="l00814"></a>00814 <span class="stringliteral">"DIT/NDIT/NDSAMPLES values"</span>);
+<a name="l00815"></a>00815 cpl_msg_indent_less() ;
+<a name="l00816"></a>00816 <span class="keywordflow">return</span> NULL;
+<a name="l00817"></a>00817 }
+<a name="l00818"></a>00818
+<a name="l00819"></a>00819 <span class="comment">/* Get the offsets */</span>
+<a name="l00820"></a>00820 <span class="keywordflow">if</span> ((offsets = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(jitters)) == NULL) {
+<a name="l00821"></a>00821 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot load the offsets"</span>) ;
+<a name="l00822"></a>00822 <span class="keywordflow">return</span> NULL ;
+<a name="l00823"></a>00823 }
+<a name="l00824"></a>00824 offs_est_x = cpl_bivector_get_x_data(offsets) ;
+<a name="l00825"></a>00825 offs_est_y = cpl_bivector_get_y_data(offsets) ;
+<a name="l00826"></a>00826
+<a name="l00827"></a>00827 <span class="comment">/* Print the header offsets */</span>
+<a name="l00828"></a>00828 <span class="keywordflow">for</span> (ioff=0 ; ioff<cpl_bivector_get_size(offsets) ; ioff++) {
+<a name="l00829"></a>00829 cpl_msg_info(cpl_func, <span class="stringliteral">"Telescope offsets (Frame %d): %g %g"</span>, ioff+1,
+<a name="l00830"></a>00830 offs_est_x[ioff], offs_est_y[ioff]) ;
+<a name="l00831"></a>00831 }
+<a name="l00832"></a>00832
+<a name="l00833"></a>00833 <span class="comment">/* Subtract the first offset to all offsets */</span>
+<a name="l00834"></a>00834 off_0_x = -offs_est_x[0]; <span class="comment">// This is to get the cpl convention</span>
+<a name="l00835"></a>00835 off_0_y = -offs_est_y[0];
+<a name="l00836"></a>00836 <span class="keywordflow">for</span> (ioff=1 ; ioff<cpl_bivector_get_size(offsets) ; ioff++)
+<a name="l00837"></a>00837 {
+<a name="l00838"></a>00838 offs_est_x[ioff] -= offs_est_x[0] ;
+<a name="l00839"></a>00839 offs_est_y[ioff] -= offs_est_y[0] ;
+<a name="l00840"></a>00840 }
+<a name="l00841"></a>00841 offs_est_x[0] = offs_est_y[0] = 0.00 ;
+<a name="l00842"></a>00842
+<a name="l00843"></a>00843 <span class="comment">/* Check if the max offset is not too big */</span>
+<a name="l00844"></a>00844 <span class="comment">/* The criteria is that for a given frame, the closest frame cannot be </span>
+<a name="l00845"></a>00845 <span class="comment"> * further than hawki_sci_jitter_config.offset_max (in both dimensions) */</span>
+<a name="l00846"></a>00846 offset_x_sort = cpl_vector_duplicate(cpl_bivector_get_x(offsets));
+<a name="l00847"></a>00847 offset_y_sort = cpl_vector_duplicate(cpl_bivector_get_y(offsets));
+<a name="l00848"></a>00848 cpl_vector_sort(offset_x_sort, +1);
+<a name="l00849"></a>00849 cpl_vector_sort(offset_y_sort, +1);
+<a name="l00850"></a>00850 <span class="keywordflow">for</span> (ioff=0 ; ioff<cpl_bivector_get_size(offsets) - 1 ; ioff++)
+<a name="l00851"></a>00851 {
+<a name="l00852"></a>00852 <span class="keywordtype">double</span> diff_x, diff_y;
+<a name="l00853"></a>00853 diff_x = cpl_vector_get(offset_x_sort,ioff+1)-cpl_vector_get(offset_x_sort,ioff);
+<a name="l00854"></a>00854 cpl_vector_set(offset_x_sort, ioff, diff_x);
+<a name="l00855"></a>00855 diff_y = cpl_vector_get(offset_y_sort,ioff+1)-cpl_vector_get(offset_y_sort,ioff);
+<a name="l00856"></a>00856 cpl_vector_set(offset_y_sort, ioff, diff_y);
+<a name="l00857"></a>00857 }
+<a name="l00858"></a>00858 cpl_vector_set(offset_x_sort, cpl_bivector_get_size(offsets)-1, 0.);
+<a name="l00859"></a>00859 cpl_vector_set(offset_y_sort, cpl_bivector_get_size(offsets)-1, 0.);
+<a name="l00860"></a>00860 max_x = cpl_vector_get_max(offset_x_sort);
+<a name="l00861"></a>00861 max_y = cpl_vector_get_max(offset_y_sort);
+<a name="l00862"></a>00862 cpl_vector_delete(offset_x_sort);
+<a name="l00863"></a>00863 cpl_vector_delete(offset_y_sort);
+<a name="l00864"></a>00864
+<a name="l00865"></a>00865 <span class="keywordflow">if</span> (max_x > hawki_sci_jitter_config.offset_max ||
+<a name="l00866"></a>00866 max_y > hawki_sci_jitter_config.offset_max)
+<a name="l00867"></a>00867 {
+<a name="l00868"></a>00868 cpl_msg_error(cpl_func, <span class="stringliteral">"Sorry, no support for frames further than %d from its closest neighbour"</span>,
+<a name="l00869"></a>00869 hawki_sci_jitter_config.offset_max) ;
+<a name="l00870"></a>00870 cpl_bivector_delete(offsets);
+<a name="l00871"></a>00871 <span class="keywordflow">return</span> NULL ;
+<a name="l00872"></a>00872 }
+<a name="l00873"></a>00873
+<a name="l00874"></a>00874 <span class="comment">/* Create output object */</span>
+<a name="l00875"></a>00875 combined = cpl_malloc(HAWKI_NB_DETECTORS*<span class="keyword">sizeof</span>(cpl_image*)) ;
+<a name="l00876"></a>00876
+<a name="l00877"></a>00877 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00878"></a>00878 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00879"></a>00879 {
+<a name="l00880"></a>00880 cpl_frameset * selected_jitter;
+<a name="l00881"></a>00881 cpl_bivector * selected_offsets;
+<a name="l00882"></a>00882 cpl_image * flat_ima = NULL;
+<a name="l00883"></a>00883 cpl_image * dark_ima = NULL;
+<a name="l00884"></a>00884 cpl_image * bpm_ima = NULL;
+<a name="l00885"></a>00885 cpl_imagelist * in = NULL;
+<a name="l00886"></a>00886 cpl_imagelist * in_sky = NULL;
+<a name="l00887"></a>00887 <span class="keywordtype">int</span> nrejected;
+<a name="l00888"></a>00888
+<a name="l00889"></a>00889 cpl_msg_info(cpl_func, <span class="stringliteral">"Combine chip number %d"</span>, idet+1) ;
+<a name="l00890"></a>00890 cpl_msg_indent_more() ;
+<a name="l00891"></a>00891
+<a name="l00892"></a>00892 <span class="comment">/* Apply frame selection based on offset values */</span>
+<a name="l00893"></a>00893 selected_jitter = cpl_frameset_duplicate(jitters);
+<a name="l00894"></a>00894 selected_offsets = cpl_bivector_duplicate(offsets);
+<a name="l00895"></a>00895 <span class="keywordflow">if</span>(hawki_sci_jitter_config.max_njitter != -1)
+<a name="l00896"></a>00896 {
+<a name="l00897"></a>00897 <span class="keywordflow">if</span>(hawki_sci_jitter_config.max_njitter <
+<a name="l00898"></a>00898 cpl_frameset_get_size(selected_jitter))
+<a name="l00899"></a>00899 {
+<a name="l00900"></a>00900 <span class="keywordflow">while</span>(cpl_frameset_get_size(selected_jitter) >
+<a name="l00901"></a>00901 hawki_sci_jitter_config.max_njitter)
+<a name="l00902"></a>00902 {
+<a name="l00903"></a>00903 <span class="keywordtype">int</span> irm = cpl_frameset_get_size(selected_jitter) - 1;
+<a name="l00904"></a>00904 cpl_frameset_erase_frame
+<a name="l00905"></a>00905 (selected_jitter,
+<a name="l00906"></a>00906 cpl_frameset_get_frame(selected_jitter,irm));
+<a name="l00907"></a>00907 }
+<a name="l00908"></a>00908 cpl_vector_set_size(cpl_bivector_get_x(selected_offsets),
+<a name="l00909"></a>00909 hawki_sci_jitter_config.max_njitter);
+<a name="l00910"></a>00910 cpl_vector_set_size(cpl_bivector_get_y(selected_offsets),
+<a name="l00911"></a>00911 hawki_sci_jitter_config.max_njitter);
+<a name="l00912"></a>00912 }
+<a name="l00913"></a>00913 }
+<a name="l00914"></a>00914 hawki_sci_jitter_output.ncomb[idet] =
+<a name="l00915"></a>00915 cpl_frameset_get_size(selected_jitter);
+<a name="l00916"></a>00916 nrejected = cpl_frameset_get_size(selected_jitter) -
+<a name="l00917"></a>00917 cpl_frameset_get_size(jitters);
+<a name="l00918"></a>00918 <span class="keywordflow">if</span>(nrejected != 0)
+<a name="l00919"></a>00919 cpl_msg_info(cpl_func,<span class="stringliteral">"%d frames reject due to large offsets"</span>,
+<a name="l00920"></a>00920 nrejected);
+<a name="l00921"></a>00921
+<a name="l00922"></a>00922
+<a name="l00923"></a>00923 <span class="comment">/* Load the input data */</span>
+<a name="l00924"></a>00924 cpl_msg_info(cpl_func, <span class="stringliteral">"Load the input data"</span>) ;
+<a name="l00925"></a>00925 cpl_msg_indent_more() ;
+<a name="l00926"></a>00926 <span class="keywordflow">if</span> ((in = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(selected_jitter,
+<a name="l00927"></a>00927 idet+1, CPL_TYPE_FLOAT)) == NULL) {
+<a name="l00928"></a>00928 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot load chip %d"</span>, idet+1) ;
+<a name="l00929"></a>00929 cpl_free(combined) ;
+<a name="l00930"></a>00930 cpl_bivector_delete(offsets) ;
+<a name="l00931"></a>00931 cpl_msg_indent_less() ;
+<a name="l00932"></a>00932 cpl_msg_indent_less() ;
+<a name="l00933"></a>00933 <span class="keywordflow">return</span> NULL ;
+<a name="l00934"></a>00934 }
+<a name="l00935"></a>00935 <span class="keywordflow">if</span> (sky) {
+<a name="l00936"></a>00936 <span class="keywordflow">if</span> ((in_sky = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(sky, idet+1, CPL_TYPE_FLOAT)) == NULL)
+<a name="l00937"></a>00937 {
+<a name="l00938"></a>00938 cpl_msg_warning(cpl_func, <span class="stringliteral">"Cannot load sky for chip %d"</span>,idet+1);
+<a name="l00939"></a>00939 }
+<a name="l00940"></a>00940 } <span class="keywordflow">else</span> in_sky = NULL ;
+<a name="l00941"></a>00941 cpl_msg_indent_less() ;
+<a name="l00942"></a>00942
+<a name="l00943"></a>00943 <span class="comment">/* Read the calibrations */</span>
+<a name="l00944"></a>00944 cpl_msg_info(cpl_func, <span class="stringliteral">"Load the calibration data"</span>) ;
+<a name="l00945"></a>00945 <span class="keywordflow">if</span>(hawki_sci_jitter_read_calib(flat, dark, bpm,
+<a name="l00946"></a>00946 &flat_ima, &dark_ima, &bpm_ima,
+<a name="l00947"></a>00947 idet) != 0)
+<a name="l00948"></a>00948 {
+<a name="l00949"></a>00949 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot read some of the calibrations"</span>);
+<a name="l00950"></a>00950 cpl_imagelist_delete(in);
+<a name="l00951"></a>00951 cpl_free(combined);
+<a name="l00952"></a>00952 <span class="keywordflow">if</span> (in_sky) cpl_imagelist_delete(in_sky);
+<a name="l00953"></a>00953 cpl_bivector_delete(offsets);
+<a name="l00954"></a>00954 cpl_msg_indent_less();
+<a name="l00955"></a>00955 cpl_msg_indent_less();
+<a name="l00956"></a>00956 <span class="keywordflow">return</span> NULL ;
+<a name="l00957"></a>00957 }
+<a name="l00958"></a>00958
+<a name="l00959"></a>00959 <span class="comment">/* Apply the calibrations */</span>
+<a name="l00960"></a>00960 <span class="keywordflow">if</span> (flat || dark || bpm )
+<a name="l00961"></a>00961 {
+<a name="l00962"></a>00962 cpl_msg_info(cpl_func, <span class="stringliteral">"Apply the calibrations"</span>) ;
+<a name="l00963"></a>00963 cpl_msg_indent_more() ;
+<a name="l00964"></a>00964 <span class="comment">/* Basic calibration of the OBJECTS */</span>
+<a name="l00965"></a>00965 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d" title="Apply the calibration to the images.">hawki_flat_dark_bpm_detector_calib</a>
+<a name="l00966"></a>00966 (in, flat_ima, dark_ima, bpm_ima) == -1)
+<a name="l00967"></a>00967 {
+<a name="l00968"></a>00968 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot calibrate the objects"</span>) ;
+<a name="l00969"></a>00969 cpl_imagelist_delete(in) ;
+<a name="l00970"></a>00970 cpl_free(combined) ;
+<a name="l00971"></a>00971 <span class="keywordflow">if</span> (in_sky) cpl_imagelist_delete(in_sky) ;
+<a name="l00972"></a>00972 cpl_bivector_delete(offsets) ;
+<a name="l00973"></a>00973 cpl_image_delete(flat_ima);
+<a name="l00974"></a>00974 cpl_image_delete(dark_ima);
+<a name="l00975"></a>00975 cpl_image_delete(bpm_ima);
+<a name="l00976"></a>00976 cpl_msg_indent_less() ;
+<a name="l00977"></a>00977 cpl_msg_indent_less() ;
+<a name="l00978"></a>00978 <span class="keywordflow">return</span> NULL ;
+<a name="l00979"></a>00979 }
+<a name="l00980"></a>00980 <span class="comment">/* Basic calibration of the SKY */</span>
+<a name="l00981"></a>00981 <span class="keywordflow">if</span> (in_sky) {
+<a name="l00982"></a>00982 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#ga5602d5f6a5703dff30afa41235c9686d" title="Apply the calibration to the images.">hawki_flat_dark_bpm_detector_calib</a>
+<a name="l00983"></a>00983 (in_sky, flat_ima, dark_ima, bpm_ima) == -1)
+<a name="l00984"></a>00984 {
+<a name="l00985"></a>00985 cpl_msg_warning(cpl_func, <span class="stringliteral">"Cannot calibrate the sky"</span>) ;
+<a name="l00986"></a>00986 cpl_imagelist_delete(in_sky) ;
+<a name="l00987"></a>00987 in_sky = NULL ;
+<a name="l00988"></a>00988 }
+<a name="l00989"></a>00989 }
+<a name="l00990"></a>00990 cpl_msg_indent_less() ;
+<a name="l00991"></a>00991 }
+<a name="l00992"></a>00992 cpl_image_delete(flat_ima);
+<a name="l00993"></a>00993 cpl_image_delete(dark_ima);
+<a name="l00994"></a>00994 cpl_image_delete(bpm_ima);
+<a name="l00995"></a>00995
+<a name="l00996"></a>00996 <span class="comment">/* Apply the sky correction */</span>
+<a name="l00997"></a>00997 cpl_msg_info(cpl_func, <span class="stringliteral">"Sky estimation and correction"</span>) ;
+<a name="l00998"></a>00998 cpl_msg_indent_more() ;
+<a name="l00999"></a>00999 <span class="keywordflow">if</span> (hawki_sci_jitter_sky(in, in_sky, bkg_stats, idet) == -1)
+<a name="l01000"></a>01000 {
+<a name="l01001"></a>01001 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot estimate the sky"</span>) ;
+<a name="l01002"></a>01002 cpl_imagelist_delete(in) ;
+<a name="l01003"></a>01003 <span class="keywordflow">if</span> (in_sky) cpl_imagelist_delete(in_sky) ;
+<a name="l01004"></a>01004 cpl_free(combined) ;
+<a name="l01005"></a>01005 cpl_bivector_delete(offsets) ;
+<a name="l01006"></a>01006 cpl_msg_indent_less() ;
+<a name="l01007"></a>01007 cpl_msg_indent_less() ;
+<a name="l01008"></a>01008 <span class="keywordflow">return</span> NULL ;
+<a name="l01009"></a>01009 }
+<a name="l01010"></a>01010 <span class="keywordflow">if</span> (in_sky) cpl_imagelist_delete(in_sky) ;
+<a name="l01011"></a>01011 cpl_msg_indent_less() ;
+<a name="l01012"></a>01012
+<a name="l01013"></a>01013 <span class="comment">/* Apply the shift and add */</span>
+<a name="l01014"></a>01014 cpl_msg_info(cpl_func, <span class="stringliteral">"Shift and stacking"</span>) ;
+<a name="l01015"></a>01015 cpl_msg_indent_more() ;
+<a name="l01016"></a>01016 comb_chip = hawki_sci_jitter_saa(&in, selected_offsets,
+<a name="l01017"></a>01017 &(hawki_sci_jitter_output.combined_pos_x[idet]),
+<a name="l01018"></a>01018 &(hawki_sci_jitter_output.combined_pos_y[idet])) ;
+<a name="l01019"></a>01019 hawki_sci_jitter_output.combined_cumoffset_x[idet] =
+<a name="l01020"></a>01020 hawki_sci_jitter_output.combined_pos_x[idet] - off_0_x;
+<a name="l01021"></a>01021 hawki_sci_jitter_output.combined_cumoffset_y[idet] =
+<a name="l01022"></a>01022 hawki_sci_jitter_output.combined_pos_y[idet] - off_0_y;
+<a name="l01023"></a>01023 <span class="keywordflow">if</span> (comb_chip == NULL) {
+<a name="l01024"></a>01024 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot apply the shift and add"</span>) ;
+<a name="l01025"></a>01025 cpl_imagelist_delete(in) ;
+<a name="l01026"></a>01026 cpl_free(combined) ;
+<a name="l01027"></a>01027 cpl_bivector_delete(offsets) ;
+<a name="l01028"></a>01028 cpl_msg_indent_less() ;
+<a name="l01029"></a>01029 cpl_msg_indent_less() ;
+<a name="l01030"></a>01030 <span class="keywordflow">return</span> NULL ;
+<a name="l01031"></a>01031 }
+<a name="l01032"></a>01032 cpl_imagelist_delete(in) ;
+<a name="l01033"></a>01033 cpl_msg_indent_less() ;
+<a name="l01034"></a>01034
+<a name="l01035"></a>01035 <span class="comment">/* Put the results in the image list */</span>
+<a name="l01036"></a>01036 combined[idet] = comb_chip[0] ;
+<a name="l01037"></a>01037 cpl_image_delete(comb_chip[1]) ;
+<a name="l01038"></a>01038 cpl_free(comb_chip) ;
+<a name="l01039"></a>01039 cpl_msg_indent_less() ;
+<a name="l01040"></a>01040
+<a name="l01041"></a>01041 <span class="comment">/* Free */</span>
+<a name="l01042"></a>01042 cpl_frameset_delete(selected_jitter);
+<a name="l01043"></a>01043 cpl_bivector_delete(selected_offsets);
+<a name="l01044"></a>01044 }
+<a name="l01045"></a>01045 cpl_bivector_delete(offsets) ;
+<a name="l01046"></a>01046
+<a name="l01047"></a>01047 <span class="keywordflow">return</span> combined ;
+<a name="l01048"></a>01048 }
+<a name="l01049"></a>01049
+<a name="l01050"></a>01050 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01057"></a>01057 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01058"></a>01058 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_sky
+<a name="l01059"></a>01059 (cpl_imagelist * objs,
+<a name="l01060"></a>01060 cpl_imagelist * skys,
+<a name="l01061"></a>01061 cpl_table ** bkg_stats,
+<a name="l01062"></a>01062 <span class="keywordtype">int</span> idet)
+<a name="l01063"></a>01063 {
+<a name="l01064"></a>01064 cpl_image * sky ;
+<a name="l01065"></a>01065 <span class="keywordtype">int</span> nframes;
+<a name="l01066"></a>01066 <span class="keywordtype">double</span> median ;
+<a name="l01067"></a>01067 cpl_image * cur_ima ;
+<a name="l01068"></a>01068 <span class="keywordtype">int</span> i ;
+<a name="l01069"></a>01069
+<a name="l01070"></a>01070 <span class="comment">/* Initialise */</span>
+<a name="l01071"></a>01071 nframes = cpl_imagelist_get_size(objs) ;
+<a name="l01072"></a>01072
+<a name="l01073"></a>01073 <span class="comment">/* Compute the sky frame */</span>
+<a name="l01074"></a>01074 <span class="keywordflow">if</span> (skys != NULL) {
+<a name="l01075"></a>01075 cpl_msg_info(cpl_func, <span class="stringliteral">"Median of sky images"</span>) ;
+<a name="l01076"></a>01076 <span class="comment">/* Use sky images */</span>
+<a name="l01077"></a>01077 <span class="keywordflow">if</span> ((sky = cpl_imagelist_collapse_median_create(skys)) == NULL) {
+<a name="l01078"></a>01078 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot compute the median of sky images"</span>) ;
+<a name="l01079"></a>01079 <span class="keywordflow">return</span> -1;
+<a name="l01080"></a>01080 }
+<a name="l01081"></a>01081
+<a name="l01082"></a>01082 <span class="comment">/* Statistics on the background */</span>
+<a name="l01083"></a>01083 <span class="keywordflow">if</span>(bkg_stats != NULL)
+<a name="l01084"></a>01084 {
+<a name="l01085"></a>01085 cpl_table_set_size(bkg_stats[idet], 1);
+<a name="l01086"></a>01086 <a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l01087"></a>01087 (bkg_stats, sky,
+<a name="l01088"></a>01088 1,
+<a name="l01089"></a>01089 1,
+<a name="l01090"></a>01090 cpl_image_get_size_x(sky),
+<a name="l01091"></a>01091 cpl_image_get_size_y(sky),
+<a name="l01092"></a>01092 idet, 0);
+<a name="l01093"></a>01093 }
+<a name="l01094"></a>01094
+<a name="l01095"></a>01095 <span class="comment">/* Correct the objects images */</span>
+<a name="l01096"></a>01096 <span class="keywordflow">if</span> (cpl_imagelist_subtract_image(objs, sky) != CPL_ERROR_NONE) {
+<a name="l01097"></a>01097 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot corr. the obj images from the sky"</span>);
+<a name="l01098"></a>01098 cpl_image_delete(sky) ;
+<a name="l01099"></a>01099 <span class="keywordflow">return</span> -1;
+<a name="l01100"></a>01100 }
+<a name="l01101"></a>01101 cpl_image_delete(sky) ;
+<a name="l01102"></a>01102 <span class="comment">/* Normalise the object planes */</span>
+<a name="l01103"></a>01103 <span class="keywordflow">for</span> (i=0 ; i<nframes ; i++) {
+<a name="l01104"></a>01104 cur_ima = cpl_imagelist_get(objs, i) ;
+<a name="l01105"></a>01105 median = cpl_image_get_median(cur_ima) ;
+<a name="l01106"></a>01106 cpl_image_subtract_scalar(cur_ima, median) ;
+<a name="l01107"></a>01107 }
+<a name="l01108"></a>01108 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (hawki_sci_jitter_config.sky_minnb > nframes) {
+<a name="l01109"></a>01109 cpl_msg_info(cpl_func, <span class="stringliteral">"Median of object images"</span>) ;
+<a name="l01110"></a>01110 <span class="comment">/* Use objs images */</span>
+<a name="l01111"></a>01111 <span class="keywordflow">if</span> ((sky = cpl_imagelist_collapse_median_create(objs)) == NULL) {
+<a name="l01112"></a>01112 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot compute the median of obj images"</span>) ;
+<a name="l01113"></a>01113 <span class="keywordflow">return</span> -1;
+<a name="l01114"></a>01114 }
+<a name="l01115"></a>01115
+<a name="l01116"></a>01116 <span class="comment">/* Statistics on the background */</span>
+<a name="l01117"></a>01117 <span class="keywordflow">if</span>(bkg_stats != NULL)
+<a name="l01118"></a>01118 {
+<a name="l01119"></a>01119 cpl_table_set_size(bkg_stats[idet], 1);
+<a name="l01120"></a>01120 <a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l01121"></a>01121 (bkg_stats, sky,
+<a name="l01122"></a>01122 1,
+<a name="l01123"></a>01123 1,
+<a name="l01124"></a>01124 cpl_image_get_size_x(sky),
+<a name="l01125"></a>01125 cpl_image_get_size_y(sky),
+<a name="l01126"></a>01126 idet, 0);
+<a name="l01127"></a>01127 }
+<a name="l01128"></a>01128
+<a name="l01129"></a>01129 <span class="comment">/* Correct the objects images */</span>
+<a name="l01130"></a>01130 <span class="keywordflow">if</span> (cpl_imagelist_subtract_image(objs, sky) != CPL_ERROR_NONE) {
+<a name="l01131"></a>01131 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot corr. the obj images from the sky"</span>);
+<a name="l01132"></a>01132 cpl_image_delete(sky) ;
+<a name="l01133"></a>01133 <span class="keywordflow">return</span> -1;
+<a name="l01134"></a>01134 }
+<a name="l01135"></a>01135 <span class="comment">/* Normalise the object planes */</span>
+<a name="l01136"></a>01136 <span class="keywordflow">for</span> (i=0 ; i<nframes ; i++) {
+<a name="l01137"></a>01137 cur_ima = cpl_imagelist_get(objs, i) ;
+<a name="l01138"></a>01138 median = cpl_image_get_median(cur_ima) ;
+<a name="l01139"></a>01139 cpl_image_subtract_scalar(cur_ima, median) ;
+<a name="l01140"></a>01140 }
+<a name="l01141"></a>01141 <span class="comment">/* Delete sky image */</span>
+<a name="l01142"></a>01142 cpl_image_delete(sky) ;
+<a name="l01143"></a>01143 } <span class="keywordflow">else</span> {
+<a name="l01144"></a>01144 cpl_msg_info(cpl_func, <span class="stringliteral">"Computing running median on jitter images"</span>) ;
+<a name="l01145"></a>01145 <span class="comment">/* Use objects images */</span>
+<a name="l01146"></a>01146 <span class="keywordflow">if</span> (hawki_sci_jitter_sky_running(objs, bkg_stats, idet) == -1)
+<a name="l01147"></a>01147 {
+<a name="l01148"></a>01148 cpl_msg_error(cpl_func,
+<a name="l01149"></a>01149 <span class="stringliteral">"Cannot apply the running median"</span>);
+<a name="l01150"></a>01150 <span class="keywordflow">return</span> -1;
+<a name="l01151"></a>01151 }
+<a name="l01152"></a>01152 }
+<a name="l01153"></a>01153 <span class="keywordflow">return</span> 0;
+<a name="l01154"></a>01154 }
+<a name="l01155"></a>01155
+<a name="l01156"></a>01156 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01175"></a>01175 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01176"></a>01176 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_sky_running
+<a name="l01177"></a>01177 (cpl_imagelist * in,
+<a name="l01178"></a>01178 cpl_table ** bkg_stats,
+<a name="l01179"></a>01179 <span class="keywordtype">int</span> idet)
+<a name="l01180"></a>01180 {
+<a name="l01181"></a>01181 <span class="keywordtype">int</span> rejmin, rejmax, halfw;
+<a name="l01182"></a>01182 cpl_imagelist * result_buffer;
+<a name="l01183"></a>01183 <span class="keywordtype">int</span> ni, nx, ny;
+<a name="l01184"></a>01184 cpl_vector * medians;
+<a name="l01185"></a>01185 cpl_image * cur_ima;
+<a name="l01186"></a>01186 cpl_image * tmp_ima;
+<a name="l01187"></a>01187 <span class="keywordtype">double</span> one_med;
+<a name="l01188"></a>01188 <span class="keywordtype">int</span> i, k;
+<a name="l01189"></a>01189 <span class="keywordtype">int</span> first_buffered = 0;
+<a name="l01190"></a>01190 <span class="keywordtype">int</span> next_not_to_be_used;
+<a name="l01191"></a>01191
+<a name="l01192"></a>01192 <span class="comment">/* Test entries */</span>
+<a name="l01193"></a>01193 <span class="keywordflow">if</span> (in==NULL) <span class="keywordflow">return</span> -1;
+<a name="l01194"></a>01194
+<a name="l01195"></a>01195 <span class="comment">/* Initialise */</span>
+<a name="l01196"></a>01196 rejmin = hawki_sci_jitter_config.sky_rejmin ;
+<a name="l01197"></a>01197 rejmax = hawki_sci_jitter_config.sky_rejmax ;
+<a name="l01198"></a>01198 halfw = hawki_sci_jitter_config.sky_halfw ;
+<a name="l01199"></a>01199 ni = cpl_imagelist_get_size(in) ;
+<a name="l01200"></a>01200 cur_ima = cpl_imagelist_get(in, 0) ;
+<a name="l01201"></a>01201 nx = cpl_image_get_size_x(cur_ima) ;
+<a name="l01202"></a>01202 ny = cpl_image_get_size_y(cur_ima) ;
+<a name="l01203"></a>01203
+<a name="l01204"></a>01204 <span class="comment">/* Tests on validity of rejection parameters */</span>
+<a name="l01205"></a>01205 <span class="keywordflow">if</span> (((rejmin+rejmax)>=halfw) || (halfw<1) || (rejmin<0) || (rejmax<0)) {
+<a name="l01206"></a>01206 cpl_msg_error(cpl_func, <span class="stringliteral">"cannot run filter with rej parms %d (%d-%d)"</span>,
+<a name="l01207"></a>01207 halfw, rejmin, rejmax);
+<a name="l01208"></a>01208 <span class="keywordflow">return</span> -1;
+<a name="l01209"></a>01209 }
+<a name="l01210"></a>01210 <span class="comment">/* Pre-compute median value in each plane */</span>
+<a name="l01211"></a>01211 medians = cpl_vector_new(ni) ;
+<a name="l01212"></a>01212 <span class="keywordflow">for</span> (i=0 ; i<ni ; i++) {
+<a name="l01213"></a>01213 cur_ima = cpl_imagelist_get(in, i) ;
+<a name="l01214"></a>01214 cpl_vector_set(medians, i, cpl_image_get_median(cur_ima)) ;
+<a name="l01215"></a>01215 }
+<a name="l01216"></a>01216 <span class="comment">/* Allocate output cube */</span>
+<a name="l01217"></a>01217 result_buffer = cpl_imagelist_new() ;
+<a name="l01218"></a>01218
+<a name="l01219"></a>01219 <span class="comment">/* Allocate output bg stats */</span>
+<a name="l01220"></a>01220 cpl_table_set_size(bkg_stats[idet], ni);
+<a name="l01221"></a>01221
+<a name="l01222"></a>01222 <span class="comment">/* Main loop over input planes */</span>
+<a name="l01223"></a>01223 <span class="keywordflow">for</span> (k=0 ; k<ni ; k++)
+<a name="l01224"></a>01224 {
+<a name="l01225"></a>01225 cpl_image * bkg;
+<a name="l01226"></a>01226
+<a name="l01227"></a>01227 <span class="comment">/* Create the background image, to later compute stats */</span>
+<a name="l01228"></a>01228 bkg = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+<a name="l01229"></a>01229
+<a name="l01230"></a>01230 <a class="code" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af" title="Computes the running mean for a set of object images using their masks.">hawki_bkg_from_running_mean_detector</a>
+<a name="l01231"></a>01231 (in, medians, k, halfw, rejmin, rejmax, bkg);
+<a name="l01232"></a>01232
+<a name="l01233"></a>01233 <span class="comment">/* Subtract the background from the current image */</span>
+<a name="l01234"></a>01234 tmp_ima = cpl_image_subtract_create(cpl_imagelist_get(in, k), bkg);
+<a name="l01235"></a>01235
+<a name="l01236"></a>01236 <span class="comment">/* Statistics on the background */</span>
+<a name="l01237"></a>01237 <span class="keywordflow">if</span>(bkg_stats != NULL)
+<a name="l01238"></a>01238 {
+<a name="l01239"></a>01239 <a class="code" href="group__hawki__image__stats.html#gaddd6e9623519487c0775de8c3a0aee0f" title="Fills a table with the statistics of an image.">hawki_image_stats_fill_from_image</a>
+<a name="l01240"></a>01240 (bkg_stats, bkg,
+<a name="l01241"></a>01241 1, 1, nx, ny,
+<a name="l01242"></a>01242 idet, k);
+<a name="l01243"></a>01243 }
+<a name="l01244"></a>01244 cpl_image_delete(bkg);
+<a name="l01245"></a>01245
+<a name="l01246"></a>01246 <span class="comment">/* Place the new image in a result buffer */</span>
+<a name="l01247"></a>01247 cpl_imagelist_set(result_buffer, tmp_ima,
+<a name="l01248"></a>01248 cpl_imagelist_get_size(result_buffer));
+<a name="l01249"></a>01249
+<a name="l01250"></a>01250 <span class="comment">/* Empty the buffer as much as possible */</span>
+<a name="l01251"></a>01251 next_not_to_be_used = k - halfw;
+<a name="l01252"></a>01252 <span class="keywordflow">while</span>(next_not_to_be_used >= first_buffered)
+<a name="l01253"></a>01253 {
+<a name="l01254"></a>01254 cpl_imagelist_set(in, cpl_imagelist_unset(result_buffer, 0),
+<a name="l01255"></a>01255 first_buffered);
+<a name="l01256"></a>01256 first_buffered++;
+<a name="l01257"></a>01257 }
+<a name="l01258"></a>01258 }
+<a name="l01259"></a>01259 <span class="comment">/* Empty the buffer finally */</span>
+<a name="l01260"></a>01260 next_not_to_be_used = ni - 1;
+<a name="l01261"></a>01261 <span class="keywordflow">while</span>(next_not_to_be_used >= first_buffered)
+<a name="l01262"></a>01262 {
+<a name="l01263"></a>01263 cpl_imagelist_set(in, cpl_imagelist_unset(result_buffer, 0),
+<a name="l01264"></a>01264 first_buffered);
+<a name="l01265"></a>01265 first_buffered++;
+<a name="l01266"></a>01266 }
+<a name="l01267"></a>01267 cpl_imagelist_delete(result_buffer);
+<a name="l01268"></a>01268 cpl_vector_delete(medians);
+<a name="l01269"></a>01269
+<a name="l01270"></a>01270 <span class="comment">/* Subtract median from each frame */</span>
+<a name="l01271"></a>01271 <span class="keywordflow">for</span> (i=0 ; i<ni ; i++) {
+<a name="l01272"></a>01272 cur_ima = cpl_imagelist_get(in, i);
+<a name="l01273"></a>01273 one_med = cpl_image_get_median(cur_ima) ;
+<a name="l01274"></a>01274 cpl_image_subtract_scalar(cur_ima, one_med) ;
+<a name="l01275"></a>01275 }
+<a name="l01276"></a>01276 <span class="keywordflow">return</span> 0;
+<a name="l01277"></a>01277 }
+<a name="l01278"></a>01278
+<a name="l01279"></a>01279 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01288"></a>01288 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01289"></a>01289 <span class="keyword">static</span> cpl_image ** hawki_sci_jitter_saa(
+<a name="l01290"></a>01290 cpl_imagelist ** in,
+<a name="l01291"></a>01291 cpl_bivector * offsets,
+<a name="l01292"></a>01292 <span class="keywordtype">double</span> * pos_x,
+<a name="l01293"></a>01293 <span class="keywordtype">double</span> * pos_y)
+<a name="l01294"></a>01294 {
+<a name="l01295"></a>01295 cpl_bivector * offs_est;
+<a name="l01296"></a>01296 cpl_bivector * offs_used;
+<a name="l01297"></a>01297 cpl_bivector * objs ;
+<a name="l01298"></a>01298 cpl_image ** combined ;
+<a name="l01299"></a>01299 <span class="keywordtype">int</span> nfiles, ngood, nima, nx, ny ;
+<a name="l01300"></a>01300 <span class="keywordtype">int</span> i;
+<a name="l01301"></a>01301
+<a name="l01302"></a>01302 <span class="comment">/* Check entries */</span>
+<a name="l01303"></a>01303 <span class="keywordflow">if</span> (pos_x == NULL || pos_y == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l01304"></a>01304 <span class="keywordflow">if</span> (offsets == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l01305"></a>01305
+<a name="l01306"></a>01306 <span class="comment">/* Get the number of images */</span>
+<a name="l01307"></a>01307 nfiles = cpl_imagelist_get_size(*in) ;
+<a name="l01308"></a>01308 <span class="keywordflow">if</span> (cpl_bivector_get_size(offsets) != nfiles) {
+<a name="l01309"></a>01309 cpl_msg_error(cpl_func, <span class="stringliteral">"Invalid input objects sizes"</span>) ;
+<a name="l01310"></a>01310 <span class="keywordflow">return</span> NULL ;
+<a name="l01311"></a>01311 }
+<a name="l01312"></a>01312
+<a name="l01313"></a>01313 <span class="comment">/* Get the offsets estimation of each input file pair */</span>
+<a name="l01314"></a>01314 cpl_msg_info(cpl_func, <span class="stringliteral">"Get the offsets estimation"</span>) ;
+<a name="l01315"></a>01315 offs_est = NULL ;
+<a name="l01316"></a>01316 <span class="keywordflow">if</span> (hawki_sci_jitter_config.offsets &&
+<a name="l01317"></a>01317 hawki_sci_jitter_config.offsets[0] != (<span class="keywordtype">char</span>)0) {
+<a name="l01318"></a>01318 <span class="comment">/* A file has been provided on the command line */</span>
+<a name="l01319"></a>01319 offs_est = cpl_bivector_read((<span class="keywordtype">char</span>*)hawki_sci_jitter_config.offsets);
+<a name="l01320"></a>01320 <span class="keywordflow">if</span> ((offs_est==NULL)||(cpl_bivector_get_size(offs_est)!=nfiles)) {
+<a name="l01321"></a>01321 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot get offsets from %s"</span>,
+<a name="l01322"></a>01322 hawki_sci_jitter_config.offsets) ;
+<a name="l01323"></a>01323 <span class="keywordflow">return</span> NULL ;
+<a name="l01324"></a>01324 }
+<a name="l01325"></a>01325 } <span class="keywordflow">else</span> {
+<a name="l01326"></a>01326 <span class="comment">/* Use the offsets from the header */</span>
+<a name="l01327"></a>01327 offs_est = cpl_bivector_duplicate(offsets) ;
+<a name="l01328"></a>01328 cpl_vector_multiply_scalar(cpl_bivector_get_x(offs_est), -1.0) ;
+<a name="l01329"></a>01329 cpl_vector_multiply_scalar(cpl_bivector_get_y(offs_est), -1.0) ;
+<a name="l01330"></a>01330 }
+<a name="l01331"></a>01331
+<a name="l01332"></a>01332 <span class="comment">/* Read the provided objects file if provided */</span>
+<a name="l01333"></a>01333 objs = NULL ;
+<a name="l01334"></a>01334 <span class="keywordflow">if</span> (hawki_sci_jitter_config.refine &&
+<a name="l01335"></a>01335 hawki_sci_jitter_config.objects &&
+<a name="l01336"></a>01336 hawki_sci_jitter_config.objects[0] != (<span class="keywordtype">char</span>)0) {
+<a name="l01337"></a>01337 cpl_msg_info(cpl_func, <span class="stringliteral">"Get the user provided correlation objects"</span>) ;
+<a name="l01338"></a>01338 <span class="comment">/* A file has been provided on the command line */</span>
+<a name="l01339"></a>01339 objs = cpl_bivector_read((<span class="keywordtype">char</span>*)hawki_sci_jitter_config.objects) ;
+<a name="l01340"></a>01340 <span class="keywordflow">if</span> (objs==NULL) {
+<a name="l01341"></a>01341 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot get objects from %s"</span>,
+<a name="l01342"></a>01342 hawki_sci_jitter_config.objects) ;
+<a name="l01343"></a>01343 cpl_bivector_delete(offs_est) ;
+<a name="l01344"></a>01344 <span class="keywordflow">return</span> NULL ;
+<a name="l01345"></a>01345 }
+<a name="l01346"></a>01346 }
+<a name="l01347"></a>01347
+<a name="l01348"></a>01348 <span class="comment">/* Get a correlation point from the difference of the first images */</span>
+<a name="l01349"></a>01349 <span class="keywordflow">if</span> (hawki_sci_jitter_config.refine && objs == NULL) {
+<a name="l01350"></a>01350 cpl_apertures * aperts;
+<a name="l01351"></a>01351 cpl_image * detect_image;
+<a name="l01352"></a>01352 cpl_vector * thresh_vect;
+<a name="l01353"></a>01353 <span class="keywordtype">double</span> * objs_x ;
+<a name="l01354"></a>01354 <span class="keywordtype">double</span> * objs_y ;
+<a name="l01355"></a>01355 cpl_msg_info(cpl_func, <span class="stringliteral">"Get a cross-correlation point"</span>) ;
+<a name="l01356"></a>01356 thresh_vect = cpl_vector_new(4) ;
+<a name="l01357"></a>01357 cpl_vector_set(thresh_vect, 0, 5.0) ;
+<a name="l01358"></a>01358 cpl_vector_set(thresh_vect, 1, 2.0) ;
+<a name="l01359"></a>01359 cpl_vector_set(thresh_vect, 2, 1.0) ;
+<a name="l01360"></a>01360 cpl_vector_set(thresh_vect, 3, 0.5) ;
+<a name="l01361"></a>01361 detect_image = cpl_imagelist_get(*in, 0);
+<a name="l01362"></a>01362 <span class="keywordflow">if</span> ((aperts = cpl_apertures_extract_window(detect_image, thresh_vect,
+<a name="l01363"></a>01363 400, 400, 1600, 1600, NULL)) == NULL) {
+<a name="l01364"></a>01364 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot find any cross-correlation point"</span>) ;
+<a name="l01365"></a>01365 cpl_bivector_delete(offs_est) ;
+<a name="l01366"></a>01366 cpl_vector_delete(thresh_vect) ;
+<a name="l01367"></a>01367 <span class="keywordflow">return</span> NULL ;
+<a name="l01368"></a>01368 }
+<a name="l01369"></a>01369 cpl_vector_delete(thresh_vect) ;
+<a name="l01370"></a>01370 cpl_apertures_sort_by_npix(aperts) ;
+<a name="l01371"></a>01371 objs = cpl_bivector_new(1) ;
+<a name="l01372"></a>01372 objs_x = cpl_bivector_get_x_data(objs) ;
+<a name="l01373"></a>01373 objs_y = cpl_bivector_get_y_data(objs) ;
+<a name="l01374"></a>01374 objs_x[0] = cpl_apertures_get_pos_x(aperts, 1) ;
+<a name="l01375"></a>01375 objs_y[0] = cpl_apertures_get_pos_y(aperts, 1) ;
+<a name="l01376"></a>01376 cpl_apertures_delete(aperts) ;
+<a name="l01377"></a>01377 <span class="keywordflow">if</span> (objs == NULL) {
+<a name="l01378"></a>01378 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot find any cross-correlation point"</span>) ;
+<a name="l01379"></a>01379 cpl_bivector_delete(offs_est) ;
+<a name="l01380"></a>01380 <span class="keywordflow">return</span> NULL ;
+<a name="l01381"></a>01381 }
+<a name="l01382"></a>01382 cpl_msg_info(cpl_func,
+<a name="l01383"></a>01383 <span class="stringliteral">"Correlation point: %g %g\n"</span>, objs_x[0], objs_y[0]);
+<a name="l01384"></a>01384 }
+<a name="l01385"></a>01385
+<a name="l01386"></a>01386 <span class="comment">/* Refine the offsets */</span>
+<a name="l01387"></a>01387 <span class="keywordflow">if</span> (hawki_sci_jitter_config.refine) {
+<a name="l01388"></a>01388 cpl_bivector * offs_refined;
+<a name="l01389"></a>01389 <span class="keywordtype">double</span> * offs_refined_x;
+<a name="l01390"></a>01390 <span class="keywordtype">double</span> * offs_refined_y;
+<a name="l01391"></a>01391 <span class="keywordtype">double</span> * offs_est_x;
+<a name="l01392"></a>01392 <span class="keywordtype">double</span> * offs_est_y;
+<a name="l01393"></a>01393 cpl_vector * correl ;
+<a name="l01394"></a>01394 <span class="keywordtype">double</span> * correl_data ;
+<a name="l01395"></a>01395 cpl_msg_info(cpl_func, <span class="stringliteral">"Refine the offsets"</span>);
+<a name="l01396"></a>01396 cpl_msg_indent_more() ;
+<a name="l01397"></a>01397 nima = cpl_imagelist_get_size(*in) ;
+<a name="l01398"></a>01398 correl = cpl_vector_new(nima) ;
+<a name="l01399"></a>01399 <span class="keywordflow">if</span> ((offs_refined = cpl_geom_img_offset_fine(*in, offs_est, objs,
+<a name="l01400"></a>01400 hawki_sci_jitter_config.sx,
+<a name="l01401"></a>01401 hawki_sci_jitter_config.sy,
+<a name="l01402"></a>01402 hawki_sci_jitter_config.mx,
+<a name="l01403"></a>01403 hawki_sci_jitter_config.my,
+<a name="l01404"></a>01404 correl)) == NULL) {
+<a name="l01405"></a>01405 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot refine the offsets"</span>);
+<a name="l01406"></a>01406 cpl_bivector_delete(offs_est) ;
+<a name="l01407"></a>01407 <span class="keywordflow">if</span> (objs != NULL) cpl_bivector_delete(objs) ;
+<a name="l01408"></a>01408 cpl_vector_delete(correl) ;
+<a name="l01409"></a>01409 <span class="keywordflow">return</span> NULL ;
+<a name="l01410"></a>01410 }
+<a name="l01411"></a>01411 <span class="keywordflow">if</span> (objs != NULL) cpl_bivector_delete(objs) ;
+<a name="l01412"></a>01412
+<a name="l01413"></a>01413 <span class="comment">/* Display the results */</span>
+<a name="l01414"></a>01414 offs_est_x = cpl_bivector_get_x_data(offs_est);
+<a name="l01415"></a>01415 offs_est_y = cpl_bivector_get_y_data(offs_est);
+<a name="l01416"></a>01416 offs_refined_x = cpl_bivector_get_x_data(offs_refined);
+<a name="l01417"></a>01417 offs_refined_y = cpl_bivector_get_y_data(offs_refined) ;
+<a name="l01418"></a>01418 correl_data = cpl_vector_get_data(correl) ;
+<a name="l01419"></a>01419 cpl_msg_info(cpl_func, <span class="stringliteral">"Refined offsets [correlation factor]"</span>) ;
+<a name="l01420"></a>01420 ngood = 0 ;
+<a name="l01421"></a>01421 <span class="keywordflow">for</span> (i=0 ; i<nima ; i++) {
+<a name="l01422"></a>01422 cpl_msg_info(cpl_func, <span class="stringliteral">"#%02d: %8.2f %8.2f [%12.2f]"</span>,
+<a name="l01423"></a>01423 i+1, offs_refined_x[i], offs_refined_y[i], correl_data[i]);
+<a name="l01424"></a>01424 <span class="keywordflow">if</span> (correl_data[i] > -0.5) ngood++ ;
+<a name="l01425"></a>01425 }
+<a name="l01426"></a>01426 <span class="keywordflow">if</span> (ngood == 0) {
+<a name="l01427"></a>01427 cpl_msg_error(cpl_func, <span class="stringliteral">"No frame correctly correlated"</span>) ;
+<a name="l01428"></a>01428 cpl_bivector_delete(offs_est);
+<a name="l01429"></a>01429 cpl_bivector_delete(offs_refined);
+<a name="l01430"></a>01430 cpl_vector_delete(correl);
+<a name="l01431"></a>01431 <span class="keywordflow">return</span> NULL ;
+<a name="l01432"></a>01432 }
+<a name="l01433"></a>01433 cpl_msg_indent_less();
+<a name="l01434"></a>01434
+<a name="l01435"></a>01435 <span class="comment">/* Replace bad correlated images with the nominal offsets */</span>
+<a name="l01436"></a>01436 cpl_msg_info(cpl_func, <span class="stringliteral">"Using nominal offsets for badly "</span>
+<a name="l01437"></a>01437 <span class="stringliteral">"correlated images (%d out of %d)"</span>, nima-ngood, nima);
+<a name="l01438"></a>01438 <span class="keywordflow">for</span> (i=0 ; i<nima ; i++) {
+<a name="l01439"></a>01439 <span class="keywordflow">if</span> (correl_data[i] < -0.5) {
+<a name="l01440"></a>01440 offs_refined_x[i] = offs_est_x[i];
+<a name="l01441"></a>01441 offs_refined_y[i] = offs_est_y[i];
+<a name="l01442"></a>01442 }
+<a name="l01443"></a>01443 }
+<a name="l01444"></a>01444 offs_used = cpl_bivector_duplicate(offs_refined);
+<a name="l01445"></a>01445 cpl_bivector_delete(offs_est);
+<a name="l01446"></a>01446 cpl_bivector_delete(offs_refined);
+<a name="l01447"></a>01447 cpl_vector_delete(correl);
+<a name="l01448"></a>01448 }
+<a name="l01449"></a>01449 <span class="keywordflow">else</span>
+<a name="l01450"></a>01450 {
+<a name="l01451"></a>01451 offs_used = cpl_bivector_duplicate(offs_est);
+<a name="l01452"></a>01452 cpl_bivector_delete(offs_est);
+<a name="l01453"></a>01453 }
+<a name="l01454"></a>01454
+<a name="l01455"></a>01455 <span class="comment">/* Discard the pixels on the sides */</span>
+<a name="l01456"></a>01456 <span class="keywordflow">if</span> (hawki_sci_jitter_config.borders > 0) {
+<a name="l01457"></a>01457 cpl_imagelist * in_ext ;
+<a name="l01458"></a>01458 cpl_image * tmp1 ;
+<a name="l01459"></a>01459 cpl_image * tmp2 ;
+<a name="l01460"></a>01460 nx = cpl_image_get_size_x(cpl_imagelist_get(*in, 0)) ;
+<a name="l01461"></a>01461 ny = cpl_image_get_size_y(cpl_imagelist_get(*in, 0)) ;
+<a name="l01462"></a>01462 in_ext = cpl_imagelist_new() ;
+<a name="l01463"></a>01463 <span class="keywordflow">while</span>(cpl_imagelist_get_size(*in) > 0)
+<a name="l01464"></a>01464 {
+<a name="l01465"></a>01465 tmp1 = cpl_imagelist_unset(*in, 0);
+<a name="l01466"></a>01466 tmp2 = cpl_image_extract(tmp1,
+<a name="l01467"></a>01467 hawki_sci_jitter_config.borders+1,
+<a name="l01468"></a>01468 hawki_sci_jitter_config.borders+1,
+<a name="l01469"></a>01469 nx-hawki_sci_jitter_config.borders,
+<a name="l01470"></a>01470 ny-hawki_sci_jitter_config.borders) ;
+<a name="l01471"></a>01471 cpl_image_delete(tmp1);
+<a name="l01472"></a>01472 cpl_imagelist_set(in_ext, tmp2, cpl_imagelist_get_size(in_ext)) ;
+<a name="l01473"></a>01473 }
+<a name="l01474"></a>01474 cpl_imagelist_delete(*in) ;
+<a name="l01475"></a>01475 *in = in_ext ;
+<a name="l01476"></a>01476 }
+<a name="l01477"></a>01477
+<a name="l01478"></a>01478 <span class="comment">/* Apply the shift & add */</span>
+<a name="l01479"></a>01479 cpl_msg_info(cpl_func, <span class="stringliteral">"Recombine the images set"</span>) ;
+<a name="l01480"></a>01480 cpl_msg_indent_more() ;
+<a name="l01481"></a>01481 <span class="keywordflow">if</span> ((combined=cpl_geom_img_offset_saa(*in, offs_used,
+<a name="l01482"></a>01482 CPL_KERNEL_DEFAULT,
+<a name="l01483"></a>01483 hawki_sci_jitter_config.rej_low,
+<a name="l01484"></a>01484 hawki_sci_jitter_config.rej_high,
+<a name="l01485"></a>01485 hawki_sci_jitter_config.comb_meth,
+<a name="l01486"></a>01486 pos_x, pos_y)) == NULL) {
+<a name="l01487"></a>01487 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot apply the shift and add"</span>) ;
+<a name="l01488"></a>01488 cpl_bivector_delete(offs_used) ;
+<a name="l01489"></a>01489 cpl_msg_indent_less() ;
+<a name="l01490"></a>01490 <span class="keywordflow">return</span> NULL ;
+<a name="l01491"></a>01491 }
+<a name="l01492"></a>01492 cpl_msg_indent_less() ;
+<a name="l01493"></a>01493 *pos_x -= hawki_sci_jitter_config.borders ;
+<a name="l01494"></a>01494 *pos_y -= hawki_sci_jitter_config.borders ;
+<a name="l01495"></a>01495
+<a name="l01496"></a>01496 <span class="comment">/* Free and return */</span>
+<a name="l01497"></a>01497 cpl_bivector_delete(offs_used) ;
+<a name="l01498"></a>01498 <span class="keywordflow">return</span> combined ;
+<a name="l01499"></a>01499 }
+<a name="l01500"></a>01500
+<a name="l01501"></a>01501 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01508"></a>01508 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01509"></a>01509 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_qc
+<a name="l01510"></a>01510 (cpl_frameset * science_frames,
+<a name="l01511"></a>01511 cpl_image ** combined_images,
+<a name="l01512"></a>01512 cpl_table ** obj_charac)
+<a name="l01513"></a>01513 {
+<a name="l01514"></a>01514 cpl_vector * thresh_vec ;
+<a name="l01515"></a>01515 cpl_apertures * aperts ;
+<a name="l01516"></a>01516 <span class="keywordtype">int</span> nb_objs ;
+<a name="l01517"></a>01517 <span class="keywordtype">double</span> angle ;
+<a name="l01518"></a>01518 <span class="keywordtype">double</span> * fwhms_x ;
+<a name="l01519"></a>01519 <span class="keywordtype">double</span> * fwhms_y ;
+<a name="l01520"></a>01520 cpl_bivector * iqe ;
+<a name="l01521"></a>01521 <span class="keywordtype">int</span> nb_good ;
+<a name="l01522"></a>01522 cpl_vector * fwhms_good ;
+<a name="l01523"></a>01523 <span class="keywordtype">double</span> * fwhms_good_data ;
+<a name="l01524"></a>01524 <span class="keywordtype">double</span> f_min, f_max, fr, fx, fy ;
+<a name="l01525"></a>01525 <span class="keywordtype">int</span> chip;
+<a name="l01526"></a>01526 <span class="keywordtype">int</span> iobj;
+<a name="l01527"></a>01527 <span class="keywordtype">int</span> j;
+<a name="l01528"></a>01528
+<a name="l01529"></a>01529 <span class="comment">/* Initialise */</span>
+<a name="l01530"></a>01530 <span class="keywordtype">double</span> seeing_min_arcsec = 0.1 ;
+<a name="l01531"></a>01531 <span class="keywordtype">double</span> seeing_max_arcsec = 5.0 ;
+<a name="l01532"></a>01532 <span class="keywordtype">double</span> seeing_fwhm_var = 0.2 ;
+<a name="l01533"></a>01533
+<a name="l01534"></a>01534 <span class="comment">/* Check entries */</span>
+<a name="l01535"></a>01535 <span class="keywordflow">if</span> (combined_images == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01536"></a>01536 <span class="keywordflow">if</span> (obj_charac == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01537"></a>01537
+<a name="l01538"></a>01538 <span class="comment">/* Create the vector for the detection thresholds */</span>
+<a name="l01539"></a>01539 thresh_vec = cpl_vector_new(11) ;
+<a name="l01540"></a>01540 cpl_vector_set(thresh_vec, 0, 100.0) ;
+<a name="l01541"></a>01541 cpl_vector_set(thresh_vec, 0, 90.0) ;
+<a name="l01542"></a>01542 cpl_vector_set(thresh_vec, 0, 80.0) ;
+<a name="l01543"></a>01543 cpl_vector_set(thresh_vec, 0, 70.0) ;
+<a name="l01544"></a>01544 cpl_vector_set(thresh_vec, 0, 60.0) ;
+<a name="l01545"></a>01545 cpl_vector_set(thresh_vec, 0, 50.0) ;
+<a name="l01546"></a>01546 cpl_vector_set(thresh_vec, 1, 40.0) ;
+<a name="l01547"></a>01547 cpl_vector_set(thresh_vec, 1, 30.0) ;
+<a name="l01548"></a>01548 cpl_vector_set(thresh_vec, 1, 20.0) ;
+<a name="l01549"></a>01549 cpl_vector_set(thresh_vec, 1, 10.0) ;
+<a name="l01550"></a>01550 cpl_vector_set(thresh_vec, 2, 5.0) ;
+<a name="l01551"></a>01551
+<a name="l01552"></a>01552 <span class="comment">/* Get the mean airmass */</span>
+<a name="l01553"></a>01553 hawki_sci_jitter_output.mean_airmass =
+<a name="l01554"></a>01554 <a class="code" href="group__hawki__utils.html#ga7b165e9e91b6c6519595109b36d4fb46" title="Get the mean airmass for a set of frames.">hawki_get_mean_airmass</a>(science_frames);;
+<a name="l01555"></a>01555
+<a name="l01556"></a>01556 <span class="comment">/* Loop on the HAWK-I detectors */</span>
+<a name="l01557"></a>01557 <span class="keywordflow">for</span> (chip=0 ; chip<HAWKI_NB_DETECTORS ; chip++)
+<a name="l01558"></a>01558 {
+<a name="l01559"></a>01559 <span class="comment">/* Check entries */</span>
+<a name="l01560"></a>01560 <span class="keywordflow">if</span> (combined_images[chip] == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01561"></a>01561 <span class="keywordflow">if</span> (obj_charac[chip] == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l01562"></a>01562
+<a name="l01563"></a>01563 <span class="comment">/* Detect apertures */</span>
+<a name="l01564"></a>01564 <span class="keywordflow">if</span> ((aperts = cpl_apertures_extract
+<a name="l01565"></a>01565 (combined_images[chip], thresh_vec, NULL)) == NULL) {
+<a name="l01566"></a>01566 cpl_msg_warning(cpl_func, <span class="stringliteral">"Cannot detect any aperture on chip %d"</span>,
+<a name="l01567"></a>01567 chip+1) ;
+<a name="l01568"></a>01568 <span class="keywordflow">continue</span>;
+<a name="l01569"></a>01569 }
+<a name="l01570"></a>01570
+<a name="l01571"></a>01571 <span class="comment">/* Number of detected objects */</span>
+<a name="l01572"></a>01572 nb_objs = cpl_apertures_get_size(aperts);
+<a name="l01573"></a>01573 cpl_msg_info(cpl_func, <span class="stringliteral">"%d objects detected on chip %d"</span>,nb_objs,chip+1);
+<a name="l01574"></a>01574 hawki_sci_jitter_output.nbobjs[chip] = nb_objs ;
+<a name="l01575"></a>01575 fwhms_x = cpl_malloc(nb_objs * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)) ;
+<a name="l01576"></a>01576 fwhms_y = cpl_malloc(nb_objs * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)) ;
+<a name="l01577"></a>01577
+<a name="l01578"></a>01578 <span class="comment">/* Initialize the output table */</span>
+<a name="l01579"></a>01579 cpl_table_set_size(obj_charac[chip], nb_objs);
+<a name="l01580"></a>01580 cpl_table_new_column
+<a name="l01581"></a>01581 (obj_charac[chip], HAWKI_COL_OBJ_POSX, CPL_TYPE_DOUBLE);
+<a name="l01582"></a>01582 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSX,<span class="stringliteral">"pix"</span>);
+<a name="l01583"></a>01583 cpl_table_new_column
+<a name="l01584"></a>01584 (obj_charac[chip], HAWKI_COL_OBJ_POSY, CPL_TYPE_DOUBLE);
+<a name="l01585"></a>01585 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSY,<span class="stringliteral">"pix"</span>);
+<a name="l01586"></a>01586 cpl_table_new_column
+<a name="l01587"></a>01587 (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, CPL_TYPE_DOUBLE);
+<a name="l01588"></a>01588 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_ANGLE,<span class="stringliteral">"grad"</span>);
+<a name="l01589"></a>01589 cpl_table_new_column
+<a name="l01590"></a>01590 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, CPL_TYPE_DOUBLE);
+<a name="l01591"></a>01591 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MAJAX,<span class="stringliteral">"pix"</span>);
+<a name="l01592"></a>01592 cpl_table_new_column
+<a name="l01593"></a>01593 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, CPL_TYPE_DOUBLE);
+<a name="l01594"></a>01594 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MINAX,<span class="stringliteral">"pix"</span>);
+<a name="l01595"></a>01595 cpl_table_new_column
+<a name="l01596"></a>01596 (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, CPL_TYPE_DOUBLE);
+<a name="l01597"></a>01597 cpl_table_new_column
+<a name="l01598"></a>01598 (obj_charac[chip], HAWKI_COL_OBJ_FLUX, CPL_TYPE_DOUBLE);
+<a name="l01599"></a>01599 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FLUX,<span class="stringliteral">"ADU"</span>);
+<a name="l01600"></a>01600 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l01601"></a>01601 {
+<a name="l01602"></a>01602 <span class="comment">/* Fill with the already known information */</span>
+<a name="l01603"></a>01603 cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSX, iobj,
+<a name="l01604"></a>01604 cpl_apertures_get_centroid_x(aperts, iobj+1));
+<a name="l01605"></a>01605 cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSY, iobj,
+<a name="l01606"></a>01606 cpl_apertures_get_centroid_y(aperts, iobj+1));
+<a name="l01607"></a>01607 cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_FLUX, iobj,
+<a name="l01608"></a>01608 cpl_apertures_get_flux(aperts, iobj+1)) ;
+<a name="l01609"></a>01609 <span class="comment">/* Compute the FWHM informations */</span>
+<a name="l01610"></a>01610 <span class="keywordflow">if</span> ((iqe = cpl_image_iqe(combined_images[chip],
+<a name="l01611"></a>01611 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_x(aperts, iobj+1) - 10,
+<a name="l01612"></a>01612 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_y(aperts, iobj+1) - 10,
+<a name="l01613"></a>01613 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_x(aperts, iobj+1) + 10,
+<a name="l01614"></a>01614 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_y(aperts, iobj+1) + 10))==NULL)
+<a name="l01615"></a>01615 {
+<a name="l01616"></a>01616 cpl_error_reset() ;
+<a name="l01617"></a>01617 cpl_msg_debug(cpl_func, <span class="stringliteral">"Cannot get FWHM for obj at pos %g %g"</span>,
+<a name="l01618"></a>01618 cpl_apertures_get_centroid_x(aperts, iobj+1),
+<a name="l01619"></a>01619 cpl_apertures_get_centroid_y(aperts, iobj+1)) ;
+<a name="l01620"></a>01620 fwhms_x[iobj] = -1.0 ;
+<a name="l01621"></a>01621 fwhms_y[iobj] = -1.0 ;
+<a name="l01622"></a>01622 angle = 0.0 ;
+<a name="l01623"></a>01623 }
+<a name="l01624"></a>01624 <span class="keywordflow">else</span>
+<a name="l01625"></a>01625 {
+<a name="l01626"></a>01626 fwhms_x[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 2) ;
+<a name="l01627"></a>01627 fwhms_y[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 3) ;
+<a name="l01628"></a>01628 angle = cpl_vector_get(cpl_bivector_get_x(iqe), 4) ;
+<a name="l01629"></a>01629 cpl_bivector_delete(iqe) ;
+<a name="l01630"></a>01630 cpl_msg_debug(cpl_func,
+<a name="l01631"></a>01631 <span class="stringliteral">"FWHM for obj at pos %g %g: %g x %g (%g)"</span>,
+<a name="l01632"></a>01632 cpl_apertures_get_centroid_x(aperts, iobj+1),
+<a name="l01633"></a>01633 cpl_apertures_get_centroid_y(aperts, iobj+1),
+<a name="l01634"></a>01634 fwhms_x[iobj], fwhms_y[iobj], angle) ;
+<a name="l01635"></a>01635 }
+<a name="l01636"></a>01636 cpl_table_set_double
+<a name="l01637"></a>01637 (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, iobj, angle) ;
+<a name="l01638"></a>01638 cpl_table_set_double
+<a name="l01639"></a>01639 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, iobj,
+<a name="l01640"></a>01640 fwhms_x[iobj]);
+<a name="l01641"></a>01641 cpl_table_set_double
+<a name="l01642"></a>01642 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, iobj,
+<a name="l01643"></a>01643 fwhms_y[iobj]);
+<a name="l01644"></a>01644 cpl_table_set_double
+<a name="l01645"></a>01645 (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, iobj,
+<a name="l01646"></a>01646 1 - fwhms_y[iobj] / fwhms_x[iobj]);
+<a name="l01647"></a>01647 }
+<a name="l01648"></a>01648 cpl_apertures_delete(aperts) ;
+<a name="l01649"></a>01649
+<a name="l01650"></a>01650 <span class="comment">/* Get the number of good values */</span>
+<a name="l01651"></a>01651 nb_good = 0 ;
+<a name="l01652"></a>01652 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l01653"></a>01653 {
+<a name="l01654"></a>01654 <span class="keywordflow">if</span> ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0)) nb_good++ ;
+<a name="l01655"></a>01655 }
+<a name="l01656"></a>01656 <span class="keywordflow">if</span> (nb_good == 0)
+<a name="l01657"></a>01657 {
+<a name="l01658"></a>01658 cpl_msg_warning(cpl_func, <span class="stringliteral">"No objects to compute FWHM on chip %d"</span>,
+<a name="l01659"></a>01659 chip+1);
+<a name="l01660"></a>01660 cpl_free(fwhms_x) ;
+<a name="l01661"></a>01661 cpl_free(fwhms_y) ;
+<a name="l01662"></a>01662 <span class="keywordflow">continue</span>;
+<a name="l01663"></a>01663 }
+<a name="l01664"></a>01664
+<a name="l01665"></a>01665 <span class="comment">/* Get the good values */</span>
+<a name="l01666"></a>01666 fwhms_good = cpl_vector_new(nb_good) ;
+<a name="l01667"></a>01667 fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+<a name="l01668"></a>01668 j=0 ;
+<a name="l01669"></a>01669 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l01670"></a>01670 {
+<a name="l01671"></a>01671 <span class="keywordflow">if</span> ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0))
+<a name="l01672"></a>01672 {
+<a name="l01673"></a>01673 fwhms_good_data[j] = (fwhms_x[iobj]+fwhms_y[iobj])/2.0 ;
+<a name="l01674"></a>01674 j++ ;
+<a name="l01675"></a>01675 }
+<a name="l01676"></a>01676 }
+<a name="l01677"></a>01677
+<a name="l01678"></a>01678 <span class="comment">/* Compute the fwhm */</span>
+<a name="l01679"></a>01679 <span class="keywordflow">if</span> (nb_good < 3)
+<a name="l01680"></a>01680 {
+<a name="l01681"></a>01681 <span class="comment">/* Too few values to compute the median */</span>
+<a name="l01682"></a>01682 hawki_sci_jitter_output.fwhm_pix[chip] = fwhms_good_data[0] ;
+<a name="l01683"></a>01683 }
+<a name="l01684"></a>01684 <span class="keywordflow">else</span>
+<a name="l01685"></a>01685 {
+<a name="l01686"></a>01686 <span class="comment">/* Compute the median */</span>
+<a name="l01687"></a>01687 hawki_sci_jitter_output.fwhm_pix[chip] =
+<a name="l01688"></a>01688 cpl_vector_get_median_const(fwhms_good) ;
+<a name="l01689"></a>01689 }
+<a name="l01690"></a>01690 hawki_sci_jitter_output.fwhm_arcsec[chip] =
+<a name="l01691"></a>01691 hawki_sci_jitter_output.fwhm_pix[chip] *
+<a name="l01692"></a>01692 hawki_sci_jitter_output.pixscale ;
+<a name="l01693"></a>01693
+<a name="l01694"></a>01694 <span class="comment">/* Compute the mode of the FWHMs */</span>
+<a name="l01695"></a>01695 <span class="keywordflow">if</span> (nb_good > 5)
+<a name="l01696"></a>01696 {
+<a name="l01697"></a>01697 hawki_sci_jitter_output.fwhm_mode[chip] =
+<a name="l01698"></a>01698 <a class="code" href="group__hawki__utils.html#gac64c154f22c4d25e242833fbe75da886" title="Compute the histogram mode.">hawki_vector_get_mode</a>(fwhms_good);
+<a name="l01699"></a>01699 hawki_sci_jitter_output.fwhm_mode[chip] *=
+<a name="l01700"></a>01700 hawki_sci_jitter_output.pixscale ;
+<a name="l01701"></a>01701 }
+<a name="l01702"></a>01702 cpl_vector_delete(fwhms_good) ;
+<a name="l01703"></a>01703
+<a name="l01704"></a>01704 <span class="comment">/* IQ is the median of the (fwhm_x+fwhm_y/2) of the good stars */</span>
+<a name="l01705"></a>01705 <span class="comment">/* Compute f_min and f_max */</span>
+<a name="l01706"></a>01706 f_min = seeing_min_arcsec / hawki_sci_jitter_output.pixscale ;
+<a name="l01707"></a>01707 f_max = seeing_max_arcsec / hawki_sci_jitter_output.pixscale ;
+<a name="l01708"></a>01708
+<a name="l01709"></a>01709 <span class="comment">/* Get the number of good values */</span>
+<a name="l01710"></a>01710 nb_good = 0 ;
+<a name="l01711"></a>01711 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l01712"></a>01712 {
+<a name="l01713"></a>01713 fx = fwhms_x[iobj] ;
+<a name="l01714"></a>01714 fy = fwhms_y[iobj] ;
+<a name="l01715"></a>01715 fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+<a name="l01716"></a>01716 <span class="keywordflow">if</span> ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+<a name="l01717"></a>01717 (fr < seeing_fwhm_var)) nb_good++ ;
+<a name="l01718"></a>01718 }
+<a name="l01719"></a>01719 <span class="keywordflow">if</span> (nb_good == 0)
+<a name="l01720"></a>01720 {
+<a name="l01721"></a>01721 cpl_msg_warning(cpl_func, <span class="stringliteral">"No objects to compute IQ on chip %d"</span>,
+<a name="l01722"></a>01722 chip+1);
+<a name="l01723"></a>01723 cpl_free(fwhms_x) ;
+<a name="l01724"></a>01724 cpl_free(fwhms_y) ;
+<a name="l01725"></a>01725 <span class="keywordflow">continue</span>;
+<a name="l01726"></a>01726 }
+<a name="l01727"></a>01727
+<a name="l01728"></a>01728 <span class="comment">/* Get the good values */</span>
+<a name="l01729"></a>01729 fwhms_good = cpl_vector_new(nb_good) ;
+<a name="l01730"></a>01730 fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+<a name="l01731"></a>01731 j=0 ;
+<a name="l01732"></a>01732 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l01733"></a>01733 {
+<a name="l01734"></a>01734 fx = fwhms_x[iobj] ;
+<a name="l01735"></a>01735 fy = fwhms_y[iobj] ;
+<a name="l01736"></a>01736 fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+<a name="l01737"></a>01737 <span class="keywordflow">if</span> ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+<a name="l01738"></a>01738 (fr < seeing_fwhm_var))
+<a name="l01739"></a>01739 {
+<a name="l01740"></a>01740 fwhms_good_data[j] = (fx + fy)/2.0 ;
+<a name="l01741"></a>01741 j++ ;
+<a name="l01742"></a>01742 }
+<a name="l01743"></a>01743 }
+<a name="l01744"></a>01744 cpl_free(fwhms_x) ;
+<a name="l01745"></a>01745 cpl_free(fwhms_y) ;
+<a name="l01746"></a>01746
+<a name="l01747"></a>01747 <span class="comment">/* Compute the fwhm */</span>
+<a name="l01748"></a>01748 <span class="keywordflow">if</span> (nb_good < 3)
+<a name="l01749"></a>01749 {
+<a name="l01750"></a>01750 <span class="comment">/* Too few values to compute the median */</span>
+<a name="l01751"></a>01751 hawki_sci_jitter_output.iq[chip] = fwhms_good_data[0] ;
+<a name="l01752"></a>01752 }
+<a name="l01753"></a>01753 <span class="keywordflow">else</span>
+<a name="l01754"></a>01754 {
+<a name="l01755"></a>01755 <span class="comment">/* Compute the median */</span>
+<a name="l01756"></a>01756 hawki_sci_jitter_output.iq[chip] =
+<a name="l01757"></a>01757 cpl_vector_get_median_const(fwhms_good) ;
+<a name="l01758"></a>01758 }
+<a name="l01759"></a>01759 cpl_vector_delete(fwhms_good) ;
+<a name="l01760"></a>01760 hawki_sci_jitter_output.iq[chip] *= hawki_sci_jitter_output.pixscale ;
+<a name="l01761"></a>01761 }
+<a name="l01762"></a>01762
+<a name="l01763"></a>01763 <span class="comment">/* Cleanup */</span>
+<a name="l01764"></a>01764 cpl_vector_delete(thresh_vec) ;
+<a name="l01765"></a>01765
+<a name="l01766"></a>01766 <span class="keywordflow">return</span> 0;
+<a name="l01767"></a>01767 }
+<a name="l01768"></a>01768
+<a name="l01769"></a>01769 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01781"></a>01781 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01782"></a>01782 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_read_calib
+<a name="l01783"></a>01783 (<span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l01784"></a>01784 <span class="keyword">const</span> <span class="keywordtype">char</span> * dark,
+<a name="l01785"></a>01785 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l01786"></a>01786 cpl_image ** flat_image,
+<a name="l01787"></a>01787 cpl_image ** dark_image,
+<a name="l01788"></a>01788 cpl_image ** bpm_image,
+<a name="l01789"></a>01789 <span class="keywordtype">int</span> idet)
+<a name="l01790"></a>01790 {
+<a name="l01791"></a>01791 <span class="keyword">const</span> <span class="keywordtype">char</span> * reffile;
+<a name="l01792"></a>01792 <span class="keywordtype">int</span> ext_nb;
+<a name="l01793"></a>01793
+<a name="l01794"></a>01794 <span class="keywordflow">if</span>(flat == NULL && dark == NULL && bpm == NULL)
+<a name="l01795"></a>01795 <span class="keywordflow">return</span> 0;
+<a name="l01796"></a>01796 <span class="keywordflow">if</span>(*flat_image != NULL || *dark_image != NULL || *bpm_image != NULL)
+<a name="l01797"></a>01797 <span class="keywordflow">return</span> 0;
+<a name="l01798"></a>01798
+<a name="l01799"></a>01799 <span class="comment">/* Get the extension number for this detector */</span>
+<a name="l01800"></a>01800 <span class="keywordflow">if</span>(flat != NULL)
+<a name="l01801"></a>01801 reffile = flat;
+<a name="l01802"></a>01802 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dark != NULL)
+<a name="l01803"></a>01803 reffile = dark;
+<a name="l01804"></a>01804 <span class="keywordflow">else</span>
+<a name="l01805"></a>01805 reffile = bpm;
+<a name="l01806"></a>01806
+<a name="l01807"></a>01807 <span class="comment">/* Guess which is the extension to read */</span>
+<a name="l01808"></a>01808 <span class="keywordflow">if</span> ((ext_nb = <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(reffile, idet + 1)) == -1) {
+<a name="l01809"></a>01809 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot get the extension with detector %d"</span>,
+<a name="l01810"></a>01810 idet + 1);
+<a name="l01811"></a>01811 <span class="keywordflow">return</span> -1;
+<a name="l01812"></a>01812 }
+<a name="l01813"></a>01813
+<a name="l01814"></a>01814 <span class="comment">/* Load the dark image */</span>
+<a name="l01815"></a>01815 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l01816"></a>01816 *dark_image = cpl_image_load(dark, CPL_TYPE_FLOAT, 0, ext_nb);
+<a name="l01817"></a>01817 <span class="comment">/* Load the flat image */</span>
+<a name="l01818"></a>01818 <span class="keywordflow">if</span>(flat != NULL)
+<a name="l01819"></a>01819 *flat_image = cpl_image_load(flat, CPL_TYPE_FLOAT, 0, ext_nb);
+<a name="l01820"></a>01820 <span class="comment">/* Load the bpm image */</span>
+<a name="l01821"></a>01821 <span class="keywordflow">if</span>(bpm != NULL)
+<a name="l01822"></a>01822 *bpm_image = cpl_image_load(bpm, CPL_TYPE_FLOAT, 0, ext_nb);
+<a name="l01823"></a>01823
+<a name="l01824"></a>01824 <span class="comment">/* Multiply the dark image by the science exposure time */</span>
+<a name="l01825"></a>01825 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l01826"></a>01826 cpl_image_multiply_scalar(*dark_image, hawki_sci_jitter_output.dit);
+<a name="l01827"></a>01827
+<a name="l01828"></a>01828 <span class="comment">/* Return */</span>
+<a name="l01829"></a>01829 <span class="keywordflow">return</span> 0;
+<a name="l01830"></a>01830 }
+<a name="l01831"></a>01831
+<a name="l01832"></a>01832 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01841"></a>01841 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01842"></a>01842 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_sci_jitter_save
+<a name="l01843"></a>01843 (cpl_image ** combined,
+<a name="l01844"></a>01844 cpl_image * stitched,
+<a name="l01845"></a>01845 cpl_table ** obj_charac,
+<a name="l01846"></a>01846 cpl_table ** raw_jitter_stats,
+<a name="l01847"></a>01847 cpl_table ** bkg_stats,
+<a name="l01848"></a>01848 <span class="keyword">const</span> cpl_table * raw_obj_tel_info,
+<a name="l01849"></a>01849 cpl_frameset * science_frames,
+<a name="l01850"></a>01850 cpl_frameset * calib_frames,
+<a name="l01851"></a>01851 cpl_parameterlist * parlist,
+<a name="l01852"></a>01852 cpl_frameset * <span class="keyword">set</span>)
+<a name="l01853"></a>01853 {
+<a name="l01854"></a>01854 cpl_propertylist * plist ;
+<a name="l01855"></a>01855 <span class="keywordtype">double</span> pscale, dit, bg_mean, bg_stdev, bg_instmag ;
+<a name="l01856"></a>01856 cpl_propertylist ** qclists ;
+<a name="l01857"></a>01857 <span class="keyword">const</span> cpl_frame * ref_frame ;
+<a name="l01858"></a>01858 cpl_frameset * used_frames;
+<a name="l01859"></a>01859 cpl_propertylist * wcslist ;
+<a name="l01860"></a>01860 cpl_propertylist * telstats;
+<a name="l01861"></a>01861 cpl_propertylist * inputlist ;
+<a name="l01862"></a>01862 <span class="keywordtype">double</span> crpix1, crpix2 ;
+<a name="l01863"></a>01863 <span class="keywordtype">int</span> ext_nb ;
+<a name="l01864"></a>01864 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_sci_jitter"</span> ;
+<a name="l01865"></a>01865 <span class="keywordtype">int</span> i;
+<a name="l01866"></a>01866 <span class="keywordtype">int</span> ext_chip_1;
+<a name="l01867"></a>01867 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l01868"></a>01868
+<a name="l01869"></a>01869 <span class="comment">/* Initialise */</span>
+<a name="l01870"></a>01870 pscale = hawki_sci_jitter_output.pixscale;
+<a name="l01871"></a>01871 dit = hawki_sci_jitter_output.dit;
+<a name="l01872"></a>01872
+<a name="l01873"></a>01873 <span class="comment">/* Get reference frame */</span>
+<a name="l01874"></a>01874 ref_frame = irplib_frameset_get_first_from_group(<span class="keyword">set</span>, CPL_FRAME_GROUP_RAW);
+<a name="l01875"></a>01875
+<a name="l01876"></a>01876 <span class="comment">/* Get the used frames */</span>
+<a name="l01877"></a>01877 used_frames = cpl_frameset_duplicate(science_frames);
+<a name="l01878"></a>01878 <span class="keywordflow">for</span>(i = 0; i< cpl_frameset_get_size(calib_frames); ++i)
+<a name="l01879"></a>01879 cpl_frameset_insert(used_frames,
+<a name="l01880"></a>01880 cpl_frame_duplicate(cpl_frameset_get_frame(calib_frames, i)));
+<a name="l01881"></a>01881
+<a name="l01882"></a>01882 <span class="comment">/* Create the telescope data statistics */</span>
+<a name="l01883"></a>01883 telstats = cpl_propertylist_new();
+<a name="l01884"></a>01884 hawki_compute_prop_tel_qc_stats(raw_obj_tel_info, telstats);
+<a name="l01885"></a>01885
+<a name="l01886"></a>01886 <span class="comment">/* Create the QC lists */</span>
+<a name="l01887"></a>01887 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l01888"></a>01888 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l01889"></a>01889
+<a name="l01890"></a>01890 <span class="comment">/* Get the extension number */</span>
+<a name="l01891"></a>01891 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), i+1);
+<a name="l01892"></a>01892
+<a name="l01893"></a>01893 <span class="comment">/* Handle WCS keys */</span>
+<a name="l01894"></a>01894 wcslist = cpl_propertylist_load_regexp(
+<a name="l01895"></a>01895 cpl_frame_get_filename(ref_frame), ext_nb, HAWKI_HEADER_WCS, 0);
+<a name="l01896"></a>01896 qclists[i] = cpl_propertylist_new() ;
+<a name="l01897"></a>01897
+<a name="l01898"></a>01898 <span class="comment">/* Compute bg_instmag */</span>
+<a name="l01899"></a>01899 bg_mean = cpl_table_get_column_mean(bkg_stats[i], HAWKI_COL_STAT_MEAN);
+<a name="l01900"></a>01900 <span class="keywordflow">if</span> (cpl_table_get_nrow(bkg_stats[i]) < 2) bg_stdev = 0 ;
+<a name="l01901"></a>01901 <span class="keywordflow">else</span> bg_stdev = cpl_table_get_column_stdev
+<a name="l01902"></a>01902 (bkg_stats[i], HAWKI_COL_STAT_MEAN);
+<a name="l01903"></a>01903 <span class="keywordflow">if</span>(bg_mean >= 0)
+<a name="l01904"></a>01904 bg_instmag = -2.5 * log10(bg_mean/(pscale*pscale*dit));
+<a name="l01905"></a>01905 <span class="keywordflow">else</span>
+<a name="l01906"></a>01906 bg_instmag = 0;
+<a name="l01907"></a>01907
+<a name="l01908"></a>01908 <span class="comment">/* Fill the QC */</span>
+<a name="l01909"></a>01909 cpl_propertylist_append_double
+<a name="l01910"></a>01910 (qclists[i], <span class="stringliteral">"ESO QC BACKGD MEAN"</span>, bg_mean) ;
+<a name="l01911"></a>01911 cpl_propertylist_append_double
+<a name="l01912"></a>01912 (qclists[i], <span class="stringliteral">"ESO QC BACKGD STDEV"</span>, bg_stdev);
+<a name="l01913"></a>01913 cpl_propertylist_append_double
+<a name="l01914"></a>01914 (qclists[i], <span class="stringliteral">"ESO QC BACKGD INSTMAG"</span>, bg_instmag) ;
+<a name="l01915"></a>01915 cpl_propertylist_append_int
+<a name="l01916"></a>01916 (qclists[i], <span class="stringliteral">"ESO QC NBOBJS"</span>, hawki_sci_jitter_output.nbobjs[i]);
+<a name="l01917"></a>01917 cpl_propertylist_append_double
+<a name="l01918"></a>01918 (qclists[i], <span class="stringliteral">"ESO QC IQ"</span>, hawki_sci_jitter_output.iq[i]);
+<a name="l01919"></a>01919 cpl_propertylist_append_double
+<a name="l01920"></a>01920 (qclists[i], <span class="stringliteral">"ESO QC IQ DIFF AMBI"</span>,
+<a name="l01921"></a>01921 hawki_sci_jitter_output.iq[i] - cpl_propertylist_get_double
+<a name="l01922"></a>01922 (telstats, <span class="stringliteral">"ESO QC TEL AMBI FWHM MEAN"</span>));
+<a name="l01923"></a>01923 cpl_propertylist_append_double
+<a name="l01924"></a>01924 (qclists[i], <span class="stringliteral">"ESO QC IQ DIFF TEL"</span>,
+<a name="l01925"></a>01925 hawki_sci_jitter_output.iq[i] - cpl_propertylist_get_double
+<a name="l01926"></a>01926 (telstats, <span class="stringliteral">"ESO QC TEL IA FWHM MEAN"</span>));
+<a name="l01927"></a>01927 cpl_propertylist_append_double
+<a name="l01928"></a>01928 (qclists[i], <span class="stringliteral">"ESO QC FWHM PIX"</span>,
+<a name="l01929"></a>01929 hawki_sci_jitter_output.fwhm_pix[i]);
+<a name="l01930"></a>01930 cpl_propertylist_append_double
+<a name="l01931"></a>01931 (qclists[i], <span class="stringliteral">"ESO QC FWHM ARCSEC"</span>,
+<a name="l01932"></a>01932 hawki_sci_jitter_output.fwhm_arcsec[i]);
+<a name="l01933"></a>01933 cpl_propertylist_append_double
+<a name="l01934"></a>01934 (qclists[i], <span class="stringliteral">"ESO QC FWHM MODE"</span>,
+<a name="l01935"></a>01935 hawki_sci_jitter_output.fwhm_mode[i]);
+<a name="l01936"></a>01936 cpl_propertylist_append_double
+<a name="l01937"></a>01937 (qclists[i], <span class="stringliteral">"ESO QC COMBINED POSX"</span>,
+<a name="l01938"></a>01938 hawki_sci_jitter_output.combined_pos_x[i]);
+<a name="l01939"></a>01939 cpl_propertylist_append_double
+<a name="l01940"></a>01940 (qclists[i], <span class="stringliteral">"ESO QC COMBINED POSY"</span>,
+<a name="l01941"></a>01941 hawki_sci_jitter_output.combined_pos_y[i]);
+<a name="l01942"></a>01942 cpl_propertylist_append_double
+<a name="l01943"></a>01943 (qclists[i], <span class="stringliteral">"ESO QC COMBINED CUMOFFSETX"</span>,
+<a name="l01944"></a>01944 hawki_sci_jitter_output.combined_cumoffset_x[i]);
+<a name="l01945"></a>01945 cpl_propertylist_append_double
+<a name="l01946"></a>01946 (qclists[i], <span class="stringliteral">"ESO QC COMBINED CUMOFFSETY"</span>,
+<a name="l01947"></a>01947 hawki_sci_jitter_output.combined_cumoffset_y[i]);
+<a name="l01948"></a>01948 cpl_propertylist_append_int
+<a name="l01949"></a>01949 (qclists[i], <span class="stringliteral">"ESO QC DATANCOM"</span>,hawki_sci_jitter_output.ncomb[i]);
+<a name="l01950"></a>01950 cpl_propertylist_append_double
+<a name="l01951"></a>01951 (qclists[i], <span class="stringliteral">"ESO QC AIRMASS MEAN"</span>,
+<a name="l01952"></a>01952 hawki_sci_jitter_output.mean_airmass);
+<a name="l01953"></a>01953
+<a name="l01954"></a>01954 <span class="comment">/* Update WCS and write them */</span>
+<a name="l01955"></a>01955 crpix1 = cpl_propertylist_get_double(wcslist, <span class="stringliteral">"CRPIX1"</span>);
+<a name="l01956"></a>01956 crpix1 += hawki_sci_jitter_output.combined_pos_x[i];
+<a name="l01957"></a>01957 cpl_propertylist_update_double(wcslist, <span class="stringliteral">"CRPIX1"</span>, crpix1) ;
+<a name="l01958"></a>01958 crpix2 = cpl_propertylist_get_double(wcslist, <span class="stringliteral">"CRPIX2"</span>);
+<a name="l01959"></a>01959 crpix2 += hawki_sci_jitter_output.combined_pos_y[i] ;
+<a name="l01960"></a>01960 cpl_propertylist_update_double(wcslist, <span class="stringliteral">"CRPIX2"</span>, crpix2) ;
+<a name="l01961"></a>01961 cpl_propertylist_copy_property_regexp
+<a name="l01962"></a>01962 (qclists[i], wcslist, HAWKI_HEADER_WCS, 0) ;
+<a name="l01963"></a>01963 cpl_propertylist_delete(wcslist);
+<a name="l01964"></a>01964
+<a name="l01965"></a>01965 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l01966"></a>01966 inputlist = cpl_propertylist_load_regexp(
+<a name="l01967"></a>01967 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l01968"></a>01968 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l01969"></a>01969 cpl_propertylist_append(qclists[i], inputlist);
+<a name="l01970"></a>01970 cpl_propertylist_delete(inputlist) ;
+<a name="l01971"></a>01971 }
+<a name="l01972"></a>01972
+<a name="l01973"></a>01973 <span class="comment">/* Statistics of the raw images in the QC */</span>
+<a name="l01974"></a>01974 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(raw_jitter_stats, qclists);
+<a name="l01975"></a>01975
+<a name="l01976"></a>01976 <span class="comment">/* Statistics of the detected objects in the QC */</span>
+<a name="l01977"></a>01977 <a class="code" href="group__hawki__obj__det.html#ga0968e63931fcc72c55c4bc0e34f71dbb" title="Compute statistics on the object properties.">hawki_obj_prop_stats</a>(obj_charac, qclists);
+<a name="l01978"></a>01978
+<a name="l01979"></a>01979 <span class="comment">/* Write the combined image */</span>
+<a name="l01980"></a>01980 <a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>(<span class="keyword">set</span>,
+<a name="l01981"></a>01981 parlist,
+<a name="l01982"></a>01982 used_frames,
+<a name="l01983"></a>01983 (<span class="keyword">const</span> cpl_image **)combined,
+<a name="l01984"></a>01984 recipe_name,
+<a name="l01985"></a>01985 HAWKI_CALPRO_COMBINED,
+<a name="l01986"></a>01986 HAWKI_PROTYPE_COMBINED,
+<a name="l01987"></a>01987 NULL,
+<a name="l01988"></a>01988 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l01989"></a>01989 <span class="stringliteral">"hawki_sci_jitter.fits"</span>);
+<a name="l01990"></a>01990
+<a name="l01991"></a>01991 <span class="comment">/* Erase the WCS */</span>
+<a name="l01992"></a>01992 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l01993"></a>01993 cpl_propertylist_erase_regexp(qclists[i], HAWKI_HEADER_WCS, 0) ;
+<a name="l01994"></a>01994 }
+<a name="l01995"></a>01995
+<a name="l01996"></a>01996 <span class="comment">/* Create a propertylist for PRO.x */</span>
+<a name="l01997"></a>01997 plist = cpl_propertylist_new();
+<a name="l01998"></a>01998 cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE,
+<a name="l01999"></a>01999 HAWKI_PROTYPE_STITCHED) ;
+<a name="l02000"></a>02000 cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG,
+<a name="l02001"></a>02001 HAWKI_CALPRO_STITCHED) ;
+<a name="l02002"></a>02002 <span class="comment">/* Handle WCS keys */</span>
+<a name="l02003"></a>02003 ext_chip_1 = 1;
+<a name="l02004"></a>02004 wcslist = cpl_propertylist_load_regexp(
+<a name="l02005"></a>02005 cpl_frame_get_filename(ref_frame), ext_chip_1, HAWKI_HEADER_WCS, 0);
+<a name="l02006"></a>02006 <span class="comment">/* Update WCS and write them */</span>
+<a name="l02007"></a>02007 crpix1 = cpl_propertylist_get_double(wcslist, <span class="stringliteral">"CRPIX1"</span>);
+<a name="l02008"></a>02008 crpix1 += hawki_sci_jitter_output.combined_pos_x[0];
+<a name="l02009"></a>02009 cpl_propertylist_update_double(wcslist, <span class="stringliteral">"CRPIX1"</span>, crpix1) ;
+<a name="l02010"></a>02010 crpix2 = cpl_propertylist_get_double(wcslist, <span class="stringliteral">"CRPIX2"</span>);
+<a name="l02011"></a>02011 crpix2 += hawki_sci_jitter_output.combined_pos_y[0] ;
+<a name="l02012"></a>02012 cpl_propertylist_update_double(wcslist, <span class="stringliteral">"CRPIX2"</span>, crpix2) ;
+<a name="l02013"></a>02013 cpl_propertylist_append(plist, wcslist);
+<a name="l02014"></a>02014 cpl_propertylist_delete(wcslist) ;
+<a name="l02015"></a>02015 <span class="comment">/* Write the stitched image */</span>
+<a name="l02016"></a>02016 cpl_dfs_save_image(<span class="keyword">set</span>,
+<a name="l02017"></a>02017 NULL,
+<a name="l02018"></a>02018 parlist,
+<a name="l02019"></a>02019 used_frames,
+<a name="l02020"></a>02020 NULL,
+<a name="l02021"></a>02021 stitched,
+<a name="l02022"></a>02022 CPL_BPP_IEEE_FLOAT,
+<a name="l02023"></a>02023 recipe_name,
+<a name="l02024"></a>02024 plist,
+<a name="l02025"></a>02025 NULL,
+<a name="l02026"></a>02026 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l02027"></a>02027 <span class="stringliteral">"hawki_sci_jitter_stitched.fits"</span>);
+<a name="l02028"></a>02028 cpl_propertylist_delete(plist);
+<a name="l02029"></a>02029
+<a name="l02030"></a>02030 <span class="comment">/* Write the FITS table with the objects statistics */</span>
+<a name="l02031"></a>02031 <span class="keywordflow">if</span> (obj_charac)
+<a name="l02032"></a>02032 {
+<a name="l02033"></a>02033 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l02034"></a>02034 parlist,
+<a name="l02035"></a>02035 used_frames,
+<a name="l02036"></a>02036 (<span class="keyword">const</span> cpl_table **)obj_charac,
+<a name="l02037"></a>02037 recipe_name,
+<a name="l02038"></a>02038 HAWKI_CALPRO_OBJ_PARAM,
+<a name="l02039"></a>02039 HAWKI_PROTYPE_OBJ_PARAM,
+<a name="l02040"></a>02040 NULL,
+<a name="l02041"></a>02041 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l02042"></a>02042 <span class="stringliteral">"hawki_sci_jitter_stars.fits"</span>);
+<a name="l02043"></a>02043 }
+<a name="l02044"></a>02044
+<a name="l02045"></a>02045 <span class="comment">/* Write the table with the background statistics */</span>
+<a name="l02046"></a>02046 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l02047"></a>02047 parlist,
+<a name="l02048"></a>02048 used_frames,
+<a name="l02049"></a>02049 (<span class="keyword">const</span> cpl_table **)bkg_stats,
+<a name="l02050"></a>02050 recipe_name,
+<a name="l02051"></a>02051 HAWKI_CALPRO_JITTER_BKG_STATS,
+<a name="l02052"></a>02052 HAWKI_PROTYPE_JITTER_BKG_STATS,
+<a name="l02053"></a>02053 NULL,
+<a name="l02054"></a>02054 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l02055"></a>02055 <span class="stringliteral">"hawki_sci_jitter_bkg_stats.fits"</span>);
+<a name="l02056"></a>02056
+<a name="l02057"></a>02057 <span class="comment">/* Free and return */</span>
+<a name="l02058"></a>02058 cpl_frameset_delete(used_frames);
+<a name="l02059"></a>02059 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l02060"></a>02060 cpl_propertylist_delete(qclists[i]) ;
+<a name="l02061"></a>02061 }
+<a name="l02062"></a>02062 cpl_propertylist_delete(telstats) ;
+<a name="l02063"></a>02063 cpl_free(qclists) ;
+<a name="l02064"></a>02064 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l02065"></a>02065 {
+<a name="l02066"></a>02066 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l02067"></a>02067 <span class="keywordflow">return</span> -1;
+<a name="l02068"></a>02068 }
+<a name="l02069"></a>02069 <span class="keywordflow">return</span> 0;
+<a name="l02070"></a>02070 }
+<a name="l02071"></a>02071
+<a name="l02072"></a>02072 <span class="keywordtype">int</span> hawki_sci_jitter_whole_image_algo
+<a name="l02073"></a>02073 (cpl_frameset * obj,
+<a name="l02074"></a>02074 cpl_table ** raw_jitter_stats,
+<a name="l02075"></a>02075 cpl_table * raw_obj_tel_info,
+<a name="l02076"></a>02076 cpl_parameterlist * parlist,
+<a name="l02077"></a>02077 cpl_frameset * recipe_set)
+<a name="l02078"></a>02078 {
+<a name="l02079"></a>02079 <span class="keywordtype">int</span> nframes;
+<a name="l02080"></a>02080 <span class="keywordtype">int</span> iframe;
+<a name="l02081"></a>02081
+<a name="l02082"></a>02082
+<a name="l02083"></a>02083 nframes = cpl_frameset_get_size(obj);
+<a name="l02084"></a>02084 <span class="keywordflow">for</span>( iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l02085"></a>02085 {
+<a name="l02086"></a>02086 <span class="comment">/* Local storage variables */</span>
+<a name="l02087"></a>02087 cpl_frame * this_target_frame;
+<a name="l02088"></a>02088 cpl_propertylist * this_properties;
+<a name="l02089"></a>02089
+<a name="l02090"></a>02090 <span class="comment">/* Computing statistics for this frame */</span>
+<a name="l02091"></a>02091 cpl_msg_info(cpl_func, <span class="stringliteral">"Getting statistics for image %d"</span>, iframe + 1);
+<a name="l02092"></a>02092 this_target_frame = cpl_frameset_get_frame(obj, iframe);
+<a name="l02093"></a>02093 <a class="code" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836" title="Fills a table with the statistics of the four detectors of a frame.">hawki_image_stats_fill_from_frame</a>
+<a name="l02094"></a>02094 (raw_jitter_stats, this_target_frame, iframe);
+<a name="l02095"></a>02095
+<a name="l02096"></a>02096 <span class="comment">/* Compute the telescope pcs statistics */</span>
+<a name="l02097"></a>02097 this_properties = cpl_propertylist_load
+<a name="l02098"></a>02098 (cpl_frame_get_filename(this_target_frame), 0);
+<a name="l02099"></a>02099 <span class="keywordflow">if</span>(this_properties == NULL)
+<a name="l02100"></a>02100 {
+<a name="l02101"></a>02101 cpl_msg_error(cpl_func,<span class="stringliteral">"Could not read the header of object frame"</span>);
+<a name="l02102"></a>02102 <span class="keywordflow">return</span> -1;
+<a name="l02103"></a>02103 }
+<a name="l02104"></a>02104 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__properties__tel.html#gaedbe52365a410453e02d6b36d9d1b612" title="Extracts all the QC keywords and append them to the table.">hawki_extract_prop_tel_qc</a>(this_properties, raw_obj_tel_info, iframe))
+<a name="l02105"></a>02105 {
+<a name="l02106"></a>02106 cpl_msg_warning(cpl_func,<span class="stringliteral">"Some telescope properties could not be "</span>
+<a name="l02107"></a>02107 <span class="stringliteral">"read for image %d"</span>, iframe+1);
+<a name="l02108"></a>02108 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l02109"></a>02109 }
+<a name="l02110"></a>02110 cpl_propertylist_delete(this_properties);
+<a name="l02111"></a>02111 }
+<a name="l02112"></a>02112
+<a name="l02113"></a>02113 <span class="comment">/* Saving the already computed products */</span>
+<a name="l02114"></a>02114 cpl_msg_info(cpl_func, <span class="stringliteral">"Saving image statistics"</span>);
+<a name="l02115"></a>02115 <span class="keywordflow">if</span>(hawki_sci_jitter_save_stats(raw_jitter_stats, raw_obj_tel_info,
+<a name="l02116"></a>02116 obj,
+<a name="l02117"></a>02117 parlist, recipe_set) != 0)
+<a name="l02118"></a>02118 cpl_msg_warning(cpl_func,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l02119"></a>02119 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l02120"></a>02120
+<a name="l02121"></a>02121
+<a name="l02122"></a>02122 <span class="comment">/* Free and return */</span>
+<a name="l02123"></a>02123 <span class="keywordflow">return</span> 0;
+<a name="l02124"></a>02124 }
+<a name="l02125"></a>02125
+<a name="l02126"></a>02126 <span class="keywordtype">int</span> hawki_sci_jitter_save_stats
+<a name="l02127"></a>02127 (cpl_table ** raw_jitter_stats,
+<a name="l02128"></a>02128 cpl_table * raw_obj_tel_info,
+<a name="l02129"></a>02129 cpl_frameset * jitter_frames,
+<a name="l02130"></a>02130 cpl_parameterlist * parlist,
+<a name="l02131"></a>02131 cpl_frameset * recipe_set)
+<a name="l02132"></a>02132 {
+<a name="l02133"></a>02133 <span class="keywordtype">int</span> idet;
+<a name="l02134"></a>02134 <span class="keyword">const</span> cpl_frame * ref_frame;
+<a name="l02135"></a>02135 cpl_propertylist ** qcstats;
+<a name="l02136"></a>02136 cpl_propertylist * telstats;
+<a name="l02137"></a>02137 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_sci_jitter"</span> ;
+<a name="l02138"></a>02138 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l02139"></a>02139
+<a name="l02140"></a>02140 <span class="comment">/* Statistics of the raw images in the QC */</span>
+<a name="l02141"></a>02141 qcstats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*));
+<a name="l02142"></a>02142 <span class="comment">/* Create the QC lists */</span>
+<a name="l02143"></a>02143 ref_frame = irplib_frameset_get_first_from_group
+<a name="l02144"></a>02144 (recipe_set, CPL_FRAME_GROUP_RAW);
+<a name="l02145"></a>02145 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l02146"></a>02146 {
+<a name="l02147"></a>02147 <span class="keywordtype">int</span> ext_nb;
+<a name="l02148"></a>02148 cpl_propertylist * reflist;
+<a name="l02149"></a>02149
+<a name="l02150"></a>02150 qcstats[idet] = cpl_propertylist_new();
+<a name="l02151"></a>02151 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l02152"></a>02152 ext_nb =
+<a name="l02153"></a>02153 <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), idet+1);
+<a name="l02154"></a>02154 reflist = cpl_propertylist_load_regexp
+<a name="l02155"></a>02155 (cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l02156"></a>02156 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l02157"></a>02157 cpl_propertylist_append(qcstats[idet], reflist);
+<a name="l02158"></a>02158 cpl_propertylist_delete(reflist);
+<a name="l02159"></a>02159 }
+<a name="l02160"></a>02160 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(raw_jitter_stats, qcstats);
+<a name="l02161"></a>02161 <span class="comment">/* Write the table with the raw jitter objects statistics */</span>
+<a name="l02162"></a>02162 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(recipe_set,
+<a name="l02163"></a>02163 parlist,
+<a name="l02164"></a>02164 jitter_frames,
+<a name="l02165"></a>02165 (<span class="keyword">const</span> cpl_table **)raw_jitter_stats,
+<a name="l02166"></a>02166 recipe_name,
+<a name="l02167"></a>02167 HAWKI_CALPRO_JITTER_STATS,
+<a name="l02168"></a>02168 HAWKI_PROTYPE_JITTER_STATS,
+<a name="l02169"></a>02169 NULL,
+<a name="l02170"></a>02170 (<span class="keyword">const</span> cpl_propertylist**)qcstats,
+<a name="l02171"></a>02171 <span class="stringliteral">"hawki_sci_jitter_stats.fits"</span>);
+<a name="l02172"></a>02172 <span class="comment">/* Free qcstats */</span>
+<a name="l02173"></a>02173 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l02174"></a>02174 cpl_propertylist_delete(qcstats[idet]);
+<a name="l02175"></a>02175
+<a name="l02176"></a>02176 <span class="comment">/* Write the FITS table with the raw telescope data */</span>
+<a name="l02177"></a>02177 telstats = cpl_propertylist_new();
+<a name="l02178"></a>02178 cpl_propertylist_append_string(telstats, CPL_DFS_PRO_TYPE,
+<a name="l02179"></a>02179 HAWKI_PROTYPE_SCIENCE_PCS);
+<a name="l02180"></a>02180 cpl_propertylist_append_string(telstats, CPL_DFS_PRO_CATG,
+<a name="l02181"></a>02181 HAWKI_CALPRO_SCIENCE_PCS);
+<a name="l02182"></a>02182 hawki_compute_prop_tel_qc_stats(raw_obj_tel_info, telstats);
+<a name="l02183"></a>02183 <span class="keywordflow">if</span>(cpl_dfs_save_table(recipe_set,
+<a name="l02184"></a>02184 NULL,
+<a name="l02185"></a>02185 parlist,
+<a name="l02186"></a>02186 jitter_frames,
+<a name="l02187"></a>02187 NULL,
+<a name="l02188"></a>02188 raw_obj_tel_info,
+<a name="l02189"></a>02189 NULL,
+<a name="l02190"></a>02190 recipe_name,
+<a name="l02191"></a>02191 telstats,
+<a name="l02192"></a>02192 NULL,
+<a name="l02193"></a>02193 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l02194"></a>02194 <span class="stringliteral">"hawki_sci_jitter_pcs.fits"</span>) != CPL_ERROR_NONE)
+<a name="l02195"></a>02195 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot save PCS table"</span>);
+<a name="l02196"></a>02196
+<a name="l02197"></a>02197 <span class="comment">/* Free and return */</span>
+<a name="l02198"></a>02198 cpl_propertylist_delete(telstats);
+<a name="l02199"></a>02199 cpl_free(qcstats);
+<a name="l02200"></a>02200 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l02201"></a>02201 {
+<a name="l02202"></a>02202 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l02203"></a>02203 <span class="keywordflow">return</span> -1;
+<a name="l02204"></a>02204 }
+<a name="l02205"></a>02205
+<a name="l02206"></a>02206 <span class="keywordflow">return</span> 0;
+<a name="l02207"></a>02207 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__apply__dist_8c_source.html b/html/hawki__step__apply__dist_8c_source.html
new file mode 100644
index 0000000..357baae
--- /dev/null
+++ b/html/hawki__step__apply__dist_8c_source.html
@@ -0,0 +1,524 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_apply_dist.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_apply_dist.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_apply_dist.c,v 1.10 2011/03/09 10:48:38 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/03/09 10:48:38 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.10 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00049"></a>00049 <span class="comment"> Functions prototypes</span>
+<a name="l00050"></a>00050 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_create(cpl_plugin *) ;
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_exec(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_destroy(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00056"></a>00056 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_save
+<a name="l00057"></a>00057 (cpl_imagelist * images,
+<a name="l00058"></a>00058 <span class="keywordtype">int</span> iserie,
+<a name="l00059"></a>00059 cpl_parameterlist * recipe_parlist,
+<a name="l00060"></a>00060 cpl_frameset * used_frameset,
+<a name="l00061"></a>00061 cpl_frameset * recipe_frameset);
+<a name="l00062"></a>00062
+<a name="l00063"></a>00063 <span class="keywordtype">int</span> hawki_step_apply_dist_compute_and_save
+<a name="l00064"></a>00064 (cpl_frameset * objects,
+<a name="l00065"></a>00065 cpl_frameset * distortion_x,
+<a name="l00066"></a>00066 cpl_frameset * distortion_y,
+<a name="l00067"></a>00067 cpl_parameterlist * parlist,
+<a name="l00068"></a>00068 cpl_frameset * recipe_frameset);
+<a name="l00069"></a>00069
+<a name="l00070"></a>00070 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00071"></a>00071 <span class="comment"> Static variables</span>
+<a name="l00072"></a>00072 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00073"></a>00073
+<a name="l00074"></a>00074 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_apply_dist_description[] =
+<a name="l00075"></a>00075 <span class="stringliteral">"hawki_step_apply_dist -- Distortion correction utility\n"</span>
+<a name="l00076"></a>00076 <span class="stringliteral">"This recipe accepts three types of frames:\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"object.fits Images to correct (PRO.CATG = "</span>HAWKI_CALPRO_BKG_SUBTRACTED<span class="stringliteral">")\n"</span>
+<a name="l00078"></a>00078 <span class="stringliteral">"distmap_x.fits The image with the distortion in X.\n"</span>
+<a name="l00079"></a>00079 <span class="stringliteral">" (PRO CATG = "</span>HAWKI_CALPRO_DISTORTION_X<span class="stringliteral">")\n"</span>
+<a name="l00080"></a>00080 <span class="stringliteral">"distmap_y.fits The image with the distortion in Y.\n"</span>
+<a name="l00081"></a>00081 <span class="stringliteral">" (PRO CATG = "</span>HAWKI_CALPRO_DISTORTION_Y<span class="stringliteral">")\n"</span>
+<a name="l00082"></a>00082 <span class="stringliteral">"\n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"This recipe produces:\n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"hawki_step_apply_dist.fits: the corrected image.\n"</span>
+<a name="l00085"></a>00085 <span class="stringliteral">" (PRO CATG = "</span>HAWKI_CALPRO_DIST_CORRECTED<span class="stringliteral">")\n"</span> ;
+<a name="l00086"></a>00086
+<a name="l00087"></a>00087 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00088"></a>00088 <span class="comment"> Functions code</span>
+<a name="l00089"></a>00089 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00090"></a>00090
+<a name="l00091"></a>00091 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00100"></a>00100 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00101"></a>00101 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00102"></a>00102 {
+<a name="l00103"></a>00103 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe ) ;
+<a name="l00104"></a>00104 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 cpl_plugin_init(plugin,
+<a name="l00107"></a>00107 CPL_PLUGIN_API,
+<a name="l00108"></a>00108 HAWKI_BINARY_VERSION,
+<a name="l00109"></a>00109 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00110"></a>00110 <span class="stringliteral">"hawki_step_apply_dist"</span>,
+<a name="l00111"></a>00111 <span class="stringliteral">"Distortion correction utility"</span>,
+<a name="l00112"></a>00112 hawki_step_apply_dist_description,
+<a name="l00113"></a>00113 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00114"></a>00114 PACKAGE_BUGREPORT,
+<a name="l00115"></a>00115 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00116"></a>00116 hawki_step_apply_dist_create,
+<a name="l00117"></a>00117 hawki_step_apply_dist_exec,
+<a name="l00118"></a>00118 hawki_step_apply_dist_destroy) ;
+<a name="l00119"></a>00119
+<a name="l00120"></a>00120 cpl_pluginlist_append(list, plugin) ;
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="keywordflow">return</span> 0;
+<a name="l00123"></a>00123 }
+<a name="l00124"></a>00124
+<a name="l00125"></a>00125 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00133"></a>00133 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00134"></a>00134 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_create(cpl_plugin * plugin)
+<a name="l00135"></a>00135 {
+<a name="l00136"></a>00136 cpl_recipe * recipe ;
+<a name="l00137"></a>00137
+<a name="l00138"></a>00138 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00139"></a>00139 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00140"></a>00140 recipe = (cpl_recipe *)plugin ;
+<a name="l00141"></a>00141 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00142"></a>00142
+<a name="l00143"></a>00143 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00144"></a>00144 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00145"></a>00145
+<a name="l00146"></a>00146 <span class="comment">/* Return */</span>
+<a name="l00147"></a>00147 <span class="keywordflow">return</span> 0;
+<a name="l00148"></a>00148 }
+<a name="l00149"></a>00149
+<a name="l00150"></a>00150 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00156"></a>00156 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00157"></a>00157 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_exec(cpl_plugin * plugin)
+<a name="l00158"></a>00158 {
+<a name="l00159"></a>00159 cpl_recipe * recipe ;
+<a name="l00160"></a>00160
+<a name="l00161"></a>00161 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00162"></a>00162 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00163"></a>00163 recipe = (cpl_recipe *)plugin ;
+<a name="l00164"></a>00164 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00165"></a>00165
+<a name="l00166"></a>00166 <span class="comment">/* Issue a banner */</span>
+<a name="l00167"></a>00167 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00168"></a>00168
+<a name="l00169"></a>00169 <span class="keywordflow">return</span> hawki_step_apply_dist(recipe->parameters, recipe->frames) ;
+<a name="l00170"></a>00170 }
+<a name="l00171"></a>00171
+<a name="l00172"></a>00172 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00178"></a>00178 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00179"></a>00179 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_destroy(cpl_plugin * plugin)
+<a name="l00180"></a>00180 {
+<a name="l00181"></a>00181 cpl_recipe * recipe ;
+<a name="l00182"></a>00182
+<a name="l00183"></a>00183 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00184"></a>00184 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00185"></a>00185 recipe = (cpl_recipe *)plugin ;
+<a name="l00186"></a>00186 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00187"></a>00187
+<a name="l00188"></a>00188 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00189"></a>00189 <span class="keywordflow">return</span> 0 ;
+<a name="l00190"></a>00190 }
+<a name="l00191"></a>00191
+<a name="l00192"></a>00192 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00199"></a>00199 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00200"></a>00200 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist(
+<a name="l00201"></a>00201 cpl_parameterlist * parlist,
+<a name="l00202"></a>00202 cpl_frameset * frameset)
+<a name="l00203"></a>00203 {
+<a name="l00204"></a>00204 cpl_frameset * objframes;
+<a name="l00205"></a>00205 cpl_frameset * distortion_x;
+<a name="l00206"></a>00206 cpl_frameset * distortion_y;
+<a name="l00207"></a>00207
+<a name="l00208"></a>00208 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00209"></a>00209
+<a name="l00210"></a>00210 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00211"></a>00211 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(frameset)) {
+<a name="l00212"></a>00212 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00213"></a>00213 <span class="keywordflow">return</span> -1 ;
+<a name="l00214"></a>00214 }
+<a name="l00215"></a>00215
+<a name="l00216"></a>00216 <span class="comment">/* Identifying objects frames */</span>
+<a name="l00217"></a>00217 cpl_msg_info(__func__, <span class="stringliteral">"Identifying objects"</span>);
+<a name="l00218"></a>00218 objframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00219"></a>00219 (frameset, HAWKI_CALPRO_BKG_SUBTRACTED);
+<a name="l00220"></a>00220 <span class="keywordflow">if</span> (objframes == NULL)
+<a name="l00221"></a>00221 {
+<a name="l00222"></a>00222 cpl_msg_error(__func__, <span class="stringliteral">"No object frames provided (%s)"</span>,
+<a name="l00223"></a>00223 HAWKI_CALPRO_BKG_SUBTRACTED);
+<a name="l00224"></a>00224 <span class="keywordflow">return</span> -1 ;
+<a name="l00225"></a>00225 }
+<a name="l00226"></a>00226
+<a name="l00227"></a>00227 <span class="comment">/* Identifying distortion frames */</span>
+<a name="l00228"></a>00228 cpl_msg_info(__func__, <span class="stringliteral">"Identifying distortion maps"</span>);
+<a name="l00229"></a>00229 distortion_x = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00230"></a>00230 (frameset, HAWKI_CALPRO_DISTORTION_X);
+<a name="l00231"></a>00231 distortion_y = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00232"></a>00232 (frameset, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00233"></a>00233 <span class="keywordflow">if</span>(cpl_frameset_get_size(distortion_x) != 1 &&
+<a name="l00234"></a>00234 cpl_frameset_get_size(distortion_y) != 1 )
+<a name="l00235"></a>00235 {
+<a name="l00236"></a>00236 cpl_msg_error(__func__, <span class="stringliteral">"One X-distortion frame and one Y-distortion "</span>
+<a name="l00237"></a>00237 <span class="stringliteral">"must be provided (%s, %s)"</span>,
+<a name="l00238"></a>00238 HAWKI_CALPRO_DISTORTION_X, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00239"></a>00239 cpl_frameset_delete(objframes);
+<a name="l00240"></a>00240 cpl_frameset_delete(distortion_x);
+<a name="l00241"></a>00241 cpl_frameset_delete(distortion_y);
+<a name="l00242"></a>00242 <span class="keywordflow">return</span> -1 ;
+<a name="l00243"></a>00243 }
+<a name="l00244"></a>00244
+<a name="l00245"></a>00245 <span class="comment">/* Apply the correction and save */</span>
+<a name="l00246"></a>00246 <span class="keywordflow">if</span>(hawki_step_apply_dist_compute_and_save
+<a name="l00247"></a>00247 (objframes, distortion_x, distortion_y, parlist, frameset) == -1)
+<a name="l00248"></a>00248 {
+<a name="l00249"></a>00249 cpl_msg_error(__func__,<span class="stringliteral">"Could not correct the frames"</span>);
+<a name="l00250"></a>00250 cpl_frameset_delete(objframes);
+<a name="l00251"></a>00251 cpl_frameset_delete(distortion_x);
+<a name="l00252"></a>00252 cpl_frameset_delete(distortion_y);
+<a name="l00253"></a>00253 <span class="keywordflow">return</span> -1;
+<a name="l00254"></a>00254 }
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 <span class="comment">/* Free and return */</span>
+<a name="l00257"></a>00257 cpl_frameset_delete(objframes);
+<a name="l00258"></a>00258 cpl_frameset_delete(distortion_x);
+<a name="l00259"></a>00259 cpl_frameset_delete(distortion_y);
+<a name="l00260"></a>00260
+<a name="l00261"></a>00261 <span class="comment">/* Return */</span>
+<a name="l00262"></a>00262 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00263"></a>00263 {
+<a name="l00264"></a>00264 cpl_msg_error(__func__,
+<a name="l00265"></a>00265 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00266"></a>00266 <span class="keywordflow">return</span> -1 ;
+<a name="l00267"></a>00267 }
+<a name="l00268"></a>00268 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00269"></a>00269 }
+<a name="l00270"></a>00270
+<a name="l00271"></a>00271 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00280"></a>00280 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00281"></a>00281 <span class="keywordtype">int</span> hawki_step_apply_dist_compute_and_save
+<a name="l00282"></a>00282 (cpl_frameset * objects,
+<a name="l00283"></a>00283 cpl_frameset * distortion_x,
+<a name="l00284"></a>00284 cpl_frameset * distortion_y,
+<a name="l00285"></a>00285 cpl_parameterlist * parlist,
+<a name="l00286"></a>00286 cpl_frameset * recipe_frameset)
+<a name="l00287"></a>00287 {
+<a name="l00288"></a>00288 <span class="keyword">const</span> cpl_frame * distframe_x;
+<a name="l00289"></a>00289 <span class="keyword">const</span> cpl_frame * distframe_y;
+<a name="l00290"></a>00290 cpl_image ** dist_x;
+<a name="l00291"></a>00291 cpl_image ** dist_y;
+<a name="l00292"></a>00292 cpl_image * first_image;
+<a name="l00293"></a>00293 <span class="keywordtype">int</span> nx;
+<a name="l00294"></a>00294 <span class="keywordtype">int</span> ny;
+<a name="l00295"></a>00295 <span class="keywordtype">int</span> iframe;
+<a name="l00296"></a>00296 <span class="keywordtype">int</span> nframes;
+<a name="l00297"></a>00297 <span class="keywordtype">int</span> idet;
+<a name="l00298"></a>00298 <span class="keywordtype">int</span> jdet;
+<a name="l00299"></a>00299 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00300"></a>00300
+<a name="l00301"></a>00301 <span class="comment">/* Get the distortion filename and distortion maps */</span>
+<a name="l00302"></a>00302 cpl_msg_info(__func__,<span class="stringliteral">"Creating the distortion maps"</span>);
+<a name="l00303"></a>00303 distframe_x = cpl_frameset_get_first_const(distortion_x);
+<a name="l00304"></a>00304 distframe_y = cpl_frameset_get_first_const(distortion_y);
+<a name="l00305"></a>00305 first_image = <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(objects, 0, 1, CPL_TYPE_FLOAT);
+<a name="l00306"></a>00306 nx = cpl_image_get_size_x(first_image);
+<a name="l00307"></a>00307 ny = cpl_image_get_size_y(first_image);
+<a name="l00308"></a>00308 cpl_image_delete(first_image);
+<a name="l00309"></a>00309 dist_x = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_image *));
+<a name="l00310"></a>00310 dist_y = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_image *));
+<a name="l00311"></a>00311 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00312"></a>00312 {
+<a name="l00313"></a>00313 hawki_distortion * distortion;
+<a name="l00314"></a>00314 dist_x[idet] = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+<a name="l00315"></a>00315 dist_y[idet] = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE) ;
+<a name="l00316"></a>00316
+<a name="l00317"></a>00317 <span class="comment">/* Load the distortion */</span>
+<a name="l00318"></a>00318 <span class="keywordflow">if</span> ((distortion = <a class="code" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7" title="Loads the distortion solution for one detector.">hawki_distortion_load</a>
+<a name="l00319"></a>00319 (distframe_x, distframe_y , idet+1)) == NULL)
+<a name="l00320"></a>00320 {
+<a name="l00321"></a>00321 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the distortion for chip %d: %s"</span>,
+<a name="l00322"></a>00322 idet+1, cpl_error_get_message());
+<a name="l00323"></a>00323 <span class="keywordflow">for</span> (jdet=0 ; jdet<=idet; jdet++)
+<a name="l00324"></a>00324 {
+<a name="l00325"></a>00325 cpl_image_delete(dist_x[jdet]);
+<a name="l00326"></a>00326 cpl_image_delete(dist_y[jdet]);
+<a name="l00327"></a>00327 }
+<a name="l00328"></a>00328 cpl_free(dist_x);
+<a name="l00329"></a>00329 cpl_free(dist_y);
+<a name="l00330"></a>00330 <span class="keywordflow">return</span> -1 ;
+<a name="l00331"></a>00331 }
+<a name="l00332"></a>00332 <span class="keywordflow">if</span> (hawki_distortion_create_maps_detector
+<a name="l00333"></a>00333 (distortion, dist_x[idet], dist_y[idet]))
+<a name="l00334"></a>00334 {
+<a name="l00335"></a>00335 cpl_msg_error(__func__, <span class="stringliteral">"Cannot create the distortion maps"</span>) ;
+<a name="l00336"></a>00336 <span class="keywordflow">for</span> (jdet=0 ; jdet<=idet; jdet++)
+<a name="l00337"></a>00337 {
+<a name="l00338"></a>00338 cpl_image_delete(dist_x[jdet]);
+<a name="l00339"></a>00339 cpl_image_delete(dist_y[jdet]);
+<a name="l00340"></a>00340 }
+<a name="l00341"></a>00341 cpl_free(dist_x);
+<a name="l00342"></a>00342 cpl_free(dist_y);
+<a name="l00343"></a>00343 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion);
+<a name="l00344"></a>00344 <span class="keywordflow">return</span> -1;
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion);
+<a name="l00347"></a>00347 }
+<a name="l00348"></a>00348
+<a name="l00349"></a>00349 <span class="comment">/* Loop on frames */</span>
+<a name="l00350"></a>00350 nframes = cpl_frameset_get_size(objects);
+<a name="l00351"></a>00351 cpl_msg_info(__func__,<span class="stringliteral">"Number of frames to process: %d"</span>, nframes);
+<a name="l00352"></a>00352 cpl_msg_indent_more();
+<a name="l00353"></a>00353 <span class="keywordflow">for</span>(iframe = 0 ; iframe < nframes; ++iframe)
+<a name="l00354"></a>00354 {
+<a name="l00355"></a>00355 cpl_imagelist * object_images;
+<a name="l00356"></a>00356 cpl_frame * this_frame;
+<a name="l00357"></a>00357 cpl_frameset * used_frameset;
+<a name="l00358"></a>00358
+<a name="l00359"></a>00359 <span class="comment">/* Msg */</span>
+<a name="l00360"></a>00360 cpl_msg_info(__func__,<span class="stringliteral">"Correcting distortion in frame %d"</span>,iframe+1);
+<a name="l00361"></a>00361
+<a name="l00362"></a>00362 <span class="comment">/* Load the HAWKI images */</span>
+<a name="l00363"></a>00363 this_frame = cpl_frameset_get_frame(objects, iframe);
+<a name="l00364"></a>00364 <span class="keywordflow">if</span>((object_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(this_frame, CPL_TYPE_FLOAT)) == NULL)
+<a name="l00365"></a>00365 {
+<a name="l00366"></a>00366 cpl_msg_error(__func__,<span class="stringliteral">"Could not load input object images"</span>);
+<a name="l00367"></a>00367 cpl_msg_indent_less();
+<a name="l00368"></a>00368 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00369"></a>00369 {
+<a name="l00370"></a>00370 cpl_image_delete(dist_x[idet]);
+<a name="l00371"></a>00371 cpl_image_delete(dist_y[idet]);
+<a name="l00372"></a>00372 }
+<a name="l00373"></a>00373 cpl_free(dist_x);
+<a name="l00374"></a>00374 cpl_free(dist_y);
+<a name="l00375"></a>00375 <span class="keywordflow">return</span> -1;
+<a name="l00376"></a>00376 }
+<a name="l00377"></a>00377
+<a name="l00378"></a>00378 <span class="comment">/* Apply the correction on the current image */</span>
+<a name="l00379"></a>00379 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__distortion.html#ga4ad09d8cbb7f3ed8fddeb451f3b2056f" title="Apply the distortion correction.">hawki_distortion_apply_maps</a>(object_images, dist_x, dist_y) == -1)
+<a name="l00380"></a>00380 {
+<a name="l00381"></a>00381 cpl_msg_error(__func__, <span class="stringliteral">"Cannot correct distortion"</span>) ;
+<a name="l00382"></a>00382 cpl_msg_indent_less();
+<a name="l00383"></a>00383 cpl_imagelist_delete(object_images);
+<a name="l00384"></a>00384 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00385"></a>00385 {
+<a name="l00386"></a>00386 cpl_image_delete(dist_x[idet]);
+<a name="l00387"></a>00387 cpl_image_delete(dist_y[idet]);
+<a name="l00388"></a>00388 }
+<a name="l00389"></a>00389 cpl_free(dist_x);
+<a name="l00390"></a>00390 cpl_free(dist_y);
+<a name="l00391"></a>00391 <span class="keywordflow">return</span> -1 ;
+<a name="l00392"></a>00392 }
+<a name="l00393"></a>00393
+<a name="l00394"></a>00394 <span class="comment">/* Set the used frameset */</span>
+<a name="l00395"></a>00395 used_frameset = cpl_frameset_new();
+<a name="l00396"></a>00396 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(this_frame));
+<a name="l00397"></a>00397 cpl_frameset_insert
+<a name="l00398"></a>00398 (used_frameset,cpl_frame_duplicate
+<a name="l00399"></a>00399 (cpl_frameset_get_first_const((distortion_x))));
+<a name="l00400"></a>00400 cpl_frameset_insert
+<a name="l00401"></a>00401 (used_frameset,cpl_frame_duplicate
+<a name="l00402"></a>00402 (cpl_frameset_get_first_const((distortion_y))));
+<a name="l00403"></a>00403
+<a name="l00404"></a>00404 <span class="comment">/* Save the corrected image */</span>
+<a name="l00405"></a>00405 <span class="keywordflow">if</span> (hawki_step_apply_dist_save
+<a name="l00406"></a>00406 (object_images, iframe,
+<a name="l00407"></a>00407 parlist, used_frameset, recipe_frameset) == -1)
+<a name="l00408"></a>00408 {
+<a name="l00409"></a>00409 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00410"></a>00410 }
+<a name="l00411"></a>00411
+<a name="l00412"></a>00412 <span class="comment">/* Free resources */</span>
+<a name="l00413"></a>00413 cpl_frameset_delete(used_frameset);
+<a name="l00414"></a>00414 cpl_imagelist_delete(object_images);
+<a name="l00415"></a>00415
+<a name="l00416"></a>00416 }
+<a name="l00417"></a>00417 cpl_msg_indent_less();
+<a name="l00418"></a>00418
+<a name="l00419"></a>00419 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00420"></a>00420 {
+<a name="l00421"></a>00421 cpl_image_delete(dist_x[idet]);
+<a name="l00422"></a>00422 cpl_image_delete(dist_y[idet]);
+<a name="l00423"></a>00423 }
+<a name="l00424"></a>00424 cpl_free(dist_x);
+<a name="l00425"></a>00425 cpl_free(dist_y);
+<a name="l00426"></a>00426 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00427"></a>00427 {
+<a name="l00428"></a>00428 cpl_msg_warning(__func__,<span class="stringliteral">"Probably some data could not be saved. "</span>
+<a name="l00429"></a>00429 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00430"></a>00430 }
+<a name="l00431"></a>00431 <span class="keywordflow">return</span> 0;
+<a name="l00432"></a>00432 }
+<a name="l00433"></a>00433
+<a name="l00434"></a>00434 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00443"></a>00443 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00444"></a>00444 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_apply_dist_save
+<a name="l00445"></a>00445 (cpl_imagelist * images,
+<a name="l00446"></a>00446 <span class="keywordtype">int</span> iserie,
+<a name="l00447"></a>00447 cpl_parameterlist * recipe_parlist,
+<a name="l00448"></a>00448 cpl_frameset * used_frameset,
+<a name="l00449"></a>00449 cpl_frameset * recipe_frameset)
+<a name="l00450"></a>00450 {
+<a name="l00451"></a>00451 <span class="keyword">const</span> cpl_frame * raw_reference;
+<a name="l00452"></a>00452 cpl_propertylist ** extproplists;
+<a name="l00453"></a>00453 <span class="keywordtype">char</span> filename[256] ;
+<a name="l00454"></a>00454 cpl_propertylist * inputlist ;
+<a name="l00455"></a>00455 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00456"></a>00456 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_apply_dist"</span>;
+<a name="l00457"></a>00457 <span class="keywordtype">int</span> idet;
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 <span class="comment">/* Get the reference frame (the raw frame) */</span>
+<a name="l00460"></a>00460 raw_reference = irplib_frameset_get_first_from_group
+<a name="l00461"></a>00461 (used_frameset, CPL_FRAME_GROUP_RAW);
+<a name="l00462"></a>00462
+<a name="l00463"></a>00463 <span class="comment">/* Create the prop lists */</span>
+<a name="l00464"></a>00464 cpl_msg_indent_more();
+<a name="l00465"></a>00465 extproplists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*));
+<a name="l00466"></a>00466 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00467"></a>00467 {
+<a name="l00468"></a>00468 <span class="comment">/* Get the extension number */</span>
+<a name="l00469"></a>00469 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00470"></a>00470 (cpl_frame_get_filename(raw_reference), idet+1);
+<a name="l00471"></a>00471
+<a name="l00472"></a>00472 <span class="comment">/* Allocate this property list */</span>
+<a name="l00473"></a>00473 extproplists[idet] = cpl_propertylist_new();
+<a name="l00474"></a>00474
+<a name="l00475"></a>00475 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00476"></a>00476 inputlist = cpl_propertylist_load_regexp(
+<a name="l00477"></a>00477 cpl_frame_get_filename(raw_reference), ext_nb,
+<a name="l00478"></a>00478 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00479"></a>00479 cpl_propertylist_append(extproplists[idet], inputlist);
+<a name="l00480"></a>00480 cpl_propertylist_delete(inputlist);
+<a name="l00481"></a>00481 inputlist = cpl_propertylist_load_regexp(
+<a name="l00482"></a>00482 cpl_frame_get_filename(raw_reference), ext_nb,
+<a name="l00483"></a>00483 HAWKI_HEADER_WCS, 0);
+<a name="l00484"></a>00484 cpl_propertylist_append(extproplists[idet], inputlist);
+<a name="l00485"></a>00485 cpl_propertylist_delete(inputlist);
+<a name="l00486"></a>00486 }
+<a name="l00487"></a>00487
+<a name="l00488"></a>00488 <span class="comment">/* Write the image */</span>
+<a name="l00489"></a>00489 snprintf(filename, 256, <span class="stringliteral">"hawki_step_apply_dist_%03d.fits"</span>, iserie+1);
+<a name="l00490"></a>00490 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>
+<a name="l00491"></a>00491 (recipe_frameset,
+<a name="l00492"></a>00492 recipe_parlist,
+<a name="l00493"></a>00493 used_frameset,
+<a name="l00494"></a>00494 images,
+<a name="l00495"></a>00495 recipe_name,
+<a name="l00496"></a>00496 HAWKI_CALPRO_DIST_CORRECTED,
+<a name="l00497"></a>00497 HAWKI_PROTYPE_DIST_CORRECTED,
+<a name="l00498"></a>00498 NULL,
+<a name="l00499"></a>00499 (<span class="keyword">const</span> cpl_propertylist**)extproplists,
+<a name="l00500"></a>00500 filename) != 0)
+<a name="l00501"></a>00501 {
+<a name="l00502"></a>00502 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00503"></a>00503 cpl_propertylist_delete(extproplists[idet]) ;
+<a name="l00504"></a>00504 cpl_free(extproplists) ;
+<a name="l00505"></a>00505 cpl_msg_indent_less();
+<a name="l00506"></a>00506 <span class="keywordflow">return</span> -1;
+<a name="l00507"></a>00507 }
+<a name="l00508"></a>00508
+<a name="l00509"></a>00509 <span class="comment">/* Free and return */</span>
+<a name="l00510"></a>00510 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l00511"></a>00511 cpl_propertylist_delete(extproplists[idet]) ;
+<a name="l00512"></a>00512 }
+<a name="l00513"></a>00513 cpl_free(extproplists) ;
+<a name="l00514"></a>00514 cpl_msg_indent_less();
+<a name="l00515"></a>00515 <span class="keywordflow">return</span> 0;
+<a name="l00516"></a>00516 }
+<a name="l00517"></a>00517
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__basic__calib_8c_source.html b/html/hawki__step__basic__calib_8c_source.html
new file mode 100644
index 0000000..f4b0af4
--- /dev/null
+++ b/html/hawki__step__basic__calib_8c_source.html
@@ -0,0 +1,578 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_basic_calib.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_basic_calib.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_basic_calib.c,v 1.13 2011/01/31 11:03:23 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/01/31 11:03:23 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.13 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00049"></a>00049 <span class="comment"> Define</span>
+<a name="l00050"></a>00050 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="preprocessor">#define NEGLIG_OFF_DIFF 0.1</span>
+<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define SQR(x) ((x)*(x))</span>
+<a name="l00054"></a>00054 <span class="preprocessor"></span>
+<a name="l00055"></a>00055 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00056"></a>00056 <span class="comment"> Functions prototypes</span>
+<a name="l00057"></a>00057 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00058"></a>00058
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_create(cpl_plugin *) ;
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_exec(cpl_plugin *) ;
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_destroy(cpl_plugin *) ;
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00063"></a>00063
+<a name="l00064"></a>00064 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_applycal_qc_save
+<a name="l00065"></a>00065 (cpl_frameset * raw_target,
+<a name="l00066"></a>00066 <span class="keyword">const</span> cpl_frame * flat,
+<a name="l00067"></a>00067 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00068"></a>00068 <span class="keyword">const</span> cpl_frame * bpm,
+<a name="l00069"></a>00069 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_postfix,
+<a name="l00070"></a>00070 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00071"></a>00071 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00072"></a>00072 cpl_parameterlist * recipe_parlist,
+<a name="l00073"></a>00073 cpl_frameset * recipe_framelist);
+<a name="l00074"></a>00074 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_step_basic_calib_qc(<span class="keywordtype">void</span>);
+<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_save
+<a name="l00076"></a>00076 (cpl_imagelist * reduced,
+<a name="l00077"></a>00077 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_postfix,
+<a name="l00078"></a>00078 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00079"></a>00079 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00080"></a>00080 <span class="keywordtype">int</span> iserie,
+<a name="l00081"></a>00081 cpl_frameset * used_frameset,
+<a name="l00082"></a>00082 cpl_parameterlist * recipe_parlist,
+<a name="l00083"></a>00083 cpl_frameset * recipe_framelist);
+<a name="l00084"></a>00084
+<a name="l00085"></a>00085 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00086"></a>00086 <span class="comment"> Static variables</span>
+<a name="l00087"></a>00087 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00088"></a>00088
+<a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_basic_calib_description[] =
+<a name="l00090"></a>00090 <span class="stringliteral">"hawki_step_basic_calib -- hawki basic reduction utility (flat, dark).\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"raw-file.fits "</span>HAWKI_IMG_JITTER_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"raw-file.fits "</span>HAWKI_IMG_JITTER_SKY_RAW<span class="stringliteral">" \n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"flat-file.fits "</span>HAWKI_CALPRO_FLAT<span class="stringliteral">" \n"</span>
+<a name="l00095"></a>00095 <span class="stringliteral">"dark-file.fits "</span>HAWKI_CALPRO_DARK<span class="stringliteral">" \n"</span>
+<a name="l00096"></a>00096 <span class="stringliteral">"bpm-file.fits "</span>HAWKI_CALPRO_BPM<span class="stringliteral">" \n"</span>;
+<a name="l00097"></a>00097
+<a name="l00098"></a>00098 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00099"></a>00099 <span class="comment"> Functions code</span>
+<a name="l00100"></a>00100 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00101"></a>00101
+<a name="l00102"></a>00102 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00110"></a>00110 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00111"></a>00111 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00112"></a>00112 {
+<a name="l00113"></a>00113 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00114"></a>00114 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00115"></a>00115
+<a name="l00116"></a>00116 cpl_plugin_init(plugin,
+<a name="l00117"></a>00117 CPL_PLUGIN_API,
+<a name="l00118"></a>00118 HAWKI_BINARY_VERSION,
+<a name="l00119"></a>00119 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00120"></a>00120 <span class="stringliteral">"hawki_step_basic_calib"</span>,
+<a name="l00121"></a>00121 <span class="stringliteral">"Basic reduction recipe"</span>,
+<a name="l00122"></a>00122 hawki_step_basic_calib_description,
+<a name="l00123"></a>00123 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00124"></a>00124 <span class="stringliteral">"cgarcia at eso.org"</span>,
+<a name="l00125"></a>00125 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00126"></a>00126 hawki_step_basic_calib_create,
+<a name="l00127"></a>00127 hawki_step_basic_calib_exec,
+<a name="l00128"></a>00128 hawki_step_basic_calib_destroy) ;
+<a name="l00129"></a>00129
+<a name="l00130"></a>00130 cpl_pluginlist_append(list, plugin) ;
+<a name="l00131"></a>00131
+<a name="l00132"></a>00132 <span class="keywordflow">return</span> 0;
+<a name="l00133"></a>00133 }
+<a name="l00134"></a>00134
+<a name="l00135"></a>00135 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00144"></a>00144 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00145"></a>00145 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_create(cpl_plugin * plugin)
+<a name="l00146"></a>00146 {
+<a name="l00147"></a>00147 cpl_recipe * recipe ;
+<a name="l00148"></a>00148 <span class="comment">/* cpl_parameter * p ; */</span>
+<a name="l00149"></a>00149
+<a name="l00150"></a>00150 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00151"></a>00151 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00152"></a>00152 recipe = (cpl_recipe *)plugin ;
+<a name="l00153"></a>00153 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00154"></a>00154
+<a name="l00155"></a>00155 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00156"></a>00156 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00157"></a>00157
+<a name="l00158"></a>00158 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00159"></a>00159 <span class="comment">/* None.. */</span>
+<a name="l00160"></a>00160
+<a name="l00161"></a>00161 <span class="comment">/* Return */</span>
+<a name="l00162"></a>00162 <span class="keywordflow">return</span> 0;
+<a name="l00163"></a>00163 }
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00171"></a>00171 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00172"></a>00172 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_exec(cpl_plugin * plugin)
+<a name="l00173"></a>00173 {
+<a name="l00174"></a>00174 cpl_recipe * recipe ;
+<a name="l00175"></a>00175
+<a name="l00176"></a>00176 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00177"></a>00177 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00178"></a>00178 recipe = (cpl_recipe *)plugin ;
+<a name="l00179"></a>00179 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/* Issue a banner */</span>
+<a name="l00182"></a>00182 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 <span class="keywordflow">return</span> hawki_step_basic_calib(recipe->parameters, recipe->frames) ;
+<a name="l00185"></a>00185 }
+<a name="l00186"></a>00186
+<a name="l00187"></a>00187 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00193"></a>00193 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00194"></a>00194 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_destroy(cpl_plugin * plugin)
+<a name="l00195"></a>00195 {
+<a name="l00196"></a>00196 cpl_recipe * recipe ;
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00199"></a>00199 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00200"></a>00200 recipe = (cpl_recipe *)plugin ;
+<a name="l00201"></a>00201 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00204"></a>00204 <span class="keywordflow">return</span> 0 ;
+<a name="l00205"></a>00205 }
+<a name="l00206"></a>00206
+<a name="l00207"></a>00207 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00214"></a>00214 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00215"></a>00215 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib(
+<a name="l00216"></a>00216 cpl_parameterlist * parlist,
+<a name="l00217"></a>00217 cpl_frameset * framelist)
+<a name="l00218"></a>00218 {
+<a name="l00219"></a>00219 <span class="keyword">const</span> cpl_frame * flat;
+<a name="l00220"></a>00220 <span class="keyword">const</span> cpl_frame * dark;
+<a name="l00221"></a>00221 <span class="keyword">const</span> cpl_frame * bpm;
+<a name="l00222"></a>00222 cpl_frameset * objframes ;
+<a name="l00223"></a>00223 cpl_frameset * skyframes ;
+<a name="l00224"></a>00224
+<a name="l00225"></a>00225 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00226"></a>00226 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00227"></a>00227 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00228"></a>00228 <span class="keywordflow">return</span> -1 ;
+<a name="l00229"></a>00229 }
+<a name="l00230"></a>00230
+<a name="l00231"></a>00231 <span class="comment">/* Retrieve calibration data */</span>
+<a name="l00232"></a>00232 cpl_msg_info(__func__, <span class="stringliteral">"Identifying calibration data"</span>);
+<a name="l00233"></a>00233 flat = cpl_frameset_find_const(framelist, HAWKI_CALPRO_FLAT);
+<a name="l00234"></a>00234 dark = cpl_frameset_find_const(framelist, HAWKI_CALPRO_DARK);
+<a name="l00235"></a>00235 bpm = cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM);
+<a name="l00236"></a>00236 <span class="keywordflow">if</span> (flat == NULL && dark == NULL && bpm == NULL)
+<a name="l00237"></a>00237 {
+<a name="l00238"></a>00238 cpl_msg_error(__func__, <span class="stringliteral">"No calibration data provided (%s and/or %s and/or %s)"</span>,
+<a name="l00239"></a>00239 HAWKI_CALPRO_FLAT, HAWKI_CALPRO_DARK, HAWKI_CALPRO_BPM);
+<a name="l00240"></a>00240 <span class="keywordflow">return</span> -1 ;
+<a name="l00241"></a>00241 }
+<a name="l00242"></a>00242
+<a name="l00243"></a>00243 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00244"></a>00244 cpl_msg_info(__func__, <span class="stringliteral">"Identifying objects and sky data"</span>);
+<a name="l00245"></a>00245 objframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_IMG_JITTER_RAW) ;
+<a name="l00246"></a>00246 <span class="comment">/* Retrieve sky frames */</span>
+<a name="l00247"></a>00247 skyframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_IMG_JITTER_SKY_RAW) ;
+<a name="l00248"></a>00248 <span class="keywordflow">if</span> (objframes == NULL && skyframes == NULL)
+<a name="l00249"></a>00249 {
+<a name="l00250"></a>00250 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find objs (%s) or sky frames (%s) in the input list"</span>,
+<a name="l00251"></a>00251 HAWKI_IMG_JITTER_RAW, HAWKI_IMG_JITTER_SKY_RAW);
+<a name="l00252"></a>00252 <span class="keywordflow">return</span> -1 ;
+<a name="l00253"></a>00253 }
+<a name="l00254"></a>00254
+<a name="l00255"></a>00255 <span class="comment">/* Applying the calibrations, QC and saving the results */</span>
+<a name="l00256"></a>00256 <span class="keywordflow">if</span> (objframes != NULL)
+<a name="l00257"></a>00257 {
+<a name="l00258"></a>00258 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat = HAWKI_CALPRO_BASICCALIBRATED;
+<a name="l00259"></a>00259 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype = HAWKI_PROTYPE_BASICCALIBRATED;
+<a name="l00260"></a>00260 cpl_msg_info(__func__, <span class="stringliteral">"Apply the basic reduction to object frames"</span>);
+<a name="l00261"></a>00261 hawki_step_basic_calib_applycal_qc_save
+<a name="l00262"></a>00262 (objframes, flat, dark, bpm, <span class="stringliteral">"obj"</span>, procat, protype,
+<a name="l00263"></a>00263 parlist, framelist);
+<a name="l00264"></a>00264 cpl_frameset_delete(objframes);
+<a name="l00265"></a>00265 }
+<a name="l00266"></a>00266 <span class="keywordflow">if</span> (skyframes != NULL)
+<a name="l00267"></a>00267 {
+<a name="l00268"></a>00268 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat = HAWKI_CALPRO_SKY_BASICCALIBRATED;
+<a name="l00269"></a>00269 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype = HAWKI_PROTYPE_SKY_BASICCALIBRATED;
+<a name="l00270"></a>00270 cpl_msg_info(__func__, <span class="stringliteral">"Apply the basic reduction to sky frames"</span>);
+<a name="l00271"></a>00271 hawki_step_basic_calib_applycal_qc_save
+<a name="l00272"></a>00272 (skyframes, flat, dark, bpm, <span class="stringliteral">"sky"</span>, procat, protype,
+<a name="l00273"></a>00273 parlist, framelist);
+<a name="l00274"></a>00274 cpl_frameset_delete(skyframes);
+<a name="l00275"></a>00275 }
+<a name="l00276"></a>00276
+<a name="l00277"></a>00277 <span class="comment">/* return */</span>
+<a name="l00278"></a>00278 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l00279"></a>00279 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00280"></a>00280 }
+<a name="l00281"></a>00281
+<a name="l00282"></a>00282 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00292"></a>00292 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00293"></a>00293 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_applycal_qc_save
+<a name="l00294"></a>00294 (cpl_frameset * raw_target,
+<a name="l00295"></a>00295 <span class="keyword">const</span> cpl_frame * flat,
+<a name="l00296"></a>00296 <span class="keyword">const</span> cpl_frame * dark,
+<a name="l00297"></a>00297 <span class="keyword">const</span> cpl_frame * bpm,
+<a name="l00298"></a>00298 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_postfix,
+<a name="l00299"></a>00299 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00300"></a>00300 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00301"></a>00301 cpl_parameterlist * recipe_parlist,
+<a name="l00302"></a>00302 cpl_frameset * recipe_framelist)
+<a name="l00303"></a>00303 {
+<a name="l00304"></a>00304 cpl_imagelist * flat_images;
+<a name="l00305"></a>00305 cpl_imagelist * dark_images;
+<a name="l00306"></a>00306 cpl_imagelist * bpm_images;
+<a name="l00307"></a>00307 cpl_frameset * calib_frameset;
+<a name="l00308"></a>00308 cpl_propertylist * plist ;
+<a name="l00309"></a>00309 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00310"></a>00310
+<a name="l00311"></a>00311 <span class="keywordtype">double</span> science_dit;
+<a name="l00312"></a>00312 <span class="keywordtype">int</span> iframe;
+<a name="l00313"></a>00313 <span class="keywordtype">int</span> ntarget;
+<a name="l00314"></a>00314
+<a name="l00315"></a>00315 <span class="comment">/* Initializing the pointers */</span>
+<a name="l00316"></a>00316 flat_images = NULL;
+<a name="l00317"></a>00317 dark_images = NULL;
+<a name="l00318"></a>00318 bpm_images = NULL;
+<a name="l00319"></a>00319
+<a name="l00320"></a>00320 <span class="comment">/* Indentation */</span>
+<a name="l00321"></a>00321 cpl_msg_indent_more();
+<a name="l00322"></a>00322
+<a name="l00323"></a>00323 <span class="comment">/* Initializating the calibration frameset */</span>
+<a name="l00324"></a>00324 calib_frameset = cpl_frameset_new();
+<a name="l00325"></a>00325
+<a name="l00326"></a>00326 <span class="comment">/* Loading the calibration files */</span>
+<a name="l00327"></a>00327 cpl_msg_info(__func__, <span class="stringliteral">"Loading the calibration data"</span>) ;
+<a name="l00328"></a>00328 <span class="keywordflow">if</span>(flat != NULL)
+<a name="l00329"></a>00329 {
+<a name="l00330"></a>00330 flat_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(flat, CPL_TYPE_FLOAT);
+<a name="l00331"></a>00331 <span class="keywordflow">if</span>(flat_images == NULL)
+<a name="l00332"></a>00332 {
+<a name="l00333"></a>00333 cpl_msg_error(__func__, <span class="stringliteral">"Error reading flat"</span>) ;
+<a name="l00334"></a>00334 cpl_frameset_delete(calib_frameset);
+<a name="l00335"></a>00335 <span class="keywordflow">return</span> -1;
+<a name="l00336"></a>00336 }
+<a name="l00337"></a>00337 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(flat));
+<a name="l00338"></a>00338 }
+<a name="l00339"></a>00339 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l00340"></a>00340 {
+<a name="l00341"></a>00341 dark_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(dark, CPL_TYPE_FLOAT);
+<a name="l00342"></a>00342 <span class="keywordflow">if</span>(dark_images == NULL)
+<a name="l00343"></a>00343 {
+<a name="l00344"></a>00344 cpl_msg_error(__func__, <span class="stringliteral">"Error reading dark"</span>) ;
+<a name="l00345"></a>00345 cpl_imagelist_delete(flat_images);
+<a name="l00346"></a>00346 cpl_frameset_delete(calib_frameset);
+<a name="l00347"></a>00347 <span class="keywordflow">return</span> -1;
+<a name="l00348"></a>00348 }
+<a name="l00349"></a>00349 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(dark));
+<a name="l00350"></a>00350 }
+<a name="l00351"></a>00351 <span class="keywordflow">if</span>(bpm != NULL)
+<a name="l00352"></a>00352 {
+<a name="l00353"></a>00353 bpm_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(bpm, CPL_TYPE_INT);
+<a name="l00354"></a>00354 <span class="keywordflow">if</span>(bpm_images == NULL)
+<a name="l00355"></a>00355 {
+<a name="l00356"></a>00356 cpl_msg_error(__func__, <span class="stringliteral">"Error reading bpm"</span>) ;
+<a name="l00357"></a>00357 cpl_imagelist_delete(flat_images);
+<a name="l00358"></a>00358 cpl_imagelist_delete(dark_images);
+<a name="l00359"></a>00359 cpl_frameset_delete(calib_frameset);
+<a name="l00360"></a>00360 <span class="keywordflow">return</span> -1;
+<a name="l00361"></a>00361 }
+<a name="l00362"></a>00362 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(bpm));
+<a name="l00363"></a>00363 }
+<a name="l00364"></a>00364
+<a name="l00365"></a>00365 <span class="comment">/* Multiply the dark image by the science exposure time */</span>
+<a name="l00366"></a>00366 <span class="keywordflow">if</span>(dark != NULL)
+<a name="l00367"></a>00367 {
+<a name="l00368"></a>00368 <span class="keywordflow">if</span> ((plist=cpl_propertylist_load
+<a name="l00369"></a>00369 (cpl_frame_get_filename
+<a name="l00370"></a>00370 (cpl_frameset_get_first_const(raw_target)), 0)) == NULL)
+<a name="l00371"></a>00371 {
+<a name="l00372"></a>00372 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get header from frame"</span>);
+<a name="l00373"></a>00373 cpl_imagelist_delete(flat_images);
+<a name="l00374"></a>00374 cpl_imagelist_delete(dark_images);
+<a name="l00375"></a>00375 cpl_frameset_delete(calib_frameset);
+<a name="l00376"></a>00376 <span class="keywordflow">return</span> -1 ;
+<a name="l00377"></a>00377 }
+<a name="l00378"></a>00378 science_dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist);
+<a name="l00379"></a>00379 cpl_imagelist_multiply_scalar(dark_images, science_dit);
+<a name="l00380"></a>00380 cpl_propertylist_delete(plist);
+<a name="l00381"></a>00381 }
+<a name="l00382"></a>00382
+<a name="l00383"></a>00383 <span class="comment">/* Loop on the number of frames */</span>
+<a name="l00384"></a>00384 ntarget = cpl_frameset_get_size(raw_target);
+<a name="l00385"></a>00385 cpl_msg_info(__func__, <span class="stringliteral">"Looping the science frames: %d frames"</span>, ntarget);
+<a name="l00386"></a>00386 <span class="keywordflow">for</span>( iframe = 0 ; iframe < ntarget ; ++iframe)
+<a name="l00387"></a>00387 {
+<a name="l00388"></a>00388 <span class="comment">/* Local storage variables */</span>
+<a name="l00389"></a>00389 cpl_frame * target_frame;
+<a name="l00390"></a>00390 cpl_imagelist * target_images;
+<a name="l00391"></a>00391 cpl_frameset * used_frameset;
+<a name="l00392"></a>00392 target_images = NULL;
+<a name="l00393"></a>00393
+<a name="l00394"></a>00394 <span class="comment">/* Loading the target */</span>
+<a name="l00395"></a>00395 cpl_msg_indent_more();
+<a name="l00396"></a>00396 cpl_msg_info(__func__, <span class="stringliteral">"Loading frame %d"</span>, iframe+1) ;
+<a name="l00397"></a>00397 target_frame = cpl_frameset_get_frame(raw_target, iframe);
+<a name="l00398"></a>00398 <span class="keywordflow">if</span>(target_frame != NULL)
+<a name="l00399"></a>00399 target_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(target_frame, CPL_TYPE_FLOAT);
+<a name="l00400"></a>00400 <span class="keywordflow">if</span>(target_images == NULL)
+<a name="l00401"></a>00401 {
+<a name="l00402"></a>00402 cpl_msg_error(__func__, <span class="stringliteral">"Error reading frame"</span>) ;
+<a name="l00403"></a>00403 cpl_imagelist_delete(flat_images);
+<a name="l00404"></a>00404 cpl_imagelist_delete(dark_images);
+<a name="l00405"></a>00405 cpl_imagelist_delete(bpm_images);
+<a name="l00406"></a>00406 <span class="keywordflow">return</span> -1;
+<a name="l00407"></a>00407 }
+<a name="l00408"></a>00408 <span class="comment">/* Creating the used frameset */</span>
+<a name="l00409"></a>00409 used_frameset = cpl_frameset_duplicate(calib_frameset);
+<a name="l00410"></a>00410 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(target_frame));
+<a name="l00411"></a>00411
+<a name="l00412"></a>00412 <span class="comment">/* TODO: Creating the variance array */</span>
+<a name="l00413"></a>00413 <span class="comment">/* cpl_create_variance_image(); */</span>
+<a name="l00414"></a>00414
+<a name="l00415"></a>00415 <span class="comment">/* Applying the calibrations */</span>
+<a name="l00416"></a>00416 cpl_msg_info(__func__, <span class="stringliteral">"Calibrating frame"</span>) ;
+<a name="l00417"></a>00417 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__calib.html#gaa722d4147127c2af3088266c63d79489" title="Apply the calibration to the images.">hawki_flat_dark_bpm_imglist_calib</a>
+<a name="l00418"></a>00418 (target_images, flat_images, dark_images, bpm_images) == -1)
+<a name="l00419"></a>00419 {
+<a name="l00420"></a>00420 cpl_msg_error(__func__, <span class="stringliteral">"Cannot calibrate frame"</span>) ;
+<a name="l00421"></a>00421 cpl_imagelist_delete(flat_images);
+<a name="l00422"></a>00422 cpl_imagelist_delete(dark_images);
+<a name="l00423"></a>00423 cpl_imagelist_delete(bpm_images);
+<a name="l00424"></a>00424 cpl_imagelist_delete(target_images);
+<a name="l00425"></a>00425 cpl_frameset_delete(used_frameset);
+<a name="l00426"></a>00426 cpl_frameset_delete(calib_frameset);
+<a name="l00427"></a>00427 cpl_msg_indent_less() ;
+<a name="l00428"></a>00428 cpl_msg_indent_less() ;
+<a name="l00429"></a>00429 <span class="keywordflow">return</span> -1 ;
+<a name="l00430"></a>00430 }
+<a name="l00431"></a>00431
+<a name="l00432"></a>00432 <span class="comment">/* Compute quality control */</span>
+<a name="l00433"></a>00433 hawki_step_basic_calib_qc();
+<a name="l00434"></a>00434
+<a name="l00435"></a>00435 <span class="comment">/* Save the products */</span>
+<a name="l00436"></a>00436 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00437"></a>00437 <span class="keywordflow">if</span> (hawki_step_basic_calib_save
+<a name="l00438"></a>00438 (target_images, filename_postfix, procat, protype, iframe,
+<a name="l00439"></a>00439 used_frameset, recipe_parlist,
+<a name="l00440"></a>00440 recipe_framelist) == -1)
+<a name="l00441"></a>00441 {
+<a name="l00442"></a>00442 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the products"</span>) ;
+<a name="l00443"></a>00443 cpl_imagelist_delete(flat_images);
+<a name="l00444"></a>00444 cpl_imagelist_delete(dark_images);
+<a name="l00445"></a>00445 cpl_imagelist_delete(bpm_images);
+<a name="l00446"></a>00446 cpl_imagelist_delete(target_images);
+<a name="l00447"></a>00447 cpl_frameset_delete(used_frameset);
+<a name="l00448"></a>00448 cpl_frameset_delete(calib_frameset);
+<a name="l00449"></a>00449 cpl_msg_indent_less() ;
+<a name="l00450"></a>00450 cpl_msg_indent_less() ;
+<a name="l00451"></a>00451 <span class="keywordflow">return</span> -1 ;
+<a name="l00452"></a>00452 }
+<a name="l00453"></a>00453
+<a name="l00454"></a>00454 <span class="comment">/* Delete the target and the used frameset */</span>
+<a name="l00455"></a>00455 cpl_imagelist_delete(target_images);
+<a name="l00456"></a>00456 cpl_frameset_delete(used_frameset);
+<a name="l00457"></a>00457 cpl_msg_indent_less();
+<a name="l00458"></a>00458 }
+<a name="l00459"></a>00459
+<a name="l00460"></a>00460 cpl_msg_indent_less();
+<a name="l00461"></a>00461 <span class="comment">/* Delete the calibration files */</span>
+<a name="l00462"></a>00462 cpl_imagelist_delete(flat_images);
+<a name="l00463"></a>00463 cpl_imagelist_delete(dark_images);
+<a name="l00464"></a>00464 cpl_imagelist_delete(bpm_images);
+<a name="l00465"></a>00465 cpl_frameset_delete(calib_frameset);
+<a name="l00466"></a>00466
+<a name="l00467"></a>00467 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00468"></a>00468 {
+<a name="l00469"></a>00469 cpl_msg_warning(__func__,<span class="stringliteral">"Probably some data could not be saved. "</span>
+<a name="l00470"></a>00470 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00471"></a>00471 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00472"></a>00472 <span class="keywordflow">return</span> 1;
+<a name="l00473"></a>00473 }
+<a name="l00474"></a>00474 <span class="keywordflow">return</span> 0;
+<a name="l00475"></a>00475 }
+<a name="l00476"></a>00476
+<a name="l00477"></a>00477 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00484"></a>00484 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00485"></a>00485 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_step_basic_calib_qc(<span class="keywordtype">void</span>)
+<a name="l00486"></a>00486 {
+<a name="l00487"></a>00487 <span class="comment">/* Compute QC parameters from the combined image */</span>
+<a name="l00488"></a>00488 <span class="comment">//cpl_msg_info(__func__, "Compute QC parameters from the reduced images") ;</span>
+<a name="l00489"></a>00489 }
+<a name="l00490"></a>00490
+<a name="l00491"></a>00491 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00501"></a>00501 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00502"></a>00502 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_basic_calib_save
+<a name="l00503"></a>00503 (cpl_imagelist * reduced,
+<a name="l00504"></a>00504 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename_postfix,
+<a name="l00505"></a>00505 <span class="keyword">const</span> <span class="keywordtype">char</span> * procat,
+<a name="l00506"></a>00506 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype,
+<a name="l00507"></a>00507 <span class="keywordtype">int</span> iserie,
+<a name="l00508"></a>00508 cpl_frameset * used_frameset,
+<a name="l00509"></a>00509 cpl_parameterlist * recipe_parlist,
+<a name="l00510"></a>00510 cpl_frameset * recipe_framelist)
+<a name="l00511"></a>00511 {
+<a name="l00512"></a>00512 <span class="keyword">const</span> cpl_frame * raw_reference;
+<a name="l00513"></a>00513 cpl_propertylist * proplist;
+<a name="l00514"></a>00514 cpl_propertylist ** extproplists;
+<a name="l00515"></a>00515 <span class="keywordtype">char</span> filename[256];
+<a name="l00516"></a>00516 cpl_propertylist * inputlist ;
+<a name="l00517"></a>00517 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00518"></a>00518 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_basic_calib"</span>;
+<a name="l00519"></a>00519 <span class="keywordtype">int</span> i;
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="comment">/* Get the reference frame (the raw frame) */</span>
+<a name="l00522"></a>00522 raw_reference = irplib_frameset_get_first_from_group
+<a name="l00523"></a>00523 (used_frameset, CPL_FRAME_GROUP_RAW);
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 <span class="comment">/* Create the prop lists */</span>
+<a name="l00526"></a>00526 cpl_msg_indent_more();
+<a name="l00527"></a>00527 proplist = cpl_propertylist_new();
+<a name="l00528"></a>00528 inputlist = cpl_propertylist_load_regexp(
+<a name="l00529"></a>00529 cpl_frame_get_filename(raw_reference), 0,
+<a name="l00530"></a>00530 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00531"></a>00531 cpl_propertylist_append(proplist, inputlist);
+<a name="l00532"></a>00532 cpl_propertylist_delete(inputlist);
+<a name="l00533"></a>00533 extproplists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*));
+<a name="l00534"></a>00534 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00535"></a>00535 {
+<a name="l00536"></a>00536 <span class="comment">/* Get the extension number */</span>
+<a name="l00537"></a>00537 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00538"></a>00538 (cpl_frame_get_filename(raw_reference), i+1);
+<a name="l00539"></a>00539
+<a name="l00540"></a>00540 <span class="comment">/* Allocate this pro perty list */</span>
+<a name="l00541"></a>00541 extproplists[i] = cpl_propertylist_new();
+<a name="l00542"></a>00542
+<a name="l00543"></a>00543 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00544"></a>00544 inputlist = cpl_propertylist_load_regexp(
+<a name="l00545"></a>00545 cpl_frame_get_filename(raw_reference), ext_nb,
+<a name="l00546"></a>00546 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00547"></a>00547 cpl_propertylist_append(extproplists[i], inputlist);
+<a name="l00548"></a>00548 cpl_propertylist_delete(inputlist);
+<a name="l00549"></a>00549 inputlist = cpl_propertylist_load_regexp(
+<a name="l00550"></a>00550 cpl_frame_get_filename(raw_reference), ext_nb,
+<a name="l00551"></a>00551 HAWKI_HEADER_WCS, 0);
+<a name="l00552"></a>00552 cpl_propertylist_append(extproplists[i], inputlist);
+<a name="l00553"></a>00553 cpl_propertylist_delete(inputlist);
+<a name="l00554"></a>00554 }
+<a name="l00555"></a>00555
+<a name="l00556"></a>00556 <span class="comment">/* Write the image */</span>
+<a name="l00557"></a>00557 snprintf(filename, 256, <span class="stringliteral">"hawki_step_basic_calib_%s%03d.fits"</span>,
+<a name="l00558"></a>00558 filename_postfix, iserie+1);
+<a name="l00559"></a>00559 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(recipe_framelist,
+<a name="l00560"></a>00560 recipe_parlist,
+<a name="l00561"></a>00561 used_frameset,
+<a name="l00562"></a>00562 reduced,
+<a name="l00563"></a>00563 recipe_name,
+<a name="l00564"></a>00564 procat,
+<a name="l00565"></a>00565 protype,
+<a name="l00566"></a>00566 (<span class="keyword">const</span> cpl_propertylist*)proplist,
+<a name="l00567"></a>00567 (<span class="keyword">const</span> cpl_propertylist**)extproplists,
+<a name="l00568"></a>00568 filename);
+<a name="l00569"></a>00569
+<a name="l00570"></a>00570 <span class="comment">/* Free and return */</span>
+<a name="l00571"></a>00571 cpl_msg_indent_less();
+<a name="l00572"></a>00572 cpl_propertylist_delete(proplist) ;
+<a name="l00573"></a>00573 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00574"></a>00574 {
+<a name="l00575"></a>00575 cpl_propertylist_delete(extproplists[i]) ;
+<a name="l00576"></a>00576 }
+<a name="l00577"></a>00577 cpl_free(extproplists) ;
+<a name="l00578"></a>00578 <span class="keywordflow">return</span> 0;
+<a name="l00579"></a>00579 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__combine_8c_source.html b/html/hawki__step__combine_8c_source.html
new file mode 100644
index 0000000..184c52c
--- /dev/null
+++ b/html/hawki__step__combine_8c_source.html
@@ -0,0 +1,1014 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_combine.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_combine.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_combine.c,v 1.24 2012/04/23 10:04:04 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/04/23 10:04:04 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.24 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <string.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_calib.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_saa.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_bkg.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "hawki_properties_tel.h"</span>
+<a name="l00053"></a>00053 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00056"></a>00056 <span class="comment"> Functions prototypes</span>
+<a name="l00057"></a>00057 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00058"></a>00058
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_create(cpl_plugin *) ;
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_exec(cpl_plugin *) ;
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_destroy(cpl_plugin *) ;
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00063"></a>00063
+<a name="l00064"></a>00064 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_retrieve_input_param
+<a name="l00065"></a>00065 (cpl_parameterlist * parlist);
+<a name="l00066"></a>00066 <span class="keyword">static</span> cpl_image ** hawki_step_combine_apply_comb
+<a name="l00067"></a>00067 (cpl_frameset * obj,
+<a name="l00068"></a>00068 cpl_frameset * offsets,
+<a name="l00069"></a>00069 cpl_frameset * bpm,
+<a name="l00070"></a>00070 cpl_frameset * bkg_bpm_frames);
+<a name="l00071"></a>00071 <span class="keyword">static</span> cpl_image ** hawki_step_combine_chip
+<a name="l00072"></a>00072 (cpl_imagelist * in,
+<a name="l00073"></a>00073 cpl_bivector * offsets,
+<a name="l00074"></a>00074 <span class="keywordtype">double</span> * pos_x,
+<a name="l00075"></a>00075 <span class="keywordtype">double</span> * pos_y);
+<a name="l00076"></a>00076 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_interpolate_badpix
+<a name="l00077"></a>00077 (cpl_image * image);
+<a name="l00078"></a>00078 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_save
+<a name="l00079"></a>00079 (cpl_image ** combined,
+<a name="l00080"></a>00080 cpl_image ** contrib_map,
+<a name="l00081"></a>00081 cpl_frameset * used_frames,
+<a name="l00082"></a>00082 cpl_parameterlist * parlist,
+<a name="l00083"></a>00083 cpl_frameset * recipe_frameset);
+<a name="l00084"></a>00084
+<a name="l00085"></a>00085 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00086"></a>00086 <span class="comment"> Static variables</span>
+<a name="l00087"></a>00087 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00088"></a>00088
+<a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00090"></a>00090 {
+<a name="l00091"></a>00091 <span class="comment">/* Inputs */</span>
+<a name="l00092"></a>00092 <span class="keywordtype">int</span> offset_max ;
+<a name="l00093"></a>00093 <span class="keywordtype">int</span> borders ;
+<a name="l00094"></a>00094 cpl_geom_combine comb_meth ;
+<a name="l00095"></a>00095 <span class="keywordtype">int</span> rej_low;
+<a name="l00096"></a>00096 <span class="keywordtype">int</span> rej_high;
+<a name="l00097"></a>00097 cpl_kernel resamp_kernel;
+<a name="l00098"></a>00098 } hawki_step_combine_config;
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00101"></a>00101 {
+<a name="l00102"></a>00102 <span class="comment">/* Outputs */</span>
+<a name="l00103"></a>00103 <span class="keywordtype">double</span> mean_airmass;
+<a name="l00104"></a>00104 <span class="keywordtype">double</span> combined_pos_x[HAWKI_NB_DETECTORS];
+<a name="l00105"></a>00105 <span class="keywordtype">double</span> combined_pos_y[HAWKI_NB_DETECTORS];
+<a name="l00106"></a>00106 <span class="keywordtype">double</span> combined_cumoffset_x[HAWKI_NB_DETECTORS];
+<a name="l00107"></a>00107 <span class="keywordtype">double</span> combined_cumoffset_y[HAWKI_NB_DETECTORS];
+<a name="l00108"></a>00108 } hawki_step_combine_output;
+<a name="l00109"></a>00109
+<a name="l00110"></a>00110 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_combine_description[] =
+<a name="l00111"></a>00111 <span class="stringliteral">"hawki_step_combine -- hawki combine jitter images.\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"science-file.fits "</span>HAWKI_CALPRO_DIST_CORRECTED<span class="stringliteral">" or\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">"science-file.fits "</span>HAWKI_CALPRO_BKG_SUBTRACTED<span class="stringliteral">" or\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">"bpm-file.fits "</span>HAWKI_CALPRO_BPM<span class="stringliteral">" (optional) \n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"bkg_bpm-file.fits "</span>HAWKI_CALPRO_BKGBPM<span class="stringliteral">" (optional) \n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">"offsets-file.fits "</span>HAWKI_CALPRO_OFFSETS<span class="stringliteral">" (optional) \n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">"hawki_step_combine.fits ("</span>HAWKI_CALPRO_COMBINED<span class="stringliteral">"): \n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">"The recipe does the following steps:\n"</span>
+<a name="l00121"></a>00121 <span class="stringliteral">"-Allocate an image with the proper combined size \n"</span>
+<a name="l00122"></a>00122 <span class="stringliteral">" (depends on parameters --comb_meth and --borders)\n"</span>
+<a name="l00123"></a>00123 <span class="stringliteral">"-Retrieve the offsets either from the offsets-file.fits or from the header\n"</span>
+<a name="l00124"></a>00124 <span class="stringliteral">"-For each combined pixel, the contribution of each individual frame \n"</span>
+<a name="l00125"></a>00125 <span class="stringliteral">" is added using a resampling kernel. If any of the pixels involved in\n"</span>
+<a name="l00126"></a>00126 <span class="stringliteral">" the resampling is a bad pixel (defined in bpm-file.fits), it is not\n"</span>
+<a name="l00127"></a>00127 <span class="stringliteral">" taken into account.\n"</span>
+<a name="l00128"></a>00128 <span class="stringliteral">" With the remaining pixels a minmax rejection is performed\n"</span>
+<a name="l00129"></a>00129 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00130"></a>00130 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00131"></a>00131 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00132"></a>00132
+<a name="l00133"></a>00133 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00134"></a>00134 <span class="comment"> Functions code</span>
+<a name="l00135"></a>00135 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00136"></a>00136
+<a name="l00137"></a>00137 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00145"></a>00145 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00146"></a>00146 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00147"></a>00147 {
+<a name="l00148"></a>00148 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00149"></a>00149 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00150"></a>00150
+<a name="l00151"></a>00151 cpl_plugin_init(plugin,
+<a name="l00152"></a>00152 CPL_PLUGIN_API,
+<a name="l00153"></a>00153 HAWKI_BINARY_VERSION,
+<a name="l00154"></a>00154 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00155"></a>00155 <span class="stringliteral">"hawki_step_combine"</span>,
+<a name="l00156"></a>00156 <span class="stringliteral">"Jitter image combination recipe"</span>,
+<a name="l00157"></a>00157 hawki_step_combine_description,
+<a name="l00158"></a>00158 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00159"></a>00159 PACKAGE_BUGREPORT,
+<a name="l00160"></a>00160 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00161"></a>00161 hawki_step_combine_create,
+<a name="l00162"></a>00162 hawki_step_combine_exec,
+<a name="l00163"></a>00163 hawki_step_combine_destroy) ;
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165 cpl_pluginlist_append(list, plugin) ;
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 <span class="keywordflow">return</span> 0;
+<a name="l00168"></a>00168 }
+<a name="l00169"></a>00169
+<a name="l00170"></a>00170 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00179"></a>00179 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00180"></a>00180 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_create(cpl_plugin * plugin)
+<a name="l00181"></a>00181 {
+<a name="l00182"></a>00182 cpl_recipe * recipe ;
+<a name="l00183"></a>00183 cpl_parameter * p ;
+<a name="l00184"></a>00184
+<a name="l00185"></a>00185 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00186"></a>00186 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00187"></a>00187 recipe = (cpl_recipe *)plugin ;
+<a name="l00188"></a>00188 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00189"></a>00189
+<a name="l00190"></a>00190 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00191"></a>00191 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00192"></a>00192 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00193"></a>00193 <span class="keywordflow">return</span> 1;
+<a name="l00194"></a>00194
+<a name="l00195"></a>00195 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00196"></a>00196 <span class="comment">/* --offset_max */</span>
+<a name="l00197"></a>00197 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_combine.offset_max"</span>,
+<a name="l00198"></a>00198 CPL_TYPE_INT,
+<a name="l00199"></a>00199 <span class="stringliteral">"Maximum offset allowed"</span>,
+<a name="l00200"></a>00200 <span class="stringliteral">"hawki.hawki_step_combine"</span>,
+<a name="l00201"></a>00201 1500) ;
+<a name="l00202"></a>00202 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"offset_max"</span>) ;
+<a name="l00203"></a>00203 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00204"></a>00204 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00205"></a>00205
+<a name="l00206"></a>00206 <span class="comment">/* --comb_meth */</span>
+<a name="l00207"></a>00207 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_combine.comb_meth"</span>,
+<a name="l00208"></a>00208 CPL_TYPE_STRING,
+<a name="l00209"></a>00209 <span class="stringliteral">"Final size of combination (union / inter / first)"</span>,
+<a name="l00210"></a>00210 <span class="stringliteral">"hawki.hawki_step_combine"</span>,
+<a name="l00211"></a>00211 <span class="stringliteral">"union"</span>) ;
+<a name="l00212"></a>00212 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"comb_meth"</span>) ;
+<a name="l00213"></a>00213 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00214"></a>00214 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00215"></a>00215
+<a name="l00216"></a>00216 <span class="comment">/* --rej */</span>
+<a name="l00217"></a>00217 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_combine.rej"</span>,
+<a name="l00218"></a>00218 CPL_TYPE_STRING,
+<a name="l00219"></a>00219 <span class="stringliteral">"Low and high number of rejected values"</span>,
+<a name="l00220"></a>00220 <span class="stringliteral">"hawki.hawki_step_combine"</span>,
+<a name="l00221"></a>00221 <span class="stringliteral">"1,1"</span>) ;
+<a name="l00222"></a>00222 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"rej"</span>) ;
+<a name="l00223"></a>00223 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00224"></a>00224 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00225"></a>00225
+<a name="l00226"></a>00226 <span class="comment">/* --borders */</span>
+<a name="l00227"></a>00227 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_combine.borders"</span>,
+<a name="l00228"></a>00228 CPL_TYPE_INT,
+<a name="l00229"></a>00229 <span class="stringliteral">"Border pixels trimmed"</span>,
+<a name="l00230"></a>00230 <span class="stringliteral">"hawki.hawki_step_combine"</span>,
+<a name="l00231"></a>00231 4) ;
+<a name="l00232"></a>00232 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"borders"</span>) ;
+<a name="l00233"></a>00233 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00234"></a>00234 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00235"></a>00235
+<a name="l00236"></a>00236 <span class="comment">/* --resamp_kernel */</span>
+<a name="l00237"></a>00237 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_combine.resamp_kernel"</span>,
+<a name="l00238"></a>00238 CPL_TYPE_STRING,
+<a name="l00239"></a>00239 <span class="stringliteral">"Resampling kernel (default/tanh/sinc/sinc2/lanczos/hamming/hann)"</span>,
+<a name="l00240"></a>00240 <span class="stringliteral">"hawki.hawki_step_combine"</span>,
+<a name="l00241"></a>00241 <span class="stringliteral">"default"</span>) ;
+<a name="l00242"></a>00242 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"resamp_kernel"</span>) ;
+<a name="l00243"></a>00243 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00244"></a>00244 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00245"></a>00245
+<a name="l00246"></a>00246 <span class="comment">/* Return */</span>
+<a name="l00247"></a>00247 <span class="keywordflow">return</span> 0;
+<a name="l00248"></a>00248 }
+<a name="l00249"></a>00249
+<a name="l00250"></a>00250 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00256"></a>00256 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00257"></a>00257 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_exec(cpl_plugin * plugin)
+<a name="l00258"></a>00258 {
+<a name="l00259"></a>00259 cpl_recipe * recipe ;
+<a name="l00260"></a>00260
+<a name="l00261"></a>00261 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00262"></a>00262 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00263"></a>00263 recipe = (cpl_recipe *)plugin ;
+<a name="l00264"></a>00264 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00265"></a>00265
+<a name="l00266"></a>00266 <span class="comment">/* Issue a banner */</span>
+<a name="l00267"></a>00267 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00268"></a>00268
+<a name="l00269"></a>00269 <span class="keywordflow">return</span> hawki_step_combine(recipe->parameters, recipe->frames) ;
+<a name="l00270"></a>00270 }
+<a name="l00271"></a>00271
+<a name="l00272"></a>00272 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00278"></a>00278 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00279"></a>00279 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_destroy(cpl_plugin * plugin)
+<a name="l00280"></a>00280 {
+<a name="l00281"></a>00281 cpl_recipe * recipe ;
+<a name="l00282"></a>00282
+<a name="l00283"></a>00283 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00284"></a>00284 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00285"></a>00285 recipe = (cpl_recipe *)plugin ;
+<a name="l00286"></a>00286 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00287"></a>00287
+<a name="l00288"></a>00288 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00289"></a>00289 <span class="keywordflow">return</span> 0 ;
+<a name="l00290"></a>00290 }
+<a name="l00291"></a>00291
+<a name="l00292"></a>00292 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00299"></a>00299 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00300"></a>00300 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine(
+<a name="l00301"></a>00301 cpl_parameterlist * parlist,
+<a name="l00302"></a>00302 cpl_frameset * framelist)
+<a name="l00303"></a>00303 {
+<a name="l00304"></a>00304 cpl_frameset * objframes ;
+<a name="l00305"></a>00305 cpl_frameset * offsets;
+<a name="l00306"></a>00306 cpl_frameset * bpm;
+<a name="l00307"></a>00307 cpl_frameset * bpmbkg;
+<a name="l00308"></a>00308 cpl_frameset * used_frames;
+<a name="l00309"></a>00309 cpl_image ** combined_contrib;
+<a name="l00310"></a>00310 cpl_image ** combined;
+<a name="l00311"></a>00311 cpl_image ** contrib_map;
+<a name="l00312"></a>00312 <span class="keywordtype">int</span> idet;
+<a name="l00313"></a>00313
+<a name="l00314"></a>00314 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00315"></a>00315 <span class="keywordflow">if</span>(hawki_step_combine_retrieve_input_param(parlist))
+<a name="l00316"></a>00316 {
+<a name="l00317"></a>00317 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00318"></a>00318 <span class="keywordflow">return</span> -1;
+<a name="l00319"></a>00319 }
+<a name="l00320"></a>00320
+<a name="l00321"></a>00321 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00322"></a>00322 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00323"></a>00323 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00324"></a>00324 <span class="keywordflow">return</span> -1 ;
+<a name="l00325"></a>00325 }
+<a name="l00326"></a>00326
+<a name="l00327"></a>00327 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00328"></a>00328 objframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_DIST_CORRECTED);
+<a name="l00329"></a>00329 <span class="keywordflow">if</span> (objframes == NULL)
+<a name="l00330"></a>00330 {
+<a name="l00331"></a>00331 objframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00332"></a>00332 (framelist, HAWKI_CALPRO_BKG_SUBTRACTED);
+<a name="l00333"></a>00333 <span class="keywordflow">if</span> (objframes == NULL)
+<a name="l00334"></a>00334 {
+<a name="l00335"></a>00335 cpl_msg_error(__func__,<span class="stringliteral">"Cannot find objs frames in the input list (%s or %s)"</span>,
+<a name="l00336"></a>00336 HAWKI_CALPRO_DIST_CORRECTED, HAWKI_CALPRO_BKG_SUBTRACTED);
+<a name="l00337"></a>00337 <span class="keywordflow">return</span> -1 ;
+<a name="l00338"></a>00338 }
+<a name="l00339"></a>00339 }
+<a name="l00340"></a>00340 used_frames = cpl_frameset_duplicate(objframes);
+<a name="l00341"></a>00341
+<a name="l00342"></a>00342 <span class="comment">/* Retrieve the refined offsets, if provided */</span>
+<a name="l00343"></a>00343 offsets = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_OFFSETS);
+<a name="l00344"></a>00344 <span class="keywordflow">if</span>(offsets)
+<a name="l00345"></a>00345 cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+<a name="l00346"></a>00346 cpl_frameset_get_first(offsets)));
+<a name="l00347"></a>00347
+<a name="l00348"></a>00348 <span class="comment">/* Retrieve the general bad pixel mask, if provided */</span>
+<a name="l00349"></a>00349 bpm = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_BPM);
+<a name="l00350"></a>00350 <span class="keywordflow">if</span>(bpm)
+<a name="l00351"></a>00351 cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+<a name="l00352"></a>00352 cpl_frameset_get_first(bpm)));
+<a name="l00353"></a>00353
+<a name="l00354"></a>00354 <span class="comment">/* Retrieve the background bad pixel masks, if provided */</span>
+<a name="l00355"></a>00355 bpmbkg = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_BKGBPM);
+<a name="l00356"></a>00356 <span class="keywordflow">if</span>(bpmbkg)
+<a name="l00357"></a>00357 {
+<a name="l00358"></a>00358 <span class="keywordtype">int</span> iframe;
+<a name="l00359"></a>00359 <span class="keywordflow">for</span>(iframe=0; iframe < cpl_frameset_get_size(bpmbkg); iframe++)
+<a name="l00360"></a>00360 cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+<a name="l00361"></a>00361 cpl_frameset_get_frame(bpmbkg,iframe)));
+<a name="l00362"></a>00362 <span class="keywordflow">if</span>(cpl_frameset_get_size(bpmbkg) != cpl_frameset_get_size(objframes))
+<a name="l00363"></a>00363 {
+<a name="l00364"></a>00364 cpl_msg_error(__func__,<span class="stringliteral">"Incompatible number of science and bad bkg"</span>
+<a name="l00365"></a>00365 <span class="stringliteral">" images."</span>);
+<a name="l00366"></a>00366 cpl_msg_error(__func__,<span class="stringliteral">"Supply as many bad bkg images as objects"</span>);
+<a name="l00367"></a>00367 cpl_frameset_delete(objframes);
+<a name="l00368"></a>00368 cpl_frameset_delete(used_frames);
+<a name="l00369"></a>00369 cpl_frameset_delete(offsets);
+<a name="l00370"></a>00370 cpl_frameset_delete(bpm);
+<a name="l00371"></a>00371 cpl_frameset_delete(bpmbkg);
+<a name="l00372"></a>00372 <span class="keywordflow">return</span> -1;
+<a name="l00373"></a>00373 }
+<a name="l00374"></a>00374 }
+<a name="l00375"></a>00375
+<a name="l00376"></a>00376 <span class="comment">/* Apply the combination */</span>
+<a name="l00377"></a>00377 cpl_msg_info(__func__, <span class="stringliteral">"Apply the data recombination"</span>);
+<a name="l00378"></a>00378 cpl_msg_indent_more() ;
+<a name="l00379"></a>00379 <span class="keywordflow">if</span> ((combined_contrib = hawki_step_combine_apply_comb
+<a name="l00380"></a>00380 (objframes, offsets, bpm, bpmbkg)) == NULL)
+<a name="l00381"></a>00381 {
+<a name="l00382"></a>00382 cpl_msg_error(__func__, <span class="stringliteral">"Cannot combine the data"</span>);
+<a name="l00383"></a>00383 cpl_frameset_delete(objframes);
+<a name="l00384"></a>00384 cpl_frameset_delete(used_frames);
+<a name="l00385"></a>00385 <span class="keywordflow">if</span>(offsets != NULL)
+<a name="l00386"></a>00386 cpl_frameset_delete(offsets);
+<a name="l00387"></a>00387 <span class="keywordflow">if</span>(bpm != NULL)
+<a name="l00388"></a>00388 cpl_frameset_delete(bpm);
+<a name="l00389"></a>00389 cpl_msg_indent_less() ;
+<a name="l00390"></a>00390 <span class="keywordflow">return</span> -1 ;
+<a name="l00391"></a>00391 }
+<a name="l00392"></a>00392
+<a name="l00393"></a>00393 <span class="comment">/* Get both the combination and the contribution map */</span>
+<a name="l00394"></a>00394 combined = combined_contrib;
+<a name="l00395"></a>00395 contrib_map = combined_contrib + HAWKI_NB_DETECTORS;
+<a name="l00396"></a>00396 cpl_msg_indent_less() ;
+<a name="l00397"></a>00397 cpl_frameset_delete(objframes);
+<a name="l00398"></a>00398 <span class="keywordflow">if</span>(offsets != NULL)
+<a name="l00399"></a>00399 cpl_frameset_delete(offsets);
+<a name="l00400"></a>00400 <span class="keywordflow">if</span>(bpm != NULL)
+<a name="l00401"></a>00401 cpl_frameset_delete(bpm);
+<a name="l00402"></a>00402 <span class="keywordflow">if</span>(bpmbkg != NULL)
+<a name="l00403"></a>00403 cpl_frameset_delete(bpmbkg);
+<a name="l00404"></a>00404
+<a name="l00405"></a>00405 <span class="comment">/* Save the products */</span>
+<a name="l00406"></a>00406 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00407"></a>00407 cpl_msg_indent_more() ;
+<a name="l00408"></a>00408 <span class="keywordflow">if</span> (hawki_step_combine_save(combined, contrib_map,
+<a name="l00409"></a>00409 used_frames, parlist, framelist) != 0)
+<a name="l00410"></a>00410 {
+<a name="l00411"></a>00411 cpl_msg_warning(__func__, <span class="stringliteral">"Some error happened saving the data. "</span>
+<a name="l00412"></a>00412 <span class="stringliteral">"Check permisions or disk space"</span>) ;
+<a name="l00413"></a>00413 <span class="keywordflow">for</span>(idet=0; idet< 2 * HAWKI_NB_DETECTORS; ++idet)
+<a name="l00414"></a>00414 cpl_image_delete(combined_contrib[idet]);
+<a name="l00415"></a>00415 cpl_frameset_delete(used_frames);
+<a name="l00416"></a>00416 cpl_free(combined_contrib);
+<a name="l00417"></a>00417 cpl_msg_indent_less() ;
+<a name="l00418"></a>00418 <span class="keywordflow">return</span> -1 ;
+<a name="l00419"></a>00419 }
+<a name="l00420"></a>00420 cpl_msg_indent_less() ;
+<a name="l00421"></a>00421
+<a name="l00422"></a>00422 <span class="comment">/* Return */</span>
+<a name="l00423"></a>00423 <span class="keywordflow">for</span>(idet=0; idet< 2 * HAWKI_NB_DETECTORS; ++idet)
+<a name="l00424"></a>00424 cpl_image_delete(combined_contrib[idet]);
+<a name="l00425"></a>00425 cpl_free(combined_contrib);
+<a name="l00426"></a>00426 cpl_frameset_delete(used_frames);
+<a name="l00427"></a>00427
+<a name="l00428"></a>00428 <span class="comment">/* Return */</span>
+<a name="l00429"></a>00429 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00430"></a>00430 {
+<a name="l00431"></a>00431 cpl_msg_error(__func__,
+<a name="l00432"></a>00432 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00433"></a>00433 <span class="keywordflow">return</span> -1 ;
+<a name="l00434"></a>00434 }
+<a name="l00435"></a>00435 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00436"></a>00436 }
+<a name="l00437"></a>00437
+<a name="l00438"></a>00438 <span class="keywordtype">int</span> hawki_step_combine_retrieve_input_param
+<a name="l00439"></a>00439 (cpl_parameterlist * parlist)
+<a name="l00440"></a>00440 {
+<a name="l00441"></a>00441 cpl_parameter * par ;
+<a name="l00442"></a>00442 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00443"></a>00443 par = NULL ;
+<a name="l00444"></a>00444 par = cpl_parameterlist_find(parlist,
+<a name="l00445"></a>00445 <span class="stringliteral">"hawki.hawki_step_combine.offset_max"</span>);
+<a name="l00446"></a>00446 hawki_step_combine_config.offset_max = cpl_parameter_get_int(par);
+<a name="l00447"></a>00447 par = cpl_parameterlist_find(parlist,
+<a name="l00448"></a>00448 <span class="stringliteral">"hawki.hawki_step_combine.comb_meth"</span>);
+<a name="l00449"></a>00449 sval = cpl_parameter_get_string(par);
+<a name="l00450"></a>00450 <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"union"</span>))
+<a name="l00451"></a>00451 hawki_step_combine_config.comb_meth = CPL_GEOM_UNION;
+<a name="l00452"></a>00452 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"inter"</span>))
+<a name="l00453"></a>00453 hawki_step_combine_config.comb_meth = CPL_GEOM_INTERSECT;
+<a name="l00454"></a>00454 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"first"</span>))
+<a name="l00455"></a>00455 hawki_step_combine_config.comb_meth = CPL_GEOM_FIRST;
+<a name="l00456"></a>00456 <span class="keywordflow">else</span>
+<a name="l00457"></a>00457 {
+<a name="l00458"></a>00458 cpl_msg_error(__func__, <span class="stringliteral">"Invalid combine method specified"</span>);
+<a name="l00459"></a>00459 <span class="keywordflow">return</span> -1;
+<a name="l00460"></a>00460 }
+<a name="l00461"></a>00461 par = cpl_parameterlist_find(parlist,
+<a name="l00462"></a>00462 <span class="stringliteral">"hawki.hawki_step_combine.borders"</span>);
+<a name="l00463"></a>00463 hawki_step_combine_config.borders = cpl_parameter_get_int(par);
+<a name="l00464"></a>00464 <span class="keywordflow">if</span>(hawki_step_combine_config.borders < 0 )
+<a name="l00465"></a>00465 {
+<a name="l00466"></a>00466 cpl_msg_error(__func__, <span class="stringliteral">"Borders cannot be less than zero"</span>);
+<a name="l00467"></a>00467 <span class="keywordflow">return</span> -1;
+<a name="l00468"></a>00468 }
+<a name="l00469"></a>00469 par = cpl_parameterlist_find(parlist,
+<a name="l00470"></a>00470 <span class="stringliteral">"hawki.hawki_step_combine.rej"</span>);
+<a name="l00471"></a>00471 sval = cpl_parameter_get_string(par);
+<a name="l00472"></a>00472 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d"</span>,
+<a name="l00473"></a>00473 &hawki_step_combine_config.rej_low,
+<a name="l00474"></a>00474 &hawki_step_combine_config.rej_high)!=2)
+<a name="l00475"></a>00475 {
+<a name="l00476"></a>00476 <span class="keywordflow">return</span> -1;
+<a name="l00477"></a>00477 }
+<a name="l00478"></a>00478 par = cpl_parameterlist_find(parlist,
+<a name="l00479"></a>00479 <span class="stringliteral">"hawki.hawki_step_combine.resamp_kernel"</span>);
+<a name="l00480"></a>00480 sval = cpl_parameter_get_string(par);
+<a name="l00481"></a>00481 <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"tanh"</span>))
+<a name="l00482"></a>00482 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_TANH;
+<a name="l00483"></a>00483 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"sinc"</span>))
+<a name="l00484"></a>00484 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_SINC;
+<a name="l00485"></a>00485 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"sinc2"</span>))
+<a name="l00486"></a>00486 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_SINC2;
+<a name="l00487"></a>00487 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"lanczos"</span>))
+<a name="l00488"></a>00488 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_LANCZOS;
+<a name="l00489"></a>00489 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"hamming"</span>))
+<a name="l00490"></a>00490 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_HAMMING;
+<a name="l00491"></a>00491 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"hann"</span>))
+<a name="l00492"></a>00492 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_HANN;
+<a name="l00493"></a>00493 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(sval, <span class="stringliteral">"default"</span>))
+<a name="l00494"></a>00494 hawki_step_combine_config.resamp_kernel = CPL_KERNEL_DEFAULT;
+<a name="l00495"></a>00495 <span class="keywordflow">else</span>
+<a name="l00496"></a>00496 {
+<a name="l00497"></a>00497 cpl_msg_error(__func__, <span class="stringliteral">"Invalid resampling kernel specified"</span>);
+<a name="l00498"></a>00498 <span class="keywordflow">return</span> -1;
+<a name="l00499"></a>00499 }
+<a name="l00500"></a>00500
+<a name="l00501"></a>00501 <span class="keywordflow">return</span> 0;
+<a name="l00502"></a>00502 }
+<a name="l00503"></a>00503
+<a name="l00504"></a>00504
+<a name="l00505"></a>00505
+<a name="l00506"></a>00506 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00512"></a>00512 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00513"></a>00513 <span class="keyword">static</span> cpl_image ** hawki_step_combine_apply_comb
+<a name="l00514"></a>00514 (cpl_frameset * obj,
+<a name="l00515"></a>00515 cpl_frameset * offsets_frames,
+<a name="l00516"></a>00516 cpl_frameset * bpm_frame,
+<a name="l00517"></a>00517 cpl_frameset * bkg_bpm_frames)
+<a name="l00518"></a>00518 {
+<a name="l00519"></a>00519 cpl_image ** combined_contrib;
+<a name="l00520"></a>00520 cpl_bivector ** offsets;
+<a name="l00521"></a>00521 cpl_mask * bpm_masks[HAWKI_NB_DETECTORS];
+<a name="l00522"></a>00522 <span class="keywordtype">int</span> idet;
+<a name="l00523"></a>00523 <span class="keywordtype">int</span> ioff;
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 <span class="keywordflow">if</span>(offsets_frames == NULL)
+<a name="l00526"></a>00526 {
+<a name="l00527"></a>00527 cpl_bivector * offsets_single_chip;
+<a name="l00528"></a>00528 <span class="keywordflow">if</span> ((offsets_single_chip = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(obj)) == NULL)
+<a name="l00529"></a>00529 {
+<a name="l00530"></a>00530 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the header offsets"</span>);
+<a name="l00531"></a>00531 <span class="keywordflow">return</span> NULL;
+<a name="l00532"></a>00532 }
+<a name="l00533"></a>00533 offsets = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_bivector *));
+<a name="l00534"></a>00534 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00535"></a>00535 offsets[idet] = cpl_bivector_duplicate(offsets_single_chip);
+<a name="l00536"></a>00536 cpl_bivector_delete(offsets_single_chip);
+<a name="l00537"></a>00537 }
+<a name="l00538"></a>00538 <span class="keywordflow">else</span>
+<a name="l00539"></a>00539 {
+<a name="l00540"></a>00540 offsets = <a class="code" href="group__hawki__load.html#gaf91b09d357b426f387123767e4a4fec1" title="Load a table containing refined offsets.">hawki_load_refined_offsets</a>
+<a name="l00541"></a>00541 (cpl_frameset_get_first(offsets_frames));
+<a name="l00542"></a>00542 <span class="keywordflow">if</span>(offsets == NULL)
+<a name="l00543"></a>00543 {
+<a name="l00544"></a>00544 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the refined offsets"</span>);
+<a name="l00545"></a>00545 <span class="keywordflow">return</span> NULL;
+<a name="l00546"></a>00546 }
+<a name="l00547"></a>00547 }
+<a name="l00548"></a>00548 <span class="comment">/* Get the oposite offsets. This is to change from </span>
+<a name="l00549"></a>00549 <span class="comment"> * telescope convention to cpl convention </span>
+<a name="l00550"></a>00550 <span class="comment"> * WARNING: It may appear that the img_jitter function </span>
+<a name="l00551"></a>00551 <span class="comment"> * does not apply the multiplication by -1, but it really does it in </span>
+<a name="l00552"></a>00552 <span class="comment"> * hawki_img_jitter_saa instead of when it reads the offsets */</span>
+<a name="l00553"></a>00553 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00554"></a>00554 {
+<a name="l00555"></a>00555 cpl_vector_multiply_scalar(cpl_bivector_get_x(offsets[idet]), -1.0);
+<a name="l00556"></a>00556 cpl_vector_multiply_scalar(cpl_bivector_get_y(offsets[idet]), -1.0);
+<a name="l00557"></a>00557 }
+<a name="l00558"></a>00558
+<a name="l00559"></a>00559 <span class="comment">/* Load the bpm */</span>
+<a name="l00560"></a>00560 <span class="keywordflow">if</span>(bpm_frame != NULL)
+<a name="l00561"></a>00561 {
+<a name="l00562"></a>00562 cpl_imagelist * bpm_images = NULL;
+<a name="l00563"></a>00563 bpm_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>
+<a name="l00564"></a>00564 (cpl_frameset_get_first(bpm_frame), CPL_TYPE_INT);
+<a name="l00565"></a>00565 <span class="keywordflow">if</span>(bpm_images == NULL)
+<a name="l00566"></a>00566 {
+<a name="l00567"></a>00567 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the bad pixel mask"</span>);
+<a name="l00568"></a>00568 <span class="keywordflow">return</span> NULL;
+<a name="l00569"></a>00569 }
+<a name="l00570"></a>00570 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00571"></a>00571 {
+<a name="l00572"></a>00572 bpm_masks[idet] = cpl_mask_threshold_image_create
+<a name="l00573"></a>00573 (cpl_imagelist_get(bpm_images, idet), 0.5, 1.5);
+<a name="l00574"></a>00574 }
+<a name="l00575"></a>00575 cpl_imagelist_delete(bpm_images);
+<a name="l00576"></a>00576 }
+<a name="l00577"></a>00577
+<a name="l00578"></a>00578 <span class="comment">/* Create output object */</span>
+<a name="l00579"></a>00579 combined_contrib = cpl_malloc(2 * HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_image *));
+<a name="l00580"></a>00580
+<a name="l00581"></a>00581 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00582"></a>00582 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00583"></a>00583 {
+<a name="l00584"></a>00584 cpl_imagelist * in ;
+<a name="l00585"></a>00585 cpl_imagelist * bpm_bkg_im = NULL;
+<a name="l00586"></a>00586 cpl_image ** comb_contrib_chip ;
+<a name="l00587"></a>00587 <span class="keywordtype">double</span> * offs_est_x ;
+<a name="l00588"></a>00588 <span class="keywordtype">double</span> * offs_est_y ;
+<a name="l00589"></a>00589 <span class="keywordtype">double</span> max_x, max_y ;
+<a name="l00590"></a>00590 <span class="keywordtype">double</span> off_0_x;
+<a name="l00591"></a>00591 <span class="keywordtype">double</span> off_0_y;
+<a name="l00592"></a>00592 <span class="keywordtype">int</span> jdet;
+<a name="l00593"></a>00593 <span class="keywordtype">int</span> iframe;
+<a name="l00594"></a>00594
+<a name="l00595"></a>00595 cpl_msg_info(__func__, <span class="stringliteral">"Combine chip number %d"</span>, idet+1) ;
+<a name="l00596"></a>00596 cpl_msg_indent_more() ;
+<a name="l00597"></a>00597
+<a name="l00598"></a>00598 <span class="comment">/* Print the offsets */</span>
+<a name="l00599"></a>00599 offs_est_x = cpl_bivector_get_x_data(offsets[idet]) ;
+<a name="l00600"></a>00600 offs_est_y = cpl_bivector_get_y_data(offsets[idet]) ;
+<a name="l00601"></a>00601 <span class="keywordflow">for</span> (ioff=0 ; ioff<cpl_bivector_get_size(offsets[idet]) ; ioff++) {
+<a name="l00602"></a>00602 cpl_msg_info(__func__,<span class="stringliteral">"Telescope offsets (Frame %d): %g %g"</span>, ioff+1,
+<a name="l00603"></a>00603 -offs_est_x[ioff], -offs_est_y[ioff]) ;
+<a name="l00604"></a>00604 }
+<a name="l00605"></a>00605
+<a name="l00606"></a>00606 <span class="comment">/* Subtract the first offset to all offsets */</span>
+<a name="l00607"></a>00607 max_x = max_y = 0.0 ;
+<a name="l00608"></a>00608 off_0_x = offs_est_x[0];
+<a name="l00609"></a>00609 off_0_y = offs_est_y[0];
+<a name="l00610"></a>00610 <span class="keywordflow">for</span> (ioff=1 ; ioff<cpl_bivector_get_size(offsets[idet]) ; ioff++)
+<a name="l00611"></a>00611 {
+<a name="l00612"></a>00612 offs_est_x[ioff] -= offs_est_x[0] ;
+<a name="l00613"></a>00613 offs_est_y[ioff] -= offs_est_y[0] ;
+<a name="l00614"></a>00614 <span class="keywordflow">if</span> (fabs(offs_est_x[ioff]) > max_x) max_x = fabs(offs_est_x[ioff]);
+<a name="l00615"></a>00615 <span class="keywordflow">if</span> (fabs(offs_est_y[ioff]) > max_y) max_y = fabs(offs_est_y[ioff]);
+<a name="l00616"></a>00616 }
+<a name="l00617"></a>00617 offs_est_x[0] = offs_est_y[0] = 0.00 ;
+<a name="l00618"></a>00618
+<a name="l00619"></a>00619 <span class="comment">/* Check if the max offset is not too big */</span>
+<a name="l00620"></a>00620 <span class="keywordflow">if</span> (max_x > hawki_step_combine_config.offset_max ||
+<a name="l00621"></a>00621 max_y > hawki_step_combine_config.offset_max)
+<a name="l00622"></a>00622 {
+<a name="l00623"></a>00623 cpl_msg_error(__func__,<span class="stringliteral">"Sorry, no support for offsets larger than %d"</span>,
+<a name="l00624"></a>00624 hawki_step_combine_config.offset_max);
+<a name="l00625"></a>00625 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00626"></a>00626 {
+<a name="l00627"></a>00627 cpl_bivector_delete(offsets[idet]);
+<a name="l00628"></a>00628 <span class="keywordflow">if</span>(bpm_frame != NULL)
+<a name="l00629"></a>00629 cpl_mask_delete(bpm_masks[idet]);
+<a name="l00630"></a>00630 }
+<a name="l00631"></a>00631 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00632"></a>00632 {
+<a name="l00633"></a>00633 cpl_image_delete(combined_contrib[idet]);
+<a name="l00634"></a>00634 cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+<a name="l00635"></a>00635 }
+<a name="l00636"></a>00636 cpl_free(combined_contrib);
+<a name="l00637"></a>00637 <span class="keywordflow">return</span> NULL ;
+<a name="l00638"></a>00638 }
+<a name="l00639"></a>00639
+<a name="l00640"></a>00640 <span class="comment">/* Load the input data */</span>
+<a name="l00641"></a>00641 cpl_msg_info(__func__, <span class="stringliteral">"Load the input data"</span>) ;
+<a name="l00642"></a>00642 cpl_msg_indent_more();
+<a name="l00643"></a>00643 <span class="keywordflow">if</span> ((in = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(obj, idet+1, CPL_TYPE_FLOAT)) == NULL) {
+<a name="l00644"></a>00644 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load chip %d"</span>,idet+1);
+<a name="l00645"></a>00645 <span class="comment">//TODO: there is probably a memory leak here. It should be checked.</span>
+<a name="l00646"></a>00646 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00647"></a>00647 {
+<a name="l00648"></a>00648 cpl_bivector_delete(offsets[idet]);
+<a name="l00649"></a>00649 <span class="keywordflow">if</span>(bpm_frame != NULL)
+<a name="l00650"></a>00650 cpl_mask_delete(bpm_masks[idet]);
+<a name="l00651"></a>00651 }
+<a name="l00652"></a>00652 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00653"></a>00653 {
+<a name="l00654"></a>00654 cpl_image_delete(combined_contrib[idet]);
+<a name="l00655"></a>00655 cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+<a name="l00656"></a>00656 }
+<a name="l00657"></a>00657 cpl_free(combined_contrib);
+<a name="l00658"></a>00658 cpl_free(offsets);
+<a name="l00659"></a>00659 cpl_msg_indent_less() ;
+<a name="l00660"></a>00660 cpl_msg_indent_less() ;
+<a name="l00661"></a>00661 <span class="keywordflow">return</span> NULL ;
+<a name="l00662"></a>00662 }
+<a name="l00663"></a>00663
+<a name="l00664"></a>00664 <span class="comment">/* Load the bad bkg images */</span>
+<a name="l00665"></a>00665 <span class="keywordflow">if</span>(bkg_bpm_frames != NULL)
+<a name="l00666"></a>00666 {
+<a name="l00667"></a>00667 cpl_msg_info(__func__, <span class="stringliteral">"Load the bad bkg images"</span>);
+<a name="l00668"></a>00668 cpl_msg_indent_more() ;
+<a name="l00669"></a>00669 <span class="keywordflow">if</span> ((bpm_bkg_im = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(bkg_bpm_frames, idet+1,
+<a name="l00670"></a>00670 CPL_TYPE_FLOAT)) == NULL)
+<a name="l00671"></a>00671 {
+<a name="l00672"></a>00672 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load chip %d"</span>,idet+1);
+<a name="l00673"></a>00673 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00674"></a>00674 {
+<a name="l00675"></a>00675 cpl_bivector_delete(offsets[idet]);
+<a name="l00676"></a>00676 <span class="keywordflow">if</span>(bpm_frame != NULL)
+<a name="l00677"></a>00677 cpl_mask_delete(bpm_masks[idet]);
+<a name="l00678"></a>00678 }
+<a name="l00679"></a>00679 <span class="keywordflow">for</span>(jdet = 0; jdet < idet; ++jdet)
+<a name="l00680"></a>00680 {
+<a name="l00681"></a>00681 cpl_image_delete(combined_contrib[idet]);
+<a name="l00682"></a>00682 cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+<a name="l00683"></a>00683 }
+<a name="l00684"></a>00684 cpl_free(combined_contrib);
+<a name="l00685"></a>00685 cpl_imagelist_delete(in);
+<a name="l00686"></a>00686 cpl_free(offsets);
+<a name="l00687"></a>00687 cpl_msg_indent_less() ;
+<a name="l00688"></a>00688 cpl_msg_indent_less() ;
+<a name="l00689"></a>00689 <span class="keywordflow">return</span> NULL ;
+<a name="l00690"></a>00690 }
+<a name="l00691"></a>00691 cpl_msg_indent_less() ;
+<a name="l00692"></a>00692 }
+<a name="l00693"></a>00693 cpl_msg_indent_less() ;
+<a name="l00694"></a>00694
+<a name="l00695"></a>00695 <span class="comment">/* Add the general bpm or background bpms in case they were specified */</span>
+<a name="l00696"></a>00696 <span class="keywordflow">if</span>(bpm_frame != NULL || bkg_bpm_frames != NULL)
+<a name="l00697"></a>00697 {
+<a name="l00698"></a>00698 <span class="keywordflow">for</span>(iframe = 0 ; iframe <cpl_imagelist_get_size(in) ; ++iframe)
+<a name="l00699"></a>00699 {
+<a name="l00700"></a>00700 cpl_mask * final_mask;
+<a name="l00701"></a>00701 cpl_image * target_image = cpl_imagelist_get(in, iframe);
+<a name="l00702"></a>00702 final_mask = cpl_mask_new(cpl_image_get_size_x(target_image),
+<a name="l00703"></a>00703 cpl_image_get_size_y(target_image));
+<a name="l00704"></a>00704 <span class="comment">//Add the common bpm</span>
+<a name="l00705"></a>00705 <span class="keywordflow">if</span>(bpm_frame != NULL)
+<a name="l00706"></a>00706 cpl_mask_or(final_mask, bpm_masks[idet]);
+<a name="l00707"></a>00707 <span class="comment">//Add the background mask if provided</span>
+<a name="l00708"></a>00708 <span class="keywordflow">if</span>(bkg_bpm_frames != NULL)
+<a name="l00709"></a>00709 {
+<a name="l00710"></a>00710 cpl_mask * bpm_bkg_mask =
+<a name="l00711"></a>00711 cpl_mask_threshold_image_create
+<a name="l00712"></a>00712 (cpl_imagelist_get(bpm_bkg_im, iframe), 0.5, FLT_MAX);
+<a name="l00713"></a>00713 cpl_mask_or(final_mask, bpm_bkg_mask);
+<a name="l00714"></a>00714 cpl_mask_delete(bpm_bkg_mask);
+<a name="l00715"></a>00715 }
+<a name="l00716"></a>00716 cpl_image_reject_from_mask(target_image, final_mask);
+<a name="l00717"></a>00717 cpl_mask_delete(final_mask);
+<a name="l00718"></a>00718 }
+<a name="l00719"></a>00719 }
+<a name="l00720"></a>00720
+<a name="l00721"></a>00721 <span class="keywordflow">if</span>(bkg_bpm_frames != NULL)
+<a name="l00722"></a>00722 cpl_imagelist_delete(bpm_bkg_im);
+<a name="l00723"></a>00723
+<a name="l00724"></a>00724 <span class="comment">/* Apply the shift and add */</span>
+<a name="l00725"></a>00725 cpl_msg_info(__func__, <span class="stringliteral">"Shift and add"</span>) ;
+<a name="l00726"></a>00726 cpl_msg_indent_more() ;
+<a name="l00727"></a>00727 comb_contrib_chip = hawki_step_combine_chip(in, offsets[idet],
+<a name="l00728"></a>00728 &(hawki_step_combine_output.combined_pos_x[idet]),
+<a name="l00729"></a>00729 &(hawki_step_combine_output.combined_pos_y[idet])) ;
+<a name="l00730"></a>00730 <span class="keywordflow">if</span> (comb_contrib_chip == NULL)
+<a name="l00731"></a>00731 {
+<a name="l00732"></a>00732 cpl_msg_error(__func__, <span class="stringliteral">"Cannot apply the shift and add"</span>) ;
+<a name="l00733"></a>00733 cpl_imagelist_delete(in) ;
+<a name="l00734"></a>00734 <span class="keywordflow">for</span>(jdet = 0; jdet < HAWKI_NB_DETECTORS; ++jdet)
+<a name="l00735"></a>00735 cpl_bivector_delete(offsets[jdet]);
+<a name="l00736"></a>00736 {
+<a name="l00737"></a>00737 cpl_image_delete(combined_contrib[idet]);
+<a name="l00738"></a>00738 cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+<a name="l00739"></a>00739 }
+<a name="l00740"></a>00740 cpl_free(combined_contrib);
+<a name="l00741"></a>00741 cpl_free(offsets);
+<a name="l00742"></a>00742 cpl_msg_indent_less() ;
+<a name="l00743"></a>00743 cpl_msg_indent_less() ;
+<a name="l00744"></a>00744 <span class="keywordflow">return</span> NULL ;
+<a name="l00745"></a>00745 }
+<a name="l00746"></a>00746
+<a name="l00747"></a>00747 <span class="comment">/* The cumoffset have the opposite criteria as cpl */</span>
+<a name="l00748"></a>00748 hawki_step_combine_output.combined_cumoffset_x[idet] =
+<a name="l00749"></a>00749 hawki_step_combine_output.combined_pos_x[idet] - off_0_x;
+<a name="l00750"></a>00750 hawki_step_combine_output.combined_cumoffset_y[idet] =
+<a name="l00751"></a>00751 hawki_step_combine_output.combined_pos_y[idet] - off_0_y;
+<a name="l00752"></a>00752 cpl_imagelist_delete(in) ;
+<a name="l00753"></a>00753 cpl_msg_indent_less() ;
+<a name="l00754"></a>00754
+<a name="l00755"></a>00755 <span class="comment">/* Interpolate bad pixels */</span>
+<a name="l00756"></a>00756 hawki_step_combine_interpolate_badpix(comb_contrib_chip[0]);
+<a name="l00757"></a>00757
+<a name="l00758"></a>00758 <span class="comment">/* Put the results in the image list */</span>
+<a name="l00759"></a>00759 combined_contrib[idet] = comb_contrib_chip[0];
+<a name="l00760"></a>00760 combined_contrib[idet+HAWKI_NB_DETECTORS] = comb_contrib_chip[1];
+<a name="l00761"></a>00761 cpl_free(comb_contrib_chip);
+<a name="l00762"></a>00762 cpl_msg_indent_less() ;
+<a name="l00763"></a>00763 }
+<a name="l00764"></a>00764
+<a name="l00765"></a>00765 <span class="comment">/* Compute the mean airmass */</span>
+<a name="l00766"></a>00766 hawki_step_combine_output.mean_airmass = <a class="code" href="group__hawki__utils.html#ga7b165e9e91b6c6519595109b36d4fb46" title="Get the mean airmass for a set of frames.">hawki_get_mean_airmass</a>(obj);
+<a name="l00767"></a>00767
+<a name="l00768"></a>00768 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00769"></a>00769 {
+<a name="l00770"></a>00770 cpl_bivector_delete(offsets[idet]);
+<a name="l00771"></a>00771 <span class="keywordflow">if</span>(bpm_frame != NULL)
+<a name="l00772"></a>00772 cpl_mask_delete(bpm_masks[idet]);
+<a name="l00773"></a>00773 }
+<a name="l00774"></a>00774 cpl_free(offsets);
+<a name="l00775"></a>00775 <span class="keywordflow">return</span> combined_contrib;
+<a name="l00776"></a>00776 }
+<a name="l00777"></a>00777
+<a name="l00778"></a>00778 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00787"></a>00787 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00788"></a>00788 <span class="keyword">static</span> cpl_image ** hawki_step_combine_chip(
+<a name="l00789"></a>00789 cpl_imagelist * in,
+<a name="l00790"></a>00790 cpl_bivector * offsets,
+<a name="l00791"></a>00791 <span class="keywordtype">double</span> * pos_x,
+<a name="l00792"></a>00792 <span class="keywordtype">double</span> * pos_y)
+<a name="l00793"></a>00793 {
+<a name="l00794"></a>00794 cpl_image ** combined_contrib;
+<a name="l00795"></a>00795 cpl_imagelist * in_ext ;
+<a name="l00796"></a>00796 cpl_image * tmp1 ;
+<a name="l00797"></a>00797 cpl_image * tmp2 ;
+<a name="l00798"></a>00798 <span class="keywordtype">int</span> nfiles, nx, ny ;
+<a name="l00799"></a>00799 <span class="keywordtype">int</span> i;
+<a name="l00800"></a>00800
+<a name="l00801"></a>00801 <span class="comment">/* Check entries */</span>
+<a name="l00802"></a>00802 <span class="keywordflow">if</span> (pos_x == NULL || pos_y == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00803"></a>00803 <span class="keywordflow">if</span> (offsets == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00804"></a>00804
+<a name="l00805"></a>00805 <span class="comment">/* Get the number of images */</span>
+<a name="l00806"></a>00806 nfiles = cpl_imagelist_get_size(in) ;
+<a name="l00807"></a>00807 <span class="keywordflow">if</span> (cpl_bivector_get_size(offsets) != nfiles) {
+<a name="l00808"></a>00808 cpl_msg_error(__func__, <span class="stringliteral">"Number of refined offsets in table "</span><span class="stringliteral">""</span>
+<a name="l00809"></a>00809 <span class="stringliteral">"is different than number of frames to combine"</span>);
+<a name="l00810"></a>00810 <span class="keywordflow">return</span> NULL ;
+<a name="l00811"></a>00811 }
+<a name="l00812"></a>00812
+<a name="l00813"></a>00813 <span class="comment">/* Discard the pixels on the sides */</span>
+<a name="l00814"></a>00814 <span class="keywordflow">if</span> (hawki_step_combine_config.borders > 0) {
+<a name="l00815"></a>00815 nx = cpl_image_get_size_x(cpl_imagelist_get(in, 0)) ;
+<a name="l00816"></a>00816 ny = cpl_image_get_size_y(cpl_imagelist_get(in, 0)) ;
+<a name="l00817"></a>00817 in_ext = cpl_imagelist_new() ;
+<a name="l00818"></a>00818 <span class="keywordflow">for</span> (i=0 ; i<cpl_imagelist_get_size(in) ; i++) {
+<a name="l00819"></a>00819 tmp1 = cpl_imagelist_get(in, i) ;
+<a name="l00820"></a>00820 tmp2 = cpl_image_extract(tmp1,
+<a name="l00821"></a>00821 hawki_step_combine_config.borders+1,
+<a name="l00822"></a>00822 hawki_step_combine_config.borders+1,
+<a name="l00823"></a>00823 nx-hawki_step_combine_config.borders,
+<a name="l00824"></a>00824 ny-hawki_step_combine_config.borders) ;
+<a name="l00825"></a>00825 cpl_imagelist_set(in_ext, tmp2, i) ;
+<a name="l00826"></a>00826 }
+<a name="l00827"></a>00827 }
+<a name="l00828"></a>00828 <span class="keywordflow">else</span>
+<a name="l00829"></a>00829 {
+<a name="l00830"></a>00830 in_ext = cpl_imagelist_duplicate(in);
+<a name="l00831"></a>00831 }
+<a name="l00832"></a>00832
+<a name="l00833"></a>00833 <span class="comment">/* Apply the shift & add */</span>
+<a name="l00834"></a>00834 cpl_msg_info(__func__, <span class="stringliteral">"Recombine the images set"</span>) ;
+<a name="l00835"></a>00835 cpl_msg_indent_more() ;
+<a name="l00836"></a>00836 <span class="keywordflow">if</span> ((combined_contrib=cpl_geom_img_offset_saa(in_ext, offsets,
+<a name="l00837"></a>00837 hawki_step_combine_config.resamp_kernel,
+<a name="l00838"></a>00838 hawki_step_combine_config.rej_low,
+<a name="l00839"></a>00839 hawki_step_combine_config.rej_high,
+<a name="l00840"></a>00840 hawki_step_combine_config.comb_meth,
+<a name="l00841"></a>00841 pos_x, pos_y)) == NULL) {
+<a name="l00842"></a>00842 cpl_msg_error(cpl_func, <span class="stringliteral">"Cannot apply the shift and add"</span>) ;
+<a name="l00843"></a>00843 cpl_msg_indent_less();
+<a name="l00844"></a>00844 <span class="keywordflow">return</span> NULL;
+<a name="l00845"></a>00845 }
+<a name="l00846"></a>00846 cpl_msg_indent_less();
+<a name="l00847"></a>00847 *pos_x -= hawki_step_combine_config.borders;
+<a name="l00848"></a>00848 *pos_y -= hawki_step_combine_config.borders;
+<a name="l00849"></a>00849
+<a name="l00850"></a>00850 <span class="comment">/* Free and return */</span>
+<a name="l00851"></a>00851 cpl_imagelist_delete(in_ext);
+<a name="l00852"></a>00852 <span class="keywordflow">return</span> combined_contrib;
+<a name="l00853"></a>00853 }
+<a name="l00854"></a>00854
+<a name="l00855"></a>00855 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00861"></a>00861 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00862"></a>00862 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_interpolate_badpix
+<a name="l00863"></a>00863 (cpl_image * image)
+<a name="l00864"></a>00864 {
+<a name="l00865"></a>00865 <span class="keywordtype">int</span> nbadpixels = cpl_image_count_rejected(image);
+<a name="l00866"></a>00866 <span class="keywordflow">if</span>(nbadpixels !=0)
+<a name="l00867"></a>00867 cpl_msg_info(__func__,<span class="stringliteral">"Number of pixels with no combined value available: %d "</span>,
+<a name="l00868"></a>00868 nbadpixels);
+<a name="l00869"></a>00869 <span class="keywordflow">if</span>(cpl_image_count_rejected(image) > 0)
+<a name="l00870"></a>00870 {
+<a name="l00871"></a>00871 <span class="comment">//I use this even if DFS08929 is still not solved</span>
+<a name="l00872"></a>00872 cpl_detector_interpolate_rejected(image);
+<a name="l00873"></a>00873 }
+<a name="l00874"></a>00874 <span class="keywordflow">return</span> 0;
+<a name="l00875"></a>00875 }
+<a name="l00876"></a>00876
+<a name="l00877"></a>00877 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00886"></a>00886 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00887"></a>00887 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_combine_save
+<a name="l00888"></a>00888 (cpl_image ** combined,
+<a name="l00889"></a>00889 cpl_image ** contrib_map,
+<a name="l00890"></a>00890 cpl_frameset * used_frames,
+<a name="l00891"></a>00891 cpl_parameterlist * parlist,
+<a name="l00892"></a>00892 cpl_frameset * recipe_frameset)
+<a name="l00893"></a>00893 {
+<a name="l00894"></a>00894 cpl_propertylist ** extproplists ;
+<a name="l00895"></a>00895 <span class="keyword">const</span> cpl_frame * ref_frame ;
+<a name="l00896"></a>00896 cpl_propertylist * wcslist ;
+<a name="l00897"></a>00897 cpl_propertylist * inputlist ;
+<a name="l00898"></a>00898 <span class="keywordtype">double</span> crpix1, crpix2 ;
+<a name="l00899"></a>00899 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00900"></a>00900 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_combine"</span> ;
+<a name="l00901"></a>00901 <span class="keywordtype">int</span> idet;
+<a name="l00902"></a>00902 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00903"></a>00903
+<a name="l00904"></a>00904 <span class="comment">/* Get a reference frame for the WCS keys */</span>
+<a name="l00905"></a>00905 ref_frame = irplib_frameset_get_first_from_group
+<a name="l00906"></a>00906 (recipe_frameset, CPL_FRAME_GROUP_RAW) ;
+<a name="l00907"></a>00907
+<a name="l00908"></a>00908 <span class="keywordflow">if</span>(ref_frame == NULL)
+<a name="l00909"></a>00909 {
+<a name="l00910"></a>00910 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get a reference frame"</span>);
+<a name="l00911"></a>00911 <span class="keywordflow">return</span> -1;
+<a name="l00912"></a>00912 }
+<a name="l00913"></a>00913
+<a name="l00914"></a>00914 <span class="comment">/* Create the QC lists */</span>
+<a name="l00915"></a>00915 extproplists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l00916"></a>00916 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00917"></a>00917 {
+<a name="l00918"></a>00918
+<a name="l00919"></a>00919 <span class="comment">/* Initialize qclists */</span>
+<a name="l00920"></a>00920 extproplists[idet] = cpl_propertylist_new() ;
+<a name="l00921"></a>00921
+<a name="l00922"></a>00922 <span class="comment">/* Get the extension number */</span>
+<a name="l00923"></a>00923 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), idet+1);
+<a name="l00924"></a>00924
+<a name="l00925"></a>00925 <span class="comment">/* Handle WCS keys */</span>
+<a name="l00926"></a>00926 wcslist = cpl_propertylist_load_regexp(
+<a name="l00927"></a>00927 cpl_frame_get_filename(ref_frame), ext_nb, HAWKI_HEADER_WCS, 0);
+<a name="l00928"></a>00928
+<a name="l00929"></a>00929 <span class="comment">/* Update WCS and write them */</span>
+<a name="l00930"></a>00930 crpix1 = cpl_propertylist_get_double(wcslist, <span class="stringliteral">"CRPIX1"</span>);
+<a name="l00931"></a>00931 crpix1 += hawki_step_combine_output.combined_pos_x[idet];
+<a name="l00932"></a>00932 cpl_propertylist_update_double(wcslist, <span class="stringliteral">"CRPIX1"</span>, crpix1) ;
+<a name="l00933"></a>00933 crpix2 = cpl_propertylist_get_double(wcslist, <span class="stringliteral">"CRPIX2"</span>);
+<a name="l00934"></a>00934 crpix2 += hawki_step_combine_output.combined_pos_y[idet] ;
+<a name="l00935"></a>00935 cpl_propertylist_update_double(wcslist, <span class="stringliteral">"CRPIX2"</span>, crpix2) ;
+<a name="l00936"></a>00936 cpl_propertylist_copy_property_regexp
+<a name="l00937"></a>00937 (extproplists[idet], wcslist, HAWKI_HEADER_WCS, 0);
+<a name="l00938"></a>00938 cpl_propertylist_delete(wcslist) ;
+<a name="l00939"></a>00939
+<a name="l00940"></a>00940 <span class="comment">/* Keywords for the relative position of the combined image */</span>
+<a name="l00941"></a>00941 cpl_propertylist_append_double
+<a name="l00942"></a>00942 (extproplists[idet], <span class="stringliteral">"ESO QC COMBINED CUMOFFSETX"</span>,
+<a name="l00943"></a>00943 hawki_step_combine_output.combined_cumoffset_x[idet]);
+<a name="l00944"></a>00944 cpl_propertylist_append_double
+<a name="l00945"></a>00945 (extproplists[idet], <span class="stringliteral">"ESO QC COMBINED CUMOFFSETY"</span>,
+<a name="l00946"></a>00946 hawki_step_combine_output.combined_cumoffset_y[idet]);
+<a name="l00947"></a>00947 cpl_propertylist_append_double
+<a name="l00948"></a>00948 (extproplists[idet], <span class="stringliteral">"ESO QC COMBINED POSX"</span>,
+<a name="l00949"></a>00949 hawki_step_combine_output.combined_pos_x[idet]);
+<a name="l00950"></a>00950 cpl_propertylist_append_double
+<a name="l00951"></a>00951 (extproplists[idet], <span class="stringliteral">"ESO QC COMBINED POSY"</span>,
+<a name="l00952"></a>00952 hawki_step_combine_output.combined_pos_y[idet]);
+<a name="l00953"></a>00953 cpl_propertylist_append_double
+<a name="l00954"></a>00954 (extproplists[idet], <span class="stringliteral">"ESO QC AIRMASS MEAN"</span>,
+<a name="l00955"></a>00955 hawki_step_combine_output.mean_airmass);
+<a name="l00956"></a>00956
+<a name="l00957"></a>00957 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00958"></a>00958 inputlist = cpl_propertylist_load_regexp(
+<a name="l00959"></a>00959 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00960"></a>00960 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l00961"></a>00961 cpl_propertylist_append(extproplists[idet], inputlist);
+<a name="l00962"></a>00962 cpl_propertylist_delete(inputlist) ;
+<a name="l00963"></a>00963 }
+<a name="l00964"></a>00964
+<a name="l00965"></a>00965 <span class="comment">/* Write the combined image */</span>
+<a name="l00966"></a>00966 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>(recipe_frameset,
+<a name="l00967"></a>00967 parlist,
+<a name="l00968"></a>00968 used_frames,
+<a name="l00969"></a>00969 (<span class="keyword">const</span> cpl_image **)combined,
+<a name="l00970"></a>00970 recipe_name,
+<a name="l00971"></a>00971 HAWKI_CALPRO_COMBINED,
+<a name="l00972"></a>00972 HAWKI_PROTYPE_COMBINED,
+<a name="l00973"></a>00973 NULL,
+<a name="l00974"></a>00974 (<span class="keyword">const</span> cpl_propertylist**)extproplists,
+<a name="l00975"></a>00975 <span class="stringliteral">"hawki_step_combine.fits"</span>) != 0)
+<a name="l00976"></a>00976 {
+<a name="l00977"></a>00977 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l00978"></a>00978 cpl_propertylist_delete(extproplists[idet]) ;
+<a name="l00979"></a>00979 }
+<a name="l00980"></a>00980 cpl_free(extproplists) ;
+<a name="l00981"></a>00981 <span class="keywordflow">return</span> -1;
+<a name="l00982"></a>00982 }
+<a name="l00983"></a>00983
+<a name="l00984"></a>00984 <span class="comment">/* Write the contrib map */</span>
+<a name="l00985"></a>00985 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>(recipe_frameset,
+<a name="l00986"></a>00986 parlist,
+<a name="l00987"></a>00987 used_frames,
+<a name="l00988"></a>00988 (<span class="keyword">const</span> cpl_image **)contrib_map,
+<a name="l00989"></a>00989 recipe_name,
+<a name="l00990"></a>00990 HAWKI_CALPRO_COMB_CONTRIB_MAP,
+<a name="l00991"></a>00991 HAWKI_PROTYPE_COMB_CONTRIB_MAP,
+<a name="l00992"></a>00992 NULL,
+<a name="l00993"></a>00993 (<span class="keyword">const</span> cpl_propertylist**)extproplists,
+<a name="l00994"></a>00994 <span class="stringliteral">"hawki_step_combine_contrib_map.fits"</span>) != 0)
+<a name="l00995"></a>00995 {
+<a name="l00996"></a>00996 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l00997"></a>00997 cpl_propertylist_delete(extproplists[idet]);
+<a name="l00998"></a>00998 }
+<a name="l00999"></a>00999 cpl_free(extproplists) ;
+<a name="l01000"></a>01000 <span class="keywordflow">return</span> -1;
+<a name="l01001"></a>01001 }
+<a name="l01002"></a>01002
+<a name="l01003"></a>01003 <span class="comment">/* Free and return */</span>
+<a name="l01004"></a>01004 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l01005"></a>01005 cpl_propertylist_delete(extproplists[idet]) ;
+<a name="l01006"></a>01006 }
+<a name="l01007"></a>01007 cpl_free(extproplists) ;
+<a name="l01008"></a>01008
+<a name="l01009"></a>01009 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l01010"></a>01010 {
+<a name="l01011"></a>01011 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l01012"></a>01012 <span class="keywordflow">return</span> 1;
+<a name="l01013"></a>01013 }
+<a name="l01014"></a>01014
+<a name="l01015"></a>01015 <span class="keywordflow">return</span> 0;
+<a name="l01016"></a>01016 }
+<a name="l01017"></a>01017
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__compute__bkg_8c_source.html b/html/hawki__step__compute__bkg_8c_source.html
new file mode 100644
index 0000000..15c3c91
--- /dev/null
+++ b/html/hawki__step__compute__bkg_8c_source.html
@@ -0,0 +1,1215 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_compute_bkg.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_compute_bkg.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_compute_bkg.c,v 1.17 2011/10/24 10:42:43 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2008 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:42:43 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.17 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_bkg.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00048"></a>00048
+<a name="l00049"></a>00049 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00050"></a>00050 <span class="comment"> Structs</span>
+<a name="l00051"></a>00051 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00054"></a>00054 {
+<a name="l00055"></a>00055 <span class="comment">/* Configuration values */</span>
+<a name="l00056"></a>00056 <span class="keywordtype">int</span> nmin_comb;
+<a name="l00057"></a>00057 <span class="keywordtype">int</span> nhalf_window;
+<a name="l00058"></a>00058 <span class="keywordtype">int</span> rejlow;
+<a name="l00059"></a>00059 <span class="keywordtype">int</span> rejhigh;
+<a name="l00060"></a>00060
+<a name="l00061"></a>00061 } hawki_step_compute_bkg_config;
+<a name="l00062"></a>00062
+<a name="l00063"></a>00063 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00064"></a>00064 <span class="comment"> Functions prototypes</span>
+<a name="l00065"></a>00065 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00066"></a>00066
+<a name="l00067"></a>00067 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_create(cpl_plugin *) ;
+<a name="l00068"></a>00068 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_exec(cpl_plugin *) ;
+<a name="l00069"></a>00069 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_destroy(cpl_plugin *) ;
+<a name="l00070"></a>00070 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00071"></a>00071
+<a name="l00072"></a>00072 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_objects_qc_save
+<a name="l00073"></a>00073 (cpl_frameset * objframes,
+<a name="l00074"></a>00074 cpl_frameset * maskframes,
+<a name="l00075"></a>00075 cpl_frameset * offsetsframes,
+<a name="l00076"></a>00076 cpl_frameset * x_distortionframes,
+<a name="l00077"></a>00077 cpl_frameset * y_distortionframes,
+<a name="l00078"></a>00078 cpl_parameterlist * parlist,
+<a name="l00079"></a>00079 cpl_frameset * recipe_framelist);
+<a name="l00080"></a>00080 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_objects_median_save
+<a name="l00081"></a>00081 (cpl_frameset * objframes,
+<a name="l00082"></a>00082 cpl_parameterlist * recipe_parlist,
+<a name="l00083"></a>00083 cpl_frameset * recipe_framelist);
+<a name="l00084"></a>00084 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_sky_median_save
+<a name="l00085"></a>00085 (cpl_frameset * skyframes,
+<a name="l00086"></a>00086 cpl_parameterlist * recipe_parlist,
+<a name="l00087"></a>00087 cpl_frameset * recipe_framelist);
+<a name="l00088"></a>00088 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_interpolate_badpix
+<a name="l00089"></a>00089 (cpl_image * image);
+<a name="l00090"></a>00090 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_objects_running_median_save
+<a name="l00091"></a>00091 (cpl_frameset * objframes,
+<a name="l00092"></a>00092 cpl_frameset * maskframes,
+<a name="l00093"></a>00093 cpl_frameset * offsetframes,
+<a name="l00094"></a>00094 cpl_frameset * x_distortionframes,
+<a name="l00095"></a>00095 cpl_frameset * y_distortionframes,
+<a name="l00096"></a>00096 cpl_parameterlist * recipe_parlist,
+<a name="l00097"></a>00097 cpl_frameset * recipe_framelist);
+<a name="l00098"></a>00098 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_running_median_nonmasked_save
+<a name="l00099"></a>00099 (<span class="keyword">const</span> cpl_frameset * objframes,
+<a name="l00100"></a>00100 <span class="keywordtype">int</span> nhalf_window,
+<a name="l00101"></a>00101 <span class="keywordtype">int</span> rejlow,
+<a name="l00102"></a>00102 <span class="keywordtype">int</span> rejhigh,
+<a name="l00103"></a>00103 cpl_frameset * recipe_framelist,
+<a name="l00104"></a>00104 cpl_parameterlist * recipe_parlist);
+<a name="l00105"></a>00105 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_running_median_masked_save
+<a name="l00106"></a>00106 (<span class="keyword">const</span> cpl_frameset * objframes,
+<a name="l00107"></a>00107 cpl_frame * maskframe,
+<a name="l00108"></a>00108 cpl_bivector ** offsets,
+<a name="l00109"></a>00109 cpl_frame * x_distortionframe,
+<a name="l00110"></a>00110 cpl_frame * y_distortionframe,
+<a name="l00111"></a>00111 <span class="keywordtype">int</span> nhalf_window,
+<a name="l00112"></a>00112 <span class="keywordtype">int</span> rejlow,
+<a name="l00113"></a>00113 <span class="keywordtype">int</span> rejhigh,
+<a name="l00114"></a>00114 cpl_frameset * recipe_framelist,
+<a name="l00115"></a>00115 cpl_parameterlist * recipe_parlist);
+<a name="l00116"></a>00116
+<a name="l00117"></a>00117
+<a name="l00118"></a>00118 <span class="keywordtype">int</span> hawki_step_compute_bkg_retrieve_input_param
+<a name="l00119"></a>00119 (cpl_parameterlist * parlist);
+<a name="l00120"></a>00120
+<a name="l00121"></a>00121 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00122"></a>00122 <span class="comment"> Static variables</span>
+<a name="l00123"></a>00123 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00124"></a>00124
+<a name="l00125"></a>00125 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_compute_bkg_description[] =
+<a name="l00126"></a>00126 <span class="stringliteral">"hawki_step_compute_bkg -- hawki background computation utility.\n"</span>
+<a name="l00127"></a>00127 <span class="stringliteral">"This recipe will create the associated background images\n"</span>
+<a name="l00128"></a>00128 <span class="stringliteral">"for a given set of object images. If there are sky images, these will\n"</span>
+<a name="l00129"></a>00129 <span class="stringliteral">"be used to compute the background, otherwise, the background is computed\n"</span>
+<a name="l00130"></a>00130 <span class="stringliteral">"using a running mean on the object images. An optional mask can be supplied\n"</span>
+<a name="l00131"></a>00131 <span class="stringliteral">"for the running mean.\n"</span>
+<a name="l00132"></a>00132 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00133"></a>00133 <span class="stringliteral">"obj_basic_cal-file.fits "</span>HAWKI_CALPRO_BASICCALIBRATED<span class="stringliteral">" or\n"</span>
+<a name="l00134"></a>00134 <span class="stringliteral">"sky_basic_cal-file.fits "</span>HAWKI_CALPRO_SKY_BASICCALIBRATED<span class="stringliteral">" \n"</span>
+<a name="l00135"></a>00135 <span class="stringliteral">"and optionally for object masking:\n"</span>
+<a name="l00136"></a>00136 <span class="stringliteral">"object_mask-file.fits "</span>HAWKI_CALPRO_OBJ_MASK<span class="stringliteral">" \n"</span>
+<a name="l00137"></a>00137 <span class="stringliteral">"offsets.fits "</span>HAWKI_CALPRO_OFFSETS<span class="stringliteral">" \n"</span>
+<a name="l00138"></a>00138 <span class="stringliteral">"distortion_x.fits "</span>HAWKI_CALPRO_DISTORTION_X<span class="stringliteral">" \n"</span>
+<a name="l00139"></a>00139 <span class="stringliteral">"distortion_y.fits "</span>HAWKI_CALPRO_DISTORTION_Y<span class="stringliteral">" \n"</span>;
+<a name="l00140"></a>00140
+<a name="l00141"></a>00141 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00142"></a>00142 <span class="comment"> Functions code</span>
+<a name="l00143"></a>00143 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00144"></a>00144
+<a name="l00145"></a>00145 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00153"></a>00153 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00154"></a>00154 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00155"></a>00155 {
+<a name="l00156"></a>00156 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00157"></a>00157 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 cpl_plugin_init(plugin,
+<a name="l00160"></a>00160 CPL_PLUGIN_API,
+<a name="l00161"></a>00161 HAWKI_BINARY_VERSION,
+<a name="l00162"></a>00162 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00163"></a>00163 <span class="stringliteral">"hawki_step_compute_bkg"</span>,
+<a name="l00164"></a>00164 <span class="stringliteral">"Background computing utility"</span>,
+<a name="l00165"></a>00165 hawki_step_compute_bkg_description,
+<a name="l00166"></a>00166 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00167"></a>00167 PACKAGE_BUGREPORT,
+<a name="l00168"></a>00168 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00169"></a>00169 hawki_step_compute_bkg_create,
+<a name="l00170"></a>00170 hawki_step_compute_bkg_exec,
+<a name="l00171"></a>00171 hawki_step_compute_bkg_destroy);
+<a name="l00172"></a>00172
+<a name="l00173"></a>00173 cpl_pluginlist_append(list, plugin);
+<a name="l00174"></a>00174
+<a name="l00175"></a>00175 <span class="keywordflow">return</span> 0;
+<a name="l00176"></a>00176 }
+<a name="l00177"></a>00177
+<a name="l00178"></a>00178 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00187"></a>00187 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00188"></a>00188 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_create(cpl_plugin * plugin)
+<a name="l00189"></a>00189 {
+<a name="l00190"></a>00190 cpl_recipe * recipe;
+<a name="l00191"></a>00191 cpl_parameter * p;
+<a name="l00192"></a>00192
+<a name="l00193"></a>00193 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00194"></a>00194 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00195"></a>00195 recipe = (cpl_recipe *)plugin ;
+<a name="l00196"></a>00196 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00199"></a>00199 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00200"></a>00200 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00201"></a>00201 <span class="keywordflow">return</span> 1;
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00204"></a>00204 <span class="comment">/* --nmin_comb */</span>
+<a name="l00205"></a>00205 p = cpl_parameter_new_value
+<a name="l00206"></a>00206 (<span class="stringliteral">"hawki.hawki_step_compute_bkg.nmin_comb"</span>,
+<a name="l00207"></a>00207 CPL_TYPE_INT,
+<a name="l00208"></a>00208 <span class="stringliteral">"Minimum number of jitter frames to use the running median"</span>,
+<a name="l00209"></a>00209 <span class="stringliteral">"hawki.hawki_step_compute_bkg"</span>,
+<a name="l00210"></a>00210 10) ;
+<a name="l00211"></a>00211 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"nmin_comb"</span>) ;
+<a name="l00212"></a>00212 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00213"></a>00213 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00214"></a>00214
+<a name="l00215"></a>00215 <span class="comment">/* --nhalf_window */</span>
+<a name="l00216"></a>00216 p = cpl_parameter_new_value
+<a name="l00217"></a>00217 (<span class="stringliteral">"hawki.hawki_step_compute_bkg.nhalf_window"</span>,
+<a name="l00218"></a>00218 CPL_TYPE_INT,
+<a name="l00219"></a>00219 <span class="stringliteral">"Number of images at both sides of the current ima to use for bkg in running median"</span>,
+<a name="l00220"></a>00220 <span class="stringliteral">"hawki.hawki_step_compute_bkg"</span>,
+<a name="l00221"></a>00221 7);
+<a name="l00222"></a>00222 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"nhalf_window"</span>) ;
+<a name="l00223"></a>00223 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00224"></a>00224 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00225"></a>00225
+<a name="l00226"></a>00226 <span class="comment">/* --rejlow */</span>
+<a name="l00227"></a>00227 p = cpl_parameter_new_value
+<a name="l00228"></a>00228 (<span class="stringliteral">"hawki.hawki_step_compute_bkg.rejlow"</span>,
+<a name="l00229"></a>00229 CPL_TYPE_INT,
+<a name="l00230"></a>00230 <span class="stringliteral">"The number of frames with low level to reject"</span>,
+<a name="l00231"></a>00231 <span class="stringliteral">"hawki.hawki_step_compute_bkg"</span>,
+<a name="l00232"></a>00232 2) ;
+<a name="l00233"></a>00233 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"rejlow"</span>) ;
+<a name="l00234"></a>00234 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00235"></a>00235 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00236"></a>00236
+<a name="l00237"></a>00237 <span class="comment">/* --rejhigh */</span>
+<a name="l00238"></a>00238 p = cpl_parameter_new_value
+<a name="l00239"></a>00239 (<span class="stringliteral">"hawki.hawki_step_compute_bkg.rejhigh"</span>,
+<a name="l00240"></a>00240 CPL_TYPE_INT,
+<a name="l00241"></a>00241 <span class="stringliteral">"The number of frames with high level to reject"</span>,
+<a name="l00242"></a>00242 <span class="stringliteral">"hawki.hawki_step_compute_bkg"</span>,
+<a name="l00243"></a>00243 2) ;
+<a name="l00244"></a>00244 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"rejhigh"</span>) ;
+<a name="l00245"></a>00245 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00246"></a>00246 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00247"></a>00247
+<a name="l00248"></a>00248 <span class="comment">/* Return */</span>
+<a name="l00249"></a>00249 <span class="keywordflow">return</span> 0;
+<a name="l00250"></a>00250 }
+<a name="l00251"></a>00251
+<a name="l00252"></a>00252 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00258"></a>00258 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00259"></a>00259 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_exec(cpl_plugin * plugin)
+<a name="l00260"></a>00260 {
+<a name="l00261"></a>00261 cpl_recipe * recipe ;
+<a name="l00262"></a>00262
+<a name="l00263"></a>00263 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00264"></a>00264 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00265"></a>00265 recipe = (cpl_recipe *)plugin ;
+<a name="l00266"></a>00266 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00267"></a>00267
+<a name="l00268"></a>00268 <span class="comment">/* Issue a banner */</span>
+<a name="l00269"></a>00269 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00270"></a>00270
+<a name="l00271"></a>00271 <span class="keywordflow">return</span> hawki_step_compute_bkg(recipe->parameters, recipe->frames) ;
+<a name="l00272"></a>00272 }
+<a name="l00273"></a>00273
+<a name="l00274"></a>00274 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00280"></a>00280 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00281"></a>00281 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_destroy(cpl_plugin * plugin)
+<a name="l00282"></a>00282 {
+<a name="l00283"></a>00283 cpl_recipe * recipe ;
+<a name="l00284"></a>00284
+<a name="l00285"></a>00285 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00286"></a>00286 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00287"></a>00287 recipe = (cpl_recipe *)plugin ;
+<a name="l00288"></a>00288 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00289"></a>00289
+<a name="l00290"></a>00290 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00291"></a>00291 <span class="keywordflow">return</span> 0 ;
+<a name="l00292"></a>00292 }
+<a name="l00293"></a>00293
+<a name="l00294"></a>00294 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00301"></a>00301 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00302"></a>00302 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg(
+<a name="l00303"></a>00303 cpl_parameterlist * parlist,
+<a name="l00304"></a>00304 cpl_frameset * framelist)
+<a name="l00305"></a>00305 {
+<a name="l00306"></a>00306 cpl_frameset * objframes = NULL;
+<a name="l00307"></a>00307 cpl_frameset * skyframes;
+<a name="l00308"></a>00308 cpl_frameset * maskframes;
+<a name="l00309"></a>00309 cpl_frameset * x_distortionframes;
+<a name="l00310"></a>00310 cpl_frameset * y_distortionframes;
+<a name="l00311"></a>00311 cpl_frameset * offsetsframes = NULL;
+<a name="l00312"></a>00312
+<a name="l00313"></a>00313 <span class="comment">/* Get the recipe parameters */</span>
+<a name="l00314"></a>00314 hawki_step_compute_bkg_retrieve_input_param(parlist);
+<a name="l00315"></a>00315
+<a name="l00316"></a>00316 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00317"></a>00317 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist))
+<a name="l00318"></a>00318 {
+<a name="l00319"></a>00319 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00320"></a>00320 <span class="keywordflow">return</span> -1 ;
+<a name="l00321"></a>00321 }
+<a name="l00322"></a>00322
+<a name="l00323"></a>00323 <span class="comment">/* Identifying objects and sky data frames */</span>
+<a name="l00324"></a>00324 cpl_msg_info(__func__, <span class="stringliteral">"Identifying objects and sky data"</span>);
+<a name="l00325"></a>00325 objframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00326"></a>00326 (framelist, HAWKI_CALPRO_BASICCALIBRATED);
+<a name="l00327"></a>00327 skyframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00328"></a>00328 (framelist, HAWKI_CALPRO_SKY_BASICCALIBRATED);
+<a name="l00329"></a>00329 <span class="keywordflow">if</span> (objframes == NULL && skyframes == NULL)
+<a name="l00330"></a>00330 {
+<a name="l00331"></a>00331 cpl_msg_error(__func__, <span class="stringliteral">"No object (%s) or sky (%s) frames provided"</span>,
+<a name="l00332"></a>00332 HAWKI_CALPRO_BASICCALIBRATED, HAWKI_CALPRO_SKY_BASICCALIBRATED);
+<a name="l00333"></a>00333 <span class="keywordflow">return</span> -1 ;
+<a name="l00334"></a>00334 }
+<a name="l00335"></a>00335
+<a name="l00336"></a>00336 <span class="comment">/* Retrieve the mask */</span>
+<a name="l00337"></a>00337 maskframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00338"></a>00338 (framelist, HAWKI_CALPRO_OBJ_MASK);
+<a name="l00339"></a>00339 <span class="keywordflow">if</span>(maskframes != NULL)
+<a name="l00340"></a>00340 {
+<a name="l00341"></a>00341 offsetsframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00342"></a>00342 (framelist, HAWKI_CALPRO_OFFSETS);
+<a name="l00343"></a>00343 x_distortionframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00344"></a>00344 (framelist, HAWKI_CALPRO_DISTORTION_X);
+<a name="l00345"></a>00345 y_distortionframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00346"></a>00346 (framelist, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00347"></a>00347 <span class="keywordflow">if</span>((x_distortionframes == NULL && y_distortionframes != NULL) ||
+<a name="l00348"></a>00348 (x_distortionframes != NULL && y_distortionframes == NULL))
+<a name="l00349"></a>00349 {
+<a name="l00350"></a>00350 cpl_msg_error(__func__, <span class="stringliteral">"One X-distortion frame (%s) and one Y-distortion (%s)"</span>
+<a name="l00351"></a>00351 <span class="stringliteral">"must be provided"</span>, HAWKI_CALPRO_DISTORTION_X, HAWKI_CALPRO_DISTORTION_Y);
+<a name="l00352"></a>00352 cpl_frameset_delete(skyframes);
+<a name="l00353"></a>00353 cpl_frameset_delete(maskframes);
+<a name="l00354"></a>00354 cpl_frameset_delete(x_distortionframes);
+<a name="l00355"></a>00355 cpl_frameset_delete(y_distortionframes);
+<a name="l00356"></a>00356 <span class="keywordflow">return</span> -1 ;
+<a name="l00357"></a>00357 }
+<a name="l00358"></a>00358 }
+<a name="l00359"></a>00359
+<a name="l00360"></a>00360 <span class="comment">/* Compute the background */</span>
+<a name="l00361"></a>00361 <span class="keywordflow">if</span>(skyframes == NULL)
+<a name="l00362"></a>00362 hawki_step_compute_bkg_from_objects_qc_save
+<a name="l00363"></a>00363 (objframes,
+<a name="l00364"></a>00364 maskframes, offsetsframes, x_distortionframes, y_distortionframes,
+<a name="l00365"></a>00365 parlist, framelist);
+<a name="l00366"></a>00366 <span class="keywordflow">else</span>
+<a name="l00367"></a>00367 hawki_step_compute_bkg_from_sky_median_save
+<a name="l00368"></a>00368 (skyframes,
+<a name="l00369"></a>00369 parlist, framelist);
+<a name="l00370"></a>00370
+<a name="l00371"></a>00371 <span class="comment">/* Free resources */</span>
+<a name="l00372"></a>00372 <span class="keywordflow">if</span>(skyframes != NULL)
+<a name="l00373"></a>00373 cpl_frameset_delete(skyframes);
+<a name="l00374"></a>00374 <span class="keywordflow">if</span>(objframes != NULL)
+<a name="l00375"></a>00375 cpl_frameset_delete(objframes);
+<a name="l00376"></a>00376 <span class="keywordflow">if</span>(maskframes != NULL)
+<a name="l00377"></a>00377 {
+<a name="l00378"></a>00378 cpl_frameset_delete(maskframes);
+<a name="l00379"></a>00379 <span class="keywordflow">if</span>(x_distortionframes != NULL)
+<a name="l00380"></a>00380 cpl_frameset_delete(x_distortionframes);
+<a name="l00381"></a>00381 <span class="keywordflow">if</span>(y_distortionframes != NULL)
+<a name="l00382"></a>00382 cpl_frameset_delete(y_distortionframes);
+<a name="l00383"></a>00383 <span class="keywordflow">if</span>(offsetsframes != NULL)
+<a name="l00384"></a>00384 cpl_frameset_delete(offsetsframes);
+<a name="l00385"></a>00385 }
+<a name="l00386"></a>00386
+<a name="l00387"></a>00387 <span class="comment">/* return */</span>
+<a name="l00388"></a>00388 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l00389"></a>00389 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00390"></a>00390 }
+<a name="l00391"></a>00391
+<a name="l00392"></a>00392 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00402"></a>00402 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00403"></a>00403 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_objects_qc_save
+<a name="l00404"></a>00404 (cpl_frameset * objframes,
+<a name="l00405"></a>00405 cpl_frameset * maskframes,
+<a name="l00406"></a>00406 cpl_frameset * offsetsframes,
+<a name="l00407"></a>00407 cpl_frameset * x_distortionframes,
+<a name="l00408"></a>00408 cpl_frameset * y_distortionframes,
+<a name="l00409"></a>00409 cpl_parameterlist * parlist,
+<a name="l00410"></a>00410 cpl_frameset * recipe_framelist)
+<a name="l00411"></a>00411 {
+<a name="l00412"></a>00412 <span class="keywordtype">int</span> nobjs;
+<a name="l00413"></a>00413
+<a name="l00414"></a>00414 <span class="comment">/* Select the algorithm based on the number of frames */</span>
+<a name="l00415"></a>00415 nobjs = cpl_frameset_get_size(objframes);
+<a name="l00416"></a>00416 cpl_msg_info(__func__,<span class="stringliteral">"Number of object frames: %d"</span>,nobjs);
+<a name="l00417"></a>00417 <span class="keywordflow">if</span> (hawki_step_compute_bkg_config.nmin_comb > nobjs)
+<a name="l00418"></a>00418 {
+<a name="l00419"></a>00419 <span class="comment">/* TODO: Support for masks in this case?? */</span>
+<a name="l00420"></a>00420 cpl_msg_info(__func__,
+<a name="l00421"></a>00421 <span class="stringliteral">"Number of obj frames min required for running median"</span>);
+<a name="l00422"></a>00422 cpl_msg_info(__func__, <span class="stringliteral">"Using simple median of object images"</span>);
+<a name="l00423"></a>00423 hawki_step_compute_bkg_from_objects_median_save
+<a name="l00424"></a>00424 (objframes, parlist, recipe_framelist);
+<a name="l00425"></a>00425 }
+<a name="l00426"></a>00426 <span class="keywordflow">else</span>
+<a name="l00427"></a>00427 {
+<a name="l00428"></a>00428 cpl_msg_info(__func__, <span class="stringliteral">"Using running median of object images"</span>);
+<a name="l00429"></a>00429 hawki_step_compute_bkg_from_objects_running_median_save
+<a name="l00430"></a>00430 (objframes, maskframes, offsetsframes,
+<a name="l00431"></a>00431 x_distortionframes, y_distortionframes,
+<a name="l00432"></a>00432 parlist, recipe_framelist);
+<a name="l00433"></a>00433 }
+<a name="l00434"></a>00434 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00435"></a>00435 {
+<a name="l00436"></a>00436 cpl_msg_error(__func__,
+<a name="l00437"></a>00437 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00438"></a>00438 <span class="keywordflow">return</span> -1 ;
+<a name="l00439"></a>00439 }
+<a name="l00440"></a>00440 <span class="keywordflow">return</span> 0;
+<a name="l00441"></a>00441 }
+<a name="l00442"></a>00442
+<a name="l00443"></a>00443 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00453"></a>00453 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00454"></a>00454 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_objects_median_save
+<a name="l00455"></a>00455 (cpl_frameset * objframes,
+<a name="l00456"></a>00456 cpl_parameterlist * recipe_parlist,
+<a name="l00457"></a>00457 cpl_frameset * recipe_framelist)
+<a name="l00458"></a>00458 {
+<a name="l00459"></a>00459 cpl_imagelist * bkg;
+<a name="l00460"></a>00460 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_compute_bkg"</span>;
+<a name="l00461"></a>00461
+<a name="l00462"></a>00462
+<a name="l00463"></a>00463 <span class="comment">/* Logging */</span>
+<a name="l00464"></a>00464 cpl_msg_info(__func__,<span class="stringliteral">"Computing background from median of object images"</span>);
+<a name="l00465"></a>00465
+<a name="l00466"></a>00466 <span class="comment">/* Allocating for the background image */</span>
+<a name="l00467"></a>00467 bkg = cpl_imagelist_new();
+<a name="l00468"></a>00468
+<a name="l00469"></a>00469 <span class="comment">/* Computing the background */</span>
+<a name="l00470"></a>00470 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#ga364c91d30c968e6a15e403c11a5d281e" title="Computes the median of the object frames.">hawki_bkg_from_objects_median</a>(objframes, bkg) != 0)
+<a name="l00471"></a>00471 {
+<a name="l00472"></a>00472 cpl_msg_error(__func__,<span class="stringliteral">"Could not compute the median of objects"</span>);
+<a name="l00473"></a>00473 cpl_imagelist_delete(bkg);
+<a name="l00474"></a>00474 <span class="keywordflow">return</span> -1;
+<a name="l00475"></a>00475 }
+<a name="l00476"></a>00476
+<a name="l00477"></a>00477 <span class="comment">/* Save the products */</span>
+<a name="l00478"></a>00478 cpl_msg_info(__func__, <span class="stringliteral">"Saving the products"</span>) ;
+<a name="l00479"></a>00479 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(recipe_framelist,
+<a name="l00480"></a>00480 recipe_parlist,
+<a name="l00481"></a>00481 objframes,
+<a name="l00482"></a>00482 (<span class="keyword">const</span> cpl_imagelist *)bkg,
+<a name="l00483"></a>00483 recipe_name,
+<a name="l00484"></a>00484 HAWKI_CALPRO_BKGIMAGE,
+<a name="l00485"></a>00485 HAWKI_PROTYPE_BKGIMAGE,
+<a name="l00486"></a>00486 NULL,
+<a name="l00487"></a>00487 NULL,
+<a name="l00488"></a>00488 <span class="stringliteral">"hawki_step_compute_bkg_01.fits"</span>) != CPL_ERROR_NONE)
+<a name="l00489"></a>00489 {
+<a name="l00490"></a>00490 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00491"></a>00491 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00492"></a>00492 }
+<a name="l00493"></a>00493
+<a name="l00494"></a>00494 <span class="comment">/* Free and return */</span>
+<a name="l00495"></a>00495 cpl_imagelist_delete(bkg);
+<a name="l00496"></a>00496 <span class="keywordflow">return</span> 0;
+<a name="l00497"></a>00497 }
+<a name="l00498"></a>00498
+<a name="l00499"></a>00499 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00509"></a>00509 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00510"></a>00510 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_sky_median_save
+<a name="l00511"></a>00511 (cpl_frameset * skyframes,
+<a name="l00512"></a>00512 cpl_parameterlist * recipe_parlist,
+<a name="l00513"></a>00513 cpl_frameset * recipe_framelist)
+<a name="l00514"></a>00514 {
+<a name="l00515"></a>00515 cpl_imagelist * bkg;
+<a name="l00516"></a>00516 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_compute_bkg"</span>;
+<a name="l00517"></a>00517
+<a name="l00518"></a>00518 <span class="comment">/* Logging */</span>
+<a name="l00519"></a>00519 cpl_msg_info(__func__,<span class="stringliteral">"Computing background from sky images"</span>);
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="comment">/* Allocating for the background image */</span>
+<a name="l00522"></a>00522 bkg = cpl_imagelist_new();
+<a name="l00523"></a>00523
+<a name="l00524"></a>00524 <span class="comment">/* Computing the background */</span>
+<a name="l00525"></a>00525 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#ga01f0d4c0177325b9a5d33f83be498097" title="Computes the median of the sky frames.">hawki_bkg_from_sky_median</a>(skyframes, bkg)!= 0)
+<a name="l00526"></a>00526 {
+<a name="l00527"></a>00527 cpl_msg_error(__func__,<span class="stringliteral">"Could not compute the median of sky images"</span>);
+<a name="l00528"></a>00528 cpl_imagelist_delete(bkg);
+<a name="l00529"></a>00529 <span class="keywordflow">return</span> -1;
+<a name="l00530"></a>00530 }
+<a name="l00531"></a>00531
+<a name="l00532"></a>00532 <span class="comment">/* Save the products */</span>
+<a name="l00533"></a>00533 cpl_msg_info(__func__, <span class="stringliteral">"Saving the products"</span>) ;
+<a name="l00534"></a>00534 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(recipe_framelist,
+<a name="l00535"></a>00535 recipe_parlist,
+<a name="l00536"></a>00536 skyframes,
+<a name="l00537"></a>00537 (<span class="keyword">const</span> cpl_imagelist *)bkg,
+<a name="l00538"></a>00538 recipe_name,
+<a name="l00539"></a>00539 HAWKI_CALPRO_BKGIMAGE,
+<a name="l00540"></a>00540 HAWKI_PROTYPE_BKGIMAGE,
+<a name="l00541"></a>00541 NULL,
+<a name="l00542"></a>00542 NULL,
+<a name="l00543"></a>00543 <span class="stringliteral">"hawki_step_compute_bkg_01.fits"</span>) != CPL_ERROR_NONE)
+<a name="l00544"></a>00544 {
+<a name="l00545"></a>00545 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00546"></a>00546 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00547"></a>00547 }
+<a name="l00548"></a>00548
+<a name="l00549"></a>00549 <span class="comment">/* Free and return */</span>
+<a name="l00550"></a>00550 cpl_imagelist_delete(bkg);
+<a name="l00551"></a>00551 <span class="keywordflow">return</span> 0;
+<a name="l00552"></a>00552 }
+<a name="l00553"></a>00553
+<a name="l00554"></a>00554 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_from_objects_running_median_save
+<a name="l00555"></a>00555 (cpl_frameset * objframes,
+<a name="l00556"></a>00556 cpl_frameset * maskframes,
+<a name="l00557"></a>00557 cpl_frameset * offsetframes,
+<a name="l00558"></a>00558 cpl_frameset * x_distortionframes,
+<a name="l00559"></a>00559 cpl_frameset * y_distortionframes,
+<a name="l00560"></a>00560 cpl_parameterlist * recipe_parlist,
+<a name="l00561"></a>00561 cpl_frameset * recipe_framelist)
+<a name="l00562"></a>00562 {
+<a name="l00563"></a>00563
+<a name="l00564"></a>00564 <span class="comment">/* Logging */</span>
+<a name="l00565"></a>00565 cpl_msg_info(__func__,<span class="stringliteral">"Computing background from running mean of objects"</span>);
+<a name="l00566"></a>00566 cpl_msg_indent_more();
+<a name="l00567"></a>00567
+<a name="l00568"></a>00568 <span class="comment">/* Actually calling the functions that computes all the background */</span>
+<a name="l00569"></a>00569 <span class="keywordflow">if</span>(maskframes == NULL)
+<a name="l00570"></a>00570 {
+<a name="l00571"></a>00571 cpl_msg_info(__func__,<span class="stringliteral">"Not using masked objects"</span>);
+<a name="l00572"></a>00572 <span class="keywordflow">if</span>(hawki_step_compute_bkg_from_running_median_nonmasked_save
+<a name="l00573"></a>00573 (objframes,
+<a name="l00574"></a>00574 hawki_step_compute_bkg_config.nhalf_window,
+<a name="l00575"></a>00575 hawki_step_compute_bkg_config.rejlow,
+<a name="l00576"></a>00576 hawki_step_compute_bkg_config.rejhigh,
+<a name="l00577"></a>00577 recipe_framelist,
+<a name="l00578"></a>00578 recipe_parlist) !=0)
+<a name="l00579"></a>00579 {
+<a name="l00580"></a>00580 cpl_msg_error(__func__,<span class="stringliteral">"Could not compute objects running median"</span>);
+<a name="l00581"></a>00581 <span class="keywordflow">return</span> -1;
+<a name="l00582"></a>00582 }
+<a name="l00583"></a>00583 }
+<a name="l00584"></a>00584 <span class="keywordflow">else</span>
+<a name="l00585"></a>00585 {
+<a name="l00586"></a>00586 cpl_frame * maskframe;
+<a name="l00587"></a>00587 cpl_bivector ** offsets; <span class="comment">/* Detector order */</span>
+<a name="l00588"></a>00588 cpl_frame * x_distortionframe;
+<a name="l00589"></a>00589 cpl_frame * y_distortionframe;
+<a name="l00590"></a>00590 <span class="keywordtype">int</span> idet;
+<a name="l00591"></a>00591
+<a name="l00592"></a>00592 cpl_msg_info(__func__,<span class="stringliteral">"Using masked objects"</span>);
+<a name="l00593"></a>00593
+<a name="l00594"></a>00594 maskframe = cpl_frameset_get_first(maskframes);
+<a name="l00595"></a>00595 <span class="keywordflow">if</span>(x_distortionframes == NULL && y_distortionframes == NULL )
+<a name="l00596"></a>00596 {
+<a name="l00597"></a>00597 x_distortionframe = NULL;
+<a name="l00598"></a>00598 y_distortionframe = NULL;
+<a name="l00599"></a>00599 }
+<a name="l00600"></a>00600 <span class="keywordflow">else</span>
+<a name="l00601"></a>00601 {
+<a name="l00602"></a>00602 x_distortionframe = cpl_frameset_get_first(x_distortionframes);
+<a name="l00603"></a>00603 y_distortionframe = cpl_frameset_get_first(y_distortionframes);
+<a name="l00604"></a>00604 }
+<a name="l00605"></a>00605
+<a name="l00606"></a>00606 <span class="comment">/* Get the offsets */</span>
+<a name="l00607"></a>00607 <span class="keywordflow">if</span>(offsetframes == NULL)
+<a name="l00608"></a>00608 {
+<a name="l00609"></a>00609 cpl_bivector * offsets_all_chips;
+<a name="l00610"></a>00610
+<a name="l00611"></a>00611 cpl_msg_info(__func__,<span class="stringliteral">"Using header nominal offsets"</span>);
+<a name="l00612"></a>00612 offsets_all_chips = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(objframes);
+<a name="l00613"></a>00613 <span class="keywordflow">if</span> (offsets_all_chips == NULL)
+<a name="l00614"></a>00614 {
+<a name="l00615"></a>00615 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the header offsets"</span>);
+<a name="l00616"></a>00616 <span class="keywordflow">return</span> -1;
+<a name="l00617"></a>00617 }
+<a name="l00618"></a>00618 offsets = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_bivector *));
+<a name="l00619"></a>00619 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00620"></a>00620 {
+<a name="l00621"></a>00621 offsets[idet] = cpl_bivector_duplicate(offsets_all_chips);
+<a name="l00622"></a>00622 <span class="comment">/* Get the oposite offsets. This is to change from </span>
+<a name="l00623"></a>00623 <span class="comment"> * telescope convention to cpl convention */</span>
+<a name="l00624"></a>00624 cpl_vector_multiply_scalar
+<a name="l00625"></a>00625 (cpl_bivector_get_x(offsets[idet]), -1.0);
+<a name="l00626"></a>00626 cpl_vector_multiply_scalar
+<a name="l00627"></a>00627 (cpl_bivector_get_y(offsets[idet]), -1.0);
+<a name="l00628"></a>00628 }
+<a name="l00629"></a>00629 cpl_bivector_delete(offsets_all_chips);
+<a name="l00630"></a>00630 }
+<a name="l00631"></a>00631 <span class="keywordflow">else</span>
+<a name="l00632"></a>00632 {
+<a name="l00633"></a>00633 cpl_msg_info(__func__,<span class="stringliteral">"Using refined offsets"</span>);
+<a name="l00634"></a>00634 offsets = <a class="code" href="group__hawki__load.html#gaf91b09d357b426f387123767e4a4fec1" title="Load a table containing refined offsets.">hawki_load_refined_offsets</a>
+<a name="l00635"></a>00635 (cpl_frameset_get_first(offsetframes));
+<a name="l00636"></a>00636 <span class="keywordflow">if</span>(offsets == NULL)
+<a name="l00637"></a>00637 {
+<a name="l00638"></a>00638 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the refined offsets"</span>);
+<a name="l00639"></a>00639 <span class="keywordflow">return</span> -1;
+<a name="l00640"></a>00640 }
+<a name="l00641"></a>00641 }
+<a name="l00642"></a>00642
+<a name="l00643"></a>00643 <span class="keywordflow">if</span>(hawki_step_compute_bkg_from_running_median_masked_save
+<a name="l00644"></a>00644 (objframes,
+<a name="l00645"></a>00645 maskframe,
+<a name="l00646"></a>00646 offsets,
+<a name="l00647"></a>00647 x_distortionframe,
+<a name="l00648"></a>00648 y_distortionframe,
+<a name="l00649"></a>00649 hawki_step_compute_bkg_config.nhalf_window,
+<a name="l00650"></a>00650 hawki_step_compute_bkg_config.rejlow,
+<a name="l00651"></a>00651 hawki_step_compute_bkg_config.rejhigh,
+<a name="l00652"></a>00652 recipe_framelist,
+<a name="l00653"></a>00653 recipe_parlist) !=0)
+<a name="l00654"></a>00654 {
+<a name="l00655"></a>00655 cpl_msg_error(__func__,<span class="stringliteral">"Could not compute objects running median"</span>);
+<a name="l00656"></a>00656 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00657"></a>00657 cpl_bivector_delete(offsets[idet]);
+<a name="l00658"></a>00658 cpl_free(offsets);
+<a name="l00659"></a>00659 cpl_msg_indent_less();
+<a name="l00660"></a>00660 <span class="keywordflow">return</span> -1;
+<a name="l00661"></a>00661 }
+<a name="l00662"></a>00662
+<a name="l00663"></a>00663 <span class="comment">/* Free */</span>
+<a name="l00664"></a>00664 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00665"></a>00665 cpl_bivector_delete(offsets[idet]);
+<a name="l00666"></a>00666 cpl_free(offsets);
+<a name="l00667"></a>00667 }
+<a name="l00668"></a>00668 cpl_msg_indent_less();
+<a name="l00669"></a>00669
+<a name="l00670"></a>00670
+<a name="l00671"></a>00671 <span class="comment">/* Freeing and exit */</span>
+<a name="l00672"></a>00672 <span class="keywordflow">return</span> 0;
+<a name="l00673"></a>00673 }
+<a name="l00674"></a>00674
+<a name="l00675"></a>00675 <span class="keywordtype">int</span> hawki_step_compute_bkg_from_running_median_nonmasked_save
+<a name="l00676"></a>00676 (<span class="keyword">const</span> cpl_frameset * objframes,
+<a name="l00677"></a>00677 <span class="keywordtype">int</span> nhalf_window,
+<a name="l00678"></a>00678 <span class="keywordtype">int</span> rejlow,
+<a name="l00679"></a>00679 <span class="keywordtype">int</span> rejhigh,
+<a name="l00680"></a>00680 cpl_frameset * recipe_framelist,
+<a name="l00681"></a>00681 cpl_parameterlist * recipe_parlist)
+<a name="l00682"></a>00682 {
+<a name="l00683"></a>00683 <span class="keywordtype">int</span> iext;
+<a name="l00684"></a>00684 <span class="keywordtype">int</span> iobj;
+<a name="l00685"></a>00685 <span class="keywordtype">int</span> nobj;
+<a name="l00686"></a>00686 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_compute_bkg"</span>;
+<a name="l00687"></a>00687 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00688"></a>00688
+<a name="l00689"></a>00689 <span class="comment">/* Preparing the files to save */</span>
+<a name="l00690"></a>00690 cpl_msg_info(__func__,<span class="stringliteral">"Preparing the output files"</span>);
+<a name="l00691"></a>00691 nobj = cpl_frameset_get_size(objframes);
+<a name="l00692"></a>00692 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobj ; ++iobj)
+<a name="l00693"></a>00693 {
+<a name="l00694"></a>00694 cpl_frameset * used_frameset;
+<a name="l00695"></a>00695 <span class="keyword">const</span> cpl_frame * target_frame;
+<a name="l00696"></a>00696 <span class="keywordtype">char</span> filename[256];
+<a name="l00697"></a>00697 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_%03d.fits"</span>, iobj + 1);
+<a name="l00698"></a>00698 target_frame = cpl_frameset_get_frame_const(objframes, iobj);
+<a name="l00699"></a>00699 used_frameset = cpl_frameset_new();
+<a name="l00700"></a>00700 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(target_frame));
+<a name="l00701"></a>00701 <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>(recipe_framelist,
+<a name="l00702"></a>00702 recipe_parlist,
+<a name="l00703"></a>00703 used_frameset,
+<a name="l00704"></a>00704 recipe_name,
+<a name="l00705"></a>00705 HAWKI_CALPRO_BKGIMAGE,
+<a name="l00706"></a>00706 HAWKI_PROTYPE_BKGIMAGE,
+<a name="l00707"></a>00707 NULL,
+<a name="l00708"></a>00708 filename);
+<a name="l00709"></a>00709 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_bpm_%03d.fits"</span>, iobj + 1);
+<a name="l00710"></a>00710 <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>(recipe_framelist,
+<a name="l00711"></a>00711 recipe_parlist,
+<a name="l00712"></a>00712 used_frameset,
+<a name="l00713"></a>00713 recipe_name,
+<a name="l00714"></a>00714 HAWKI_CALPRO_BKGBPM,
+<a name="l00715"></a>00715 HAWKI_PROTYPE_BKGBPM,
+<a name="l00716"></a>00716 NULL,
+<a name="l00717"></a>00717 filename);
+<a name="l00718"></a>00718 cpl_frameset_delete(used_frameset);
+<a name="l00719"></a>00719 }
+<a name="l00720"></a>00720
+<a name="l00721"></a>00721 <span class="comment">/* Loop on extensions */</span>
+<a name="l00722"></a>00722 cpl_msg_indent_more();
+<a name="l00723"></a>00723 <span class="keywordflow">for</span>(iext = 0; iext < HAWKI_NB_DETECTORS; ++iext)
+<a name="l00724"></a>00724 {
+<a name="l00725"></a>00725 cpl_imagelist * img_serie;
+<a name="l00726"></a>00726 cpl_vector * medians;
+<a name="l00727"></a>00727
+<a name="l00728"></a>00728 <span class="comment">/* Info message */</span>
+<a name="l00729"></a>00729 cpl_msg_info(__func__,<span class="stringliteral">"Working on extension %d"</span>, iext + 1);
+<a name="l00730"></a>00730
+<a name="l00731"></a>00731 <span class="comment">/* Loading the object frame */</span>
+<a name="l00732"></a>00732 img_serie = <a class="code" href="group__hawki__load.html#ga1cf51c1b905de7941d7fcf3e249e536d" title="Loads a given extension from a HAWKI frameset in an image list.">hawki_load_extensions</a>(objframes, iext + 1, CPL_TYPE_FLOAT);
+<a name="l00733"></a>00733 <span class="keywordflow">if</span>(img_serie== NULL)
+<a name="l00734"></a>00734 {
+<a name="l00735"></a>00735 cpl_msg_error(__func__, <span class="stringliteral">"Error reading object image"</span>) ;
+<a name="l00736"></a>00736 <span class="keywordflow">return</span> -1;
+<a name="l00737"></a>00737 }
+<a name="l00738"></a>00738
+<a name="l00739"></a>00739 <span class="comment">/* Pre-compute median value in each plane */</span>
+<a name="l00740"></a>00740 medians = cpl_vector_new(nobj);
+<a name="l00741"></a>00741 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobj ; iobj++)
+<a name="l00742"></a>00742 {
+<a name="l00743"></a>00743 cpl_vector_set
+<a name="l00744"></a>00744 (medians,
+<a name="l00745"></a>00745 iobj,
+<a name="l00746"></a>00746 cpl_image_get_median(cpl_imagelist_get(img_serie, iobj))) ;
+<a name="l00747"></a>00747 }
+<a name="l00748"></a>00748
+<a name="l00749"></a>00749 cpl_msg_indent_more();
+<a name="l00750"></a>00750 <span class="keywordflow">for</span>(iobj = 0 ; iobj < nobj ; ++iobj)
+<a name="l00751"></a>00751 {
+<a name="l00752"></a>00752 <span class="keywordtype">int</span> nx;
+<a name="l00753"></a>00753 <span class="keywordtype">int</span> ny;
+<a name="l00754"></a>00754 cpl_image * this_bkg_image;
+<a name="l00755"></a>00755 cpl_image * this_bkg_image_mask;
+<a name="l00756"></a>00756 <span class="keywordtype">char</span> filename[256];
+<a name="l00757"></a>00757
+<a name="l00758"></a>00758 <span class="comment">/* Info message */</span>
+<a name="l00759"></a>00759 cpl_msg_info(__func__,<span class="stringliteral">"Computing bkg for image %d"</span>, iobj + 1);
+<a name="l00760"></a>00760
+<a name="l00761"></a>00761 <span class="comment">/* Creates the background image */</span>
+<a name="l00762"></a>00762 nx = cpl_image_get_size_x(cpl_imagelist_get(img_serie, 0));
+<a name="l00763"></a>00763 ny = cpl_image_get_size_y(cpl_imagelist_get(img_serie, 0));
+<a name="l00764"></a>00764 this_bkg_image = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+<a name="l00765"></a>00765
+<a name="l00766"></a>00766 <span class="comment">/* Actually computing the running mean */</span>
+<a name="l00767"></a>00767 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af" title="Computes the running mean for a set of object images using their masks.">hawki_bkg_from_running_mean_detector</a>
+<a name="l00768"></a>00768 (img_serie,
+<a name="l00769"></a>00769 medians,
+<a name="l00770"></a>00770 iobj,
+<a name="l00771"></a>00771 nhalf_window,
+<a name="l00772"></a>00772 rejlow,
+<a name="l00773"></a>00773 rejhigh,
+<a name="l00774"></a>00774 this_bkg_image) != 0)
+<a name="l00775"></a>00775 {
+<a name="l00776"></a>00776 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute bkg"</span>);
+<a name="l00777"></a>00777 cpl_vector_delete(medians);
+<a name="l00778"></a>00778 cpl_imagelist_delete(img_serie);
+<a name="l00779"></a>00779 cpl_image_delete(this_bkg_image);
+<a name="l00780"></a>00780 <span class="keywordflow">return</span> -1;
+<a name="l00781"></a>00781 }
+<a name="l00782"></a>00782
+<a name="l00783"></a>00783 <span class="comment">/* Save the extension bad pixel mask */</span>
+<a name="l00784"></a>00784 this_bkg_image_mask =
+<a name="l00785"></a>00785 cpl_image_new_from_mask(cpl_image_get_bpm(this_bkg_image));
+<a name="l00786"></a>00786 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_bpm_%03d.fits"</span>,iobj +1);
+<a name="l00787"></a>00787 <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>
+<a name="l00788"></a>00788 (objframes,
+<a name="l00789"></a>00789 this_bkg_image_mask,
+<a name="l00790"></a>00790 iext + 1,
+<a name="l00791"></a>00791 NULL,
+<a name="l00792"></a>00792 filename);
+<a name="l00793"></a>00793
+<a name="l00794"></a>00794 <span class="comment">/* Interpolate bad pixels */</span>
+<a name="l00795"></a>00795 hawki_step_compute_bkg_interpolate_badpix(this_bkg_image);
+<a name="l00796"></a>00796
+<a name="l00797"></a>00797 <span class="comment">/* Save this extension */</span>
+<a name="l00798"></a>00798 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_%03d.fits"</span>,iobj +1);
+<a name="l00799"></a>00799 <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>
+<a name="l00800"></a>00800 (objframes,
+<a name="l00801"></a>00801 this_bkg_image,
+<a name="l00802"></a>00802 iext + 1,
+<a name="l00803"></a>00803 NULL,
+<a name="l00804"></a>00804 filename);
+<a name="l00805"></a>00805
+<a name="l00806"></a>00806 <span class="comment">/* Free */</span>
+<a name="l00807"></a>00807 cpl_image_delete(this_bkg_image);
+<a name="l00808"></a>00808 cpl_image_delete(this_bkg_image_mask);
+<a name="l00809"></a>00809 }
+<a name="l00810"></a>00810 cpl_msg_indent_less();
+<a name="l00811"></a>00811
+<a name="l00812"></a>00812 <span class="comment">/* Freeing */</span>
+<a name="l00813"></a>00813 cpl_vector_delete(medians);
+<a name="l00814"></a>00814 cpl_imagelist_delete(img_serie);
+<a name="l00815"></a>00815 }
+<a name="l00816"></a>00816 cpl_msg_indent_less();
+<a name="l00817"></a>00817 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00818"></a>00818 {
+<a name="l00819"></a>00819 cpl_msg_warning(__func__,<span class="stringliteral">"Probably some data could not be saved. "</span>
+<a name="l00820"></a>00820 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00821"></a>00821 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00822"></a>00822 <span class="keywordflow">return</span> 1;
+<a name="l00823"></a>00823 }
+<a name="l00824"></a>00824 <span class="keywordflow">return</span> 0;
+<a name="l00825"></a>00825 }
+<a name="l00826"></a>00826
+<a name="l00827"></a>00827 <span class="keywordtype">int</span> hawki_step_compute_bkg_from_running_median_masked_save
+<a name="l00828"></a>00828 (<span class="keyword">const</span> cpl_frameset * objframes,
+<a name="l00829"></a>00829 cpl_frame * maskframe,
+<a name="l00830"></a>00830 cpl_bivector ** offsets,
+<a name="l00831"></a>00831 cpl_frame * x_distortionframe,
+<a name="l00832"></a>00832 cpl_frame * y_distortionframe,
+<a name="l00833"></a>00833 <span class="keywordtype">int</span> nhalf_window,
+<a name="l00834"></a>00834 <span class="keywordtype">int</span> rejlow,
+<a name="l00835"></a>00835 <span class="keywordtype">int</span> rejhigh,
+<a name="l00836"></a>00836 cpl_frameset * recipe_framelist,
+<a name="l00837"></a>00837 cpl_parameterlist * recipe_parlist)
+<a name="l00838"></a>00838 {
+<a name="l00839"></a>00839 <span class="keywordtype">int</span> iext; <span class="comment">/* 0 to HAWKI_NB_DETECTORS-1 */</span>
+<a name="l00840"></a>00840 <span class="keywordtype">int</span> idet; <span class="comment">/* 1 to HAWKI_NB_DETECTORS */</span>
+<a name="l00841"></a>00841 <span class="keywordtype">int</span> iobj; <span class="comment">/* 0 to obj-1 */</span>
+<a name="l00842"></a>00842 <span class="keywordtype">int</span> nobj;
+<a name="l00843"></a>00843 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_compute_bkg"</span>;
+<a name="l00844"></a>00844 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00845"></a>00845 cpl_frameset * calib_frameset;
+<a name="l00846"></a>00846
+<a name="l00847"></a>00847
+<a name="l00848"></a>00848 <span class="comment">//Add all the used frames</span>
+<a name="l00849"></a>00849 calib_frameset = cpl_frameset_new();
+<a name="l00850"></a>00850 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(maskframe));
+<a name="l00851"></a>00851 <span class="keywordflow">if</span>(x_distortionframe != NULL)
+<a name="l00852"></a>00852 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(x_distortionframe));
+<a name="l00853"></a>00853 <span class="keywordflow">if</span>(y_distortionframe != NULL)
+<a name="l00854"></a>00854 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(y_distortionframe));
+<a name="l00855"></a>00855
+<a name="l00856"></a>00856 <span class="comment">/* Preparing the files to save */</span>
+<a name="l00857"></a>00857 cpl_msg_info(__func__,<span class="stringliteral">"Preparing the final files"</span>);
+<a name="l00858"></a>00858 nobj = cpl_frameset_get_size(objframes);
+<a name="l00859"></a>00859 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobj ; ++iobj)
+<a name="l00860"></a>00860 {
+<a name="l00861"></a>00861 cpl_frameset * used_frameset;
+<a name="l00862"></a>00862 <span class="keyword">const</span> cpl_frame * target_frame;
+<a name="l00863"></a>00863 <span class="keywordtype">char</span> filename[256];
+<a name="l00864"></a>00864 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_%03d.fits"</span>, iobj + 1);
+<a name="l00865"></a>00865 target_frame = cpl_frameset_get_frame_const(objframes, iobj);
+<a name="l00866"></a>00866 used_frameset = cpl_frameset_duplicate(calib_frameset);
+<a name="l00867"></a>00867 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(target_frame));
+<a name="l00868"></a>00868 cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(maskframe));
+<a name="l00869"></a>00869 <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>(recipe_framelist,
+<a name="l00870"></a>00870 recipe_parlist,
+<a name="l00871"></a>00871 used_frameset,
+<a name="l00872"></a>00872 recipe_name,
+<a name="l00873"></a>00873 HAWKI_CALPRO_BKGIMAGE,
+<a name="l00874"></a>00874 HAWKI_PROTYPE_BKGIMAGE,
+<a name="l00875"></a>00875 NULL,
+<a name="l00876"></a>00876 filename);
+<a name="l00877"></a>00877 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_bpm_%03d.fits"</span>, iobj + 1);
+<a name="l00878"></a>00878 <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>(recipe_framelist,
+<a name="l00879"></a>00879 recipe_parlist,
+<a name="l00880"></a>00880 used_frameset,
+<a name="l00881"></a>00881 recipe_name,
+<a name="l00882"></a>00882 HAWKI_CALPRO_BKGBPM,
+<a name="l00883"></a>00883 HAWKI_PROTYPE_BKGBPM,
+<a name="l00884"></a>00884 NULL,
+<a name="l00885"></a>00885 filename);
+<a name="l00886"></a>00886 cpl_frameset_delete(used_frameset);
+<a name="l00887"></a>00887 }
+<a name="l00888"></a>00888 cpl_frameset_delete(calib_frameset);
+<a name="l00889"></a>00889
+<a name="l00890"></a>00890 <span class="comment">/* Loop on extensions */</span>
+<a name="l00891"></a>00891 cpl_msg_indent_more();
+<a name="l00892"></a>00892 <span class="keywordflow">for</span>(iext = 0; iext < HAWKI_NB_DETECTORS; ++iext)
+<a name="l00893"></a>00893 {
+<a name="l00894"></a>00894 cpl_imagelist * img_serie;
+<a name="l00895"></a>00895 cpl_vector * medians;
+<a name="l00896"></a>00896 cpl_image * mask;
+<a name="l00897"></a>00897 hawki_distortion * inv_distortion = NULL;
+<a name="l00898"></a>00898 cpl_propertylist * prop_list;
+<a name="l00899"></a>00899 cpl_image * dist_x = NULL;
+<a name="l00900"></a>00900 cpl_image * dist_y = NULL;
+<a name="l00901"></a>00901 <span class="keywordtype">double</span> mask_off_x;
+<a name="l00902"></a>00902 <span class="keywordtype">double</span> mask_off_y;
+<a name="l00903"></a>00903
+<a name="l00904"></a>00904 cpl_msg_info(__func__,<span class="stringliteral">"Working on extension %d"</span>, iext + 1);
+<a name="l00905"></a>00905 cpl_msg_indent_more();
+<a name="l00906"></a>00906
+<a name="l00907"></a>00907 <span class="comment">/* Loading the object frames */</span>
+<a name="l00908"></a>00908 img_serie = <a class="code" href="group__hawki__load.html#ga1cf51c1b905de7941d7fcf3e249e536d" title="Loads a given extension from a HAWKI frameset in an image list.">hawki_load_extensions</a>(objframes, iext + 1, CPL_TYPE_FLOAT);
+<a name="l00909"></a>00909 <span class="keywordflow">if</span>(img_serie== NULL)
+<a name="l00910"></a>00910 {
+<a name="l00911"></a>00911 cpl_msg_error(__func__, <span class="stringliteral">"Error reading object image"</span>) ;
+<a name="l00912"></a>00912 cpl_msg_indent_less();
+<a name="l00913"></a>00913 <span class="keywordflow">return</span> -1;
+<a name="l00914"></a>00914 }
+<a name="l00915"></a>00915 nobj = cpl_imagelist_get_size(img_serie);
+<a name="l00916"></a>00916
+<a name="l00917"></a>00917 <span class="comment">/* Loading the mask frame */</span>
+<a name="l00918"></a>00918 mask = <a class="code" href="group__hawki__load.html#ga43ebac74ab2f9da7a452f23ec76803ef" title="Load one the extensions of HAWKI images from a frame into an image.">hawki_load_frame_extension</a>(maskframe, iext + 1, CPL_TYPE_FLOAT);
+<a name="l00919"></a>00919 <span class="keywordflow">if</span>(mask == NULL)
+<a name="l00920"></a>00920 {
+<a name="l00921"></a>00921 cpl_msg_error(__func__, <span class="stringliteral">"Error reading mask image"</span>);
+<a name="l00922"></a>00922 cpl_msg_indent_less();
+<a name="l00923"></a>00923 cpl_msg_indent_less();
+<a name="l00924"></a>00924 <span class="keywordflow">return</span> -1;
+<a name="l00925"></a>00925 }
+<a name="l00926"></a>00926 idet =
+<a name="l00927"></a>00927 <a class="code" href="group__hawki__load.html#gac57166de157def8422f2e7e2d12dd756" title="Get the chip to store in the wished extension.">hawki_get_detector_from_ext</a>(cpl_frame_get_filename(maskframe), iext+1);
+<a name="l00928"></a>00928 prop_list =
+<a name="l00929"></a>00929 cpl_propertylist_load(cpl_frame_get_filename(maskframe), iext + 1);
+<a name="l00930"></a>00930 mask_off_x = <a class="code" href="group__hawki__pfits.html#ga24483514187ce9bcf0860cc654b8508c" title="find out the cumulative X offset of the combined image">hawki_pfits_get_comb_cumoffsetx</a>(prop_list);
+<a name="l00931"></a>00931 mask_off_y = <a class="code" href="group__hawki__pfits.html#gadc1b3f141f5474486b5b32502634b29a" title="find out the cumulative Y offset of the combined image">hawki_pfits_get_comb_cumoffsety</a>(prop_list);
+<a name="l00932"></a>00932 <span class="comment">/* Change the offsets to cpl convention */</span>
+<a name="l00933"></a>00933 mask_off_x *= -1;
+<a name="l00934"></a>00934 mask_off_y *= -1;
+<a name="l00935"></a>00935 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(CPL_ERROR_NONE))
+<a name="l00936"></a>00936 {
+<a name="l00937"></a>00937 cpl_msg_error(__func__,<span class="stringliteral">"Could not get the offsets from mask file.\n"</span>
+<a name="l00938"></a>00938 <span class="stringliteral">"Keywords %s are missing"</span>,<span class="stringliteral">"ESO QC COMBINED CUMOFFSET{X,Y}"</span>);
+<a name="l00939"></a>00939 cpl_imagelist_delete(img_serie);
+<a name="l00940"></a>00940 cpl_image_delete(mask);
+<a name="l00941"></a>00941 cpl_msg_indent_less();
+<a name="l00942"></a>00942 cpl_msg_indent_less();
+<a name="l00943"></a>00943 cpl_propertylist_delete(prop_list);
+<a name="l00944"></a>00944 <span class="keywordflow">return</span> -1;
+<a name="l00945"></a>00945 }
+<a name="l00946"></a>00946 cpl_msg_info(__func__,<span class="stringliteral">"Mask offsets: %f %f"</span>, mask_off_x, mask_off_y);
+<a name="l00947"></a>00947
+<a name="l00948"></a>00948 <span class="keywordflow">if</span>(x_distortionframe != NULL && y_distortionframe != NULL)
+<a name="l00949"></a>00949 {
+<a name="l00950"></a>00950 <span class="keywordtype">int</span> nx;
+<a name="l00951"></a>00951 <span class="keywordtype">int</span> ny;
+<a name="l00952"></a>00952
+<a name="l00953"></a>00953 <span class="comment">/* Load the distortion */</span>
+<a name="l00954"></a>00954 <span class="keywordflow">if</span> ((inv_distortion = <a class="code" href="group__hawki__distortion.html#gab9c3ebd02585f319d08b5149b44528e7" title="Loads the distortion solution for one detector.">hawki_distortion_load</a>
+<a name="l00955"></a>00955 (x_distortionframe, y_distortionframe, idet)) == NULL)
+<a name="l00956"></a>00956 {
+<a name="l00957"></a>00957 cpl_imagelist_delete(img_serie);
+<a name="l00958"></a>00958 cpl_propertylist_delete(prop_list);
+<a name="l00959"></a>00959 cpl_image_delete(mask);
+<a name="l00960"></a>00960 cpl_msg_error(__func__,
+<a name="l00961"></a>00961 <span class="stringliteral">"Cannot load distortion for chip %d"</span>,idet);
+<a name="l00962"></a>00962 cpl_msg_indent_less();
+<a name="l00963"></a>00963 cpl_msg_indent_less();
+<a name="l00964"></a>00964 <span class="keywordflow">return</span> -1 ;
+<a name="l00965"></a>00965 }
+<a name="l00966"></a>00966 <span class="comment">/* Multiply distortion by -1, to get the inverse distortion */</span>
+<a name="l00967"></a>00967 cpl_image_multiply_scalar(inv_distortion->dist_x, -1.);
+<a name="l00968"></a>00968 cpl_image_multiply_scalar(inv_distortion->dist_y, -1.);
+<a name="l00969"></a>00969 <span class="comment">/* Create the distortion maps */</span>
+<a name="l00970"></a>00970 nx = cpl_image_get_size_x(mask);
+<a name="l00971"></a>00971 ny = cpl_image_get_size_y(mask);
+<a name="l00972"></a>00972 dist_x = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+<a name="l00973"></a>00973 dist_y = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+<a name="l00974"></a>00974 <span class="keywordflow">if</span> (hawki_distortion_create_maps_detector
+<a name="l00975"></a>00975 (inv_distortion, dist_x, dist_y))
+<a name="l00976"></a>00976 {
+<a name="l00977"></a>00977 cpl_msg_error(__func__, <span class="stringliteral">"Cannot create the distortion maps"</span>) ;
+<a name="l00978"></a>00978 cpl_imagelist_delete(img_serie);
+<a name="l00979"></a>00979 cpl_propertylist_delete(prop_list);
+<a name="l00980"></a>00980 cpl_image_delete(mask);
+<a name="l00981"></a>00981 cpl_image_delete(dist_x);
+<a name="l00982"></a>00982 cpl_image_delete(dist_y);
+<a name="l00983"></a>00983 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(inv_distortion);
+<a name="l00984"></a>00984 cpl_msg_indent_less();
+<a name="l00985"></a>00985 cpl_msg_indent_less();
+<a name="l00986"></a>00986 <span class="keywordflow">return</span> -1;
+<a name="l00987"></a>00987 }
+<a name="l00988"></a>00988
+<a name="l00989"></a>00989 }
+<a name="l00990"></a>00990
+<a name="l00991"></a>00991 <span class="comment">/* Creating a different mask for each object, using the offsets </span>
+<a name="l00992"></a>00992 <span class="comment"> * and the distortion (if applies) */</span>
+<a name="l00993"></a>00993 cpl_msg_info(__func__,<span class="stringliteral">"Constructing the masks"</span>);
+<a name="l00994"></a>00994 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobj ; iobj++)
+<a name="l00995"></a>00995 {
+<a name="l00996"></a>00996 cpl_image * mask_shifted;
+<a name="l00997"></a>00997 cpl_image * mask_trim;
+<a name="l00998"></a>00998 cpl_mask * mask_final;
+<a name="l00999"></a>00999 cpl_image * target_image;
+<a name="l01000"></a>01000 cpl_vector * off_x;
+<a name="l01001"></a>01001 cpl_vector * off_y;
+<a name="l01002"></a>01002
+<a name="l01003"></a>01003 <span class="comment">/* Retrieve the offsets. Warning, it is in chip order */</span>
+<a name="l01004"></a>01004 off_x = cpl_bivector_get_x(offsets[idet-1]);
+<a name="l01005"></a>01005 off_y = cpl_bivector_get_y(offsets[idet-1]);
+<a name="l01006"></a>01006
+<a name="l01007"></a>01007 target_image = cpl_imagelist_get(img_serie, iobj);
+<a name="l01008"></a>01008 mask_shifted = cpl_image_duplicate(mask);
+<a name="l01009"></a>01009 cpl_image_shift(mask_shifted,
+<a name="l01010"></a>01010 -(<span class="keywordtype">int</span>)(cpl_vector_get(off_x, iobj) - mask_off_x),
+<a name="l01011"></a>01011 -(<span class="keywordtype">int</span>)(cpl_vector_get(off_y, iobj) - mask_off_y));
+<a name="l01012"></a>01012 <span class="keywordflow">if</span>(x_distortionframe != NULL && y_distortionframe != NULL)
+<a name="l01013"></a>01013 {
+<a name="l01014"></a>01014 cpl_image * mask_distcorr;
+<a name="l01015"></a>01015
+<a name="l01016"></a>01016 <span class="comment">/* Dedistort the mask */</span>
+<a name="l01017"></a>01017 mask_distcorr = <a class="code" href="group__hawki__distortion.html#ga872e536210e467ff47f70959f5390b7c" title="Apply the distortion correction to one chip.">hawki_distortion_correct_detector</a>
+<a name="l01018"></a>01018 (mask_shifted, dist_x, dist_y);
+<a name="l01019"></a>01019 <span class="keywordflow">if</span>(mask_distcorr == NULL)
+<a name="l01020"></a>01020 {
+<a name="l01021"></a>01021 cpl_msg_error(__func__, <span class="stringliteral">"Cannot correct the distortion"</span>) ;
+<a name="l01022"></a>01022 cpl_image_delete(dist_x);
+<a name="l01023"></a>01023 cpl_image_delete(dist_y);
+<a name="l01024"></a>01024 cpl_image_delete(mask_shifted);
+<a name="l01025"></a>01025 cpl_imagelist_delete(img_serie);
+<a name="l01026"></a>01026 cpl_image_delete(mask);
+<a name="l01027"></a>01027 cpl_propertylist_delete(prop_list);
+<a name="l01028"></a>01028 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(inv_distortion);
+<a name="l01029"></a>01029 cpl_msg_indent_less();
+<a name="l01030"></a>01030 cpl_msg_indent_less();
+<a name="l01031"></a>01031 <span class="keywordflow">return</span> -1 ;
+<a name="l01032"></a>01032 }
+<a name="l01033"></a>01033 mask_trim = cpl_image_extract
+<a name="l01034"></a>01034 (mask_distcorr, 1, 1,
+<a name="l01035"></a>01035 cpl_image_get_size_x(target_image),
+<a name="l01036"></a>01036 cpl_image_get_size_y(target_image));
+<a name="l01037"></a>01037 cpl_image_delete(mask_distcorr);
+<a name="l01038"></a>01038 }
+<a name="l01039"></a>01039 <span class="keywordflow">else</span>
+<a name="l01040"></a>01040 {
+<a name="l01041"></a>01041 mask_trim = cpl_image_extract
+<a name="l01042"></a>01042 (mask_shifted, 1, 1,
+<a name="l01043"></a>01043 cpl_image_get_size_x(target_image),
+<a name="l01044"></a>01044 cpl_image_get_size_y(target_image));
+<a name="l01045"></a>01045 }
+<a name="l01046"></a>01046 mask_final =
+<a name="l01047"></a>01047 cpl_mask_threshold_image_create(mask_trim, 0.5, FLT_MAX);
+<a name="l01048"></a>01048 <span class="comment">/* TODO: Add the current bpm to this mask? */</span>
+<a name="l01049"></a>01049 cpl_image_reject_from_mask
+<a name="l01050"></a>01050 (target_image, mask_final);
+<a name="l01051"></a>01051 cpl_image_delete(mask_shifted);
+<a name="l01052"></a>01052 cpl_image_delete(mask_trim);
+<a name="l01053"></a>01053 cpl_mask_delete(mask_final);
+<a name="l01054"></a>01054 }
+<a name="l01055"></a>01055
+<a name="l01056"></a>01056 <span class="comment">/* Pre-compute median value in each plane */</span>
+<a name="l01057"></a>01057 cpl_msg_info(__func__,<span class="stringliteral">"Computing the medians"</span>);
+<a name="l01058"></a>01058 medians = cpl_vector_new(nobj);
+<a name="l01059"></a>01059 <span class="keywordflow">for</span> (iobj=0 ; iobj<nobj ; iobj++)
+<a name="l01060"></a>01060 {
+<a name="l01061"></a>01061 cpl_vector_set
+<a name="l01062"></a>01062 (medians,
+<a name="l01063"></a>01063 iobj,
+<a name="l01064"></a>01064 cpl_image_get_median(cpl_imagelist_get(img_serie, iobj))) ;
+<a name="l01065"></a>01065 }
+<a name="l01066"></a>01066
+<a name="l01067"></a>01067 <span class="comment">/* Object loop to get the bkg */</span>
+<a name="l01068"></a>01068 cpl_msg_info(__func__,<span class="stringliteral">"Computing backgrounds"</span>);
+<a name="l01069"></a>01069 cpl_msg_indent_more();
+<a name="l01070"></a>01070 <span class="keywordflow">for</span>(iobj = 0 ; iobj < nobj ; ++iobj)
+<a name="l01071"></a>01071 {
+<a name="l01072"></a>01072 <span class="keywordtype">int</span> nx;
+<a name="l01073"></a>01073 <span class="keywordtype">int</span> ny;
+<a name="l01074"></a>01074 cpl_image * this_bkg_image;
+<a name="l01075"></a>01075 cpl_image * this_bkg_image_mask;
+<a name="l01076"></a>01076 <span class="keywordtype">char</span> filename[256];
+<a name="l01077"></a>01077
+<a name="l01078"></a>01078 <span class="comment">/* Creates the background image */</span>
+<a name="l01079"></a>01079 cpl_msg_info(__func__,<span class="stringliteral">"Computing bkg for image %d"</span>, iobj + 1);
+<a name="l01080"></a>01080 nx = cpl_image_get_size_x(cpl_imagelist_get(img_serie, 0));
+<a name="l01081"></a>01081 ny = cpl_image_get_size_y(cpl_imagelist_get(img_serie, 0));
+<a name="l01082"></a>01082 this_bkg_image = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+<a name="l01083"></a>01083
+<a name="l01084"></a>01084 <span class="comment">/* Actually computing the running mean */</span>
+<a name="l01085"></a>01085 <span class="keywordflow">if</span>(<a class="code" href="group__hawki__image__stats.html#ga5c5f3ead9c1f168f90e1b8bd42dd07af" title="Computes the running mean for a set of object images using their masks.">hawki_bkg_from_running_mean_detector</a>
+<a name="l01086"></a>01086 (img_serie,
+<a name="l01087"></a>01087 medians,
+<a name="l01088"></a>01088 iobj,
+<a name="l01089"></a>01089 nhalf_window,
+<a name="l01090"></a>01090 rejlow,
+<a name="l01091"></a>01091 rejhigh,
+<a name="l01092"></a>01092 this_bkg_image) != 0)
+<a name="l01093"></a>01093 {
+<a name="l01094"></a>01094 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute bkg"</span>);
+<a name="l01095"></a>01095 cpl_image_delete(this_bkg_image);
+<a name="l01096"></a>01096 cpl_vector_delete(medians);
+<a name="l01097"></a>01097 cpl_imagelist_delete(img_serie);
+<a name="l01098"></a>01098 cpl_image_delete(mask);
+<a name="l01099"></a>01099 cpl_propertylist_delete(prop_list);
+<a name="l01100"></a>01100 <span class="keywordflow">if</span>(x_distortionframe != NULL && y_distortionframe != NULL)
+<a name="l01101"></a>01101 {
+<a name="l01102"></a>01102 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(inv_distortion);
+<a name="l01103"></a>01103 cpl_image_delete(dist_x);
+<a name="l01104"></a>01104 cpl_image_delete(dist_y);
+<a name="l01105"></a>01105 }
+<a name="l01106"></a>01106 cpl_msg_indent_less();
+<a name="l01107"></a>01107 cpl_msg_indent_less();
+<a name="l01108"></a>01108 cpl_msg_indent_less();
+<a name="l01109"></a>01109 <span class="keywordflow">return</span> -1;
+<a name="l01110"></a>01110 }
+<a name="l01111"></a>01111
+<a name="l01112"></a>01112 <span class="comment">/* Save the extension bad pixel mask */</span>
+<a name="l01113"></a>01113 this_bkg_image_mask =
+<a name="l01114"></a>01114 cpl_image_new_from_mask(cpl_image_get_bpm(this_bkg_image));
+<a name="l01115"></a>01115 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_bpm_%03d.fits"</span>,iobj +1);
+<a name="l01116"></a>01116 <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>
+<a name="l01117"></a>01117 (objframes,
+<a name="l01118"></a>01118 this_bkg_image_mask,
+<a name="l01119"></a>01119 iext + 1,
+<a name="l01120"></a>01120 NULL,
+<a name="l01121"></a>01121 filename);
+<a name="l01122"></a>01122
+<a name="l01123"></a>01123 <span class="comment">/* Interpolate bad pixels */</span>
+<a name="l01124"></a>01124 hawki_step_compute_bkg_interpolate_badpix(this_bkg_image);
+<a name="l01125"></a>01125
+<a name="l01126"></a>01126 <span class="comment">/* Save this extension */</span>
+<a name="l01127"></a>01127 snprintf(filename, 256, <span class="stringliteral">"hawki_step_compute_bkg_%03d.fits"</span>,iobj +1);
+<a name="l01128"></a>01128 <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>
+<a name="l01129"></a>01129 (objframes,
+<a name="l01130"></a>01130 this_bkg_image,
+<a name="l01131"></a>01131 iext + 1,
+<a name="l01132"></a>01132 NULL,
+<a name="l01133"></a>01133 filename);
+<a name="l01134"></a>01134
+<a name="l01135"></a>01135 <span class="comment">/* Free */</span>
+<a name="l01136"></a>01136 cpl_image_delete(this_bkg_image);
+<a name="l01137"></a>01137 cpl_image_delete(this_bkg_image_mask);
+<a name="l01138"></a>01138 }
+<a name="l01139"></a>01139 cpl_msg_indent_less();
+<a name="l01140"></a>01140
+<a name="l01141"></a>01141 <span class="comment">/* Freeing */</span>
+<a name="l01142"></a>01142 cpl_vector_delete(medians);
+<a name="l01143"></a>01143 cpl_imagelist_delete(img_serie);
+<a name="l01144"></a>01144 cpl_image_delete(mask);
+<a name="l01145"></a>01145 cpl_propertylist_delete(prop_list);
+<a name="l01146"></a>01146 <span class="keywordflow">if</span>(x_distortionframe != NULL && y_distortionframe != NULL)
+<a name="l01147"></a>01147 {
+<a name="l01148"></a>01148 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(inv_distortion);
+<a name="l01149"></a>01149 cpl_image_delete(dist_x);
+<a name="l01150"></a>01150 cpl_image_delete(dist_y);
+<a name="l01151"></a>01151 }
+<a name="l01152"></a>01152 cpl_msg_indent_less();
+<a name="l01153"></a>01153 }
+<a name="l01154"></a>01154 cpl_msg_indent_less();
+<a name="l01155"></a>01155 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l01156"></a>01156 {
+<a name="l01157"></a>01157 cpl_msg_warning(__func__,<span class="stringliteral">"Probably some data could not be saved. "</span>
+<a name="l01158"></a>01158 <span class="stringliteral">"Check permissions or disk space"</span>);
+<a name="l01159"></a>01159 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l01160"></a>01160 <span class="keywordflow">return</span> 1;
+<a name="l01161"></a>01161 }
+<a name="l01162"></a>01162 <span class="keywordflow">return</span> 0;
+<a name="l01163"></a>01163 }
+<a name="l01164"></a>01164
+<a name="l01165"></a>01165 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01171"></a>01171 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01172"></a>01172 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_compute_bkg_interpolate_badpix
+<a name="l01173"></a>01173 (cpl_image * image)
+<a name="l01174"></a>01174 {
+<a name="l01175"></a>01175 <span class="keywordtype">int</span> nbadpixels = cpl_image_count_rejected(image);
+<a name="l01176"></a>01176 <span class="keywordflow">if</span>(nbadpixels !=0)
+<a name="l01177"></a>01177 cpl_msg_info(__func__,<span class="stringliteral">"Number of pixels with no background available: %d "</span>,
+<a name="l01178"></a>01178 nbadpixels);
+<a name="l01179"></a>01179 <span class="keywordflow">if</span>(cpl_image_count_rejected(image) > 0)
+<a name="l01180"></a>01180 {
+<a name="l01181"></a>01181 <span class="keywordtype">int</span> ipix,npix;
+<a name="l01182"></a>01182 <span class="keywordtype">double</span> median = cpl_image_get_median(image);
+<a name="l01183"></a>01183 <span class="keyword">const</span> cpl_binary * bpm = cpl_mask_get_data_const
+<a name="l01184"></a>01184 (cpl_image_get_bpm(image));
+<a name="l01185"></a>01185 <span class="keywordtype">float</span> * image_p = (<span class="keywordtype">float</span>*)cpl_image_get_data(image);
+<a name="l01186"></a>01186 cpl_msg_warning(__func__,<span class="stringliteral">"Substituting pixels with no bkg with median of image %f"</span>,median);
+<a name="l01187"></a>01187 npix = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+<a name="l01188"></a>01188 <span class="keywordflow">for</span>(ipix = 0; ipix < npix; ipix++)
+<a name="l01189"></a>01189 {
+<a name="l01190"></a>01190 <span class="keywordflow">if</span> (bpm[ipix])
+<a name="l01191"></a>01191 {
+<a name="l01192"></a>01192 image_p[ipix] = median;
+<a name="l01193"></a>01193 }
+<a name="l01194"></a>01194 }
+<a name="l01195"></a>01195 <span class="comment">//This cannot be used until DFS08929 is solved</span>
+<a name="l01196"></a>01196 <span class="comment">//cpl_detector_interpolate_rejected(image);</span>
+<a name="l01197"></a>01197 }
+<a name="l01198"></a>01198 <span class="keywordflow">return</span> 0;
+<a name="l01199"></a>01199 }
+<a name="l01200"></a>01200
+<a name="l01201"></a>01201 <span class="keywordtype">int</span> hawki_step_compute_bkg_retrieve_input_param
+<a name="l01202"></a>01202 (cpl_parameterlist * parlist)
+<a name="l01203"></a>01203 {
+<a name="l01204"></a>01204 cpl_parameter * par ;
+<a name="l01205"></a>01205
+<a name="l01206"></a>01206 par = NULL ;
+<a name="l01207"></a>01207 par = cpl_parameterlist_find
+<a name="l01208"></a>01208 (parlist, <span class="stringliteral">"hawki.hawki_step_compute_bkg.nmin_comb"</span>);
+<a name="l01209"></a>01209 hawki_step_compute_bkg_config.nmin_comb = cpl_parameter_get_int(par);
+<a name="l01210"></a>01210
+<a name="l01211"></a>01211 par = cpl_parameterlist_find
+<a name="l01212"></a>01212 (parlist, <span class="stringliteral">"hawki.hawki_step_compute_bkg.nhalf_window"</span>);
+<a name="l01213"></a>01213 hawki_step_compute_bkg_config.nhalf_window = cpl_parameter_get_int(par);
+<a name="l01214"></a>01214
+<a name="l01215"></a>01215 par = cpl_parameterlist_find
+<a name="l01216"></a>01216 (parlist, <span class="stringliteral">"hawki.hawki_step_compute_bkg.rejlow"</span>);
+<a name="l01217"></a>01217 hawki_step_compute_bkg_config.rejlow = cpl_parameter_get_int(par);
+<a name="l01218"></a>01218
+<a name="l01219"></a>01219 par = cpl_parameterlist_find
+<a name="l01220"></a>01220 (parlist, <span class="stringliteral">"hawki.hawki_step_compute_bkg.rejhigh"</span>);
+<a name="l01221"></a>01221 hawki_step_compute_bkg_config.rejhigh = cpl_parameter_get_int(par);
+<a name="l01222"></a>01222
+<a name="l01223"></a>01223 <span class="keywordflow">return</span> 0;
+<a name="l01224"></a>01224 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__detect__obj_8c_source.html b/html/hawki__step__detect__obj_8c_source.html
new file mode 100644
index 0000000..fc7bd79
--- /dev/null
+++ b/html/hawki__step__detect__obj_8c_source.html
@@ -0,0 +1,970 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_detect_obj.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_detect_obj.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_detect_obj.c,v 1.26 2012/05/03 10:43:22 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/05/03 10:43:22 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.26 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <string.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_calib.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_obj_det.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_mask.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00054"></a>00054 <span class="comment"> Functions prototypes</span>
+<a name="l00055"></a>00055 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_create(cpl_plugin *) ;
+<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_exec(cpl_plugin *) ;
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_destroy(cpl_plugin *) ;
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_step_detect_obj_init_output(<span class="keywordtype">void</span>);
+<a name="l00063"></a>00063 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_step_detect_obj_get_pscale
+<a name="l00064"></a>00064 (cpl_frameset * combframes);
+<a name="l00065"></a>00065 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_retrieve_input_param
+<a name="l00066"></a>00066 (cpl_parameterlist * parlist);
+<a name="l00067"></a>00067 <span class="keyword">static</span> cpl_apertures ** hawki_step_detect_obj_mask_and_apertures
+<a name="l00068"></a>00068 (cpl_frameset * combframes,
+<a name="l00069"></a>00069 cpl_image ** mask_image,
+<a name="l00070"></a>00070 cpl_image ** comb_image);
+<a name="l00071"></a>00071 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_aper_params
+<a name="l00072"></a>00072 (cpl_image ** combined_images,
+<a name="l00073"></a>00073 cpl_apertures ** apertures,
+<a name="l00074"></a>00074 cpl_table ** obj_charac);
+<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_save
+<a name="l00076"></a>00076 (cpl_image ** mask_images,
+<a name="l00077"></a>00077 cpl_table ** obj_charac,
+<a name="l00078"></a>00078 cpl_propertylist ** obj_stats,
+<a name="l00079"></a>00079 cpl_parameterlist * parlist,
+<a name="l00080"></a>00080 cpl_frameset * framelist);
+<a name="l00081"></a>00081
+<a name="l00082"></a>00082 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00083"></a>00083 <span class="comment"> Static variables</span>
+<a name="l00084"></a>00084 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00085"></a>00085
+<a name="l00086"></a>00086 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00087"></a>00087 {
+<a name="l00088"></a>00088 <span class="comment">/* Inputs */</span>
+<a name="l00089"></a>00089 <span class="keywordtype">double</span> sigma_det;
+<a name="l00090"></a>00090 <span class="keywordtype">int</span> growing_radius;
+<a name="l00091"></a>00091 } hawki_step_detect_obj_config;
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00094"></a>00094 {
+<a name="l00095"></a>00095 <span class="comment">/* Outputs */</span>
+<a name="l00096"></a>00096 <span class="keywordtype">double</span> pixscale;
+<a name="l00097"></a>00097 <span class="keywordtype">double</span> iq[HAWKI_NB_DETECTORS] ;
+<a name="l00098"></a>00098 <span class="keywordtype">int</span> nbobjs[HAWKI_NB_DETECTORS] ;
+<a name="l00099"></a>00099 <span class="keywordtype">double</span> fwhm_pix[HAWKI_NB_DETECTORS] ;
+<a name="l00100"></a>00100 <span class="keywordtype">double</span> fwhm_arcsec[HAWKI_NB_DETECTORS] ;
+<a name="l00101"></a>00101 <span class="keywordtype">double</span> fwhm_mode[HAWKI_NB_DETECTORS] ;
+<a name="l00102"></a>00102 <span class="keywordtype">double</span> pos_x[HAWKI_NB_DETECTORS] ;
+<a name="l00103"></a>00103 <span class="keywordtype">double</span> pos_y[HAWKI_NB_DETECTORS] ;
+<a name="l00104"></a>00104 } hawki_step_detect_obj_output;
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_detect_obj_description[] =
+<a name="l00107"></a>00107 <span class="stringliteral">"hawki_step_detect_obj -- hawki detect objects recipe.\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">"This recipe detects objects from the combined image creating a mask\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">"and a list of object properties\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">"The input of the recipe files listed in the Set Of Frames (sof-file)\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">"must be tagged as:\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">"combined.fits "</span>HAWKI_CALPRO_COMBINED<span class="stringliteral">"\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">"hawki_step_detect_obj_mask.fits ("</span>HAWKI_CALPRO_OBJ_MASK<span class="stringliteral">"): A mask with 1 where the objects are present and 0 elsewhere\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">"hawki_step_detect_obj_stars.fits ("</span>HAWKI_CALPRO_OBJ_PARAM<span class="stringliteral">"): A table with the detected objects characteristics\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00119"></a>00119
+<a name="l00120"></a>00120
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00123"></a>00123 <span class="comment"> Functions code</span>
+<a name="l00124"></a>00124 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00125"></a>00125
+<a name="l00126"></a>00126 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00134"></a>00134 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00135"></a>00135 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00136"></a>00136 {
+<a name="l00137"></a>00137 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00138"></a>00138 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00139"></a>00139
+<a name="l00140"></a>00140 cpl_plugin_init(plugin,
+<a name="l00141"></a>00141 CPL_PLUGIN_API,
+<a name="l00142"></a>00142 HAWKI_BINARY_VERSION,
+<a name="l00143"></a>00143 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00144"></a>00144 <span class="stringliteral">"hawki_step_detect_obj"</span>,
+<a name="l00145"></a>00145 <span class="stringliteral">"Object detection recipe"</span>,
+<a name="l00146"></a>00146 hawki_step_detect_obj_description,
+<a name="l00147"></a>00147 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00148"></a>00148 PACKAGE_BUGREPORT,
+<a name="l00149"></a>00149 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00150"></a>00150 hawki_step_detect_obj_create,
+<a name="l00151"></a>00151 hawki_step_detect_obj_exec,
+<a name="l00152"></a>00152 hawki_step_detect_obj_destroy) ;
+<a name="l00153"></a>00153
+<a name="l00154"></a>00154 cpl_pluginlist_append(list, plugin) ;
+<a name="l00155"></a>00155
+<a name="l00156"></a>00156 <span class="keywordflow">return</span> 0;
+<a name="l00157"></a>00157 }
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00168"></a>00168 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00169"></a>00169 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_create(cpl_plugin * plugin)
+<a name="l00170"></a>00170 {
+<a name="l00171"></a>00171 cpl_recipe * recipe ;
+<a name="l00172"></a>00172 cpl_parameter * p ;
+<a name="l00173"></a>00173
+<a name="l00174"></a>00174 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00175"></a>00175 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00176"></a>00176 recipe = (cpl_recipe *)plugin ;
+<a name="l00177"></a>00177 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00178"></a>00178
+<a name="l00179"></a>00179 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00180"></a>00180 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00181"></a>00181 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00182"></a>00182 <span class="keywordflow">return</span> 1;
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00185"></a>00185 <span class="comment">/* --sigma_det */</span>
+<a name="l00186"></a>00186 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_detect_obj.sigma_det"</span>,
+<a name="l00187"></a>00187 CPL_TYPE_DOUBLE, <span class="stringliteral">"detection level"</span>,
+<a name="l00188"></a>00188 <span class="stringliteral">"hawki.hawki_step_detect_obj"</span>, 6.);
+<a name="l00189"></a>00189 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sigma_det"</span>);
+<a name="l00190"></a>00190 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00191"></a>00191 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00192"></a>00192
+<a name="l00193"></a>00193 <span class="comment">/* --growing_radius */</span>
+<a name="l00194"></a>00194 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_detect_obj.growing_radius"</span>,
+<a name="l00195"></a>00195 CPL_TYPE_INT,
+<a name="l00196"></a>00196 <span class="stringliteral">"radius of convolution kernel to apply to objects"</span>,
+<a name="l00197"></a>00197 <span class="stringliteral">"hawki.hawki_step_detect_obj"</span>, 5);
+<a name="l00198"></a>00198 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"growing_radius"</span>);
+<a name="l00199"></a>00199 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00200"></a>00200 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00201"></a>00201
+<a name="l00202"></a>00202 <span class="comment">/* Return */</span>
+<a name="l00203"></a>00203 <span class="keywordflow">return</span> 0;
+<a name="l00204"></a>00204 }
+<a name="l00205"></a>00205
+<a name="l00206"></a>00206 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00212"></a>00212 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00213"></a>00213 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_exec(cpl_plugin * plugin)
+<a name="l00214"></a>00214 {
+<a name="l00215"></a>00215 cpl_recipe * recipe ;
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00218"></a>00218 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00219"></a>00219 recipe = (cpl_recipe *)plugin ;
+<a name="l00220"></a>00220 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00221"></a>00221
+<a name="l00222"></a>00222 <span class="comment">/* Issue a banner */</span>
+<a name="l00223"></a>00223 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00224"></a>00224
+<a name="l00225"></a>00225 <span class="keywordflow">return</span> hawki_step_detect_obj(recipe->parameters, recipe->frames) ;
+<a name="l00226"></a>00226 }
+<a name="l00227"></a>00227
+<a name="l00228"></a>00228 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00234"></a>00234 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00235"></a>00235 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_destroy(cpl_plugin * plugin)
+<a name="l00236"></a>00236 {
+<a name="l00237"></a>00237 cpl_recipe * recipe ;
+<a name="l00238"></a>00238
+<a name="l00239"></a>00239 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00240"></a>00240 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00241"></a>00241 recipe = (cpl_recipe *)plugin ;
+<a name="l00242"></a>00242 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00243"></a>00243
+<a name="l00244"></a>00244 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00245"></a>00245 <span class="keywordflow">return</span> 0 ;
+<a name="l00246"></a>00246 }
+<a name="l00247"></a>00247
+<a name="l00248"></a>00248 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00255"></a>00255 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00256"></a>00256 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj(
+<a name="l00257"></a>00257 cpl_parameterlist * parlist,
+<a name="l00258"></a>00258 cpl_frameset * framelist)
+<a name="l00259"></a>00259 {
+<a name="l00260"></a>00260 cpl_frameset * combframes;
+<a name="l00261"></a>00261 cpl_image ** mask_image;
+<a name="l00262"></a>00262 cpl_image ** comb_image;
+<a name="l00263"></a>00263 cpl_apertures ** apertures;
+<a name="l00264"></a>00264 cpl_table ** obj_charac;
+<a name="l00265"></a>00265 cpl_propertylist ** obj_stats;
+<a name="l00266"></a>00266 <span class="keywordtype">int</span> idet;
+<a name="l00267"></a>00267
+<a name="l00268"></a>00268 <span class="comment">/* Initialise */</span>
+<a name="l00269"></a>00269 hawki_step_detect_obj_init_output();
+<a name="l00270"></a>00270
+<a name="l00271"></a>00271 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00272"></a>00272 <span class="keywordflow">if</span>(hawki_step_detect_obj_retrieve_input_param(parlist))
+<a name="l00273"></a>00273 {
+<a name="l00274"></a>00274 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00275"></a>00275 <span class="keywordflow">return</span> -1;
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277
+<a name="l00278"></a>00278 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00279"></a>00279 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00280"></a>00280 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00281"></a>00281 <span class="keywordflow">return</span> -1 ;
+<a name="l00282"></a>00282 }
+<a name="l00283"></a>00283
+<a name="l00284"></a>00284 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00285"></a>00285 combframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_COMBINED) ;
+<a name="l00286"></a>00286 <span class="keywordflow">if</span> (combframes == NULL)
+<a name="l00287"></a>00287 {
+<a name="l00288"></a>00288 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find combined images in the input (%s)"</span>,
+<a name="l00289"></a>00289 HAWKI_CALPRO_COMBINED);
+<a name="l00290"></a>00290 <span class="keywordflow">return</span> -1 ;
+<a name="l00291"></a>00291 }
+<a name="l00292"></a>00292 <span class="keywordflow">if</span> (cpl_frameset_get_size(combframes) != 1)
+<a name="l00293"></a>00293 {
+<a name="l00294"></a>00294 cpl_msg_error(__func__, <span class="stringliteral">"Only one combined image must be provided"</span>);
+<a name="l00295"></a>00295 <span class="keywordflow">return</span> -1 ;
+<a name="l00296"></a>00296 }
+<a name="l00297"></a>00297
+<a name="l00298"></a>00298 <span class="comment">/* Get info from the headers */</span>
+<a name="l00299"></a>00299 hawki_step_detect_obj_get_pscale(combframes);
+<a name="l00300"></a>00300
+<a name="l00301"></a>00301 <span class="comment">/* Get the mask with the points above the background </span>
+<a name="l00302"></a>00302 <span class="comment"> * and the associated apertures*/</span>
+<a name="l00303"></a>00303 cpl_msg_info(__func__, <span class="stringliteral">"Getting the object masks"</span>) ;
+<a name="l00304"></a>00304 mask_image = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_image *));
+<a name="l00305"></a>00305 comb_image = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_image *));
+<a name="l00306"></a>00306 apertures = hawki_step_detect_obj_mask_and_apertures
+<a name="l00307"></a>00307 (combframes, mask_image, comb_image);
+<a name="l00308"></a>00308 <span class="keywordflow">if</span>(apertures == NULL)
+<a name="l00309"></a>00309 {
+<a name="l00310"></a>00310 cpl_msg_error(__func__,<span class="stringliteral">"Could not detect objects in image"</span>);
+<a name="l00311"></a>00311 cpl_frameset_delete(combframes);
+<a name="l00312"></a>00312 cpl_free(mask_image);
+<a name="l00313"></a>00313 cpl_free(comb_image);
+<a name="l00314"></a>00314 <span class="keywordflow">return</span> -1;
+<a name="l00315"></a>00315 }
+<a name="l00316"></a>00316
+<a name="l00317"></a>00317 <span class="comment">/* Get object characterizations and statistics */</span>
+<a name="l00318"></a>00318 cpl_msg_info(__func__, <span class="stringliteral">"Getting object parameters"</span>) ;
+<a name="l00319"></a>00319 obj_charac = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *)) ;
+<a name="l00320"></a>00320 obj_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist *));
+<a name="l00321"></a>00321 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00322"></a>00322 {
+<a name="l00323"></a>00323 obj_charac[idet] = cpl_table_new
+<a name="l00324"></a>00324 (cpl_apertures_get_size(apertures[idet]));
+<a name="l00325"></a>00325 obj_stats[idet] = cpl_propertylist_new();
+<a name="l00326"></a>00326 }
+<a name="l00327"></a>00327 hawki_step_detect_obj_aper_params(comb_image, apertures, obj_charac);
+<a name="l00328"></a>00328
+<a name="l00329"></a>00329 <span class="comment">/* Statistics of the detected objects in the QC */</span>
+<a name="l00330"></a>00330 <a class="code" href="group__hawki__obj__det.html#ga0968e63931fcc72c55c4bc0e34f71dbb" title="Compute statistics on the object properties.">hawki_obj_prop_stats</a>(obj_charac, obj_stats);
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 <span class="comment">/* Save the products */</span>
+<a name="l00333"></a>00333 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00334"></a>00334 <span class="keywordflow">if</span> (hawki_step_detect_obj_save(mask_image, obj_charac, obj_stats,
+<a name="l00335"></a>00335 parlist, framelist) == -1)
+<a name="l00336"></a>00336 {
+<a name="l00337"></a>00337 cpl_msg_warning(__func__, <span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00338"></a>00338 <span class="stringliteral">"Check permisions or disk space"</span>) ;
+<a name="l00339"></a>00339 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00340"></a>00340 {
+<a name="l00341"></a>00341 cpl_table_delete(obj_charac[idet]);
+<a name="l00342"></a>00342 cpl_propertylist_delete(obj_stats[idet]);
+<a name="l00343"></a>00343 cpl_apertures_delete(apertures[idet]);
+<a name="l00344"></a>00344 }
+<a name="l00345"></a>00345 cpl_free(apertures);
+<a name="l00346"></a>00346 cpl_free(obj_charac);
+<a name="l00347"></a>00347 cpl_free(obj_stats);
+<a name="l00348"></a>00348 cpl_frameset_delete(combframes);
+<a name="l00349"></a>00349 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00350"></a>00350 {
+<a name="l00351"></a>00351 cpl_image_delete(mask_image[idet]);
+<a name="l00352"></a>00352 cpl_image_delete(comb_image[idet]);
+<a name="l00353"></a>00353 }
+<a name="l00354"></a>00354 cpl_free(mask_image);
+<a name="l00355"></a>00355 cpl_free(comb_image);
+<a name="l00356"></a>00356 <span class="keywordflow">return</span> -1 ;
+<a name="l00357"></a>00357 }
+<a name="l00358"></a>00358
+<a name="l00359"></a>00359 <span class="comment">/* Return */</span>
+<a name="l00360"></a>00360 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00361"></a>00361 {
+<a name="l00362"></a>00362 cpl_table_delete(obj_charac[idet]);
+<a name="l00363"></a>00363 cpl_propertylist_delete(obj_stats[idet]);
+<a name="l00364"></a>00364 cpl_apertures_delete(apertures[idet]);
+<a name="l00365"></a>00365 cpl_image_delete(mask_image[idet]);
+<a name="l00366"></a>00366 cpl_image_delete(comb_image[idet]);
+<a name="l00367"></a>00367 }
+<a name="l00368"></a>00368 cpl_free(apertures);
+<a name="l00369"></a>00369 cpl_free(obj_charac);
+<a name="l00370"></a>00370 cpl_free(obj_stats);
+<a name="l00371"></a>00371 cpl_frameset_delete(combframes);
+<a name="l00372"></a>00372 cpl_free(mask_image);
+<a name="l00373"></a>00373 cpl_free(comb_image);
+<a name="l00374"></a>00374
+<a name="l00375"></a>00375 <span class="comment">/* Return */</span>
+<a name="l00376"></a>00376 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00377"></a>00377 {
+<a name="l00378"></a>00378 cpl_msg_error(__func__,
+<a name="l00379"></a>00379 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00380"></a>00380 <span class="keywordflow">return</span> -1 ;
+<a name="l00381"></a>00381 }
+<a name="l00382"></a>00382 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00383"></a>00383 }
+<a name="l00384"></a>00384
+<a name="l00385"></a>00385 <span class="keywordtype">int</span> hawki_step_detect_obj_retrieve_input_param
+<a name="l00386"></a>00386 (cpl_parameterlist * parlist)
+<a name="l00387"></a>00387 {
+<a name="l00388"></a>00388 cpl_parameter * par ;
+<a name="l00389"></a>00389
+<a name="l00390"></a>00390 par = NULL ;
+<a name="l00391"></a>00391 par = cpl_parameterlist_find
+<a name="l00392"></a>00392 (parlist, <span class="stringliteral">"hawki.hawki_step_detect_obj.sigma_det"</span>);
+<a name="l00393"></a>00393 hawki_step_detect_obj_config.sigma_det = cpl_parameter_get_double(par);
+<a name="l00394"></a>00394 par = cpl_parameterlist_find
+<a name="l00395"></a>00395 (parlist, <span class="stringliteral">"hawki.hawki_step_detect_obj.growing_radius"</span>);
+<a name="l00396"></a>00396 hawki_step_detect_obj_config.growing_radius = cpl_parameter_get_int(par);
+<a name="l00397"></a>00397 <span class="keywordflow">if</span>(hawki_step_detect_obj_config.growing_radius > 100)
+<a name="l00398"></a>00398 {
+<a name="l00399"></a>00399 cpl_msg_error(__func__,<span class="stringliteral">"The maximum radius allowed is 100"</span>);
+<a name="l00400"></a>00400 <span class="keywordflow">return</span> -1;
+<a name="l00401"></a>00401 }
+<a name="l00402"></a>00402 <span class="keywordflow">if</span>(hawki_step_detect_obj_config.sigma_det <= 0 )
+<a name="l00403"></a>00403 {
+<a name="l00404"></a>00404 cpl_msg_error(__func__,<span class="stringliteral">"Detection sigma has to be greater than 0"</span>);
+<a name="l00405"></a>00405 <span class="keywordflow">return</span> -1;
+<a name="l00406"></a>00406 }
+<a name="l00407"></a>00407
+<a name="l00408"></a>00408 <span class="keywordflow">return</span> 0;
+<a name="l00409"></a>00409 }
+<a name="l00410"></a>00410
+<a name="l00411"></a>00411
+<a name="l00412"></a>00412
+<a name="l00413"></a>00413 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00423"></a>00423 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00424"></a>00424 <span class="keyword">static</span> cpl_apertures ** hawki_step_detect_obj_mask_and_apertures
+<a name="l00425"></a>00425 (cpl_frameset * combframes,
+<a name="l00426"></a>00426 cpl_image ** mask_image,
+<a name="l00427"></a>00427 cpl_image ** comb_image)
+<a name="l00428"></a>00428 {
+<a name="l00429"></a>00429 cpl_apertures ** apertures;
+<a name="l00430"></a>00430 <span class="keywordtype">int</span> idet;
+<a name="l00431"></a>00431
+<a name="l00432"></a>00432 <span class="comment">/* Create output object */</span>
+<a name="l00433"></a>00433 apertures = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_apertures *));
+<a name="l00434"></a>00434
+<a name="l00435"></a>00435 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00436"></a>00436 cpl_msg_indent_more();
+<a name="l00437"></a>00437 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00438"></a>00438 {
+<a name="l00439"></a>00439 cpl_image * chip_image;
+<a name="l00440"></a>00440 cpl_image * chip_image_sort;
+<a name="l00441"></a>00441 cpl_mask * object_mask;
+<a name="l00442"></a>00442 cpl_mask * kernel_op;
+<a name="l00443"></a>00443 cpl_matrix * kernel;
+<a name="l00444"></a>00444 cpl_image * labels;
+<a name="l00445"></a>00445 cpl_size nobj;
+<a name="l00446"></a>00446 <span class="keywordtype">double</span> bkg_level;
+<a name="l00447"></a>00447 <span class="keywordtype">double</span> bkg_noise;
+<a name="l00448"></a>00448 <span class="keywordtype">double</span> threshold;
+<a name="l00449"></a>00449 <span class="keywordtype">int</span> kernel_size;
+<a name="l00450"></a>00450 <span class="keywordtype">int</span> ix;
+<a name="l00451"></a>00451 <span class="keywordtype">int</span> iy;
+<a name="l00452"></a>00452
+<a name="l00453"></a>00453 cpl_msg_info(__func__, <span class="stringliteral">"Detecting objects on chip number %d"</span>, idet+1) ;
+<a name="l00454"></a>00454 cpl_msg_indent_more();
+<a name="l00455"></a>00455
+<a name="l00456"></a>00456 <span class="comment">/* Load the input data */</span>
+<a name="l00457"></a>00457 cpl_msg_info(__func__, <span class="stringliteral">"Load the input data"</span>) ;
+<a name="l00458"></a>00458 chip_image = <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(combframes, 0, idet+1, CPL_TYPE_FLOAT);
+<a name="l00459"></a>00459 <span class="keywordflow">if</span> (chip_image == NULL)
+<a name="l00460"></a>00460 {
+<a name="l00461"></a>00461 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load chip %d"</span>, idet+1) ;
+<a name="l00462"></a>00462 cpl_msg_indent_less() ;
+<a name="l00463"></a>00463 cpl_free(apertures);
+<a name="l00464"></a>00464 <span class="keywordflow">return</span> NULL ;
+<a name="l00465"></a>00465 }
+<a name="l00466"></a>00466
+<a name="l00467"></a>00467 <span class="comment">/* Subtract the median of the frame first */</span>
+<a name="l00468"></a>00468 chip_image_sort = cpl_image_duplicate(chip_image);
+<a name="l00469"></a>00469 bkg_level = cpl_image_get_median(chip_image);
+<a name="l00470"></a>00470 bkg_noise = <a class="code" href="group__hawki__image__stats.html#gade5ca3e76e59c9ab510cb85bc02dd651" title="Get a robust estimation of the sigma based on the quartiles.">hawki_image_float_get_sigma_from_quartile</a>(chip_image_sort);
+<a name="l00471"></a>00471 cpl_image_delete(chip_image_sort);
+<a name="l00472"></a>00472 threshold = bkg_level + hawki_step_detect_obj_config.sigma_det * bkg_noise;
+<a name="l00473"></a>00473 cpl_msg_info(__func__, <span class="stringliteral">"Background: %f"</span>,bkg_level);
+<a name="l00474"></a>00474 cpl_msg_info(__func__, <span class="stringliteral">"Background noise: %f"</span>,bkg_noise);
+<a name="l00475"></a>00475
+<a name="l00476"></a>00476 <span class="comment">/* Create the mask */</span>
+<a name="l00477"></a>00477 cpl_msg_info(__func__, <span class="stringliteral">"Mask creation with threshold: %f"</span>,threshold);
+<a name="l00478"></a>00478 object_mask = cpl_mask_threshold_image_create
+<a name="l00479"></a>00479 (chip_image, threshold, DBL_MAX);
+<a name="l00480"></a>00480
+<a name="l00481"></a>00481 <span class="comment">/* Apply a morphological opening to remove single pixel detections */</span>
+<a name="l00482"></a>00482 cpl_msg_info(__func__, <span class="stringliteral">"Removing single pixel detections"</span>);
+<a name="l00483"></a>00483 kernel_op = cpl_mask_new(3, 3);
+<a name="l00484"></a>00484 cpl_mask_not(kernel_op);
+<a name="l00485"></a>00485 <span class="keywordflow">if</span> (cpl_mask_filter(object_mask, object_mask, kernel_op,
+<a name="l00486"></a>00486 CPL_FILTER_OPENING,
+<a name="l00487"></a>00487 CPL_BORDER_ZERO) != CPL_ERROR_NONE)
+<a name="l00488"></a>00488 {
+<a name="l00489"></a>00489 cpl_mask_delete(object_mask);
+<a name="l00490"></a>00490 cpl_mask_delete(kernel_op);
+<a name="l00491"></a>00491 <span class="keywordflow">return</span> NULL;
+<a name="l00492"></a>00492 }
+<a name="l00493"></a>00493 cpl_mask_delete(kernel_op);
+<a name="l00494"></a>00494
+<a name="l00495"></a>00495 <span class="comment">/* Apply dilation to the mask */</span>
+<a name="l00496"></a>00496 <span class="keywordflow">if</span>(hawki_step_detect_obj_config.growing_radius>0)
+<a name="l00497"></a>00497 {
+<a name="l00498"></a>00498 cpl_msg_info(__func__, <span class="stringliteral">"Growing the mask with radius %d"</span>,
+<a name="l00499"></a>00499 hawki_step_detect_obj_config.growing_radius);
+<a name="l00500"></a>00500 kernel_size = hawki_step_detect_obj_config.growing_radius*2+1;
+<a name="l00501"></a>00501 kernel = cpl_matrix_new(kernel_size, kernel_size);
+<a name="l00502"></a>00502 <span class="keywordflow">for</span>(ix=0;ix<kernel_size;++ix)
+<a name="l00503"></a>00503 <span class="keywordflow">for</span>(iy=0;iy<kernel_size;++iy)
+<a name="l00504"></a>00504 {
+<a name="l00505"></a>00505 <span class="keywordtype">double</span> xpos = ix+0.5-kernel_size/2.;
+<a name="l00506"></a>00506 <span class="keywordtype">double</span> ypos = iy+0.5-kernel_size/2.;
+<a name="l00507"></a>00507 <span class="keywordtype">double</span> kernel_func = 1-sqrt(xpos*xpos+ypos*ypos)/
+<a name="l00508"></a>00508 hawki_step_detect_obj_config.growing_radius;
+<a name="l00509"></a>00509 <span class="keywordflow">if</span>(kernel_func<0)
+<a name="l00510"></a>00510 kernel_func = 0;
+<a name="l00511"></a>00511 cpl_matrix_set(kernel, ix, iy, kernel_func);
+<a name="l00512"></a>00512 }
+<a name="l00513"></a>00513 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__mask.html#ga6154878d3444c3d4204a2a6132719e69">hawki_mask_convolve</a>(object_mask, kernel) != CPL_ERROR_NONE) {
+<a name="l00514"></a>00514 cpl_mask_delete(object_mask) ;
+<a name="l00515"></a>00515 cpl_matrix_delete(kernel) ;
+<a name="l00516"></a>00516 <span class="keywordflow">return</span> NULL;
+<a name="l00517"></a>00517 }
+<a name="l00518"></a>00518 cpl_matrix_delete(kernel);
+<a name="l00519"></a>00519 }
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="comment">/* Put the mask and the chip image in the imagelist */</span>
+<a name="l00522"></a>00522 mask_image[idet] = cpl_image_new_from_mask(object_mask);
+<a name="l00523"></a>00523 comb_image[idet] = chip_image;
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 <span class="comment">/* Labelise the different detected apertures */</span>
+<a name="l00526"></a>00526 cpl_msg_info(__func__, <span class="stringliteral">"Labelise mask"</span>) ;
+<a name="l00527"></a>00527 labels = cpl_image_labelise_mask_create(object_mask, &nobj);
+<a name="l00528"></a>00528 <span class="keywordflow">if</span> (labels == NULL)
+<a name="l00529"></a>00529 {
+<a name="l00530"></a>00530 <span class="keywordtype">int</span> jdet;
+<a name="l00531"></a>00531 cpl_free(apertures);
+<a name="l00532"></a>00532 cpl_mask_delete(object_mask);
+<a name="l00533"></a>00533 <span class="keywordflow">for</span> (jdet=0 ; jdet<idet + 1 ; jdet++)
+<a name="l00534"></a>00534 {
+<a name="l00535"></a>00535 cpl_image_delete(mask_image[jdet]);
+<a name="l00536"></a>00536 cpl_image_delete(comb_image[jdet]);
+<a name="l00537"></a>00537 }
+<a name="l00538"></a>00538 }
+<a name="l00539"></a>00539 cpl_msg_info(__func__, <span class="stringliteral">"Number of objects detected: %"</span>CPL_SIZE_FORMAT,
+<a name="l00540"></a>00540 nobj) ;
+<a name="l00541"></a>00541
+<a name="l00542"></a>00542 <span class="comment">/* Create the detected apertures list */</span>
+<a name="l00543"></a>00543 cpl_msg_info(__func__, <span class="stringliteral">"Create apertures"</span>) ;
+<a name="l00544"></a>00544 apertures[idet] = cpl_apertures_new_from_image(chip_image, labels);
+<a name="l00545"></a>00545 <span class="keywordflow">if</span> (apertures[idet] == NULL)
+<a name="l00546"></a>00546 {
+<a name="l00547"></a>00547 <span class="keywordtype">int</span> jdet;
+<a name="l00548"></a>00548 cpl_free(apertures);
+<a name="l00549"></a>00549 cpl_mask_delete(object_mask);
+<a name="l00550"></a>00550 <span class="keywordflow">for</span> (jdet=0 ; jdet<idet + 1 ; jdet++)
+<a name="l00551"></a>00551 {
+<a name="l00552"></a>00552 cpl_image_delete(mask_image[jdet]);
+<a name="l00553"></a>00553 cpl_image_delete(comb_image[jdet]);
+<a name="l00554"></a>00554 }
+<a name="l00555"></a>00555 <span class="keywordflow">return</span> NULL;
+<a name="l00556"></a>00556 }
+<a name="l00557"></a>00557
+<a name="l00558"></a>00558 <span class="comment">/* Free */</span>
+<a name="l00559"></a>00559 cpl_mask_delete(object_mask);
+<a name="l00560"></a>00560 cpl_image_delete(labels);
+<a name="l00561"></a>00561 cpl_msg_indent_less();
+<a name="l00562"></a>00562 }
+<a name="l00563"></a>00563
+<a name="l00564"></a>00564 <span class="comment">/* Free and return */</span>
+<a name="l00565"></a>00565 cpl_msg_indent_less();
+<a name="l00566"></a>00566 <span class="keywordflow">return</span> apertures;
+<a name="l00567"></a>00567 }
+<a name="l00568"></a>00568
+<a name="l00569"></a>00569 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00576"></a>00576 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00577"></a>00577 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_aper_params
+<a name="l00578"></a>00578 (cpl_image ** combined_images,
+<a name="l00579"></a>00579 cpl_apertures ** apertures,
+<a name="l00580"></a>00580 cpl_table ** obj_charac)
+<a name="l00581"></a>00581 {
+<a name="l00582"></a>00582 <span class="keywordtype">int</span> nb_objs ;
+<a name="l00583"></a>00583 <span class="keywordtype">double</span> angle ;
+<a name="l00584"></a>00584 <span class="keywordtype">double</span> * fwhms_x ;
+<a name="l00585"></a>00585 <span class="keywordtype">double</span> * fwhms_y ;
+<a name="l00586"></a>00586 cpl_bivector * iqe ;
+<a name="l00587"></a>00587 <span class="keywordtype">int</span> nb_good ;
+<a name="l00588"></a>00588 cpl_vector * fwhms_good ;
+<a name="l00589"></a>00589 <span class="keywordtype">double</span> * fwhms_good_data ;
+<a name="l00590"></a>00590 <span class="keywordtype">double</span> f_min, f_max, fr, fx, fy ;
+<a name="l00591"></a>00591 <span class="keywordtype">int</span> chip;
+<a name="l00592"></a>00592 <span class="keywordtype">int</span> iobj;
+<a name="l00593"></a>00593 <span class="keywordtype">int</span> j;
+<a name="l00594"></a>00594
+<a name="l00595"></a>00595 <span class="comment">/* Initialise */</span>
+<a name="l00596"></a>00596 <span class="keywordtype">double</span> seeing_min_arcsec = 0.1 ;
+<a name="l00597"></a>00597 <span class="keywordtype">double</span> seeing_max_arcsec = 5.0 ;
+<a name="l00598"></a>00598 <span class="keywordtype">double</span> seeing_fwhm_var = 0.2 ;
+<a name="l00599"></a>00599
+<a name="l00600"></a>00600 <span class="comment">/* Check entries */</span>
+<a name="l00601"></a>00601 <span class="keywordflow">if</span> (combined_images == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00602"></a>00602 <span class="keywordflow">if</span> (obj_charac == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00603"></a>00603
+<a name="l00604"></a>00604 <span class="comment">/* Loop on the HAWK-I detectors */</span>
+<a name="l00605"></a>00605 cpl_msg_indent_more();
+<a name="l00606"></a>00606 <span class="keywordflow">for</span> (chip=0 ; chip<HAWKI_NB_DETECTORS ; chip++)
+<a name="l00607"></a>00607 {
+<a name="l00608"></a>00608
+<a name="l00609"></a>00609 <span class="comment">/* Number of detected objects */</span>
+<a name="l00610"></a>00610 nb_objs = cpl_apertures_get_size(apertures[chip]);
+<a name="l00611"></a>00611 cpl_msg_info(__func__, <span class="stringliteral">"%d objects detected on chip %d"</span>,nb_objs,chip+1);
+<a name="l00612"></a>00612 hawki_step_detect_obj_output.nbobjs[chip] = nb_objs ;
+<a name="l00613"></a>00613 fwhms_x = cpl_malloc(nb_objs * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)) ;
+<a name="l00614"></a>00614 fwhms_y = cpl_malloc(nb_objs * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)) ;
+<a name="l00615"></a>00615
+<a name="l00616"></a>00616 <span class="comment">/* Initialize the output table */</span>
+<a name="l00617"></a>00617 cpl_table_set_size(obj_charac[chip], nb_objs);
+<a name="l00618"></a>00618 cpl_table_new_column
+<a name="l00619"></a>00619 (obj_charac[chip], HAWKI_COL_OBJ_POSX, CPL_TYPE_DOUBLE);
+<a name="l00620"></a>00620 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSX,<span class="stringliteral">"pix"</span>);
+<a name="l00621"></a>00621 cpl_table_new_column
+<a name="l00622"></a>00622 (obj_charac[chip], HAWKI_COL_OBJ_POSY, CPL_TYPE_DOUBLE);
+<a name="l00623"></a>00623 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSY,<span class="stringliteral">"pix"</span>);
+<a name="l00624"></a>00624 cpl_table_new_column
+<a name="l00625"></a>00625 (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, CPL_TYPE_DOUBLE);
+<a name="l00626"></a>00626 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_ANGLE,<span class="stringliteral">"grad"</span>);
+<a name="l00627"></a>00627 cpl_table_new_column
+<a name="l00628"></a>00628 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, CPL_TYPE_DOUBLE);
+<a name="l00629"></a>00629 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MAJAX,<span class="stringliteral">"pix"</span>);
+<a name="l00630"></a>00630 cpl_table_new_column
+<a name="l00631"></a>00631 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, CPL_TYPE_DOUBLE);
+<a name="l00632"></a>00632 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MINAX,<span class="stringliteral">"pix"</span>);
+<a name="l00633"></a>00633 cpl_table_new_column
+<a name="l00634"></a>00634 (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, CPL_TYPE_DOUBLE);
+<a name="l00635"></a>00635 cpl_table_new_column
+<a name="l00636"></a>00636 (obj_charac[chip], HAWKI_COL_OBJ_FLUX, CPL_TYPE_DOUBLE);
+<a name="l00637"></a>00637 cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FLUX,<span class="stringliteral">"ADU"</span>);
+<a name="l00638"></a>00638 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l00639"></a>00639 {
+<a name="l00640"></a>00640 <span class="comment">/* Fill with the already known information */</span>
+<a name="l00641"></a>00641 cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSX, iobj,
+<a name="l00642"></a>00642 cpl_apertures_get_centroid_x(apertures[chip],
+<a name="l00643"></a>00643 iobj+1));
+<a name="l00644"></a>00644 cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSY, iobj,
+<a name="l00645"></a>00645 cpl_apertures_get_centroid_y(apertures[chip],
+<a name="l00646"></a>00646 iobj+1));
+<a name="l00647"></a>00647 cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_FLUX, iobj,
+<a name="l00648"></a>00648 cpl_apertures_get_flux(apertures[chip],
+<a name="l00649"></a>00649 iobj+1));
+<a name="l00650"></a>00650 <span class="comment">/* Compute the FWHM informations */</span>
+<a name="l00651"></a>00651 iqe = cpl_image_iqe(combined_images[chip],
+<a name="l00652"></a>00652 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_x(apertures[chip], iobj+1)- 10,
+<a name="l00653"></a>00653 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_y(apertures[chip], iobj+1)- 10,
+<a name="l00654"></a>00654 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_x(apertures[chip], iobj+1)+ 10,
+<a name="l00655"></a>00655 (<span class="keywordtype">int</span>)cpl_apertures_get_centroid_y(apertures[chip], iobj+1)+ 10);
+<a name="l00656"></a>00656 <span class="keywordflow">if</span> (iqe == NULL)
+<a name="l00657"></a>00657 {
+<a name="l00658"></a>00658 cpl_error_reset() ;
+<a name="l00659"></a>00659 cpl_msg_debug(__func__, <span class="stringliteral">"Cannot get FWHM for obj at pos %g %g"</span>,
+<a name="l00660"></a>00660 cpl_apertures_get_centroid_x(apertures[chip],
+<a name="l00661"></a>00661 iobj+1),
+<a name="l00662"></a>00662 cpl_apertures_get_centroid_y(apertures[chip],
+<a name="l00663"></a>00663 iobj+1)) ;
+<a name="l00664"></a>00664 fwhms_x[iobj] = -1.0 ;
+<a name="l00665"></a>00665 fwhms_y[iobj] = -1.0 ;
+<a name="l00666"></a>00666 angle = 0.0 ;
+<a name="l00667"></a>00667 }
+<a name="l00668"></a>00668 <span class="keywordflow">else</span>
+<a name="l00669"></a>00669 {
+<a name="l00670"></a>00670 fwhms_x[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 2) ;
+<a name="l00671"></a>00671 fwhms_y[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 3) ;
+<a name="l00672"></a>00672 angle = cpl_vector_get(cpl_bivector_get_x(iqe), 4) ;
+<a name="l00673"></a>00673 cpl_bivector_delete(iqe) ;
+<a name="l00674"></a>00674 cpl_msg_debug(__func__,
+<a name="l00675"></a>00675 <span class="stringliteral">"FWHM for obj at pos %g %g: %g x %g (%g)"</span>,
+<a name="l00676"></a>00676 cpl_apertures_get_centroid_x(apertures[chip],
+<a name="l00677"></a>00677 iobj+1),
+<a name="l00678"></a>00678 cpl_apertures_get_centroid_y(apertures[chip],
+<a name="l00679"></a>00679 iobj+1),
+<a name="l00680"></a>00680 fwhms_x[iobj], fwhms_y[iobj], angle) ;
+<a name="l00681"></a>00681 }
+<a name="l00682"></a>00682 cpl_table_set_double
+<a name="l00683"></a>00683 (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, iobj, angle) ;
+<a name="l00684"></a>00684 cpl_table_set_double
+<a name="l00685"></a>00685 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, iobj,
+<a name="l00686"></a>00686 fwhms_x[iobj]);
+<a name="l00687"></a>00687 cpl_table_set_double
+<a name="l00688"></a>00688 (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, iobj,
+<a name="l00689"></a>00689 fwhms_y[iobj]);
+<a name="l00690"></a>00690 cpl_table_set_double
+<a name="l00691"></a>00691 (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, iobj,
+<a name="l00692"></a>00692 1 - fwhms_y[iobj] / fwhms_x[iobj]);
+<a name="l00693"></a>00693 }
+<a name="l00694"></a>00694
+<a name="l00695"></a>00695 <span class="comment">/* Get the number of good values */</span>
+<a name="l00696"></a>00696 nb_good = 0 ;
+<a name="l00697"></a>00697 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l00698"></a>00698 {
+<a name="l00699"></a>00699 <span class="keywordflow">if</span> ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0)) nb_good++ ;
+<a name="l00700"></a>00700 }
+<a name="l00701"></a>00701 <span class="keywordflow">if</span> (nb_good == 0)
+<a name="l00702"></a>00702 {
+<a name="l00703"></a>00703 cpl_msg_warning
+<a name="l00704"></a>00704 (__func__, <span class="stringliteral">"No objects to compute mean FWHM on chip %d"</span>,chip+1);
+<a name="l00705"></a>00705 cpl_free(fwhms_x) ;
+<a name="l00706"></a>00706 cpl_free(fwhms_y) ;
+<a name="l00707"></a>00707 <span class="keywordflow">continue</span>;
+<a name="l00708"></a>00708 }
+<a name="l00709"></a>00709
+<a name="l00710"></a>00710 <span class="comment">/* Get the good values */</span>
+<a name="l00711"></a>00711 fwhms_good = cpl_vector_new(nb_good) ;
+<a name="l00712"></a>00712 fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+<a name="l00713"></a>00713 j=0 ;
+<a name="l00714"></a>00714 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l00715"></a>00715 {
+<a name="l00716"></a>00716 <span class="keywordflow">if</span> ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0))
+<a name="l00717"></a>00717 {
+<a name="l00718"></a>00718 fwhms_good_data[j] = (fwhms_x[iobj]+fwhms_y[iobj])/2.0 ;
+<a name="l00719"></a>00719 j++ ;
+<a name="l00720"></a>00720 }
+<a name="l00721"></a>00721 }
+<a name="l00722"></a>00722
+<a name="l00723"></a>00723 <span class="comment">/* Compute the fwhm */</span>
+<a name="l00724"></a>00724 <span class="keywordflow">if</span> (nb_good < 3)
+<a name="l00725"></a>00725 {
+<a name="l00726"></a>00726 <span class="comment">/* Too few values to compute the median */</span>
+<a name="l00727"></a>00727 hawki_step_detect_obj_output.fwhm_pix[chip] = fwhms_good_data[0] ;
+<a name="l00728"></a>00728 cpl_msg_warning
+<a name="l00729"></a>00729 (__func__, <span class="stringliteral">"Fewer than 3 objects, using the first object FWHM"</span>);
+<a name="l00730"></a>00730 }
+<a name="l00731"></a>00731 <span class="keywordflow">else</span>
+<a name="l00732"></a>00732 {
+<a name="l00733"></a>00733 <span class="comment">/* Compute the median */</span>
+<a name="l00734"></a>00734 hawki_step_detect_obj_output.fwhm_pix[chip] =
+<a name="l00735"></a>00735 cpl_vector_get_median_const(fwhms_good);
+<a name="l00736"></a>00736 }
+<a name="l00737"></a>00737 hawki_step_detect_obj_output.fwhm_arcsec[chip] =
+<a name="l00738"></a>00738 hawki_step_detect_obj_output.fwhm_pix[chip] *
+<a name="l00739"></a>00739 hawki_step_detect_obj_output.pixscale ;
+<a name="l00740"></a>00740
+<a name="l00741"></a>00741 <span class="comment">/* Compute the mode of the FWHMs */</span>
+<a name="l00742"></a>00742 <span class="keywordflow">if</span> (nb_good > 5)
+<a name="l00743"></a>00743 {
+<a name="l00744"></a>00744 hawki_step_detect_obj_output.fwhm_mode[chip] =
+<a name="l00745"></a>00745 <a class="code" href="group__hawki__utils.html#gac64c154f22c4d25e242833fbe75da886" title="Compute the histogram mode.">hawki_vector_get_mode</a>(fwhms_good);
+<a name="l00746"></a>00746 hawki_step_detect_obj_output.fwhm_mode[chip] *=
+<a name="l00747"></a>00747 hawki_step_detect_obj_output.pixscale;
+<a name="l00748"></a>00748 }
+<a name="l00749"></a>00749 cpl_vector_delete(fwhms_good);
+<a name="l00750"></a>00750
+<a name="l00751"></a>00751 <span class="comment">/* IQ is the median of the (fwhm_x+fwhm_y/2) of the good stars */</span>
+<a name="l00752"></a>00752 <span class="comment">/* Compute f_min and f_max */</span>
+<a name="l00753"></a>00753 f_min = seeing_min_arcsec / hawki_step_detect_obj_output.pixscale;
+<a name="l00754"></a>00754 f_max = seeing_max_arcsec / hawki_step_detect_obj_output.pixscale;
+<a name="l00755"></a>00755
+<a name="l00756"></a>00756 <span class="comment">/* Get the number of good values */</span>
+<a name="l00757"></a>00757 nb_good = 0 ;
+<a name="l00758"></a>00758 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l00759"></a>00759 {
+<a name="l00760"></a>00760 fx = fwhms_x[iobj] ;
+<a name="l00761"></a>00761 fy = fwhms_y[iobj] ;
+<a name="l00762"></a>00762 fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+<a name="l00763"></a>00763 <span class="keywordflow">if</span> ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+<a name="l00764"></a>00764 (fr < seeing_fwhm_var)) nb_good++ ;
+<a name="l00765"></a>00765 }
+<a name="l00766"></a>00766 <span class="keywordflow">if</span> (nb_good == 0)
+<a name="l00767"></a>00767 {
+<a name="l00768"></a>00768 cpl_msg_warning(__func__, <span class="stringliteral">"No objects to compute IQ on chip %d"</span>,
+<a name="l00769"></a>00769 chip+1);
+<a name="l00770"></a>00770 cpl_free(fwhms_x) ;
+<a name="l00771"></a>00771 cpl_free(fwhms_y) ;
+<a name="l00772"></a>00772 <span class="keywordflow">continue</span>;
+<a name="l00773"></a>00773 }
+<a name="l00774"></a>00774
+<a name="l00775"></a>00775 <span class="comment">/* Get the good values */</span>
+<a name="l00776"></a>00776 fwhms_good = cpl_vector_new(nb_good) ;
+<a name="l00777"></a>00777 fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+<a name="l00778"></a>00778 j=0 ;
+<a name="l00779"></a>00779 <span class="keywordflow">for</span> (iobj=0 ; iobj<nb_objs ; iobj++)
+<a name="l00780"></a>00780 {
+<a name="l00781"></a>00781 fx = fwhms_x[iobj] ;
+<a name="l00782"></a>00782 fy = fwhms_y[iobj] ;
+<a name="l00783"></a>00783 fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+<a name="l00784"></a>00784 <span class="keywordflow">if</span> ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+<a name="l00785"></a>00785 (fr < seeing_fwhm_var))
+<a name="l00786"></a>00786 {
+<a name="l00787"></a>00787 fwhms_good_data[j] = (fx + fy)/2.0 ;
+<a name="l00788"></a>00788 j++ ;
+<a name="l00789"></a>00789 }
+<a name="l00790"></a>00790 }
+<a name="l00791"></a>00791 cpl_free(fwhms_x) ;
+<a name="l00792"></a>00792 cpl_free(fwhms_y) ;
+<a name="l00793"></a>00793
+<a name="l00794"></a>00794 <span class="comment">/* Compute the fwhm */</span>
+<a name="l00795"></a>00795 <span class="keywordflow">if</span> (nb_good < 3)
+<a name="l00796"></a>00796 {
+<a name="l00797"></a>00797 <span class="comment">/* Too few values to compute the median */</span>
+<a name="l00798"></a>00798 hawki_step_detect_obj_output.iq[chip] = fwhms_good_data[0] ;
+<a name="l00799"></a>00799 }
+<a name="l00800"></a>00800 <span class="keywordflow">else</span>
+<a name="l00801"></a>00801 {
+<a name="l00802"></a>00802 <span class="comment">/* Compute the median */</span>
+<a name="l00803"></a>00803 hawki_step_detect_obj_output.iq[chip] =
+<a name="l00804"></a>00804 cpl_vector_get_median_const(fwhms_good) ;
+<a name="l00805"></a>00805 }
+<a name="l00806"></a>00806 cpl_vector_delete(fwhms_good);
+<a name="l00807"></a>00807 hawki_step_detect_obj_output.iq[chip] *=
+<a name="l00808"></a>00808 hawki_step_detect_obj_output.pixscale;
+<a name="l00809"></a>00809 }
+<a name="l00810"></a>00810 cpl_msg_indent_less();
+<a name="l00811"></a>00811
+<a name="l00812"></a>00812 <span class="keywordflow">return</span> 0;
+<a name="l00813"></a>00813 }
+<a name="l00814"></a>00814
+<a name="l00815"></a>00815
+<a name="l00816"></a>00816 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00825"></a>00825 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00826"></a>00826 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_detect_obj_save
+<a name="l00827"></a>00827 (cpl_image ** mask_images,
+<a name="l00828"></a>00828 cpl_table ** obj_charac,
+<a name="l00829"></a>00829 cpl_propertylist ** obj_stats,
+<a name="l00830"></a>00830 cpl_parameterlist * parlist,
+<a name="l00831"></a>00831 cpl_frameset * framelist)
+<a name="l00832"></a>00832 {
+<a name="l00833"></a>00833 <span class="keyword">const</span> cpl_frame * ref_frame ;
+<a name="l00834"></a>00834 cpl_propertylist ** qclists;
+<a name="l00835"></a>00835 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00836"></a>00836 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_detect_obj"</span> ;
+<a name="l00837"></a>00837 <span class="keywordtype">int</span> i;
+<a name="l00838"></a>00838 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00839"></a>00839
+<a name="l00840"></a>00840
+<a name="l00841"></a>00841
+<a name="l00842"></a>00842 <span class="comment">/* Load the WCS keys */</span>
+<a name="l00843"></a>00843 ref_frame = irplib_frameset_get_first_from_group
+<a name="l00844"></a>00844 (framelist, CPL_FRAME_GROUP_RAW);
+<a name="l00845"></a>00845
+<a name="l00846"></a>00846 <span class="comment">/* Create the QC lists */</span>
+<a name="l00847"></a>00847 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l00848"></a>00848 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+<a name="l00849"></a>00849 {
+<a name="l00850"></a>00850 cpl_propertylist * inputlist;
+<a name="l00851"></a>00851 cpl_propertylist * offsetlist;
+<a name="l00852"></a>00852 cpl_propertylist * wcslist;
+<a name="l00853"></a>00853
+<a name="l00854"></a>00854 <span class="comment">/* Get the extension number */</span>
+<a name="l00855"></a>00855 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), i+1);
+<a name="l00856"></a>00856 qclists[i] = cpl_propertylist_new() ;
+<a name="l00857"></a>00857
+<a name="l00858"></a>00858 <span class="comment">/* Fill the QC */</span>
+<a name="l00859"></a>00859 cpl_propertylist_append_int
+<a name="l00860"></a>00860 (qclists[i], <span class="stringliteral">"ESO QC NBOBJS"</span>,
+<a name="l00861"></a>00861 hawki_step_detect_obj_output.nbobjs[i]);
+<a name="l00862"></a>00862 cpl_propertylist_append_double
+<a name="l00863"></a>00863 (qclists[i], <span class="stringliteral">"ESO QC IQ"</span>, hawki_step_detect_obj_output.iq[i]);
+<a name="l00864"></a>00864 cpl_propertylist_append_double
+<a name="l00865"></a>00865 (qclists[i], <span class="stringliteral">"ESO QC FWHM PIX"</span>,
+<a name="l00866"></a>00866 hawki_step_detect_obj_output.fwhm_pix[i]);
+<a name="l00867"></a>00867 cpl_propertylist_append_double
+<a name="l00868"></a>00868 (qclists[i], <span class="stringliteral">"ESO QC FWHM ARCSEC"</span>,
+<a name="l00869"></a>00869 hawki_step_detect_obj_output.fwhm_arcsec[i]);
+<a name="l00870"></a>00870 cpl_propertylist_append_double
+<a name="l00871"></a>00871 (qclists[i], <span class="stringliteral">"ESO QC FWHM MODE"</span>,
+<a name="l00872"></a>00872 hawki_step_detect_obj_output.fwhm_mode[i]);
+<a name="l00873"></a>00873
+<a name="l00874"></a>00874 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00875"></a>00875 inputlist = cpl_propertylist_load_regexp(
+<a name="l00876"></a>00876 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00877"></a>00877 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00878"></a>00878 offsetlist = cpl_propertylist_load_regexp(
+<a name="l00879"></a>00879 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00880"></a>00880 HAWKI_HEADER_COMB_OFFSETS, 0);
+<a name="l00881"></a>00881 wcslist = cpl_propertylist_load_regexp(
+<a name="l00882"></a>00882 cpl_frame_get_filename(ref_frame), ext_nb,
+<a name="l00883"></a>00883 HAWKI_HEADER_WCS, 0);
+<a name="l00884"></a>00884 cpl_propertylist_append(qclists[i], inputlist);
+<a name="l00885"></a>00885 cpl_propertylist_append(qclists[i], offsetlist);
+<a name="l00886"></a>00886 cpl_propertylist_append(qclists[i], wcslist);
+<a name="l00887"></a>00887 cpl_propertylist_delete(inputlist);
+<a name="l00888"></a>00888 cpl_propertylist_delete(offsetlist);
+<a name="l00889"></a>00889 cpl_propertylist_delete(wcslist);
+<a name="l00890"></a>00890
+<a name="l00891"></a>00891 <span class="comment">/* Add the object statistics keywords */</span>
+<a name="l00892"></a>00892 cpl_propertylist_append(qclists[i], obj_stats[i]);
+<a name="l00893"></a>00893 }
+<a name="l00894"></a>00894
+<a name="l00895"></a>00895
+<a name="l00896"></a>00896 <span class="comment">/* Write the object mask */</span>
+<a name="l00897"></a>00897 <a class="code" href="group__hawki__save.html#ga096962e65c0aab2bce1e9b2419789bd4" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_images_save</a>(framelist,
+<a name="l00898"></a>00898 parlist,
+<a name="l00899"></a>00899 framelist,
+<a name="l00900"></a>00900 (<span class="keyword">const</span> cpl_image**)mask_images,
+<a name="l00901"></a>00901 recipe_name,
+<a name="l00902"></a>00902 HAWKI_CALPRO_OBJ_MASK,
+<a name="l00903"></a>00903 HAWKI_PROTYPE_OBJ_MASK,
+<a name="l00904"></a>00904 NULL,
+<a name="l00905"></a>00905 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l00906"></a>00906 <span class="stringliteral">"hawki_step_detect_obj_mask.fits"</span>) ;
+<a name="l00907"></a>00907
+<a name="l00908"></a>00908 <span class="comment">/* Write the FITS table with the objects statistics */</span>
+<a name="l00909"></a>00909 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(framelist,
+<a name="l00910"></a>00910 parlist,
+<a name="l00911"></a>00911 framelist,
+<a name="l00912"></a>00912 (<span class="keyword">const</span> cpl_table **)obj_charac,
+<a name="l00913"></a>00913 recipe_name,
+<a name="l00914"></a>00914 HAWKI_CALPRO_OBJ_PARAM,
+<a name="l00915"></a>00915 HAWKI_PROTYPE_OBJ_PARAM,
+<a name="l00916"></a>00916 NULL,
+<a name="l00917"></a>00917 (<span class="keyword">const</span> cpl_propertylist**)qclists,
+<a name="l00918"></a>00918 <span class="stringliteral">"hawki_step_detect_obj_stars.fits"</span>) ;
+<a name="l00919"></a>00919
+<a name="l00920"></a>00920
+<a name="l00921"></a>00921 <span class="comment">/* Free and return */</span>
+<a name="l00922"></a>00922 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00923"></a>00923 cpl_propertylist_delete(qclists[i]) ;
+<a name="l00924"></a>00924 }
+<a name="l00925"></a>00925 cpl_free(qclists) ;
+<a name="l00926"></a>00926 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00927"></a>00927 {
+<a name="l00928"></a>00928 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00929"></a>00929 <span class="keywordflow">return</span> -1;
+<a name="l00930"></a>00930 }
+<a name="l00931"></a>00931 <span class="keywordflow">return</span> 0;
+<a name="l00932"></a>00932 }
+<a name="l00933"></a>00933
+<a name="l00934"></a>00934 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_step_detect_obj_init_output(<span class="keywordtype">void</span>)
+<a name="l00935"></a>00935 {
+<a name="l00936"></a>00936 <span class="keywordtype">int</span> idet;
+<a name="l00937"></a>00937
+<a name="l00938"></a>00938 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00939"></a>00939 {
+<a name="l00940"></a>00940 hawki_step_detect_obj_output.iq[idet] = -1.0 ;
+<a name="l00941"></a>00941 hawki_step_detect_obj_output.nbobjs[idet] = -1 ;
+<a name="l00942"></a>00942 hawki_step_detect_obj_output.fwhm_pix[idet] = -1.0 ;
+<a name="l00943"></a>00943 hawki_step_detect_obj_output.fwhm_arcsec[idet] = -1.0 ;
+<a name="l00944"></a>00944 hawki_step_detect_obj_output.fwhm_mode[idet] = -1.0 ;
+<a name="l00945"></a>00945 hawki_step_detect_obj_output.pos_x[idet] = -1.0 ;
+<a name="l00946"></a>00946 hawki_step_detect_obj_output.pos_y[idet] = -1.0 ;
+<a name="l00947"></a>00947 }
+<a name="l00948"></a>00948 hawki_step_detect_obj_output.pixscale = -1.0;
+<a name="l00949"></a>00949 }
+<a name="l00950"></a>00950
+<a name="l00951"></a>00951 <span class="keyword">static</span> <span class="keywordtype">void</span> hawki_step_detect_obj_get_pscale
+<a name="l00952"></a>00952 (cpl_frameset * combframes)
+<a name="l00953"></a>00953 {
+<a name="l00954"></a>00954 cpl_propertylist * plist;
+<a name="l00955"></a>00955 cpl_frame * firstframe;
+<a name="l00956"></a>00956 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00957"></a>00957
+<a name="l00958"></a>00958 <span class="comment">/* Get the header infos */</span>
+<a name="l00959"></a>00959 firstframe = cpl_frameset_get_frame(combframes, 0) ;
+<a name="l00960"></a>00960 plist=cpl_propertylist_load(cpl_frame_get_filename(firstframe), 0) ;
+<a name="l00961"></a>00961 hawki_step_detect_obj_output.pixscale = <a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b" title="find out the pixel scale">hawki_pfits_get_pixscale</a>(plist);
+<a name="l00962"></a>00962 cpl_propertylist_delete(plist) ;
+<a name="l00963"></a>00963 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00964"></a>00964 {
+<a name="l00965"></a>00965 cpl_msg_error(__func__, <span class="stringliteral">"Missing PIXSCALE keyword in FITS header"</span>) ;
+<a name="l00966"></a>00966 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00967"></a>00967 <span class="keywordflow">return</span>;
+<a name="l00968"></a>00968 }
+<a name="l00969"></a>00969 }
+<a name="l00970"></a>00970
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__photom__2mass_8c_source.html b/html/hawki__step__photom__2mass_8c_source.html
new file mode 100644
index 0000000..97b04c9
--- /dev/null
+++ b/html/hawki__step__photom__2mass_8c_source.html
@@ -0,0 +1,975 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_photom_2mass.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_photom_2mass.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_photom_2mass.c,v 1.17 2012/04/23 10:08:45 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/04/23 10:08:45 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.17 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <string.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_alloc.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "irplib_cat.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "irplib_stdstar.h"</span>
+<a name="l00050"></a>00050
+<a name="l00051"></a>00051 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00052"></a>00052 <span class="comment"> Functions prototypes</span>
+<a name="l00053"></a>00053 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_create(cpl_plugin *) ;
+<a name="l00056"></a>00056 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_exec(cpl_plugin *) ;
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_destroy(cpl_plugin *) ;
+<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass(cpl_parameterlist * parlist,
+<a name="l00059"></a>00059 cpl_frameset * frameset);
+<a name="l00060"></a>00060
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 cpl_table ** hawki_step_photom_2mass_get_zpoints
+<a name="l00063"></a>00063 (cpl_frameset * cat_2mass,
+<a name="l00064"></a>00064 cpl_frameset * obj_param,
+<a name="l00065"></a>00065 cpl_frameset * obj_ima);
+<a name="l00066"></a>00066
+<a name="l00067"></a>00067 <span class="keyword">static</span> cpl_table * hawki_step_photom_2mass_retrieve_stars
+<a name="l00068"></a>00068 (cpl_frameset * cat_2mass,
+<a name="l00069"></a>00069 cpl_propertylist * wcs_keywords);
+<a name="l00070"></a>00070
+<a name="l00071"></a>00071 <span class="keyword">static</span> cpl_array * hawki_step_photom_2mass_ppm
+<a name="l00072"></a>00072 (cpl_table * stars_2mass,
+<a name="l00073"></a>00073 cpl_table * obj_det);
+<a name="l00074"></a>00074
+<a name="l00075"></a>00075 <span class="keyword">static</span> cpl_table * hawki_step_photom_2mass_fill_zpoint_table
+<a name="l00076"></a>00076 (cpl_table * stars_2mass,
+<a name="l00077"></a>00077 cpl_table * obj_det_param,
+<a name="l00078"></a>00078 cpl_array * matches,
+<a name="l00079"></a>00079 cpl_propertylist * plist,
+<a name="l00080"></a>00080 <span class="keywordtype">int</span> idet);
+<a name="l00081"></a>00081
+<a name="l00082"></a>00082 <span class="keyword">static</span> cpl_propertylist ** hawki_step_photom_2mass_qc
+<a name="l00083"></a>00083 (cpl_table ** zpoint_table);
+<a name="l00084"></a>00084
+<a name="l00085"></a>00085 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_save
+<a name="l00086"></a>00086 (cpl_table ** zpoints,
+<a name="l00087"></a>00087 cpl_parameterlist * parlist,
+<a name="l00088"></a>00088 cpl_propertylist ** qclists,
+<a name="l00089"></a>00089 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00090"></a>00090
+<a name="l00091"></a>00091 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00092"></a>00092 <span class="comment"> Static variables</span>
+<a name="l00093"></a>00093 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00094"></a>00094
+<a name="l00095"></a>00095 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_photom_2mass_description[] =
+<a name="l00096"></a>00096 <span class="stringliteral">"hawki_step_photom_2mass -- HAWK-I photometric autocalibration using 2MASS.\n"</span>
+<a name="l00097"></a>00097 <span class="stringliteral">"The input files must be tagged:\n"</span>
+<a name="l00098"></a>00098 <span class="stringliteral">"obj_param.fits "</span>HAWKI_CALPRO_OBJ_PARAM<span class="stringliteral">"\n"</span>
+<a name="l00099"></a>00099 <span class="stringliteral">"image.fits "</span>HAWKI_CALPRO_COMBINED<span class="stringliteral">"\n"</span>
+<a name="l00100"></a>00100 <span class="stringliteral">"2mass_master_index.fits "</span>HAWKI_UTIL_CAT_2MASS<span class="stringliteral">"\n"</span>
+<a name="l00101"></a>00101 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00102"></a>00102 <span class="stringliteral">"hawki_cal_photom_2mass.fits ("</span>HAWKI_CALPRO_ZPOINT_TAB<span class="stringliteral">"): \n"</span>
+<a name="l00103"></a>00103 <span class="stringliteral">"The recipe does the following steps:\n"</span>
+<a name="l00104"></a>00104 <span class="stringliteral">"-Search the 2MASS catalogue for stars in the FOV\n"</span>
+<a name="l00105"></a>00105 <span class="stringliteral">"-Matches the input detected object catalogue and the 2MASS stars\n"</span>
+<a name="l00106"></a>00106 <span class="stringliteral">"-Computes photometric characteristics for each matched star\n"</span>
+<a name="l00107"></a>00107 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00110"></a>00110
+<a name="l00111"></a>00111 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00112"></a>00112 <span class="comment"> Functions code</span>
+<a name="l00113"></a>00113 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00114"></a>00114
+<a name="l00115"></a>00115 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00123"></a>00123 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00124"></a>00124 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00125"></a>00125 {
+<a name="l00126"></a>00126 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00127"></a>00127 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00128"></a>00128
+<a name="l00129"></a>00129 cpl_plugin_init(plugin,
+<a name="l00130"></a>00130 CPL_PLUGIN_API,
+<a name="l00131"></a>00131 HAWKI_BINARY_VERSION,
+<a name="l00132"></a>00132 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00133"></a>00133 <span class="stringliteral">"hawki_step_photom_2mass"</span>,
+<a name="l00134"></a>00134 <span class="stringliteral">"2MASS photometric calibration"</span>,
+<a name="l00135"></a>00135 hawki_step_photom_2mass_description,
+<a name="l00136"></a>00136 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00137"></a>00137 PACKAGE_BUGREPORT,
+<a name="l00138"></a>00138 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00139"></a>00139 hawki_step_photom_2mass_create,
+<a name="l00140"></a>00140 hawki_step_photom_2mass_exec,
+<a name="l00141"></a>00141 hawki_step_photom_2mass_destroy);
+<a name="l00142"></a>00142
+<a name="l00143"></a>00143 cpl_pluginlist_append(list, plugin) ;
+<a name="l00144"></a>00144
+<a name="l00145"></a>00145 <span class="keywordflow">return</span> 0;
+<a name="l00146"></a>00146 }
+<a name="l00147"></a>00147
+<a name="l00148"></a>00148 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00157"></a>00157 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00158"></a>00158 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_create(cpl_plugin * plugin)
+<a name="l00159"></a>00159 {
+<a name="l00160"></a>00160 cpl_recipe * recipe ;
+<a name="l00161"></a>00161
+<a name="l00162"></a>00162 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00163"></a>00163 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00164"></a>00164 recipe = (cpl_recipe *)plugin ;
+<a name="l00165"></a>00165 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00168"></a>00168 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00169"></a>00169 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00170"></a>00170 <span class="keywordflow">return</span> 1;
+<a name="l00171"></a>00171
+<a name="l00172"></a>00172 <span class="comment">/* Return */</span>
+<a name="l00173"></a>00173 <span class="keywordflow">return</span> 0;
+<a name="l00174"></a>00174 }
+<a name="l00175"></a>00175
+<a name="l00176"></a>00176 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00182"></a>00182 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00183"></a>00183 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_exec(cpl_plugin * plugin)
+<a name="l00184"></a>00184 {
+<a name="l00185"></a>00185 cpl_recipe * recipe ;
+<a name="l00186"></a>00186
+<a name="l00187"></a>00187 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00188"></a>00188 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00189"></a>00189 recipe = (cpl_recipe *)plugin ;
+<a name="l00190"></a>00190 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00191"></a>00191
+<a name="l00192"></a>00192 <span class="comment">/* Issue a banner */</span>
+<a name="l00193"></a>00193 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00194"></a>00194
+<a name="l00195"></a>00195 <span class="keywordflow">return</span> hawki_step_photom_2mass(recipe->parameters, recipe->frames) ;
+<a name="l00196"></a>00196 }
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00204"></a>00204 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00205"></a>00205 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_destroy(cpl_plugin * plugin)
+<a name="l00206"></a>00206 {
+<a name="l00207"></a>00207 cpl_recipe * recipe ;
+<a name="l00208"></a>00208
+<a name="l00209"></a>00209 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00210"></a>00210 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00211"></a>00211 recipe = (cpl_recipe *)plugin ;
+<a name="l00212"></a>00212 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00213"></a>00213
+<a name="l00214"></a>00214 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00215"></a>00215 <span class="keywordflow">return</span> 0 ;
+<a name="l00216"></a>00216 }
+<a name="l00217"></a>00217
+<a name="l00218"></a>00218 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00224"></a>00224 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00225"></a>00225 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass(cpl_parameterlist * parlist,
+<a name="l00226"></a>00226 cpl_frameset * frameset)
+<a name="l00227"></a>00227 {
+<a name="l00228"></a>00228 cpl_frameset * cat_2mass;
+<a name="l00229"></a>00229 cpl_frameset * obj_param;
+<a name="l00230"></a>00230 cpl_frameset * obj_ima;
+<a name="l00231"></a>00231 cpl_table ** zpoint_table;
+<a name="l00232"></a>00232 cpl_propertylist ** qclists;
+<a name="l00233"></a>00233 <span class="keywordtype">int</span> idet;
+<a name="l00234"></a>00234
+<a name="l00235"></a>00235 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00236"></a>00236 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(frameset)) {
+<a name="l00237"></a>00237 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00238"></a>00238 <span class="keywordflow">return</span> -1 ;
+<a name="l00239"></a>00239 }
+<a name="l00240"></a>00240
+<a name="l00241"></a>00241 <span class="comment">/* Retrieve 2MASS catalogue */</span>
+<a name="l00242"></a>00242 <span class="keywordflow">if</span> ((cat_2mass = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(frameset,
+<a name="l00243"></a>00243 HAWKI_UTIL_CAT_2MASS)) == NULL)
+<a name="l00244"></a>00244 {
+<a name="l00245"></a>00245 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find 2MASS catalogue (%s)"</span>,
+<a name="l00246"></a>00246 HAWKI_UTIL_CAT_2MASS);
+<a name="l00247"></a>00247 <span class="keywordflow">return</span> -1 ;
+<a name="l00248"></a>00248 }
+<a name="l00249"></a>00249
+<a name="l00250"></a>00250 <span class="comment">/* Retrieve obj param */</span>
+<a name="l00251"></a>00251 <span class="keywordflow">if</span> ((obj_param = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00252"></a>00252 (frameset, HAWKI_CALPRO_OBJ_PARAM)) == NULL)
+<a name="l00253"></a>00253 {
+<a name="l00254"></a>00254 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find object parameters (%s)"</span>,
+<a name="l00255"></a>00255 HAWKI_CALPRO_OBJ_PARAM);
+<a name="l00256"></a>00256 <span class="keywordflow">return</span> -1 ;
+<a name="l00257"></a>00257 }
+<a name="l00258"></a>00258
+<a name="l00259"></a>00259 <span class="comment">/* Retrieve reference image */</span>
+<a name="l00260"></a>00260 <span class="keywordflow">if</span> ((obj_ima = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00261"></a>00261 (frameset, HAWKI_CALPRO_COMBINED)) == NULL)
+<a name="l00262"></a>00262 {
+<a name="l00263"></a>00263 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find combined image (%s) "</span>,
+<a name="l00264"></a>00264 HAWKI_CALPRO_COMBINED);
+<a name="l00265"></a>00265 <span class="keywordflow">return</span> -1 ;
+<a name="l00266"></a>00266 }
+<a name="l00267"></a>00267
+<a name="l00268"></a>00268 <span class="comment">/* Compute the zpoints */</span>
+<a name="l00269"></a>00269 zpoint_table = hawki_step_photom_2mass_get_zpoints
+<a name="l00270"></a>00270 (cat_2mass, obj_param, obj_ima);
+<a name="l00271"></a>00271 <span class="keywordflow">if</span>(zpoint_table == NULL)
+<a name="l00272"></a>00272 {
+<a name="l00273"></a>00273 cpl_msg_error(__func__,<span class="stringliteral">"Could not get the zpoints"</span>);
+<a name="l00274"></a>00274 cpl_frameset_delete(cat_2mass);
+<a name="l00275"></a>00275 cpl_frameset_delete(obj_param);
+<a name="l00276"></a>00276 cpl_frameset_delete(obj_ima);
+<a name="l00277"></a>00277 <span class="keywordflow">return</span> -1;
+<a name="l00278"></a>00278 }
+<a name="l00279"></a>00279
+<a name="l00280"></a>00280 <span class="comment">/* Get some QC */</span>
+<a name="l00281"></a>00281 qclists = hawki_step_photom_2mass_qc(zpoint_table);
+<a name="l00282"></a>00282 <span class="keywordflow">if</span>(zpoint_table == NULL)
+<a name="l00283"></a>00283 {
+<a name="l00284"></a>00284 cpl_msg_error(__func__,<span class="stringliteral">"Could not compute quality controls"</span>);
+<a name="l00285"></a>00285 cpl_frameset_delete(cat_2mass);
+<a name="l00286"></a>00286 cpl_frameset_delete(obj_param);
+<a name="l00287"></a>00287 cpl_frameset_delete(obj_ima);
+<a name="l00288"></a>00288 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_table);
+<a name="l00289"></a>00289 <span class="keywordflow">return</span> -1;
+<a name="l00290"></a>00290 }
+<a name="l00291"></a>00291
+<a name="l00292"></a>00292 <span class="comment">/* Save the products */</span>
+<a name="l00293"></a>00293 cpl_msg_info(__func__,<span class="stringliteral">"Saving products"</span>);
+<a name="l00294"></a>00294 <span class="keywordflow">if</span>(hawki_step_photom_2mass_save(zpoint_table, parlist, qclists, frameset) == -1)
+<a name="l00295"></a>00295 {
+<a name="l00296"></a>00296 cpl_msg_error(__func__,<span class="stringliteral">"Could not save products"</span>);
+<a name="l00297"></a>00297 cpl_frameset_delete(cat_2mass);
+<a name="l00298"></a>00298 cpl_frameset_delete(obj_param);
+<a name="l00299"></a>00299 cpl_frameset_delete(obj_ima);
+<a name="l00300"></a>00300 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_table);
+<a name="l00301"></a>00301 <span class="keywordflow">return</span> -1;
+<a name="l00302"></a>00302 }
+<a name="l00303"></a>00303
+<a name="l00304"></a>00304 <span class="comment">/* Free and return */</span>
+<a name="l00305"></a>00305 cpl_frameset_delete(cat_2mass);
+<a name="l00306"></a>00306 cpl_frameset_delete(obj_param);
+<a name="l00307"></a>00307 cpl_frameset_delete(obj_ima);
+<a name="l00308"></a>00308 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_table);
+<a name="l00309"></a>00309 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00310"></a>00310 cpl_propertylist_delete(qclists[idet]);
+<a name="l00311"></a>00311 cpl_free(qclists);
+<a name="l00312"></a>00312
+<a name="l00313"></a>00313 <span class="comment">/* Return */</span>
+<a name="l00314"></a>00314 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00315"></a>00315 {
+<a name="l00316"></a>00316 cpl_msg_error(__func__,
+<a name="l00317"></a>00317 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00318"></a>00318 <span class="keywordflow">return</span> -1 ;
+<a name="l00319"></a>00319 }
+<a name="l00320"></a>00320 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00321"></a>00321 }
+<a name="l00322"></a>00322
+<a name="l00323"></a>00323 cpl_table ** hawki_step_photom_2mass_get_zpoints
+<a name="l00324"></a>00324 (cpl_frameset * cat_2mass,
+<a name="l00325"></a>00325 cpl_frameset * obj_param,
+<a name="l00326"></a>00326 cpl_frameset * obj_ima)
+<a name="l00327"></a>00327 {
+<a name="l00328"></a>00328 cpl_table ** zpoint_table;
+<a name="l00329"></a>00329 cpl_table ** obj_det_param;
+<a name="l00330"></a>00330 cpl_propertylist * plist;
+<a name="l00331"></a>00331 <span class="keywordtype">int</span> idet;
+<a name="l00332"></a>00332 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00333"></a>00333
+<a name="l00334"></a>00334 <span class="comment">/* Allocate zpoint_table */</span>
+<a name="l00335"></a>00335 zpoint_table = cpl_malloc(<span class="keyword">sizeof</span>(cpl_table *) * HAWKI_NB_DETECTORS);
+<a name="l00336"></a>00336
+<a name="l00337"></a>00337 <span class="comment">/* Load detected obj */</span>
+<a name="l00338"></a>00338 obj_det_param = <a class="code" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0" title="Load a table with four extensions, one for each chip.">hawki_load_tables</a>(cpl_frameset_get_first(obj_param));
+<a name="l00339"></a>00339
+<a name="l00340"></a>00340 <span class="comment">/* Read the main header */</span>
+<a name="l00341"></a>00341 plist = cpl_propertylist_load
+<a name="l00342"></a>00342 (cpl_frame_get_filename(cpl_frameset_get_first(obj_ima)), 0);
+<a name="l00343"></a>00343 <span class="comment">/* Loop on detectors */</span>
+<a name="l00344"></a>00344 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00345"></a>00345 {
+<a name="l00346"></a>00346 cpl_propertylist * wcs_info;
+<a name="l00347"></a>00347 cpl_table * stars_2mass;
+<a name="l00348"></a>00348 cpl_array * matches;
+<a name="l00349"></a>00349 <span class="keywordtype">int</span> ext_nb;
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 cpl_msg_info(__func__,<span class="stringliteral">"Working on chip %d"</span>, idet + 1);
+<a name="l00352"></a>00352 cpl_msg_indent_more();
+<a name="l00353"></a>00353
+<a name="l00354"></a>00354 <span class="comment">/* Retrieve stars */</span>
+<a name="l00355"></a>00355 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00356"></a>00356 (cpl_frame_get_filename(cpl_frameset_get_first(obj_ima)),idet+1);
+<a name="l00357"></a>00357 wcs_info = cpl_propertylist_load
+<a name="l00358"></a>00358 (cpl_frame_get_filename(cpl_frameset_get_first(obj_ima)), ext_nb);
+<a name="l00359"></a>00359 stars_2mass =
+<a name="l00360"></a>00360 hawki_step_photom_2mass_retrieve_stars(cat_2mass, wcs_info);
+<a name="l00361"></a>00361 <span class="keywordflow">if</span>(stars_2mass == NULL)
+<a name="l00362"></a>00362 {
+<a name="l00363"></a>00363 <span class="keywordtype">int</span> jdet;
+<a name="l00364"></a>00364 cpl_msg_error(__func__, <span class="stringliteral">"Cannot retrieve stars"</span>);
+<a name="l00365"></a>00365 cpl_propertylist_delete(plist);
+<a name="l00366"></a>00366 cpl_propertylist_delete(wcs_info);
+<a name="l00367"></a>00367 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(obj_det_param);
+<a name="l00368"></a>00368 <span class="keywordflow">for</span>(jdet = 0; jdet <idet; ++jdet)
+<a name="l00369"></a>00369 cpl_table_delete(zpoint_table[jdet]);
+<a name="l00370"></a>00370 cpl_free(zpoint_table);
+<a name="l00371"></a>00371 <span class="keywordflow">return</span> NULL;
+<a name="l00372"></a>00372 }
+<a name="l00373"></a>00373
+<a name="l00374"></a>00374 <span class="comment">/* Pattern matching btw stars in 2MASS and detected ones */</span>
+<a name="l00375"></a>00375 cpl_msg_info(__func__,<span class="stringliteral">"Matching %"</span>CPL_SIZE_FORMAT
+<a name="l00376"></a>00376 <span class="stringliteral">" 2MASS stars and %"</span>CPL_SIZE_FORMAT<span class="stringliteral">" detections"</span>,
+<a name="l00377"></a>00377 cpl_table_get_nrow(stars_2mass),
+<a name="l00378"></a>00378 cpl_table_get_nrow(obj_det_param[idet]));
+<a name="l00379"></a>00379 matches = hawki_step_photom_2mass_ppm(stars_2mass, obj_det_param[idet]);
+<a name="l00380"></a>00380
+<a name="l00381"></a>00381 <span class="comment">/* Fill the zpoint table */</span>
+<a name="l00382"></a>00382 cpl_msg_info(__func__,<span class="stringliteral">"Computing zero points"</span>);
+<a name="l00383"></a>00383 zpoint_table[idet] = hawki_step_photom_2mass_fill_zpoint_table
+<a name="l00384"></a>00384 (stars_2mass, obj_det_param[idet], matches, plist, idet);
+<a name="l00385"></a>00385 <span class="keywordflow">if</span>(zpoint_table[idet] == NULL)
+<a name="l00386"></a>00386 {
+<a name="l00387"></a>00387 <span class="keywordtype">int</span> jdet;
+<a name="l00388"></a>00388 cpl_msg_error(__func__, <span class="stringliteral">"Could not compute the zero points"</span>);
+<a name="l00389"></a>00389 cpl_propertylist_delete(plist);
+<a name="l00390"></a>00390 cpl_propertylist_delete(wcs_info);
+<a name="l00391"></a>00391 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(obj_det_param);
+<a name="l00392"></a>00392 cpl_table_delete(stars_2mass);
+<a name="l00393"></a>00393 <span class="keywordflow">for</span>(jdet = 0; jdet <idet; ++jdet)
+<a name="l00394"></a>00394 cpl_table_delete(zpoint_table[jdet]);
+<a name="l00395"></a>00395 cpl_free(zpoint_table);
+<a name="l00396"></a>00396 cpl_array_delete(matches);
+<a name="l00397"></a>00397 <span class="keywordflow">return</span> NULL;
+<a name="l00398"></a>00398 }
+<a name="l00399"></a>00399
+<a name="l00400"></a>00400 <span class="comment">/* Cleaning resources */</span>
+<a name="l00401"></a>00401 cpl_msg_indent_less();
+<a name="l00402"></a>00402 cpl_propertylist_delete(wcs_info);
+<a name="l00403"></a>00403 cpl_table_delete(stars_2mass);
+<a name="l00404"></a>00404 cpl_array_delete(matches);
+<a name="l00405"></a>00405 }
+<a name="l00406"></a>00406
+<a name="l00407"></a>00407 <span class="comment">/* Free and return */</span>
+<a name="l00408"></a>00408 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(obj_det_param);
+<a name="l00409"></a>00409 cpl_propertylist_delete(plist);
+<a name="l00410"></a>00410 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00411"></a>00411 {
+<a name="l00412"></a>00412 <span class="keywordtype">int</span> jdet;
+<a name="l00413"></a>00413 <span class="keywordflow">for</span>(jdet = 0; jdet <HAWKI_NB_DETECTORS; ++jdet)
+<a name="l00414"></a>00414 cpl_table_delete(zpoint_table[jdet]);
+<a name="l00415"></a>00415 cpl_free(zpoint_table);
+<a name="l00416"></a>00416 cpl_msg_error(__func__, <span class="stringliteral">"A problem happened computing the zero point"</span>);
+<a name="l00417"></a>00417 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00418"></a>00418 <span class="keywordflow">return</span> NULL;
+<a name="l00419"></a>00419 }
+<a name="l00420"></a>00420 <span class="keywordflow">return</span> zpoint_table;
+<a name="l00421"></a>00421 }
+<a name="l00422"></a>00422
+<a name="l00423"></a>00423 <span class="keyword">static</span> cpl_table * hawki_step_photom_2mass_retrieve_stars
+<a name="l00424"></a>00424 (cpl_frameset * cat_2mass,
+<a name="l00425"></a>00425 cpl_propertylist * wcs_keywords)
+<a name="l00426"></a>00426 {
+<a name="l00427"></a>00427 <span class="keywordtype">char</span> * catpath;
+<a name="l00428"></a>00428 <span class="keywordtype">char</span> * catname;
+<a name="l00429"></a>00429 cpl_table * stars;
+<a name="l00430"></a>00430 cpl_wcs * wcs;
+<a name="l00431"></a>00431 <span class="keywordtype">int</span> nstars;
+<a name="l00432"></a>00432 <span class="keywordtype">int</span> istar;
+<a name="l00433"></a>00433 <span class="keywordtype">double</span> ra1;
+<a name="l00434"></a>00434 <span class="keywordtype">double</span> ra2;
+<a name="l00435"></a>00435 <span class="keywordtype">double</span> dec1;
+<a name="l00436"></a>00436 <span class="keywordtype">double</span> dec2;
+<a name="l00437"></a>00437 <span class="keywordtype">double</span> extra_search = 0.;
+<a name="l00438"></a>00438 cpl_matrix * from_coord;
+<a name="l00439"></a>00439 cpl_matrix * to_coord;
+<a name="l00440"></a>00440 cpl_array * status;
+<a name="l00441"></a>00441
+<a name="l00442"></a>00442
+<a name="l00443"></a>00443 <span class="comment">/* Extract the catalog path */</span>
+<a name="l00444"></a>00444 <span class="keywordflow">if</span> (irplib_2mass_get_catpars(cpl_frameset_get_first(cat_2mass),
+<a name="l00445"></a>00445 &catpath, &catname) != CPL_ERROR_NONE)
+<a name="l00446"></a>00446 <span class="keywordflow">return</span> NULL;
+<a name="l00447"></a>00447
+<a name="l00448"></a>00448 <span class="comment">/* Get the WCS info */</span>
+<a name="l00449"></a>00449 wcs = cpl_wcs_new_from_propertylist(wcs_keywords);
+<a name="l00450"></a>00450 <span class="keywordflow">if</span>(cpl_error_get_code() == CPL_ERROR_NO_WCS)
+<a name="l00451"></a>00451 {
+<a name="l00452"></a>00452 cpl_msg_error(__func__,<span class="stringliteral">"Not compiled with WCS support."</span>);
+<a name="l00453"></a>00453 <span class="keywordflow">return</span> NULL;
+<a name="l00454"></a>00454 }
+<a name="l00455"></a>00455
+<a name="l00456"></a>00456 <span class="comment">/* Get the limits to search */</span>
+<a name="l00457"></a>00457 <span class="keywordflow">if</span>(irplib_cat_get_image_limits(wcs, extra_search,
+<a name="l00458"></a>00458 &ra1, &ra2, &dec1, &dec2) ==
+<a name="l00459"></a>00459 CPL_ERROR_DATA_NOT_FOUND)
+<a name="l00460"></a>00460 {
+<a name="l00461"></a>00461 cpl_msg_error(__func__,<span class="stringliteral">"No WCS information found"</span>);
+<a name="l00462"></a>00462 cpl_free(catname);
+<a name="l00463"></a>00463 cpl_free(catpath);
+<a name="l00464"></a>00464 cpl_wcs_delete(wcs);
+<a name="l00465"></a>00465 <span class="keywordflow">return</span> NULL;
+<a name="l00466"></a>00466 }
+<a name="l00467"></a>00467 cpl_msg_info(__func__,<span class="stringliteral">"Searching stars in RA=[%f,%f] DEC=[%f,%f]"</span>,
+<a name="l00468"></a>00468 ra1/15., ra2/15., dec1, dec2);
+<a name="l00469"></a>00469
+<a name="l00470"></a>00470
+<a name="l00471"></a>00471 <span class="comment">/* Search the stars */</span>
+<a name="l00472"></a>00472 stars = irplib_2mass_extract(catpath, ra1, ra2, dec1, dec2);
+<a name="l00473"></a>00473 <span class="keywordflow">if</span>(stars == NULL)
+<a name="l00474"></a>00474 {
+<a name="l00475"></a>00475 cpl_msg_error(__func__,<span class="stringliteral">"Error retrieving 2mass stars: %s "</span>,
+<a name="l00476"></a>00476 cpl_error_get_message());
+<a name="l00477"></a>00477 cpl_free(catname);
+<a name="l00478"></a>00478 cpl_free(catpath);
+<a name="l00479"></a>00479 cpl_wcs_delete(wcs);
+<a name="l00480"></a>00480 <span class="keywordflow">return</span> NULL;
+<a name="l00481"></a>00481 }
+<a name="l00482"></a>00482 nstars = cpl_table_get_nrow(stars);
+<a name="l00483"></a>00483 cpl_msg_indent_more();
+<a name="l00484"></a>00484 cpl_msg_info(__func__, <span class="stringliteral">"%d 2MASS stars found"</span>, nstars);
+<a name="l00485"></a>00485
+<a name="l00486"></a>00486 <span class="comment">/* Convert Ra, Dec to X,Y using the WCS information from image */</span>
+<a name="l00487"></a>00487 from_coord = cpl_matrix_new(nstars, 2);
+<a name="l00488"></a>00488 <span class="keywordflow">for</span> (istar=0; istar<nstars; istar++)
+<a name="l00489"></a>00489 {
+<a name="l00490"></a>00490 cpl_matrix_set(from_coord, istar, 0, cpl_table_get_float
+<a name="l00491"></a>00491 (stars, HAWKI_COL_2MASS_RA, istar, NULL));
+<a name="l00492"></a>00492 cpl_matrix_set(from_coord, istar, 1, cpl_table_get_float
+<a name="l00493"></a>00493 (stars, HAWKI_COL_2MASS_DEC, istar, NULL));
+<a name="l00494"></a>00494 }
+<a name="l00495"></a>00495
+<a name="l00496"></a>00496 to_coord = NULL;
+<a name="l00497"></a>00497 status = NULL;
+<a name="l00498"></a>00498 <span class="keywordflow">if</span>(cpl_wcs_convert(wcs, from_coord, &to_coord,
+<a name="l00499"></a>00499 &status, CPL_WCS_WORLD2PHYS) != CPL_ERROR_NONE)
+<a name="l00500"></a>00500 {
+<a name="l00501"></a>00501 cpl_array_delete(status);
+<a name="l00502"></a>00502 cpl_matrix_delete(from_coord);
+<a name="l00503"></a>00503 cpl_matrix_delete(to_coord);
+<a name="l00504"></a>00504 cpl_free(catname);
+<a name="l00505"></a>00505 cpl_free(catpath);
+<a name="l00506"></a>00506 cpl_wcs_delete(wcs);
+<a name="l00507"></a>00507 cpl_msg_error(cpl_func,<span class="stringliteral">"Error in cpl_wcs conversion. %s"</span>,
+<a name="l00508"></a>00508 cpl_error_get_message());
+<a name="l00509"></a>00509 <span class="keywordflow">return</span> NULL;
+<a name="l00510"></a>00510 }
+<a name="l00511"></a>00511
+<a name="l00512"></a>00512 <span class="comment">/* Add the predicted x,y coordinate columns to the 2MASS table */</span>
+<a name="l00513"></a>00513 cpl_table_new_column(stars, HAWKI_COL_2MASS_XPREDICT, CPL_TYPE_FLOAT);
+<a name="l00514"></a>00514 cpl_table_set_column_unit(stars,HAWKI_COL_2MASS_XPREDICT, <span class="stringliteral">"pixels"</span>);
+<a name="l00515"></a>00515 cpl_table_new_column(stars, HAWKI_COL_2MASS_YPREDICT, CPL_TYPE_FLOAT);
+<a name="l00516"></a>00516 cpl_table_set_column_unit(stars, HAWKI_COL_2MASS_YPREDICT, <span class="stringliteral">"pixels"</span>);
+<a name="l00517"></a>00517 <span class="keywordflow">for</span>(istar=0; istar< nstars; istar++)
+<a name="l00518"></a>00518 {
+<a name="l00519"></a>00519 <span class="keywordtype">float</span> xpredict = (float)cpl_matrix_get(to_coord, istar, 0);
+<a name="l00520"></a>00520 <span class="keywordtype">float</span> ypredict = (float)cpl_matrix_get(to_coord, istar, 1);
+<a name="l00521"></a>00521 cpl_table_set_float(stars,<span class="stringliteral">"xpredict"</span>, istar, xpredict);
+<a name="l00522"></a>00522 cpl_table_set_float(stars,<span class="stringliteral">"ypredict"</span>, istar, ypredict);
+<a name="l00523"></a>00523 }
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 <span class="comment">/* Free and return */</span>
+<a name="l00526"></a>00526 cpl_array_delete(status);
+<a name="l00527"></a>00527 cpl_matrix_delete(from_coord);
+<a name="l00528"></a>00528 cpl_matrix_delete(to_coord);
+<a name="l00529"></a>00529 cpl_wcs_delete(wcs);
+<a name="l00530"></a>00530 cpl_free(catname);
+<a name="l00531"></a>00531 cpl_free(catpath);
+<a name="l00532"></a>00532 cpl_msg_indent_less();
+<a name="l00533"></a>00533 <span class="keywordflow">return</span> stars;
+<a name="l00534"></a>00534 }
+<a name="l00535"></a>00535
+<a name="l00536"></a>00536 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00542"></a>00542 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00543"></a>00543 <span class="keyword">static</span> cpl_array * hawki_step_photom_2mass_ppm
+<a name="l00544"></a>00544 (cpl_table * stars_2mass,
+<a name="l00545"></a>00545 cpl_table * obj_det)
+<a name="l00546"></a>00546 {
+<a name="l00547"></a>00547 <span class="keywordtype">int</span> istar;
+<a name="l00548"></a>00548 <span class="keywordtype">int</span> iobj;
+<a name="l00549"></a>00549 <span class="keywordtype">int</span> iter;
+<a name="l00550"></a>00550 <span class="keywordtype">int</span> nstars_2mass;
+<a name="l00551"></a>00551 <span class="keywordtype">int</span> nstars_2mass_used_match;
+<a name="l00552"></a>00552 <span class="keywordtype">int</span> nobj;
+<a name="l00553"></a>00553 <span class="keywordtype">int</span> nobj_used_match;
+<a name="l00554"></a>00554 <span class="keywordtype">int</span> nmatches;
+<a name="l00555"></a>00555 <span class="keywordtype">int</span> nmax_match_pattern = 30;
+<a name="l00556"></a>00556 cpl_matrix * pattern;
+<a name="l00557"></a>00557 cpl_array * matches;
+<a name="l00558"></a>00558 <span class="keywordtype">double</span> tol = 0.1;
+<a name="l00559"></a>00559 <span class="keywordtype">double</span> pradius = 30.0;
+<a name="l00560"></a>00560 <span class="keywordtype">double</span> mean_data_pos_err = 5.;
+<a name="l00561"></a>00561 <span class="keywordtype">int</span> ppm_max_iter = 5;
+<a name="l00562"></a>00562 <span class="keywordtype">double</span> scale = 1;
+<a name="l00563"></a>00563 <span class="keywordtype">double</span> angle;
+<a name="l00564"></a>00564 cpl_matrix * obj_pos;
+<a name="l00565"></a>00565 cpl_propertylist * sort_prop;
+<a name="l00566"></a>00566
+<a name="l00567"></a>00567
+<a name="l00568"></a>00568 <span class="comment">/* Sort the detected objects */</span>
+<a name="l00569"></a>00569 cpl_msg_indent_more();
+<a name="l00570"></a>00570 sort_prop = cpl_propertylist_new();
+<a name="l00571"></a>00571 cpl_propertylist_append_bool(sort_prop, HAWKI_COL_OBJ_FLUX, 1);
+<a name="l00572"></a>00572 <span class="keywordflow">if</span> (cpl_table_sort(obj_det, sort_prop) != CPL_ERROR_NONE)
+<a name="l00573"></a>00573 {
+<a name="l00574"></a>00574 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot sort detected sources table"</span>);
+<a name="l00575"></a>00575 cpl_propertylist_delete(sort_prop);
+<a name="l00576"></a>00576 <span class="keywordflow">return</span> NULL;
+<a name="l00577"></a>00577 }
+<a name="l00578"></a>00578
+<a name="l00579"></a>00579 <span class="comment">/* Create matrix of X,Y coordinates of detected objects*/</span>
+<a name="l00580"></a>00580 nobj = cpl_table_get_nrow(obj_det);
+<a name="l00581"></a>00581 obj_pos = cpl_matrix_new(2, nobj);
+<a name="l00582"></a>00582 <span class="keywordflow">for</span> (iobj=0; iobj<nobj; iobj++)
+<a name="l00583"></a>00583 {
+<a name="l00584"></a>00584 <span class="keywordtype">float</span> xim = cpl_table_get_double
+<a name="l00585"></a>00585 (obj_det, HAWKI_COL_OBJ_POSX, iobj, NULL);
+<a name="l00586"></a>00586 <span class="keywordtype">float</span> yim = cpl_table_get_double
+<a name="l00587"></a>00587 (obj_det, HAWKI_COL_OBJ_POSY, iobj, NULL);
+<a name="l00588"></a>00588 cpl_matrix_set(obj_pos, 0, iobj, xim);
+<a name="l00589"></a>00589 cpl_matrix_set(obj_pos, 1, iobj, yim);
+<a name="l00590"></a>00590 }
+<a name="l00591"></a>00591
+<a name="l00592"></a>00592 <span class="comment">/* Sort the 2MASS stars by magnitude */</span>
+<a name="l00593"></a>00593 cpl_propertylist_empty(sort_prop);
+<a name="l00594"></a>00594 cpl_propertylist_append_bool(sort_prop, HAWKI_COL_2MASS_K_MAG, 0);
+<a name="l00595"></a>00595 <span class="keywordflow">if</span> (cpl_table_sort(stars_2mass, sort_prop) != CPL_ERROR_NONE)
+<a name="l00596"></a>00596 {
+<a name="l00597"></a>00597 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot sort 2MASS stars table"</span>);
+<a name="l00598"></a>00598 cpl_propertylist_delete(sort_prop);
+<a name="l00599"></a>00599 <span class="keywordflow">return</span> NULL;
+<a name="l00600"></a>00600 }
+<a name="l00601"></a>00601
+<a name="l00602"></a>00602 <span class="comment">/* Prepare the 2MASS matrix for the pattern matching */</span>
+<a name="l00603"></a>00603 nstars_2mass = cpl_table_get_nrow(stars_2mass);
+<a name="l00604"></a>00604 pattern = cpl_matrix_new(2, nstars_2mass);
+<a name="l00605"></a>00605 <span class="keywordflow">for</span>(istar=0; istar<nstars_2mass ; istar++)
+<a name="l00606"></a>00606 {
+<a name="l00607"></a>00607 <span class="keywordtype">float</span> x = cpl_table_get_float
+<a name="l00608"></a>00608 (stars_2mass, HAWKI_COL_2MASS_XPREDICT, istar, NULL);
+<a name="l00609"></a>00609 <span class="keywordtype">float</span> y = cpl_table_get_float
+<a name="l00610"></a>00610 (stars_2mass, HAWKI_COL_2MASS_YPREDICT, istar, NULL);
+<a name="l00611"></a>00611 cpl_matrix_set(pattern, 0, istar, x);
+<a name="l00612"></a>00612 cpl_matrix_set(pattern, 1, istar, y);
+<a name="l00613"></a>00613 }
+<a name="l00614"></a>00614
+<a name="l00615"></a>00615 <span class="comment">/* Do the ppm */</span>
+<a name="l00616"></a>00616 nstars_2mass_used_match = nmax_match_pattern;
+<a name="l00617"></a>00617 <span class="keywordflow">if</span>(nstars_2mass < nmax_match_pattern)
+<a name="l00618"></a>00618 nstars_2mass_used_match = nstars_2mass;
+<a name="l00619"></a>00619 nobj_used_match = (int)(1.7 * nstars_2mass_used_match);
+<a name="l00620"></a>00620 <span class="keywordflow">if</span>(nobj_used_match > nobj)
+<a name="l00621"></a>00621 nobj_used_match = nobj;
+<a name="l00622"></a>00622 <span class="keywordflow">if</span>(nobj_used_match < nstars_2mass_used_match)
+<a name="l00623"></a>00623 nobj_used_match = nstars_2mass_used_match;
+<a name="l00624"></a>00624 cpl_msg_info(__func__,<span class="stringliteral">"The first step match will use %d stars "</span>
+<a name="l00625"></a>00625 <span class="stringliteral">"and %d objects"</span>, nstars_2mass_used_match,nobj_used_match);
+<a name="l00626"></a>00626 <span class="keywordflow">for</span> (iter = 0; iter < ppm_max_iter; iter++)
+<a name="l00627"></a>00627 {
+<a name="l00628"></a>00628 <span class="keywordtype">int</span> nmatchsize;
+<a name="l00629"></a>00629 nmatches = 0;
+<a name="l00630"></a>00630 matches = cpl_ppm_match_points(obj_pos, nobj_used_match,
+<a name="l00631"></a>00631 mean_data_pos_err,
+<a name="l00632"></a>00632 pattern, nstars_2mass_used_match,
+<a name="l00633"></a>00633 1, tol, pradius,
+<a name="l00634"></a>00634 NULL, NULL, &scale, &angle);
+<a name="l00635"></a>00635 <span class="keywordflow">if</span>(matches != NULL)
+<a name="l00636"></a>00636 {
+<a name="l00637"></a>00637 nmatchsize = cpl_array_get_size(matches);
+<a name="l00638"></a>00638 nmatches = nmatchsize -
+<a name="l00639"></a>00639 cpl_array_count_invalid(matches);
+<a name="l00640"></a>00640 }
+<a name="l00641"></a>00641 <span class="keywordflow">else</span>
+<a name="l00642"></a>00642 {
+<a name="l00643"></a>00643 nmatchsize = 0;
+<a name="l00644"></a>00644 nmatches = 0;
+<a name="l00645"></a>00645 }
+<a name="l00646"></a>00646
+<a name="l00647"></a>00647 cpl_msg_info(cpl_func,<span class="stringliteral">"Total matches: %d. Valid matches: %d"</span>,
+<a name="l00648"></a>00648 nmatchsize, nmatches);
+<a name="l00649"></a>00649 cpl_msg_info(cpl_func,<span class="stringliteral">"Scale=%g angle=%g"</span>, scale, angle);
+<a name="l00650"></a>00650 <span class="keywordflow">if</span>((matches == NULL) || (nmatches < floor(nobj_used_match*0.1)))
+<a name="l00651"></a>00651 {
+<a name="l00652"></a>00652 nobj_used_match = nobj_used_match + 10;
+<a name="l00653"></a>00653 cpl_msg_info(cpl_func,
+<a name="l00654"></a>00654 <span class="stringliteral">"Increasing number of detections used in PPM to %d"</span>,
+<a name="l00655"></a>00655 nobj_used_match);
+<a name="l00656"></a>00656 <span class="keywordflow">continue</span>;
+<a name="l00657"></a>00657 }
+<a name="l00658"></a>00658 <span class="keywordflow">else</span>
+<a name="l00659"></a>00659 <span class="keywordflow">break</span>;
+<a name="l00660"></a>00660 }
+<a name="l00661"></a>00661
+<a name="l00662"></a>00662 <span class="comment">/* Output debug messages */</span>
+<a name="l00663"></a>00663 cpl_msg_indent_more();
+<a name="l00664"></a>00664 cpl_msg_debug(__func__,<span class="stringliteral">"Matched stars:"</span>);
+<a name="l00665"></a>00665 cpl_msg_indent_more();
+<a name="l00666"></a>00666 cpl_msg_debug(__func__,<span class="stringliteral">"X_OBJ Y_OBJ X_STAR Y_STAR X_DIFF Y_DIFF:"</span>);
+<a name="l00667"></a>00667 <span class="keywordflow">for</span>(istar=0; istar < nstars_2mass; ++istar)
+<a name="l00668"></a>00668 {
+<a name="l00669"></a>00669 <span class="keywordtype">int</span> null;
+<a name="l00670"></a>00670 <span class="keywordtype">double</span> x_obj, y_obj, x_star, y_star, x_diff, y_diff;
+<a name="l00671"></a>00671 iobj = cpl_array_get_int(matches, istar, &null);
+<a name="l00672"></a>00672
+<a name="l00673"></a>00673 <span class="keywordflow">if</span>(null != 0)
+<a name="l00674"></a>00674 <span class="keywordflow">continue</span>;
+<a name="l00675"></a>00675 x_obj = cpl_matrix_get(obj_pos, 0, iobj);
+<a name="l00676"></a>00676 y_obj = cpl_matrix_get(obj_pos, 1, iobj);
+<a name="l00677"></a>00677 x_star = cpl_matrix_get(pattern, 0, istar);
+<a name="l00678"></a>00678 y_star = cpl_matrix_get(pattern, 1, istar);
+<a name="l00679"></a>00679 x_diff = x_obj - x_star;
+<a name="l00680"></a>00680 y_diff = y_obj - y_star;
+<a name="l00681"></a>00681 cpl_msg_debug(__func__,<span class="stringliteral">"%6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n"</span>,
+<a name="l00682"></a>00682 x_obj, y_obj, x_star, y_star, x_diff, y_diff);
+<a name="l00683"></a>00683 }
+<a name="l00684"></a>00684 cpl_msg_indent_less();
+<a name="l00685"></a>00685 cpl_msg_indent_less();
+<a name="l00686"></a>00686
+<a name="l00687"></a>00687 cpl_matrix_delete(pattern);
+<a name="l00688"></a>00688 cpl_msg_info(cpl_func, <span class="stringliteral">"%d points matched"</span>, nmatches);
+<a name="l00689"></a>00689
+<a name="l00690"></a>00690 <span class="keywordflow">if</span>(matches == NULL || nmatches == 0)
+<a name="l00691"></a>00691 {
+<a name="l00692"></a>00692 <span class="keywordflow">if</span>(nmatches == 0)
+<a name="l00693"></a>00693 cpl_array_delete(matches);
+<a name="l00694"></a>00694 cpl_msg_error(cpl_func,<span class="stringliteral">"Error in PPM. %s"</span>,cpl_error_get_message());
+<a name="l00695"></a>00695 cpl_matrix_delete(obj_pos);
+<a name="l00696"></a>00696 cpl_propertylist_delete(sort_prop);
+<a name="l00697"></a>00697 cpl_msg_indent_less();
+<a name="l00698"></a>00698 <span class="keywordflow">return</span> NULL;
+<a name="l00699"></a>00699 }
+<a name="l00700"></a>00700
+<a name="l00701"></a>00701 <span class="keywordflow">if</span>(nmatches < floor(nobj_used_match*0.1))
+<a name="l00702"></a>00702 {
+<a name="l00703"></a>00703 cpl_msg_warning(cpl_func,<span class="stringliteral">"PPM detected matched only %d objects."</span>
+<a name="l00704"></a>00704 <span class="stringliteral">" Results could be unreliable"</span>,nmatches);
+<a name="l00705"></a>00705 }
+<a name="l00706"></a>00706
+<a name="l00707"></a>00707 <span class="comment">/* Free and return */</span>
+<a name="l00708"></a>00708 cpl_matrix_delete(obj_pos);
+<a name="l00709"></a>00709 cpl_propertylist_delete(sort_prop);
+<a name="l00710"></a>00710 cpl_msg_indent_less();
+<a name="l00711"></a>00711 <span class="keywordflow">return</span> matches;
+<a name="l00712"></a>00712 }
+<a name="l00713"></a>00713
+<a name="l00714"></a>00714 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00719"></a>00719 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00720"></a>00720 <span class="keyword">static</span> cpl_table * hawki_step_photom_2mass_fill_zpoint_table
+<a name="l00721"></a>00721 (cpl_table * stars_2mass,
+<a name="l00722"></a>00722 cpl_table * obj_det_param,
+<a name="l00723"></a>00723 cpl_array * matches,
+<a name="l00724"></a>00724 cpl_propertylist * plist,
+<a name="l00725"></a>00725 <span class="keywordtype">int</span> idet)
+<a name="l00726"></a>00726 {
+<a name="l00727"></a>00727 cpl_table * zpoints;
+<a name="l00728"></a>00728 <span class="keywordtype">int</span> nmatches;
+<a name="l00729"></a>00729 <span class="keywordtype">int</span> nstars;
+<a name="l00730"></a>00730 <span class="keywordtype">int</span> imatch;
+<a name="l00731"></a>00731 <span class="keywordtype">int</span> istar;
+<a name="l00732"></a>00732 <span class="keyword">const</span> <span class="keywordtype">char</span> * filter;
+<a name="l00733"></a>00733 <span class="keywordtype">char</span> magcol_2mass[100];
+<a name="l00734"></a>00734 <span class="keywordtype">char</span> magerrcol_2mass[100];
+<a name="l00735"></a>00735 <span class="keywordtype">double</span> dit;
+<a name="l00736"></a>00736 <span class="keywordtype">double</span> airmass;
+<a name="l00737"></a>00737 <span class="keywordtype">double</span> pixscale;
+<a name="l00738"></a>00738 <span class="keywordtype">double</span> extinction;
+<a name="l00739"></a>00739 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00740"></a>00740
+<a name="l00741"></a>00741 <span class="comment">/* Read parameters from the propertylist */</span>
+<a name="l00742"></a>00742 airmass = (<a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(plist) +
+<a name="l00743"></a>00743 <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(plist)) / 2.;
+<a name="l00744"></a>00744 filter = <a class="code" href="group__hawki__pfits.html#ga3ad06f5c4dea6ec8adcc437e7f9f5501" title="find out which wave band is active">hawki_pfits_get_filter</a>(plist);
+<a name="l00745"></a>00745 dit = <a class="code" href="group__hawki__pfits.html#ga1971ab60e27df384b5fd533461e7356f" title="find out the DIT value">hawki_pfits_get_dit</a>(plist);
+<a name="l00746"></a>00746 pixscale = <a class="code" href="group__hawki__pfits.html#ga79c432e5ab5585c45472cfa86b2d146b" title="find out the pixel scale">hawki_pfits_get_pixscale</a>(plist);
+<a name="l00747"></a>00747 <span class="keywordflow">switch</span> (<a class="code" href="group__hawki__utils.html#ga6d85879fd8b8895544f7787e8a6ddade" title="Get the band.">hawki_get_band</a>(filter))
+<a name="l00748"></a>00748 {
+<a name="l00749"></a>00749 <span class="keywordflow">case</span> HAWKI_BAND_J:
+<a name="l00750"></a>00750 extinction = 0.098;
+<a name="l00751"></a>00751 strcpy(magcol_2mass, HAWKI_COL_2MASS_J_MAG);
+<a name="l00752"></a>00752 strcpy(magerrcol_2mass, HAWKI_COL_2MASS_J_MAGSIG);
+<a name="l00753"></a>00753 break ;
+<a name="l00754"></a>00754 <span class="keywordflow">case</span> HAWKI_BAND_H:
+<a name="l00755"></a>00755 extinction = 0.039;
+<a name="l00756"></a>00756 strcpy(magcol_2mass, HAWKI_COL_2MASS_H_MAG);
+<a name="l00757"></a>00757 strcpy(magerrcol_2mass, HAWKI_COL_2MASS_H_MAGSIG);
+<a name="l00758"></a>00758 break ;
+<a name="l00759"></a>00759 <span class="keywordflow">case</span> HAWKI_BAND_K:
+<a name="l00760"></a>00760 extinction = 0.065;
+<a name="l00761"></a>00761 strcpy(magcol_2mass, HAWKI_COL_2MASS_K_MAG);
+<a name="l00762"></a>00762 strcpy(magerrcol_2mass, HAWKI_COL_2MASS_K_MAGSIG);
+<a name="l00763"></a>00763 break ;
+<a name="l00764"></a>00764 <span class="keywordflow">default</span>:
+<a name="l00765"></a>00765 extinction = 0.00;
+<a name="l00766"></a>00766 cpl_msg_warning(__func__,<span class="stringliteral">"The filter %s does not exist in 2MASS. "</span>
+<a name="l00767"></a>00767 <span class="stringliteral">"The 2MASS K band will be used instead. "</span>
+<a name="l00768"></a>00768 <span class="stringliteral">"Columns %s, %s, %s and %s in product will not "</span>
+<a name="l00769"></a>00769 <span class="stringliteral">"be accurate"</span>, filter,
+<a name="l00770"></a>00770 HAWKI_COL_ZPOINT_MAG, HAWKI_COL_ZPOINT_ERRMAG,
+<a name="l00771"></a>00771 HAWKI_COL_ZPOINT_ZPOINT, HAWKI_COL_ZPOINT_ATX0);
+<a name="l00772"></a>00772 strcpy(magcol_2mass, HAWKI_COL_2MASS_K_MAG);
+<a name="l00773"></a>00773 strcpy(magerrcol_2mass, HAWKI_COL_2MASS_K_MAGSIG);
+<a name="l00774"></a>00774 break ;
+<a name="l00775"></a>00775 }
+<a name="l00776"></a>00776
+<a name="l00777"></a>00777 <span class="comment">/* Select only stars in 2MASS that have the given magnitude */</span>
+<a name="l00778"></a>00778 <span class="comment">//irplib_stdstar_select_stars_mag(stars_2mass, magcol_2mass);</span>
+<a name="l00779"></a>00779 <span class="comment">//cpl_msg_warning(__func__,"Paso irplib");</span>
+<a name="l00780"></a>00780
+<a name="l00781"></a>00781 <span class="comment">/* Create the table */</span>
+<a name="l00782"></a>00782 nstars = cpl_table_get_nrow(stars_2mass);
+<a name="l00783"></a>00783 nmatches = cpl_array_get_size(matches) - cpl_array_count_invalid(matches);
+<a name="l00784"></a>00784 zpoints = cpl_table_new(nmatches) ;
+<a name="l00785"></a>00785 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_CHIP, CPL_TYPE_INT) ;
+<a name="l00786"></a>00786 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_POSX, CPL_TYPE_DOUBLE) ;
+<a name="l00787"></a>00787 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_POSY, CPL_TYPE_DOUBLE) ;
+<a name="l00788"></a>00788 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_ZPOINT, CPL_TYPE_DOUBLE) ;
+<a name="l00789"></a>00789 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_ATX0, CPL_TYPE_DOUBLE) ;
+<a name="l00790"></a>00790 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_MAG, CPL_TYPE_DOUBLE) ;
+<a name="l00791"></a>00791 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_ERRMAG, CPL_TYPE_DOUBLE) ;
+<a name="l00792"></a>00792 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_AIRMASS, CPL_TYPE_DOUBLE) ;
+<a name="l00793"></a>00793 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FLUX, CPL_TYPE_DOUBLE) ;
+<a name="l00794"></a>00794 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FILTER, CPL_TYPE_STRING) ;
+<a name="l00795"></a>00795 <span class="comment">// cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_PEAK, CPL_TYPE_DOUBLE) ;</span>
+<a name="l00796"></a>00796 <span class="comment">// cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_BGD, CPL_TYPE_DOUBLE) ;</span>
+<a name="l00797"></a>00797 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMX, CPL_TYPE_DOUBLE) ;
+<a name="l00798"></a>00798 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMY, CPL_TYPE_DOUBLE) ;
+<a name="l00799"></a>00799 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHM, CPL_TYPE_DOUBLE) ;
+<a name="l00800"></a>00800 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMX_AS, CPL_TYPE_DOUBLE) ;
+<a name="l00801"></a>00801 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMY_AS, CPL_TYPE_DOUBLE) ;
+<a name="l00802"></a>00802 cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHM_AS, CPL_TYPE_DOUBLE) ;
+<a name="l00803"></a>00803 imatch = 0;
+<a name="l00804"></a>00804
+<a name="l00805"></a>00805 <span class="keywordflow">for</span> (istar=0; istar<nstars; istar++)
+<a name="l00806"></a>00806 {
+<a name="l00807"></a>00807 <span class="keywordtype">int</span> iobj;
+<a name="l00808"></a>00808 <span class="keywordtype">int</span> null;
+<a name="l00809"></a>00809 <span class="keywordtype">double</span> zpoint;
+<a name="l00810"></a>00810 <span class="keywordtype">double</span> atx0;
+<a name="l00811"></a>00811 <span class="keywordtype">double</span> flux;
+<a name="l00812"></a>00812 <span class="keywordtype">double</span> mag;
+<a name="l00813"></a>00813 <span class="keywordtype">double</span> errmag;
+<a name="l00814"></a>00814 <span class="keywordtype">double</span> fwhm_x;
+<a name="l00815"></a>00815 <span class="keywordtype">double</span> fwhm_y;
+<a name="l00816"></a>00816 <span class="keywordtype">double</span> fwhm;
+<a name="l00817"></a>00817
+<a name="l00818"></a>00818 iobj = cpl_array_get_int(matches, istar, &null);
+<a name="l00819"></a>00819
+<a name="l00820"></a>00820 <span class="keywordflow">if</span>(null != 0)
+<a name="l00821"></a>00821 <span class="keywordflow">continue</span>;
+<a name="l00822"></a>00822 <span class="keywordflow">if</span>(!cpl_table_is_selected(stars_2mass, istar))
+<a name="l00823"></a>00823 <span class="keywordflow">continue</span>;
+<a name="l00824"></a>00824
+<a name="l00825"></a>00825 flux = cpl_table_get_double
+<a name="l00826"></a>00826 (obj_det_param, HAWKI_COL_OBJ_FLUX, iobj, NULL);
+<a name="l00827"></a>00827 mag = cpl_table_get_float
+<a name="l00828"></a>00828 (stars_2mass, magcol_2mass, istar, NULL);
+<a name="l00829"></a>00829 errmag = cpl_table_get_float
+<a name="l00830"></a>00830 (stars_2mass, magerrcol_2mass, istar, NULL);
+<a name="l00831"></a>00831 zpoint = mag + 2.5 * log10(flux) - 2.5 * log10(dit);
+<a name="l00832"></a>00832 atx0 = zpoint + airmass * extinction;
+<a name="l00833"></a>00833 fwhm_x = cpl_table_get_double
+<a name="l00834"></a>00834 (obj_det_param, HAWKI_COL_OBJ_FWHM_MAJAX, iobj, NULL);
+<a name="l00835"></a>00835 fwhm_y = cpl_table_get_double
+<a name="l00836"></a>00836 (obj_det_param, HAWKI_COL_OBJ_FWHM_MINAX, iobj, NULL);
+<a name="l00837"></a>00837 fwhm = sqrt(fwhm_x*fwhm_y);
+<a name="l00838"></a>00838
+<a name="l00839"></a>00839 cpl_table_set_int(zpoints, HAWKI_COL_ZPOINT_CHIP, imatch, idet + 1) ;
+<a name="l00840"></a>00840 cpl_table_set_double
+<a name="l00841"></a>00841 (zpoints, HAWKI_COL_ZPOINT_MAG, imatch, mag);
+<a name="l00842"></a>00842 cpl_table_set_double
+<a name="l00843"></a>00843 (zpoints, HAWKI_COL_ZPOINT_ERRMAG, imatch, errmag);
+<a name="l00844"></a>00844 cpl_table_set_string
+<a name="l00845"></a>00845 (zpoints, HAWKI_COL_ZPOINT_FILTER, imatch, filter);
+<a name="l00846"></a>00846 cpl_table_set_double
+<a name="l00847"></a>00847 (zpoints, HAWKI_COL_ZPOINT_AIRMASS, imatch, airmass);
+<a name="l00848"></a>00848 cpl_table_set_double
+<a name="l00849"></a>00849 (zpoints, HAWKI_COL_ZPOINT_POSX, imatch, cpl_table_get_double
+<a name="l00850"></a>00850 (obj_det_param, HAWKI_COL_OBJ_POSX, iobj, NULL));
+<a name="l00851"></a>00851 cpl_table_set_double
+<a name="l00852"></a>00852 (zpoints, HAWKI_COL_ZPOINT_POSY, imatch, cpl_table_get_double
+<a name="l00853"></a>00853 (obj_det_param, HAWKI_COL_OBJ_POSY, iobj, NULL));
+<a name="l00854"></a>00854 cpl_table_set_double(zpoints, HAWKI_COL_ZPOINT_ZPOINT, imatch, zpoint);
+<a name="l00855"></a>00855 cpl_table_set_double(zpoints, HAWKI_COL_ZPOINT_ATX0, imatch, atx0);
+<a name="l00856"></a>00856 cpl_table_set_double
+<a name="l00857"></a>00857 (zpoints, HAWKI_COL_ZPOINT_FLUX, imatch, flux);
+<a name="l00858"></a>00858 <span class="comment">// cpl_table_set_double(tab, HAWKI_COL_ZPOINT_PEAK, imatch, </span>
+<a name="l00859"></a>00859 <span class="comment">// hawki_img_zpoint_outputs.peak[labels[iframe]-1]) ;</span>
+<a name="l00860"></a>00860 <span class="comment">// cpl_table_set_double(tab, HAWKI_COL_ZPOINT_BGD, imatch, </span>
+<a name="l00861"></a>00861 <span class="comment">// hawki_img_zpoint_outputs.bgd[labels[iframe]-1]) ;</span>
+<a name="l00862"></a>00862 cpl_table_set_double
+<a name="l00863"></a>00863 (zpoints, HAWKI_COL_ZPOINT_FWHMX, imatch, fwhm_x);
+<a name="l00864"></a>00864 cpl_table_set_double
+<a name="l00865"></a>00865 (zpoints, HAWKI_COL_ZPOINT_FWHMY, imatch, fwhm_y);
+<a name="l00866"></a>00866 cpl_table_set_double
+<a name="l00867"></a>00867 (zpoints, HAWKI_COL_ZPOINT_FWHM, imatch, fwhm);
+<a name="l00868"></a>00868 cpl_table_set_double
+<a name="l00869"></a>00869 (zpoints, HAWKI_COL_ZPOINT_FWHMX_AS, imatch, fwhm_x * pixscale);
+<a name="l00870"></a>00870 cpl_table_set_double
+<a name="l00871"></a>00871 (zpoints, HAWKI_COL_ZPOINT_FWHMY_AS, imatch, fwhm_y * pixscale);
+<a name="l00872"></a>00872 cpl_table_set_double
+<a name="l00873"></a>00873 (zpoints, HAWKI_COL_ZPOINT_FWHM_AS, imatch, fwhm * pixscale);
+<a name="l00874"></a>00874 ++imatch;
+<a name="l00875"></a>00875 }
+<a name="l00876"></a>00876
+<a name="l00877"></a>00877 <span class="comment">/* Check error and return */</span>
+<a name="l00878"></a>00878 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00879"></a>00879 {
+<a name="l00880"></a>00880 cpl_msg_error(__func__,<span class="stringliteral">"An error happened filling the zpoint table: %s"</span>,
+<a name="l00881"></a>00881 cpl_error_get_message());
+<a name="l00882"></a>00882 cpl_table_delete(zpoints);
+<a name="l00883"></a>00883 <span class="keywordflow">return</span> NULL;
+<a name="l00884"></a>00884 }
+<a name="l00885"></a>00885 <span class="keywordflow">return</span> zpoints;
+<a name="l00886"></a>00886 }
+<a name="l00887"></a>00887
+<a name="l00888"></a>00888 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00893"></a>00893 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00894"></a>00894 <span class="keyword">static</span> cpl_propertylist ** hawki_step_photom_2mass_qc
+<a name="l00895"></a>00895 (cpl_table ** zpoint_table)
+<a name="l00896"></a>00896 {
+<a name="l00897"></a>00897 <span class="keywordtype">int</span> idet;
+<a name="l00898"></a>00898 cpl_propertylist ** qclists;
+<a name="l00899"></a>00899
+<a name="l00900"></a>00900 <span class="comment">/* Allocate the qclists */</span>
+<a name="l00901"></a>00901 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l00902"></a>00902
+<a name="l00903"></a>00903 <span class="comment">/* Loop on the detectors to get the mean zpoint */</span>
+<a name="l00904"></a>00904 <span class="keywordflow">for</span>(idet = 0 ; idet < HAWKI_NB_DETECTORS ; ++idet)
+<a name="l00905"></a>00905 {
+<a name="l00906"></a>00906 <span class="keywordtype">double</span> mean_zpoint;
+<a name="l00907"></a>00907
+<a name="l00908"></a>00908 <span class="comment">/* Allocate this qclist */</span>
+<a name="l00909"></a>00909 qclists[idet] = cpl_propertylist_new() ;
+<a name="l00910"></a>00910
+<a name="l00911"></a>00911 <span class="comment">/* Compute the mean zpoint */</span>
+<a name="l00912"></a>00912 mean_zpoint = cpl_table_get_column_mean(zpoint_table[idet],
+<a name="l00913"></a>00913 HAWKI_COL_ZPOINT_ZPOINT);
+<a name="l00914"></a>00914
+<a name="l00915"></a>00915 cpl_propertylist_append_double
+<a name="l00916"></a>00916 (qclists[idet], <span class="stringliteral">"ESO QC ZPOINT"</span>, mean_zpoint);
+<a name="l00917"></a>00917 }
+<a name="l00918"></a>00918
+<a name="l00919"></a>00919 <span class="keywordflow">return</span> qclists;
+<a name="l00920"></a>00920 }
+<a name="l00921"></a>00921
+<a name="l00922"></a>00922 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00932"></a>00932 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00933"></a>00933 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_photom_2mass_save
+<a name="l00934"></a>00934 (cpl_table ** zpoints,
+<a name="l00935"></a>00935 cpl_parameterlist * parlist,
+<a name="l00936"></a>00936 cpl_propertylist ** qclists,
+<a name="l00937"></a>00937 cpl_frameset * <span class="keyword">set</span>)
+<a name="l00938"></a>00938 {
+<a name="l00939"></a>00939 cpl_propertylist * protype;
+<a name="l00940"></a>00940 cpl_frame * ref_frame ;
+<a name="l00941"></a>00941 cpl_frameset * combinedframes;
+<a name="l00942"></a>00942 <span class="keywordtype">int</span> nframes ;
+<a name="l00943"></a>00943 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_photom_2mass"</span> ;
+<a name="l00944"></a>00944
+<a name="l00945"></a>00945 <span class="comment">/* Initialise */</span>
+<a name="l00946"></a>00946 nframes = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l00947"></a>00947
+<a name="l00948"></a>00948 <span class="comment">/* Get the reference frame */</span>
+<a name="l00949"></a>00949 combinedframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(<span class="keyword">set</span>, HAWKI_CALPRO_COMBINED);
+<a name="l00950"></a>00950 ref_frame = cpl_frameset_get_first(combinedframes);
+<a name="l00951"></a>00951
+<a name="l00952"></a>00952 <span class="comment">/* Create the protype lists */</span>
+<a name="l00953"></a>00953 protype = cpl_propertylist_new();
+<a name="l00954"></a>00954 cpl_propertylist_append_string(protype, <span class="stringliteral">"ESO PRO TYPE"</span>,
+<a name="l00955"></a>00955 HAWKI_PROTYPE_ZPOINT_TAB);
+<a name="l00956"></a>00956
+<a name="l00957"></a>00957 <span class="comment">/* Write the zpoint table */</span>
+<a name="l00958"></a>00958 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l00959"></a>00959 parlist,
+<a name="l00960"></a>00960 <span class="keyword">set</span>,
+<a name="l00961"></a>00961 (<span class="keyword">const</span> cpl_table **)zpoints,
+<a name="l00962"></a>00962 recipe_name,
+<a name="l00963"></a>00963 HAWKI_CALPRO_ZPOINT_TAB,
+<a name="l00964"></a>00964 HAWKI_PROTYPE_ZPOINT_TAB,
+<a name="l00965"></a>00965 protype,
+<a name="l00966"></a>00966 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l00967"></a>00967 <span class="stringliteral">"hawki_step_photom_2mass.fits"</span>) ;
+<a name="l00968"></a>00968
+<a name="l00969"></a>00969 <span class="comment">/* Free and return */</span>
+<a name="l00970"></a>00970 cpl_propertylist_delete(protype);
+<a name="l00971"></a>00971 cpl_frameset_delete(combinedframes);
+<a name="l00972"></a>00972 <span class="keywordflow">return</span> 0;
+<a name="l00973"></a>00973 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__refine__offsets_8c_source.html b/html/hawki__step__refine__offsets_8c_source.html
new file mode 100644
index 0000000..0994f23
--- /dev/null
+++ b/html/hawki__step__refine__offsets_8c_source.html
@@ -0,0 +1,811 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_refine_offsets.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_refine_offsets.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_refine_offsets.c,v 1.17 2011/10/24 10:42:12 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:42:12 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.17 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <string.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_calib.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_saa.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_bkg.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "hawki_properties_tel.h"</span>
+<a name="l00053"></a>00053 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00056"></a>00056 <span class="comment"> Define</span>
+<a name="l00057"></a>00057 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00058"></a>00058
+<a name="l00059"></a>00059 <span class="preprocessor">#define NEGLIG_OFF_DIFF 0.1</span>
+<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define SQR(x) ((x)*(x))</span>
+<a name="l00061"></a>00061 <span class="preprocessor"></span>
+<a name="l00062"></a>00062 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00063"></a>00063 <span class="comment"> Functions prototypes</span>
+<a name="l00064"></a>00064 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_create(cpl_plugin *) ;
+<a name="l00067"></a>00067 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_exec(cpl_plugin *) ;
+<a name="l00068"></a>00068 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_destroy(cpl_plugin *) ;
+<a name="l00069"></a>00069 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00070"></a>00070
+<a name="l00071"></a>00071 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_retrieve_input_param
+<a name="l00072"></a>00072 (cpl_parameterlist * parlist);
+<a name="l00073"></a>00073 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_fine
+<a name="l00074"></a>00074 (<span class="keyword">const</span> cpl_frameset * science_objects_frames,
+<a name="l00075"></a>00075 <span class="keyword">const</span> cpl_frameset * reference_objects_frames,
+<a name="l00076"></a>00076 cpl_bivector ** refined_offsets,
+<a name="l00077"></a>00077 cpl_vector ** correl);
+<a name="l00078"></a>00078
+<a name="l00079"></a>00079 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_save
+<a name="l00080"></a>00080 (cpl_bivector ** refined_offsets,
+<a name="l00081"></a>00081 cpl_vector ** correlations,
+<a name="l00082"></a>00082 cpl_parameterlist * recipe_parlist,
+<a name="l00083"></a>00083 cpl_frameset * recipe_frameset);
+<a name="l00084"></a>00084
+<a name="l00085"></a>00085 <span class="keyword">static</span> cpl_bivector ** hawki_step_refine_offsets_read_select_objects
+<a name="l00086"></a>00086 (<span class="keyword">const</span> cpl_frameset * reference_obj_frames,
+<a name="l00087"></a>00087 <span class="keywordtype">double</span> first_image_off_x,
+<a name="l00088"></a>00088 <span class="keywordtype">double</span> first_image_off_y,
+<a name="l00089"></a>00089 <span class="keywordtype">int</span> nx,
+<a name="l00090"></a>00090 <span class="keywordtype">int</span> ny);
+<a name="l00091"></a>00091
+<a name="l00092"></a>00092 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00093"></a>00093 <span class="comment"> Static variables</span>
+<a name="l00094"></a>00094 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00095"></a>00095
+<a name="l00096"></a>00096 <span class="keyword">static</span> <span class="keyword">struct </span>
+<a name="l00097"></a>00097 {
+<a name="l00098"></a>00098 <span class="comment">/* Inputs */</span>
+<a name="l00099"></a>00099 <span class="keywordtype">int</span> nbrightest;
+<a name="l00100"></a>00100 <span class="keywordtype">int</span> sx ;
+<a name="l00101"></a>00101 <span class="keywordtype">int</span> sy ;
+<a name="l00102"></a>00102 <span class="keywordtype">int</span> mx ;
+<a name="l00103"></a>00103 <span class="keywordtype">int</span> my ;
+<a name="l00104"></a>00104 } hawki_step_refine_offsets_config;
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_refine_offsets_description[] =
+<a name="l00107"></a>00107 <span class="stringliteral">"hawki_step_refine_offsets -- utility to refine the nominal offsets.\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">"This utility will take the offsets in the header as a first approach\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">"and tries to refine them correlating the input images at the points\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">"given by the detected objects.\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">"The input of the recipe files listed in the Set Of Frames (sof-file)\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">"must be tagged as:\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"images.fits "</span>HAWKI_CALPRO_DIST_CORRECTED<span class="stringliteral">" or\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">"images.fits "</span>HAWKI_CALPRO_BKG_SUBTRACTED<span class="stringliteral">" and\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">"det_obj_stats.fits "</span>HAWKI_CALPRO_OBJ_PARAM<span class="stringliteral">"\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">"hawki_step_refine_offsets.fits ("</span>HAWKI_CALPRO_OFFSETS<span class="stringliteral">"): Table with refined offsets\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122
+<a name="l00123"></a>00123 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00124"></a>00124 <span class="comment"> Functions code</span>
+<a name="l00125"></a>00125 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00126"></a>00126
+<a name="l00127"></a>00127 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00135"></a>00135 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00136"></a>00136 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00137"></a>00137 {
+<a name="l00138"></a>00138 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00139"></a>00139 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00140"></a>00140
+<a name="l00141"></a>00141 cpl_plugin_init(plugin,
+<a name="l00142"></a>00142 CPL_PLUGIN_API,
+<a name="l00143"></a>00143 HAWKI_BINARY_VERSION,
+<a name="l00144"></a>00144 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00145"></a>00145 <span class="stringliteral">"hawki_step_refine_offsets"</span>,
+<a name="l00146"></a>00146 <span class="stringliteral">"Jitter recipe"</span>,
+<a name="l00147"></a>00147 hawki_step_refine_offsets_description,
+<a name="l00148"></a>00148 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00149"></a>00149 PACKAGE_BUGREPORT,
+<a name="l00150"></a>00150 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00151"></a>00151 hawki_step_refine_offsets_create,
+<a name="l00152"></a>00152 hawki_step_refine_offsets_exec,
+<a name="l00153"></a>00153 hawki_step_refine_offsets_destroy) ;
+<a name="l00154"></a>00154
+<a name="l00155"></a>00155 cpl_pluginlist_append(list, plugin) ;
+<a name="l00156"></a>00156
+<a name="l00157"></a>00157 <span class="keywordflow">return</span> 0;
+<a name="l00158"></a>00158 }
+<a name="l00159"></a>00159
+<a name="l00160"></a>00160 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00169"></a>00169 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00170"></a>00170 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_create(cpl_plugin * plugin)
+<a name="l00171"></a>00171 {
+<a name="l00172"></a>00172 cpl_recipe * recipe ;
+<a name="l00173"></a>00173 cpl_parameter * p ;
+<a name="l00174"></a>00174
+<a name="l00175"></a>00175 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00176"></a>00176 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00177"></a>00177 recipe = (cpl_recipe *)plugin ;
+<a name="l00178"></a>00178 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00179"></a>00179
+<a name="l00180"></a>00180 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00181"></a>00181 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00182"></a>00182 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00183"></a>00183 <span class="keywordflow">return</span> 1;
+<a name="l00184"></a>00184
+<a name="l00185"></a>00185 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00186"></a>00186 <span class="comment">/* --xcorr */</span>
+<a name="l00187"></a>00187 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_refine_offsets.xcorr"</span>,
+<a name="l00188"></a>00188 CPL_TYPE_STRING,
+<a name="l00189"></a>00189 <span class="stringliteral">"Cross correlation search and measure sizes"</span>,
+<a name="l00190"></a>00190 <span class="stringliteral">"hawki.hawki_step_refine_offsets"</span>,
+<a name="l00191"></a>00191 <span class="stringliteral">"20,20,25,25"</span>) ;
+<a name="l00192"></a>00192 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"xcorr"</span>) ;
+<a name="l00193"></a>00193 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00194"></a>00194 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00195"></a>00195
+<a name="l00196"></a>00196 <span class="comment">/* --nbrightest */</span>
+<a name="l00197"></a>00197 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_step_refine_offsets.nbrightest"</span>,
+<a name="l00198"></a>00198 CPL_TYPE_INT,
+<a name="l00199"></a>00199 <span class="stringliteral">"Number of brightest objects to use"</span>,
+<a name="l00200"></a>00200 <span class="stringliteral">"hawki.hawki_step_refine_offsets"</span>,
+<a name="l00201"></a>00201 3);
+<a name="l00202"></a>00202 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"nbrightest"</span>) ;
+<a name="l00203"></a>00203 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+<a name="l00204"></a>00204 cpl_parameterlist_append(recipe->parameters, p) ;
+<a name="l00205"></a>00205
+<a name="l00206"></a>00206 <span class="comment">/* Return */</span>
+<a name="l00207"></a>00207 <span class="keywordflow">return</span> 0;
+<a name="l00208"></a>00208 }
+<a name="l00209"></a>00209
+<a name="l00210"></a>00210 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00216"></a>00216 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00217"></a>00217 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_exec(cpl_plugin * plugin)
+<a name="l00218"></a>00218 {
+<a name="l00219"></a>00219 cpl_recipe * recipe ;
+<a name="l00220"></a>00220
+<a name="l00221"></a>00221 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00222"></a>00222 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00223"></a>00223 recipe = (cpl_recipe *)plugin ;
+<a name="l00224"></a>00224 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00225"></a>00225
+<a name="l00226"></a>00226 <span class="comment">/* Issue a banner */</span>
+<a name="l00227"></a>00227 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00228"></a>00228
+<a name="l00229"></a>00229 <span class="keywordflow">return</span> hawki_step_refine_offsets(recipe->parameters, recipe->frames) ;
+<a name="l00230"></a>00230 }
+<a name="l00231"></a>00231
+<a name="l00232"></a>00232 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00238"></a>00238 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00239"></a>00239 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_destroy(cpl_plugin * plugin)
+<a name="l00240"></a>00240 {
+<a name="l00241"></a>00241 cpl_recipe * recipe ;
+<a name="l00242"></a>00242
+<a name="l00243"></a>00243 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00244"></a>00244 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00245"></a>00245 recipe = (cpl_recipe *)plugin ;
+<a name="l00246"></a>00246 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00247"></a>00247
+<a name="l00248"></a>00248 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00249"></a>00249 <span class="keywordflow">return</span> 0 ;
+<a name="l00250"></a>00250 }
+<a name="l00251"></a>00251
+<a name="l00252"></a>00252 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00259"></a>00259 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00260"></a>00260 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets(
+<a name="l00261"></a>00261 cpl_parameterlist * parlist,
+<a name="l00262"></a>00262 cpl_frameset * framelist)
+<a name="l00263"></a>00263 {
+<a name="l00264"></a>00264 cpl_frameset * science_obj_frames ;
+<a name="l00265"></a>00265 cpl_frameset * reference_obj_frames ;
+<a name="l00266"></a>00266 cpl_bivector ** refined_offsets;
+<a name="l00267"></a>00267 cpl_vector ** correl;
+<a name="l00268"></a>00268 <span class="keywordtype">int</span> idet;
+<a name="l00269"></a>00269
+<a name="l00270"></a>00270 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00271"></a>00271 <span class="keywordflow">if</span>(hawki_step_refine_offsets_retrieve_input_param(parlist))
+<a name="l00272"></a>00272 {
+<a name="l00273"></a>00273 cpl_msg_error(__func__, <span class="stringliteral">"Wrong parameters"</span>);
+<a name="l00274"></a>00274 <span class="keywordflow">return</span> -1;
+<a name="l00275"></a>00275 }
+<a name="l00276"></a>00276
+<a name="l00277"></a>00277 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00278"></a>00278 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00279"></a>00279 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00280"></a>00280 <span class="keywordflow">return</span> -1 ;
+<a name="l00281"></a>00281 }
+<a name="l00282"></a>00282
+<a name="l00283"></a>00283 <span class="comment">/* Get the object images frames */</span>
+<a name="l00284"></a>00284 cpl_msg_info(__func__, <span class="stringliteral">"Identifying input frames"</span>);
+<a name="l00285"></a>00285 science_obj_frames =
+<a name="l00286"></a>00286 <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_DIST_CORRECTED);
+<a name="l00287"></a>00287 <span class="keywordflow">if</span> (science_obj_frames == NULL)
+<a name="l00288"></a>00288 {
+<a name="l00289"></a>00289 science_obj_frames =
+<a name="l00290"></a>00290 <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_BKG_SUBTRACTED);
+<a name="l00291"></a>00291 <span class="keywordflow">if</span> (science_obj_frames == NULL)
+<a name="l00292"></a>00292 {
+<a name="l00293"></a>00293 cpl_msg_error(__func__, <span class="stringliteral">"No science object frames provided (%s)"</span>,
+<a name="l00294"></a>00294 HAWKI_CALPRO_DIST_CORRECTED);
+<a name="l00295"></a>00295 <span class="keywordflow">return</span> -1 ;
+<a name="l00296"></a>00296 }
+<a name="l00297"></a>00297 }
+<a name="l00298"></a>00298
+<a name="l00299"></a>00299 <span class="comment">/* Get the detected "objects" frame */</span>
+<a name="l00300"></a>00300 reference_obj_frames =
+<a name="l00301"></a>00301 <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_OBJ_PARAM);
+<a name="l00302"></a>00302 <span class="keywordflow">if</span>(cpl_frameset_get_size(reference_obj_frames) != 1)
+<a name="l00303"></a>00303 {
+<a name="l00304"></a>00304 cpl_msg_error(__func__, <span class="stringliteral">"One object parameters frame must be provided (%s)"</span>,
+<a name="l00305"></a>00305 HAWKI_CALPRO_OBJ_PARAM);
+<a name="l00306"></a>00306 cpl_frameset_delete(science_obj_frames) ;
+<a name="l00307"></a>00307 <span class="keywordflow">if</span>(reference_obj_frames != NULL)
+<a name="l00308"></a>00308 cpl_frameset_delete(reference_obj_frames);
+<a name="l00309"></a>00309 <span class="keywordflow">return</span> -1 ;
+<a name="l00310"></a>00310 }
+<a name="l00311"></a>00311
+<a name="l00312"></a>00312 <span class="comment">/* Get the offsets refinement */</span>
+<a name="l00313"></a>00313 refined_offsets = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_bivector *));
+<a name="l00314"></a>00314 correl = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_vector *));
+<a name="l00315"></a>00315 <span class="keywordflow">for</span>(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00316"></a>00316 {
+<a name="l00317"></a>00317 refined_offsets[idet] = cpl_bivector_new
+<a name="l00318"></a>00318 (cpl_frameset_get_size(science_obj_frames));
+<a name="l00319"></a>00319 correl[idet] = cpl_vector_new
+<a name="l00320"></a>00320 (cpl_frameset_get_size(science_obj_frames));
+<a name="l00321"></a>00321 }
+<a name="l00322"></a>00322 <span class="keywordflow">if</span> (hawki_step_refine_offsets_fine
+<a name="l00323"></a>00323 (science_obj_frames, reference_obj_frames,
+<a name="l00324"></a>00324 refined_offsets, correl) == -1)
+<a name="l00325"></a>00325 {
+<a name="l00326"></a>00326 cpl_msg_error(__func__, <span class="stringliteral">"Cannot refine the objects"</span>) ;
+<a name="l00327"></a>00327 cpl_frameset_delete(reference_obj_frames) ;
+<a name="l00328"></a>00328 cpl_frameset_delete(science_obj_frames) ;
+<a name="l00329"></a>00329 <span class="keywordflow">for</span>(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00330"></a>00330 {
+<a name="l00331"></a>00331 cpl_bivector_delete(refined_offsets[idet]);
+<a name="l00332"></a>00332 cpl_vector_delete(correl[idet]);
+<a name="l00333"></a>00333 }
+<a name="l00334"></a>00334 cpl_free(refined_offsets);
+<a name="l00335"></a>00335 cpl_free(correl);
+<a name="l00336"></a>00336 <span class="keywordflow">return</span> -1 ;
+<a name="l00337"></a>00337 }
+<a name="l00338"></a>00338
+<a name="l00339"></a>00339 <span class="comment">/* Save the products */</span>
+<a name="l00340"></a>00340 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>) ;
+<a name="l00341"></a>00341 <span class="keywordflow">if</span> (hawki_step_refine_offsets_save
+<a name="l00342"></a>00342 (refined_offsets, correl, parlist, framelist) == -1)
+<a name="l00343"></a>00343 {
+<a name="l00344"></a>00344 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00345"></a>00345 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00346"></a>00346 cpl_frameset_delete(science_obj_frames);
+<a name="l00347"></a>00347 cpl_frameset_delete(reference_obj_frames);
+<a name="l00348"></a>00348 <span class="keywordflow">for</span>(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00349"></a>00349 {
+<a name="l00350"></a>00350 cpl_bivector_delete(refined_offsets[idet]);
+<a name="l00351"></a>00351 cpl_vector_delete(correl[idet]);
+<a name="l00352"></a>00352 }
+<a name="l00353"></a>00353 cpl_free(refined_offsets);
+<a name="l00354"></a>00354 cpl_free(correl);
+<a name="l00355"></a>00355 <span class="keywordflow">return</span> -1 ;
+<a name="l00356"></a>00356 }
+<a name="l00357"></a>00357
+<a name="l00358"></a>00358 <span class="comment">/* Free and return */</span>
+<a name="l00359"></a>00359 cpl_frameset_delete(science_obj_frames);
+<a name="l00360"></a>00360 cpl_frameset_delete(reference_obj_frames);
+<a name="l00361"></a>00361 <span class="keywordflow">for</span>(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00362"></a>00362 {
+<a name="l00363"></a>00363 cpl_bivector_delete(refined_offsets[idet]);
+<a name="l00364"></a>00364 cpl_vector_delete(correl[idet]);
+<a name="l00365"></a>00365 }
+<a name="l00366"></a>00366 cpl_free(refined_offsets);
+<a name="l00367"></a>00367 cpl_free(correl);
+<a name="l00368"></a>00368
+<a name="l00369"></a>00369 <span class="comment">/* Return */</span>
+<a name="l00370"></a>00370 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00371"></a>00371 {
+<a name="l00372"></a>00372 cpl_msg_error(__func__,
+<a name="l00373"></a>00373 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00374"></a>00374 <span class="keywordflow">return</span> -1 ;
+<a name="l00375"></a>00375 }
+<a name="l00376"></a>00376 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00377"></a>00377 }
+<a name="l00378"></a>00378
+<a name="l00379"></a>00379 <span class="keywordtype">int</span> hawki_step_refine_offsets_retrieve_input_param
+<a name="l00380"></a>00380 (cpl_parameterlist * parlist)
+<a name="l00381"></a>00381 {
+<a name="l00382"></a>00382 cpl_parameter * par ;
+<a name="l00383"></a>00383 <span class="keyword">const</span> <span class="keywordtype">char</span> * sval ;
+<a name="l00384"></a>00384 par = NULL ;
+<a name="l00385"></a>00385 par = cpl_parameterlist_find
+<a name="l00386"></a>00386 (parlist, <span class="stringliteral">"hawki.hawki_step_refine_offsets.nbrightest"</span>);
+<a name="l00387"></a>00387 hawki_step_refine_offsets_config.nbrightest =
+<a name="l00388"></a>00388 cpl_parameter_get_int(par);
+<a name="l00389"></a>00389 par = cpl_parameterlist_find
+<a name="l00390"></a>00390 (parlist, <span class="stringliteral">"hawki.hawki_step_refine_offsets.xcorr"</span>);
+<a name="l00391"></a>00391 sval = cpl_parameter_get_string(par);
+<a name="l00392"></a>00392 <span class="keywordflow">if</span> (sscanf(sval, <span class="stringliteral">"%d,%d,%d,%d"</span>,
+<a name="l00393"></a>00393 &hawki_step_refine_offsets_config.sx,
+<a name="l00394"></a>00394 &hawki_step_refine_offsets_config.sy,
+<a name="l00395"></a>00395 &hawki_step_refine_offsets_config.mx,
+<a name="l00396"></a>00396 &hawki_step_refine_offsets_config.my)!=4)
+<a name="l00397"></a>00397 {
+<a name="l00398"></a>00398 <span class="keywordflow">return</span> -1;
+<a name="l00399"></a>00399 }
+<a name="l00400"></a>00400 <span class="keywordflow">return</span> 0;
+<a name="l00401"></a>00401 }
+<a name="l00402"></a>00402
+<a name="l00403"></a>00403
+<a name="l00404"></a>00404
+<a name="l00405"></a>00405 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00410"></a>00410 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00411"></a>00411 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_fine
+<a name="l00412"></a>00412 (<span class="keyword">const</span> cpl_frameset * science_obj_frames,
+<a name="l00413"></a>00413 <span class="keyword">const</span> cpl_frameset * reference_obj_frames,
+<a name="l00414"></a>00414 cpl_bivector ** refined_offsets,
+<a name="l00415"></a>00415 cpl_vector ** correl)
+<a name="l00416"></a>00416 {
+<a name="l00417"></a>00417 cpl_imagelist * in ;
+<a name="l00418"></a>00418 cpl_bivector * nominal_offsets ;
+<a name="l00419"></a>00419 cpl_bivector ** reference_objects;
+<a name="l00420"></a>00420 <span class="keywordtype">double</span> * offs_est_x ;
+<a name="l00421"></a>00421 <span class="keywordtype">double</span> * offs_est_y ;
+<a name="l00422"></a>00422 <span class="keywordtype">double</span> off_0_x;
+<a name="l00423"></a>00423 <span class="keywordtype">double</span> off_0_y;
+<a name="l00424"></a>00424 <span class="keywordtype">double</span> max_x, max_y ;
+<a name="l00425"></a>00425 <span class="keywordtype">int</span> idet;
+<a name="l00426"></a>00426 <span class="keywordtype">int</span> ioff;
+<a name="l00427"></a>00427 cpl_propertylist * header;
+<a name="l00428"></a>00428 <span class="keywordtype">int</span> nx;
+<a name="l00429"></a>00429 <span class="keywordtype">int</span> ny;
+<a name="l00430"></a>00430
+<a name="l00431"></a>00431 <span class="comment">/* Get the nominal offsets from the header */</span>
+<a name="l00432"></a>00432 cpl_msg_info(__func__,<span class="stringliteral">"Getting the nominal offsets"</span>);
+<a name="l00433"></a>00433 nominal_offsets = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(science_obj_frames);
+<a name="l00434"></a>00434 <span class="keywordflow">if</span> (nominal_offsets == NULL)
+<a name="l00435"></a>00435 {
+<a name="l00436"></a>00436 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load the header offsets"</span>) ;
+<a name="l00437"></a>00437 <span class="keywordflow">return</span> -1;
+<a name="l00438"></a>00438 }
+<a name="l00439"></a>00439 offs_est_x = cpl_bivector_get_x_data(nominal_offsets);
+<a name="l00440"></a>00440 offs_est_y = cpl_bivector_get_y_data(nominal_offsets);
+<a name="l00441"></a>00441
+<a name="l00442"></a>00442 <span class="comment">/* Print the header offsets */</span>
+<a name="l00443"></a>00443 cpl_msg_indent_more();
+<a name="l00444"></a>00444 <span class="keywordflow">for</span> (ioff=0 ; ioff<cpl_bivector_get_size(nominal_offsets) ; ioff++)
+<a name="l00445"></a>00445 {
+<a name="l00446"></a>00446 cpl_msg_info(__func__, <span class="stringliteral">"Telescope offsets (Frame %d): %g %g"</span>, ioff+1,
+<a name="l00447"></a>00447 offs_est_x[ioff], offs_est_y[ioff]) ;
+<a name="l00448"></a>00448 }
+<a name="l00449"></a>00449 cpl_msg_indent_less();
+<a name="l00450"></a>00450
+<a name="l00451"></a>00451 <span class="comment">/* Get the size of the detectors of the first extension */</span>
+<a name="l00452"></a>00452 header = cpl_propertylist_load
+<a name="l00453"></a>00453 (cpl_frame_get_filename
+<a name="l00454"></a>00454 (cpl_frameset_get_first_const(science_obj_frames)), 1);
+<a name="l00455"></a>00455 nx = <a class="code" href="group__hawki__pfits.html#ga509576593bbfc282745eae7d29a89102" title="Get the number of pixels in axis 1.">hawki_pfits_get_naxis1</a>(header);
+<a name="l00456"></a>00456 ny = <a class="code" href="group__hawki__pfits.html#gaabcefe7bbad8cb43ad652970057d0356" title="Get the number of pixels in axis 2.">hawki_pfits_get_naxis2</a>(header);
+<a name="l00457"></a>00457 cpl_propertylist_delete(header);
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 <span class="comment">/* Get the first offset to all offsets */</span>
+<a name="l00460"></a>00460 off_0_x = offs_est_x[0];
+<a name="l00461"></a>00461 off_0_y = offs_est_y[0];
+<a name="l00462"></a>00462
+<a name="l00463"></a>00463 <span class="comment">/* Get the objects (anchor points)*/</span>
+<a name="l00464"></a>00464 <span class="comment">/* They are already in the "first image" reference system */</span>
+<a name="l00465"></a>00465 reference_objects =
+<a name="l00466"></a>00466 hawki_step_refine_offsets_read_select_objects(reference_obj_frames,
+<a name="l00467"></a>00467 off_0_x,
+<a name="l00468"></a>00468 off_0_y,
+<a name="l00469"></a>00469 nx,
+<a name="l00470"></a>00470 ny);
+<a name="l00471"></a>00471 <span class="keywordflow">if</span>(reference_objects == NULL)
+<a name="l00472"></a>00472 {
+<a name="l00473"></a>00473 cpl_msg_error(__func__,<span class="stringliteral">"Error reading the reference objects"</span>);
+<a name="l00474"></a>00474 cpl_bivector_delete(nominal_offsets);
+<a name="l00475"></a>00475 <span class="keywordflow">return</span> -1;
+<a name="l00476"></a>00476 }
+<a name="l00477"></a>00477
+<a name="l00478"></a>00478 <span class="comment">/* Subtract the first offset to all offsets */</span>
+<a name="l00479"></a>00479 max_x = max_y = 0.0 ;
+<a name="l00480"></a>00480 <span class="keywordflow">for</span> (ioff=1 ; ioff<cpl_bivector_get_size(nominal_offsets) ; ioff++)
+<a name="l00481"></a>00481 {
+<a name="l00482"></a>00482 offs_est_x[ioff] -= off_0_x;
+<a name="l00483"></a>00483 offs_est_y[ioff] -= off_0_y;
+<a name="l00484"></a>00484 <span class="keywordflow">if</span> (fabs(offs_est_x[ioff]) > max_x) max_x = fabs(offs_est_x[ioff]) ;
+<a name="l00485"></a>00485 <span class="keywordflow">if</span> (fabs(offs_est_y[ioff]) > max_y) max_y = fabs(offs_est_y[ioff]) ;
+<a name="l00486"></a>00486 }
+<a name="l00487"></a>00487 offs_est_x[0] = offs_est_y[0] = 0.00 ;
+<a name="l00488"></a>00488
+<a name="l00489"></a>00489 <span class="comment">/* Get the opposite offsets. This is to change from </span>
+<a name="l00490"></a>00490 <span class="comment"> * telescope convention to cpl convention */</span>
+<a name="l00491"></a>00491 cpl_vector_multiply_scalar(cpl_bivector_get_x(nominal_offsets), -1.0);
+<a name="l00492"></a>00492 cpl_vector_multiply_scalar(cpl_bivector_get_y(nominal_offsets), -1.0);
+<a name="l00493"></a>00493
+<a name="l00494"></a>00494 <span class="comment">/* Loop on the detectors */</span>
+<a name="l00495"></a>00495 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00496"></a>00496 {
+<a name="l00497"></a>00497 cpl_msg_info(__func__, <span class="stringliteral">"Working on detector number %d"</span>, idet+1) ;
+<a name="l00498"></a>00498 cpl_msg_indent_more();
+<a name="l00499"></a>00499
+<a name="l00500"></a>00500 <span class="comment">/* Load the input data */</span>
+<a name="l00501"></a>00501 cpl_msg_info(__func__, <span class="stringliteral">"Loading the input data"</span>) ;
+<a name="l00502"></a>00502 cpl_msg_indent_more() ;
+<a name="l00503"></a>00503 <span class="keywordflow">if</span> ((in = <a class="code" href="group__hawki__load.html#gad4d9d26496599a54ebc31e2a43814895" title="Load the chips of HAWKI frameset in an image list.">hawki_load_detector</a>(science_obj_frames,
+<a name="l00504"></a>00504 idet+1, CPL_TYPE_FLOAT)) == NULL)
+<a name="l00505"></a>00505 {
+<a name="l00506"></a>00506 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load chip %d"</span>, idet+1) ;
+<a name="l00507"></a>00507 cpl_bivector_delete(nominal_offsets) ;
+<a name="l00508"></a>00508 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00509"></a>00509 {
+<a name="l00510"></a>00510 cpl_bivector_delete(reference_objects[idet]);
+<a name="l00511"></a>00511 }
+<a name="l00512"></a>00512 cpl_free(reference_objects);
+<a name="l00513"></a>00513 cpl_msg_indent_less() ;
+<a name="l00514"></a>00514 cpl_msg_indent_less() ;
+<a name="l00515"></a>00515 <span class="keywordflow">return</span> -1;
+<a name="l00516"></a>00516 }
+<a name="l00517"></a>00517
+<a name="l00518"></a>00518 <span class="comment">/* Get the refinement */</span>
+<a name="l00519"></a>00519 cpl_msg_info(__func__, <span class="stringliteral">"Getting the refinement"</span>);
+<a name="l00520"></a>00520 cpl_msg_indent_more() ;
+<a name="l00521"></a>00521 <span class="keywordflow">if</span> (hawki_geom_refine_images_offsets
+<a name="l00522"></a>00522 (in,
+<a name="l00523"></a>00523 nominal_offsets,
+<a name="l00524"></a>00524 reference_objects[idet],
+<a name="l00525"></a>00525 hawki_step_refine_offsets_config.sx,
+<a name="l00526"></a>00526 hawki_step_refine_offsets_config.sy,
+<a name="l00527"></a>00527 hawki_step_refine_offsets_config.mx,
+<a name="l00528"></a>00528 hawki_step_refine_offsets_config.my,
+<a name="l00529"></a>00529 refined_offsets[idet],
+<a name="l00530"></a>00530 correl[idet]) == -1)
+<a name="l00531"></a>00531 {
+<a name="l00532"></a>00532 cpl_msg_error(__func__, <span class="stringliteral">"Cannot apply the shift and add"</span>) ;
+<a name="l00533"></a>00533 cpl_imagelist_delete(in) ;
+<a name="l00534"></a>00534 cpl_bivector_delete(nominal_offsets) ;
+<a name="l00535"></a>00535 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00536"></a>00536 cpl_bivector_delete(reference_objects[idet]);
+<a name="l00537"></a>00537 cpl_free(reference_objects);
+<a name="l00538"></a>00538 cpl_msg_indent_less() ;
+<a name="l00539"></a>00539 cpl_msg_indent_less() ;
+<a name="l00540"></a>00540 <span class="keywordflow">return</span> -1;
+<a name="l00541"></a>00541 }
+<a name="l00542"></a>00542
+<a name="l00543"></a>00543 <span class="comment">/* Convert to "telescope criteria" */</span>
+<a name="l00544"></a>00544 <span class="comment">/* Also add the offset of the first image */</span>
+<a name="l00545"></a>00545 cpl_vector_multiply_scalar
+<a name="l00546"></a>00546 (cpl_bivector_get_x(refined_offsets[idet]), -1.0);
+<a name="l00547"></a>00547 cpl_vector_multiply_scalar
+<a name="l00548"></a>00548 (cpl_bivector_get_y(refined_offsets[idet]), -1.0);
+<a name="l00549"></a>00549 cpl_vector_add_scalar
+<a name="l00550"></a>00550 (cpl_bivector_get_x(refined_offsets[idet]), off_0_x);
+<a name="l00551"></a>00551 cpl_vector_add_scalar
+<a name="l00552"></a>00552 (cpl_bivector_get_y(refined_offsets[idet]), off_0_y);
+<a name="l00553"></a>00553
+<a name="l00554"></a>00554 <span class="comment">/* Print the new offsets */</span>
+<a name="l00555"></a>00555 <span class="keywordflow">for</span> (ioff=0 ; ioff<cpl_bivector_get_size(refined_offsets[idet]); ioff++)
+<a name="l00556"></a>00556 {
+<a name="l00557"></a>00557 cpl_msg_info(__func__,<span class="stringliteral">"Refined telescope offsets (Frame %d): %g %g"</span>,
+<a name="l00558"></a>00558 ioff+1,
+<a name="l00559"></a>00559 cpl_vector_get(cpl_bivector_get_x
+<a name="l00560"></a>00560 (refined_offsets[idet]), ioff),
+<a name="l00561"></a>00561 cpl_vector_get(cpl_bivector_get_y
+<a name="l00562"></a>00562 (refined_offsets[idet]), ioff));
+<a name="l00563"></a>00563 }
+<a name="l00564"></a>00564 cpl_imagelist_delete(in) ;
+<a name="l00565"></a>00565 cpl_msg_indent_less() ;
+<a name="l00566"></a>00566 cpl_msg_indent_less() ;
+<a name="l00567"></a>00567 }
+<a name="l00568"></a>00568
+<a name="l00569"></a>00569 <span class="comment">/* Freeing */</span>
+<a name="l00570"></a>00570 cpl_bivector_delete(nominal_offsets);
+<a name="l00571"></a>00571 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00572"></a>00572 cpl_bivector_delete(reference_objects[idet]);
+<a name="l00573"></a>00573 cpl_free(reference_objects);
+<a name="l00574"></a>00574
+<a name="l00575"></a>00575 <span class="keywordflow">return</span> 0;
+<a name="l00576"></a>00576 }
+<a name="l00577"></a>00577
+<a name="l00578"></a>00578 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00586"></a>00586 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00587"></a>00587
+<a name="l00588"></a>00588 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_refine_offsets_save
+<a name="l00589"></a>00589 (cpl_bivector ** refined_offsets,
+<a name="l00590"></a>00590 cpl_vector ** correlations,
+<a name="l00591"></a>00591 cpl_parameterlist * recipe_parlist,
+<a name="l00592"></a>00592 cpl_frameset * recipe_frameset)
+<a name="l00593"></a>00593 {
+<a name="l00594"></a>00594 cpl_table ** offset_tables;
+<a name="l00595"></a>00595 <span class="keywordtype">int</span> ioff;
+<a name="l00596"></a>00596 <span class="keywordtype">int</span> idet;
+<a name="l00597"></a>00597 <span class="keywordtype">int</span> noff;
+<a name="l00598"></a>00598 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_refine_offsets"</span>;
+<a name="l00599"></a>00599 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00600"></a>00600
+<a name="l00601"></a>00601
+<a name="l00602"></a>00602 <span class="comment">/* Convert the offsets to a table */</span>
+<a name="l00603"></a>00603 offset_tables = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00604"></a>00604 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00605"></a>00605 {
+<a name="l00606"></a>00606 offset_tables[idet] = cpl_table_new
+<a name="l00607"></a>00607 (cpl_bivector_get_size(refined_offsets[idet]));
+<a name="l00608"></a>00608 cpl_table_new_column(offset_tables[idet],
+<a name="l00609"></a>00609 HAWKI_COL_OFFSET_X, CPL_TYPE_FLOAT);
+<a name="l00610"></a>00610 cpl_table_set_column_unit(offset_tables[idet],HAWKI_COL_OFFSET_X,<span class="stringliteral">"pix"</span>);
+<a name="l00611"></a>00611 cpl_table_new_column(offset_tables[idet],
+<a name="l00612"></a>00612 HAWKI_COL_OFFSET_Y, CPL_TYPE_FLOAT);
+<a name="l00613"></a>00613 cpl_table_set_column_unit(offset_tables[idet],HAWKI_COL_OFFSET_Y,<span class="stringliteral">"pix"</span>);
+<a name="l00614"></a>00614 cpl_table_new_column(offset_tables[idet],
+<a name="l00615"></a>00615 HAWKI_COL_CORRELATION, CPL_TYPE_FLOAT);
+<a name="l00616"></a>00616 noff = cpl_bivector_get_size(refined_offsets[idet]);
+<a name="l00617"></a>00617 <span class="keywordflow">for</span>(ioff = 0; ioff < noff; ++ioff)
+<a name="l00618"></a>00618 {
+<a name="l00619"></a>00619 <span class="keywordtype">double</span> xoffset, yoffset, corr;
+<a name="l00620"></a>00620 xoffset = cpl_vector_get
+<a name="l00621"></a>00621 (cpl_bivector_get_x(refined_offsets[idet]), ioff);
+<a name="l00622"></a>00622 yoffset = cpl_vector_get
+<a name="l00623"></a>00623 (cpl_bivector_get_y(refined_offsets[idet]), ioff);
+<a name="l00624"></a>00624 corr = cpl_vector_get(correlations[idet], ioff);
+<a name="l00625"></a>00625 cpl_table_set
+<a name="l00626"></a>00626 (offset_tables[idet], HAWKI_COL_OFFSET_X, ioff, xoffset);
+<a name="l00627"></a>00627 cpl_table_set
+<a name="l00628"></a>00628 (offset_tables[idet], HAWKI_COL_OFFSET_Y, ioff, yoffset);
+<a name="l00629"></a>00629 cpl_table_set
+<a name="l00630"></a>00630 (offset_tables[idet], HAWKI_COL_CORRELATION, ioff, corr);
+<a name="l00631"></a>00631 }
+<a name="l00632"></a>00632 }
+<a name="l00633"></a>00633
+<a name="l00634"></a>00634 <span class="comment">/* Write the table with the statistics */</span>
+<a name="l00635"></a>00635 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(recipe_frameset,
+<a name="l00636"></a>00636 recipe_parlist,
+<a name="l00637"></a>00637 recipe_frameset,
+<a name="l00638"></a>00638 (<span class="keyword">const</span> cpl_table **)offset_tables,
+<a name="l00639"></a>00639 recipe_name,
+<a name="l00640"></a>00640 HAWKI_CALPRO_OFFSETS,
+<a name="l00641"></a>00641 HAWKI_PROTYPE_OFFSETS,
+<a name="l00642"></a>00642 NULL,
+<a name="l00643"></a>00643 NULL,
+<a name="l00644"></a>00644 <span class="stringliteral">"hawki_step_refine_offsets.fits"</span>) != CPL_ERROR_NONE)
+<a name="l00645"></a>00645 {
+<a name="l00646"></a>00646 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the first extension table"</span>) ;
+<a name="l00647"></a>00647 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00648"></a>00648 cpl_table_delete(offset_tables[idet]);
+<a name="l00649"></a>00649 cpl_free(offset_tables);
+<a name="l00650"></a>00650 <span class="keywordflow">return</span> -1 ;
+<a name="l00651"></a>00651 }
+<a name="l00652"></a>00652
+<a name="l00653"></a>00653 <span class="comment">/* Free and return */</span>
+<a name="l00654"></a>00654 <span class="keywordflow">for</span>(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+<a name="l00655"></a>00655 cpl_table_delete(offset_tables[idet]);
+<a name="l00656"></a>00656 cpl_free(offset_tables);
+<a name="l00657"></a>00657 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00658"></a>00658 {
+<a name="l00659"></a>00659 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00660"></a>00660 <span class="keywordflow">return</span> -1;
+<a name="l00661"></a>00661 }
+<a name="l00662"></a>00662 <span class="keywordflow">return</span> 0;
+<a name="l00663"></a>00663 }
+<a name="l00664"></a>00664
+<a name="l00665"></a>00665 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00680"></a>00680 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00681"></a>00681 <span class="keyword">static</span> cpl_bivector ** hawki_step_refine_offsets_read_select_objects
+<a name="l00682"></a>00682 (<span class="keyword">const</span> cpl_frameset * reference_obj_frames,
+<a name="l00683"></a>00683 <span class="keywordtype">double</span> first_image_off_x,
+<a name="l00684"></a>00684 <span class="keywordtype">double</span> first_image_off_y,
+<a name="l00685"></a>00685 <span class="keywordtype">int</span> nx,
+<a name="l00686"></a>00686 <span class="keywordtype">int</span> ny)
+<a name="l00687"></a>00687 {
+<a name="l00688"></a>00688 <span class="keyword">const</span> cpl_frame * reference_obj_frame;
+<a name="l00689"></a>00689 cpl_table ** obj_param;
+<a name="l00690"></a>00690 cpl_propertylist * sort_column;
+<a name="l00691"></a>00691 cpl_bivector ** reference_objects;
+<a name="l00692"></a>00692 <span class="keywordtype">int</span> idet;
+<a name="l00693"></a>00693
+<a name="l00694"></a>00694 <span class="comment">/* Get the objects */</span>
+<a name="l00695"></a>00695 cpl_msg_info(__func__,<span class="stringliteral">"Getting the reference object positions"</span>);
+<a name="l00696"></a>00696 reference_obj_frame = cpl_frameset_get_first_const(reference_obj_frames);
+<a name="l00697"></a>00697 obj_param = <a class="code" href="group__hawki__load.html#ga8ad708e19bdb35ac89abc2d9ba3932f0" title="Load a table with four extensions, one for each chip.">hawki_load_tables</a>(reference_obj_frame);
+<a name="l00698"></a>00698 <span class="keywordflow">if</span>(obj_param == NULL)
+<a name="l00699"></a>00699 {
+<a name="l00700"></a>00700 cpl_msg_error(__func__,<span class="stringliteral">"Could not read the reference objects parameters"</span>);
+<a name="l00701"></a>00701 <span class="keywordflow">return</span> NULL;
+<a name="l00702"></a>00702 }
+<a name="l00703"></a>00703
+<a name="l00704"></a>00704 <span class="comment">/* Create the sorting criteria: by flux */</span>
+<a name="l00705"></a>00705 sort_column = cpl_propertylist_new();
+<a name="l00706"></a>00706 cpl_propertylist_append_bool(sort_column, HAWKI_COL_OBJ_FLUX, CPL_TRUE);
+<a name="l00707"></a>00707
+<a name="l00708"></a>00708 <span class="comment">/* Allocate partially the reference objects */</span>
+<a name="l00709"></a>00709 reference_objects = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_bivector *));
+<a name="l00710"></a>00710
+<a name="l00711"></a>00711 <span class="comment">/* Loop on detectors */</span>
+<a name="l00712"></a>00712 cpl_msg_indent_more();
+<a name="l00713"></a>00713 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00714"></a>00714 {
+<a name="l00715"></a>00715 cpl_propertylist * objects_plist;
+<a name="l00716"></a>00716 cpl_vector * obj_x;
+<a name="l00717"></a>00717 cpl_vector * obj_y;
+<a name="l00718"></a>00718 <span class="keywordtype">int</span> nobj;
+<a name="l00719"></a>00719 <span class="keywordtype">int</span> nselect;
+<a name="l00720"></a>00720 <span class="keywordtype">int</span> iobj;
+<a name="l00721"></a>00721 <span class="keywordtype">int</span> ext_nb;
+<a name="l00722"></a>00722 <span class="keywordtype">double</span> reference_offset_x;
+<a name="l00723"></a>00723 <span class="keywordtype">double</span> reference_offset_y;
+<a name="l00724"></a>00724
+<a name="l00725"></a>00725 <span class="comment">/* Get the global offset */</span>
+<a name="l00726"></a>00726 <span class="comment">/* This allows to know which is the reference point of the detected </span>
+<a name="l00727"></a>00727 <span class="comment"> * objects positions (which are referred in general to the combined image */</span>
+<a name="l00728"></a>00728 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00729"></a>00729 (cpl_frame_get_filename(reference_obj_frame), idet + 1);
+<a name="l00730"></a>00730 objects_plist = cpl_propertylist_load
+<a name="l00731"></a>00731 (cpl_frame_get_filename(reference_obj_frame), ext_nb);
+<a name="l00732"></a>00732 reference_offset_x =
+<a name="l00733"></a>00733 <a class="code" href="group__hawki__pfits.html#ga24483514187ce9bcf0860cc654b8508c" title="find out the cumulative X offset of the combined image">hawki_pfits_get_comb_cumoffsetx</a>(objects_plist);
+<a name="l00734"></a>00734 reference_offset_y =
+<a name="l00735"></a>00735 <a class="code" href="group__hawki__pfits.html#gadc1b3f141f5474486b5b32502634b29a" title="find out the cumulative Y offset of the combined image">hawki_pfits_get_comb_cumoffsety</a>(objects_plist);
+<a name="l00736"></a>00736 <span class="keywordflow">if</span>(cpl_error_get_code() != CPL_ERROR_NONE)
+<a name="l00737"></a>00737 {
+<a name="l00738"></a>00738 cpl_msg_error(__func__,<span class="stringliteral">"Could not find keywords "</span>
+<a name="l00739"></a>00739 <span class="stringliteral">"ESO QC COMBINED CUMOFFSETX,Y in reference objects frame"</span>);
+<a name="l00740"></a>00740 cpl_propertylist_delete(objects_plist);
+<a name="l00741"></a>00741 cpl_propertylist_delete(sort_column);
+<a name="l00742"></a>00742 <span class="keywordflow">return</span> NULL;
+<a name="l00743"></a>00743 }
+<a name="l00744"></a>00744 cpl_msg_info(__func__,<span class="stringliteral">"Objects offsets wrt telescope: %f %f"</span>,
+<a name="l00745"></a>00745 reference_offset_x, reference_offset_y);
+<a name="l00746"></a>00746 cpl_propertylist_delete(objects_plist);
+<a name="l00747"></a>00747
+<a name="l00748"></a>00748 <span class="comment">/* Sort the table by flux */</span>
+<a name="l00749"></a>00749 cpl_table_sort(obj_param[idet], sort_column);
+<a name="l00750"></a>00750 nobj = cpl_table_get_nrow(obj_param[idet]);
+<a name="l00751"></a>00751
+<a name="l00752"></a>00752 <span class="comment">/* Allocate objects vector */</span>
+<a name="l00753"></a>00753 reference_objects[idet] = cpl_bivector_new(nobj);
+<a name="l00754"></a>00754 obj_x = cpl_bivector_get_x(reference_objects[idet]);
+<a name="l00755"></a>00755 obj_y = cpl_bivector_get_y(reference_objects[idet]);
+<a name="l00756"></a>00756 cpl_msg_info(__func__, <span class="stringliteral">"Number of objects in chip %d: %d"</span>, idet+1,nobj);
+<a name="l00757"></a>00757
+<a name="l00758"></a>00758 <span class="comment">/* Keep only those objects within the first image */</span>
+<a name="l00759"></a>00759 cpl_table_unselect_all(obj_param[idet]);
+<a name="l00760"></a>00760 <span class="keywordflow">for</span>(iobj = 0 ; iobj < nobj; ++iobj)
+<a name="l00761"></a>00761 {
+<a name="l00762"></a>00762 <span class="keywordtype">double</span> xpos_orig = cpl_table_get
+<a name="l00763"></a>00763 (obj_param[idet], HAWKI_COL_OBJ_POSX, iobj, NULL);
+<a name="l00764"></a>00764 <span class="keywordtype">double</span> ypos_orig = cpl_table_get
+<a name="l00765"></a>00765 (obj_param[idet], HAWKI_COL_OBJ_POSY, iobj, NULL);
+<a name="l00766"></a>00766 <span class="keywordtype">double</span> xpos_rel = xpos_orig - reference_offset_x + first_image_off_x;
+<a name="l00767"></a>00767 <span class="keywordtype">double</span> ypos_rel = ypos_orig - reference_offset_y + first_image_off_y;
+<a name="l00768"></a>00768 <span class="keywordflow">if</span>(xpos_rel < 0.0 || xpos_rel >= nx ||
+<a name="l00769"></a>00769 ypos_rel < 0.0 || ypos_rel >= ny)
+<a name="l00770"></a>00770 {
+<a name="l00771"></a>00771 cpl_table_select_row(obj_param[idet], iobj);
+<a name="l00772"></a>00772 }
+<a name="l00773"></a>00773 }
+<a name="l00774"></a>00774 cpl_table_erase_selected(obj_param[idet]);
+<a name="l00775"></a>00775 nobj = cpl_table_get_nrow(obj_param[idet]);
+<a name="l00776"></a>00776 cpl_msg_info(__func__, <span class="stringliteral">"Number of objects within limits of detector "</span>
+<a name="l00777"></a>00777 <span class="stringliteral">"in chip %d: %d"</span>, idet+1,nobj);
+<a name="l00778"></a>00778
+<a name="l00779"></a>00779 <span class="comment">/* Apply the flux criteria */</span>
+<a name="l00780"></a>00780 nselect = hawki_step_refine_offsets_config.nbrightest;
+<a name="l00781"></a>00781 <span class="keywordflow">if</span>(nselect < 0 || nselect > nobj)
+<a name="l00782"></a>00782 nselect = nobj;
+<a name="l00783"></a>00783 cpl_msg_info(__func__, <span class="stringliteral">"Number of selected objects: %d"</span>, nselect);
+<a name="l00784"></a>00784 <span class="keywordflow">for</span>(iobj = 0 ; iobj < nselect; ++iobj)
+<a name="l00785"></a>00785 {
+<a name="l00786"></a>00786 <span class="keywordtype">double</span> xpos_orig = cpl_table_get
+<a name="l00787"></a>00787 (obj_param[idet], HAWKI_COL_OBJ_POSX, iobj, NULL);
+<a name="l00788"></a>00788 <span class="keywordtype">double</span> ypos_orig = cpl_table_get
+<a name="l00789"></a>00789 (obj_param[idet], HAWKI_COL_OBJ_POSY, iobj, NULL);
+<a name="l00790"></a>00790
+<a name="l00791"></a>00791 cpl_vector_set
+<a name="l00792"></a>00792 (obj_x, iobj, xpos_orig - reference_offset_x + first_image_off_x);
+<a name="l00793"></a>00793 cpl_vector_set
+<a name="l00794"></a>00794 (obj_y, iobj, ypos_orig - reference_offset_y + first_image_off_y);
+<a name="l00795"></a>00795 cpl_msg_debug(__func__,<span class="stringliteral">"Using anchor point at %f,%f"</span>,
+<a name="l00796"></a>00796 cpl_vector_get(obj_x,iobj),
+<a name="l00797"></a>00797 cpl_vector_get(obj_y,iobj));
+<a name="l00798"></a>00798
+<a name="l00799"></a>00799 }
+<a name="l00800"></a>00800 cpl_vector_set_size(obj_x, nselect);
+<a name="l00801"></a>00801 cpl_vector_set_size(obj_y, nselect);
+<a name="l00802"></a>00802
+<a name="l00803"></a>00803 }
+<a name="l00804"></a>00804 cpl_msg_indent_less();
+<a name="l00805"></a>00805
+<a name="l00806"></a>00806 <span class="comment">/* Freeing */</span>
+<a name="l00807"></a>00807 <span class="keywordflow">for</span> (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+<a name="l00808"></a>00808 cpl_table_delete(obj_param[idet]);
+<a name="l00809"></a>00809 cpl_free(obj_param);
+<a name="l00810"></a>00810 cpl_propertylist_delete(sort_column);
+<a name="l00811"></a>00811
+<a name="l00812"></a>00812 <span class="keywordflow">return</span> reference_objects;
+<a name="l00813"></a>00813 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__stats_8c_source.html b/html/hawki__step__stats_8c_source.html
new file mode 100644
index 0000000..339aa8e
--- /dev/null
+++ b/html/hawki__step__stats_8c_source.html
@@ -0,0 +1,437 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_stats.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_stats.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_stats.c,v 1.12 2011/10/24 10:42:03 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:42:03 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.12 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_image_stats.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00046"></a>00046
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00049"></a>00049 <span class="comment"> Functions prototypes</span>
+<a name="l00050"></a>00050 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_create(cpl_plugin *) ;
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_exec(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_destroy(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_frameset_stats
+<a name="l00058"></a>00058 (cpl_table ** target_stats,
+<a name="l00059"></a>00059 cpl_propertylist ** stats_stats,
+<a name="l00060"></a>00060 cpl_frameset * target_frames);
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_save
+<a name="l00063"></a>00063 (cpl_table ** target_stats,
+<a name="l00064"></a>00064 cpl_parameterlist * recipe_parlist,
+<a name="l00065"></a>00065 cpl_frameset * recipe_frameset,
+<a name="l00066"></a>00066 cpl_frameset * used_frameset,
+<a name="l00067"></a>00067 cpl_propertylist ** stats_stats,
+<a name="l00068"></a>00068 <span class="keyword">const</span> <span class="keywordtype">char</span> * calpro,
+<a name="l00069"></a>00069 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype);
+<a name="l00070"></a>00070
+<a name="l00071"></a>00071 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00072"></a>00072 <span class="comment"> Static variables</span>
+<a name="l00073"></a>00073 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00074"></a>00074
+<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_stats_description[] =
+<a name="l00076"></a>00076 <span class="stringliteral">"hawki_step_stats -- hawki statistics utility (mean, stdev, ...).\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00078"></a>00078 <span class="stringliteral">"raw-jitter.fits "</span>HAWKI_IMG_JITTER_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00079"></a>00079 <span class="stringliteral">"bkg.fits "</span>HAWKI_CALPRO_BKGIMAGE<span class="stringliteral">" or\n"</span>
+<a name="l00080"></a>00080 <span class="stringliteral">"raw-flat.fits "</span>HAWKI_CAL_FLAT_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00081"></a>00081 <span class="stringliteral">"raw-dark.fits "</span>HAWKI_CAL_DARK_RAW<span class="stringliteral">" or\n"</span>
+<a name="l00082"></a>00082 <span class="stringliteral">"raw-zpoint.fits "</span>HAWKI_CAL_ZPOINT_RAW<span class="stringliteral">" \n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"hawki_step_stats.fits ("</span>HAWKI_CALPRO_JITTER_STATS<span class="stringliteral">"): Statistics of raw jitter images, or\n"</span>
+<a name="l00085"></a>00085 <span class="stringliteral">"hawki_step_stats.fits ("</span>HAWKI_CALPRO_JITTER_BKG_STATS<span class="stringliteral">"): Statistics of background images, or\n"</span>
+<a name="l00086"></a>00086 <span class="stringliteral">"hawki_step_stats.fits ("</span>HAWKI_CALPRO_FLAT_STATS<span class="stringliteral">"): Statistics of raw flats, or\n"</span>
+<a name="l00087"></a>00087 <span class="stringliteral">"hawki_step_stats.fits ("</span>HAWKI_CALPRO_DARK_STATS<span class="stringliteral">"): Statistics of raw darks, or\n"</span>
+<a name="l00088"></a>00088 <span class="stringliteral">"hawki_step_stats.fits ("</span>HAWKI_CALPRO_ZPOINT_STATS<span class="stringliteral">"): Statistics of raw standard star images.\n"</span>
+<a name="l00089"></a>00089 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00090"></a>00090 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093
+<a name="l00094"></a>00094 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00095"></a>00095 <span class="comment"> Functions code</span>
+<a name="l00096"></a>00096 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00097"></a>00097
+<a name="l00098"></a>00098 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00106"></a>00106 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00107"></a>00107 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00108"></a>00108 {
+<a name="l00109"></a>00109 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00110"></a>00110 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00111"></a>00111
+<a name="l00112"></a>00112 cpl_plugin_init(plugin,
+<a name="l00113"></a>00113 CPL_PLUGIN_API,
+<a name="l00114"></a>00114 HAWKI_BINARY_VERSION,
+<a name="l00115"></a>00115 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00116"></a>00116 <span class="stringliteral">"hawki_step_stats"</span>,
+<a name="l00117"></a>00117 <span class="stringliteral">"Standard statistics utility"</span>,
+<a name="l00118"></a>00118 hawki_step_stats_description,
+<a name="l00119"></a>00119 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00120"></a>00120 PACKAGE_BUGREPORT,
+<a name="l00121"></a>00121 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00122"></a>00122 hawki_step_stats_create,
+<a name="l00123"></a>00123 hawki_step_stats_exec,
+<a name="l00124"></a>00124 hawki_step_stats_destroy) ;
+<a name="l00125"></a>00125
+<a name="l00126"></a>00126 cpl_pluginlist_append(list, plugin) ;
+<a name="l00127"></a>00127
+<a name="l00128"></a>00128 <span class="keywordflow">return</span> 0;
+<a name="l00129"></a>00129 }
+<a name="l00130"></a>00130
+<a name="l00131"></a>00131 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00140"></a>00140 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00141"></a>00141 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_create(cpl_plugin * plugin)
+<a name="l00142"></a>00142 {
+<a name="l00143"></a>00143 cpl_recipe * recipe ;
+<a name="l00144"></a>00144 <span class="comment">/* cpl_parameter * p ; */</span>
+<a name="l00145"></a>00145
+<a name="l00146"></a>00146 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00147"></a>00147 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00148"></a>00148 recipe = (cpl_recipe *)plugin ;
+<a name="l00149"></a>00149 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00150"></a>00150
+<a name="l00151"></a>00151 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00152"></a>00152 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00153"></a>00153 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00154"></a>00154 <span class="keywordflow">return</span> 1;
+<a name="l00155"></a>00155
+<a name="l00156"></a>00156 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00157"></a>00157 <span class="comment">/* None.. */</span>
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 <span class="comment">/* Return */</span>
+<a name="l00160"></a>00160 <span class="keywordflow">return</span> 0;
+<a name="l00161"></a>00161 }
+<a name="l00162"></a>00162
+<a name="l00163"></a>00163 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00169"></a>00169 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00170"></a>00170 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_exec(cpl_plugin * plugin)
+<a name="l00171"></a>00171 {
+<a name="l00172"></a>00172 cpl_recipe * recipe ;
+<a name="l00173"></a>00173
+<a name="l00174"></a>00174 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00175"></a>00175 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00176"></a>00176 recipe = (cpl_recipe *)plugin ;
+<a name="l00177"></a>00177 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00178"></a>00178
+<a name="l00179"></a>00179 <span class="comment">/* Issue a banner */</span>
+<a name="l00180"></a>00180 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00181"></a>00181
+<a name="l00182"></a>00182 <span class="keywordflow">return</span> hawki_step_stats(recipe->parameters, recipe->frames) ;
+<a name="l00183"></a>00183 }
+<a name="l00184"></a>00184
+<a name="l00185"></a>00185 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00191"></a>00191 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00192"></a>00192 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_destroy(cpl_plugin * plugin)
+<a name="l00193"></a>00193 {
+<a name="l00194"></a>00194 cpl_recipe * recipe ;
+<a name="l00195"></a>00195
+<a name="l00196"></a>00196 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00197"></a>00197 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00198"></a>00198 recipe = (cpl_recipe *)plugin ;
+<a name="l00199"></a>00199 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00200"></a>00200
+<a name="l00201"></a>00201 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00202"></a>00202 <span class="keywordflow">return</span> 0 ;
+<a name="l00203"></a>00203 }
+<a name="l00204"></a>00204
+<a name="l00205"></a>00205 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00212"></a>00212 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00213"></a>00213 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats(
+<a name="l00214"></a>00214 cpl_parameterlist * parlist,
+<a name="l00215"></a>00215 cpl_frameset * framelist)
+<a name="l00216"></a>00216 {
+<a name="l00217"></a>00217 cpl_frameset * frames ;
+<a name="l00218"></a>00218 cpl_table ** target_stats;
+<a name="l00219"></a>00219 cpl_propertylist ** stats_stats;
+<a name="l00220"></a>00220 <span class="keywordtype">int</span> idet;
+<a name="l00221"></a>00221 <span class="keywordtype">char</span> calpro[1024];
+<a name="l00222"></a>00222 <span class="keywordtype">char</span> protype[1024];
+<a name="l00223"></a>00223
+<a name="l00224"></a>00224 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00225"></a>00225 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist))
+<a name="l00226"></a>00226 {
+<a name="l00227"></a>00227 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00228"></a>00228 <span class="keywordflow">return</span> -1;
+<a name="l00229"></a>00229 }
+<a name="l00230"></a>00230
+<a name="l00231"></a>00231 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00232"></a>00232 cpl_msg_info(__func__, <span class="stringliteral">"Identifying input frames"</span>);
+<a name="l00233"></a>00233 frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_IMG_JITTER_RAW) ;
+<a name="l00234"></a>00234 snprintf(calpro, 1024, HAWKI_CALPRO_JITTER_STATS);
+<a name="l00235"></a>00235 snprintf(protype, 1024, HAWKI_PROTYPE_JITTER_STATS);
+<a name="l00236"></a>00236 <span class="keywordflow">if</span> (frames == NULL)
+<a name="l00237"></a>00237 {
+<a name="l00238"></a>00238 frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CALPRO_BKGIMAGE);
+<a name="l00239"></a>00239 snprintf(calpro, 1024, HAWKI_CALPRO_JITTER_BKG_STATS);
+<a name="l00240"></a>00240 snprintf(protype, 1024, HAWKI_PROTYPE_JITTER_BKG_STATS);
+<a name="l00241"></a>00241 }
+<a name="l00242"></a>00242 <span class="keywordflow">if</span> (frames == NULL)
+<a name="l00243"></a>00243 {
+<a name="l00244"></a>00244 frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CAL_DARK_RAW);
+<a name="l00245"></a>00245 snprintf(calpro, 1024, HAWKI_CALPRO_DARK_STATS);
+<a name="l00246"></a>00246 snprintf(protype, 1024, HAWKI_PROTYPE_DARK_STATS);
+<a name="l00247"></a>00247 }
+<a name="l00248"></a>00248 <span class="keywordflow">if</span> (frames == NULL)
+<a name="l00249"></a>00249 {
+<a name="l00250"></a>00250 frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CAL_FLAT_RAW);
+<a name="l00251"></a>00251 snprintf(calpro, 1024, HAWKI_CALPRO_FLAT_STATS);
+<a name="l00252"></a>00252 snprintf(protype, 1024, HAWKI_PROTYPE_FLAT_STATS);
+<a name="l00253"></a>00253 }
+<a name="l00254"></a>00254 <span class="keywordflow">if</span> (frames == NULL)
+<a name="l00255"></a>00255 {
+<a name="l00256"></a>00256 frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_CAL_ZPOINT_RAW);
+<a name="l00257"></a>00257 snprintf(calpro, 1024, HAWKI_CALPRO_ZPOINT_STATS);
+<a name="l00258"></a>00258 snprintf(protype, 1024, HAWKI_PROTYPE_ZPOINT_STATS);
+<a name="l00259"></a>00259 }
+<a name="l00260"></a>00260 <span class="keywordflow">if</span> (frames == NULL)
+<a name="l00261"></a>00261 {
+<a name="l00262"></a>00262 cpl_msg_error(__func__,<span class="stringliteral">"Tag of input frames not supported"</span>);
+<a name="l00263"></a>00263 cpl_msg_error(__func__,<span class="stringliteral">"Supported: %s %s %s %s %s"</span>,
+<a name="l00264"></a>00264 HAWKI_IMG_JITTER_RAW, HAWKI_CALPRO_BKGIMAGE,
+<a name="l00265"></a>00265 HAWKI_CAL_DARK_RAW, HAWKI_CAL_FLAT_RAW, HAWKI_CAL_ZPOINT_RAW);
+<a name="l00266"></a>00266 <span class="keywordflow">return</span> -1;
+<a name="l00267"></a>00267 }
+<a name="l00268"></a>00268
+<a name="l00269"></a>00269 <span class="comment">/* Create the statistics table and the "stats of the stats"*/</span>
+<a name="l00270"></a>00270 target_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00271"></a>00271 stats_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist *));
+<a name="l00272"></a>00272 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00273"></a>00273 {
+<a name="l00274"></a>00274 target_stats[idet] = cpl_table_new(cpl_frameset_get_size(frames));
+<a name="l00275"></a>00275 stats_stats[idet] = cpl_propertylist_new();
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(target_stats);
+<a name="l00278"></a>00278
+<a name="l00279"></a>00279 <span class="comment">/* Compute actually the statistics */</span>
+<a name="l00280"></a>00280 hawki_step_stats_frameset_stats(target_stats, stats_stats, frames);
+<a name="l00281"></a>00281
+<a name="l00282"></a>00282 <span class="comment">/* Saving the table product */</span>
+<a name="l00283"></a>00283 <span class="keywordflow">if</span>(hawki_step_stats_save
+<a name="l00284"></a>00284 (target_stats, parlist, framelist, frames, stats_stats, calpro, protype) !=0)
+<a name="l00285"></a>00285 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00286"></a>00286 <span class="stringliteral">"Check permisions or disk space\n"</span>);
+<a name="l00287"></a>00287
+<a name="l00288"></a>00288 <span class="comment">/* Free and return */</span>
+<a name="l00289"></a>00289 cpl_frameset_delete(frames);
+<a name="l00290"></a>00290 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00291"></a>00291 {
+<a name="l00292"></a>00292 cpl_table_delete(target_stats[idet]);
+<a name="l00293"></a>00293 cpl_propertylist_delete(stats_stats[idet]);
+<a name="l00294"></a>00294 }
+<a name="l00295"></a>00295 cpl_free(target_stats);
+<a name="l00296"></a>00296 cpl_free(stats_stats);
+<a name="l00297"></a>00297
+<a name="l00298"></a>00298 <span class="comment">/* Return */</span>
+<a name="l00299"></a>00299 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00300"></a>00300 {
+<a name="l00301"></a>00301 cpl_msg_error(__func__,
+<a name="l00302"></a>00302 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00303"></a>00303 <span class="keywordflow">return</span> -1 ;
+<a name="l00304"></a>00304 }
+<a name="l00305"></a>00305 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00306"></a>00306 }
+<a name="l00307"></a>00307
+<a name="l00308"></a>00308 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00318"></a>00318 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00319"></a>00319 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_frameset_stats
+<a name="l00320"></a>00320 (cpl_table ** target_stats,
+<a name="l00321"></a>00321 cpl_propertylist ** stats_stats,
+<a name="l00322"></a>00322 cpl_frameset * target_frames)
+<a name="l00323"></a>00323 {
+<a name="l00324"></a>00324 <span class="keywordtype">int</span> iframe;
+<a name="l00325"></a>00325 <span class="keywordtype">int</span> nframes;
+<a name="l00326"></a>00326
+<a name="l00327"></a>00327 <span class="comment">/* Loop on the number of frames */</span>
+<a name="l00328"></a>00328 nframes = cpl_frameset_get_size(target_frames);
+<a name="l00329"></a>00329 cpl_msg_info(__func__, <span class="stringliteral">"Looping the target frames: %d frames"</span>, nframes);
+<a name="l00330"></a>00330 cpl_msg_indent_more();
+<a name="l00331"></a>00331 <span class="keywordflow">for</span>( iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l00332"></a>00332 {
+<a name="l00333"></a>00333 <span class="comment">/* Local storage variables */</span>
+<a name="l00334"></a>00334 cpl_frame * this_target_frame;
+<a name="l00335"></a>00335
+<a name="l00336"></a>00336 <span class="comment">/* Computing statistics for this frame */</span>
+<a name="l00337"></a>00337 cpl_msg_info(__func__, <span class="stringliteral">"Computing stats for frame: %d"</span>, iframe +1);
+<a name="l00338"></a>00338 this_target_frame = cpl_frameset_get_frame(target_frames, iframe);
+<a name="l00339"></a>00339 <a class="code" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836" title="Fills a table with the statistics of the four detectors of a frame.">hawki_image_stats_fill_from_frame</a>
+<a name="l00340"></a>00340 (target_stats, this_target_frame, iframe);
+<a name="l00341"></a>00341 }
+<a name="l00342"></a>00342 cpl_msg_indent_less();
+<a name="l00343"></a>00343
+<a name="l00344"></a>00344 <span class="comment">/* Compute stats of the stats */</span>
+<a name="l00345"></a>00345 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(target_stats, stats_stats);
+<a name="l00346"></a>00346
+<a name="l00347"></a>00347 <span class="comment">/* Print info about the statistics */</span>
+<a name="l00348"></a>00348 hawki_image_stats_print(target_stats);
+<a name="l00349"></a>00349
+<a name="l00350"></a>00350 <span class="keywordflow">return</span> 0;
+<a name="l00351"></a>00351 }
+<a name="l00352"></a>00352
+<a name="l00353"></a>00353 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00363"></a>00363 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00364"></a>00364 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stats_save
+<a name="l00365"></a>00365 (cpl_table ** target_stats,
+<a name="l00366"></a>00366 cpl_parameterlist * recipe_parlist,
+<a name="l00367"></a>00367 cpl_frameset * recipe_frameset,
+<a name="l00368"></a>00368 cpl_frameset * used_frameset,
+<a name="l00369"></a>00369 cpl_propertylist ** stats_stats,
+<a name="l00370"></a>00370 <span class="keyword">const</span> <span class="keywordtype">char</span> * calpro,
+<a name="l00371"></a>00371 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype)
+<a name="l00372"></a>00372 {
+<a name="l00373"></a>00373 <span class="keyword">const</span> cpl_frame * reference_frame;
+<a name="l00374"></a>00374 cpl_propertylist * referencelist;
+<a name="l00375"></a>00375 cpl_propertylist ** extlists;
+<a name="l00376"></a>00376 <span class="keywordtype">int</span> idet;
+<a name="l00377"></a>00377 <span class="keywordtype">int</span> ext_nb;
+<a name="l00378"></a>00378 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_stats"</span>;
+<a name="l00379"></a>00379 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00380"></a>00380
+<a name="l00381"></a>00381
+<a name="l00382"></a>00382 <span class="comment">/* Get the reference frame (the first one) */</span>
+<a name="l00383"></a>00383 reference_frame = cpl_frameset_get_first_const(used_frameset);
+<a name="l00384"></a>00384
+<a name="l00385"></a>00385 <span class="comment">/* Create the prop lists */</span>
+<a name="l00386"></a>00386 cpl_msg_info(__func__, <span class="stringliteral">"Creating the keywords list"</span>) ;
+<a name="l00387"></a>00387 referencelist = cpl_propertylist_load_regexp
+<a name="l00388"></a>00388 (cpl_frame_get_filename(reference_frame), 0,HAWKI_HEADER_EXT_FORWARD,0);
+<a name="l00389"></a>00389 extlists =
+<a name="l00390"></a>00390 cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*));
+<a name="l00391"></a>00391 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00392"></a>00392 {
+<a name="l00393"></a>00393 <span class="comment">/* Get the extension number */</span>
+<a name="l00394"></a>00394 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00395"></a>00395 (cpl_frame_get_filename(reference_frame), idet+1);
+<a name="l00396"></a>00396
+<a name="l00397"></a>00397 <span class="comment">/* Propagate the keywords from input frame extensions */</span>
+<a name="l00398"></a>00398 extlists[idet] = cpl_propertylist_load_regexp(
+<a name="l00399"></a>00399 cpl_frame_get_filename(reference_frame), ext_nb,
+<a name="l00400"></a>00400 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00401"></a>00401
+<a name="l00402"></a>00402 <span class="comment">/* Add the stats of the stats */</span>
+<a name="l00403"></a>00403 cpl_propertylist_append(extlists[idet],stats_stats[idet]);
+<a name="l00404"></a>00404 }
+<a name="l00405"></a>00405
+<a name="l00406"></a>00406 <span class="comment">/* Write the table with the statistics */</span>
+<a name="l00407"></a>00407 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(recipe_frameset,
+<a name="l00408"></a>00408 recipe_parlist,
+<a name="l00409"></a>00409 used_frameset,
+<a name="l00410"></a>00410 (<span class="keyword">const</span> cpl_table **)target_stats,
+<a name="l00411"></a>00411 recipe_name,
+<a name="l00412"></a>00412 calpro,
+<a name="l00413"></a>00413 protype,
+<a name="l00414"></a>00414 (<span class="keyword">const</span> cpl_propertylist*)referencelist,
+<a name="l00415"></a>00415 (<span class="keyword">const</span> cpl_propertylist**)extlists,
+<a name="l00416"></a>00416 <span class="stringliteral">"hawki_step_stats.fits"</span>);
+<a name="l00417"></a>00417
+<a name="l00418"></a>00418 <span class="comment">/* Free and return */</span>
+<a name="l00419"></a>00419 cpl_propertylist_delete(referencelist) ;
+<a name="l00420"></a>00420 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00421"></a>00421 {
+<a name="l00422"></a>00422 cpl_propertylist_delete(extlists[idet]) ;
+<a name="l00423"></a>00423 }
+<a name="l00424"></a>00424 cpl_free(extlists) ;
+<a name="l00425"></a>00425
+<a name="l00426"></a>00426 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00427"></a>00427 {
+<a name="l00428"></a>00428 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00429"></a>00429 <span class="keywordflow">return</span> -1;
+<a name="l00430"></a>00430 }
+<a name="l00431"></a>00431 <span class="keywordflow">return</span> 0;
+<a name="l00432"></a>00432 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__stitch_8c_source.html b/html/hawki__step__stitch_8c_source.html
new file mode 100644
index 0000000..90bc340
--- /dev/null
+++ b/html/hawki__step__stitch_8c_source.html
@@ -0,0 +1,367 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_stitch.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_stitch.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_stitch.c,v 1.7 2011/10/24 10:41:54 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:41:54 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.7 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00045"></a>00045
+<a name="l00046"></a>00046 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00047"></a>00047 <span class="comment"> Functions prototypes</span>
+<a name="l00048"></a>00048 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00049"></a>00049
+<a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_create(cpl_plugin *) ;
+<a name="l00051"></a>00051 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_exec(cpl_plugin *) ;
+<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_destroy(cpl_plugin *) ;
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_save
+<a name="l00055"></a>00055 (cpl_image * in,
+<a name="l00056"></a>00056 cpl_frame * combined,
+<a name="l00057"></a>00057 cpl_parameterlist * parlist,
+<a name="l00058"></a>00058 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00059"></a>00059
+<a name="l00060"></a>00060 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00061"></a>00061 <span class="comment"> Static variables</span>
+<a name="l00062"></a>00062 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00063"></a>00063
+<a name="l00064"></a>00064 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_stitch_description[] =
+<a name="l00065"></a>00065 <span class="stringliteral">"hawki_step_stitch -- Stitching utility\n"</span>
+<a name="l00066"></a>00066 <span class="stringliteral">"This recipe accepts 1 parameter:\n"</span>
+<a name="l00067"></a>00067 <span class="stringliteral">"First parameter: the HAWKI image to stitch "</span>
+<a name="l00068"></a>00068 <span class="stringliteral">" (PRO CATG = "</span>HAWKI_CALPRO_COMBINED<span class="stringliteral">")\n"</span>
+<a name="l00069"></a>00069 <span class="stringliteral">"\n"</span>
+<a name="l00070"></a>00070 <span class="stringliteral">"This recipe produces 1 file:\n"</span>
+<a name="l00071"></a>00071 <span class="stringliteral">"First product: the stitch image.\n"</span>
+<a name="l00072"></a>00072 <span class="stringliteral">" (PRO CATG = "</span>HAWKI_CALPRO_STITCHED<span class="stringliteral">")\n"</span> ;
+<a name="l00073"></a>00073
+<a name="l00074"></a>00074 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00075"></a>00075 <span class="comment"> Functions code</span>
+<a name="l00076"></a>00076 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00077"></a>00077
+<a name="l00078"></a>00078 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00087"></a>00087 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00088"></a>00088 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00089"></a>00089 {
+<a name="l00090"></a>00090 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe ) ;
+<a name="l00091"></a>00091 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093 cpl_plugin_init(plugin,
+<a name="l00094"></a>00094 CPL_PLUGIN_API,
+<a name="l00095"></a>00095 HAWKI_BINARY_VERSION,
+<a name="l00096"></a>00096 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00097"></a>00097 <span class="stringliteral">"hawki_step_stitch"</span>,
+<a name="l00098"></a>00098 <span class="stringliteral">"Stitching utility"</span>,
+<a name="l00099"></a>00099 hawki_step_stitch_description,
+<a name="l00100"></a>00100 <span class="stringliteral">"Cesar Enrique Garcia"</span>,
+<a name="l00101"></a>00101 PACKAGE_BUGREPORT,
+<a name="l00102"></a>00102 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00103"></a>00103 hawki_step_stitch_create,
+<a name="l00104"></a>00104 hawki_step_stitch_exec,
+<a name="l00105"></a>00105 hawki_step_stitch_destroy) ;
+<a name="l00106"></a>00106
+<a name="l00107"></a>00107 cpl_pluginlist_append(list, plugin) ;
+<a name="l00108"></a>00108
+<a name="l00109"></a>00109 <span class="keywordflow">return</span> 0;
+<a name="l00110"></a>00110 }
+<a name="l00111"></a>00111
+<a name="l00112"></a>00112 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00120"></a>00120 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00121"></a>00121 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_create(cpl_plugin * plugin)
+<a name="l00122"></a>00122 {
+<a name="l00123"></a>00123 cpl_recipe * recipe ;
+<a name="l00124"></a>00124
+<a name="l00125"></a>00125 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00126"></a>00126 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00127"></a>00127 recipe = (cpl_recipe *)plugin ;
+<a name="l00128"></a>00128 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00129"></a>00129
+<a name="l00130"></a>00130 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00131"></a>00131 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00132"></a>00132 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00133"></a>00133 <span class="keywordflow">return</span> 1;
+<a name="l00134"></a>00134
+<a name="l00135"></a>00135 <span class="comment">/* Return */</span>
+<a name="l00136"></a>00136 <span class="keywordflow">return</span> 0;
+<a name="l00137"></a>00137 }
+<a name="l00138"></a>00138
+<a name="l00139"></a>00139 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00145"></a>00145 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00146"></a>00146 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_exec(cpl_plugin * plugin)
+<a name="l00147"></a>00147 {
+<a name="l00148"></a>00148 cpl_recipe * recipe ;
+<a name="l00149"></a>00149
+<a name="l00150"></a>00150 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00151"></a>00151 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00152"></a>00152 recipe = (cpl_recipe *)plugin ;
+<a name="l00153"></a>00153 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00154"></a>00154
+<a name="l00155"></a>00155 <span class="comment">/* Issue a banner */</span>
+<a name="l00156"></a>00156 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00157"></a>00157
+<a name="l00158"></a>00158 <span class="keywordflow">return</span> hawki_step_stitch(recipe->parameters, recipe->frames) ;
+<a name="l00159"></a>00159 }
+<a name="l00160"></a>00160
+<a name="l00161"></a>00161 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00167"></a>00167 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00168"></a>00168 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_destroy(cpl_plugin * plugin)
+<a name="l00169"></a>00169 {
+<a name="l00170"></a>00170 cpl_recipe * recipe ;
+<a name="l00171"></a>00171
+<a name="l00172"></a>00172 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00173"></a>00173 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00174"></a>00174 recipe = (cpl_recipe *)plugin ;
+<a name="l00175"></a>00175 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00176"></a>00176
+<a name="l00177"></a>00177 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00178"></a>00178 <span class="keywordflow">return</span> 0 ;
+<a name="l00179"></a>00179 }
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00188"></a>00188 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00189"></a>00189 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch(
+<a name="l00190"></a>00190 cpl_parameterlist * parlist,
+<a name="l00191"></a>00191 cpl_frameset * frameset)
+<a name="l00192"></a>00192 {
+<a name="l00193"></a>00193 <span class="keyword">const</span> <span class="keywordtype">char</span> * comb_filename ;
+<a name="l00194"></a>00194 cpl_frameset * combframes;
+<a name="l00195"></a>00195 cpl_frame * combframe;
+<a name="l00196"></a>00196 cpl_propertylist * plist ;
+<a name="l00197"></a>00197 cpl_image * stitched ;
+<a name="l00198"></a>00198 cpl_image * in[HAWKI_NB_DETECTORS] ;
+<a name="l00199"></a>00199 <span class="keywordtype">double</span> posx[HAWKI_NB_DETECTORS] ;
+<a name="l00200"></a>00200 <span class="keywordtype">double</span> posy[HAWKI_NB_DETECTORS] ;
+<a name="l00201"></a>00201 <span class="keywordtype">int</span> i, j ;
+<a name="l00202"></a>00202 cpl_errorstate error_prevstate;
+<a name="l00203"></a>00203
+<a name="l00204"></a>00204
+<a name="l00205"></a>00205 <span class="comment">/* Retrieve input parameters */</span>
+<a name="l00206"></a>00206
+<a name="l00207"></a>00207 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00208"></a>00208 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(frameset)) {
+<a name="l00209"></a>00209 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00210"></a>00210 <span class="keywordflow">return</span> -1 ;
+<a name="l00211"></a>00211 }
+<a name="l00212"></a>00212
+<a name="l00213"></a>00213 <span class="comment">/* Identifying the combined frame */</span>
+<a name="l00214"></a>00214 cpl_msg_info(__func__, <span class="stringliteral">"Identifying the combined frame"</span>);
+<a name="l00215"></a>00215 combframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00216"></a>00216 (frameset, HAWKI_CALPRO_COMBINED);
+<a name="l00217"></a>00217 <span class="keywordflow">if</span> (combframes == NULL)
+<a name="l00218"></a>00218 {
+<a name="l00219"></a>00219 cpl_msg_error(__func__, <span class="stringliteral">"No combined images found (%s)"</span>,
+<a name="l00220"></a>00220 HAWKI_CALPRO_COMBINED);
+<a name="l00221"></a>00221 cpl_frameset_delete(combframes);
+<a name="l00222"></a>00222 <span class="keywordflow">return</span> -1 ;
+<a name="l00223"></a>00223 }
+<a name="l00224"></a>00224
+<a name="l00225"></a>00225 <span class="comment">/* Check that we have 1 files in input */</span>
+<a name="l00226"></a>00226 <span class="keywordflow">if</span> (cpl_frameset_get_size(combframes) != 1) {
+<a name="l00227"></a>00227 cpl_msg_error(__func__, <span class="stringliteral">"Expects one single combined images"</span>) ;
+<a name="l00228"></a>00228 cpl_frameset_delete(combframes);
+<a name="l00229"></a>00229 <span class="keywordflow">return</span> -1 ;
+<a name="l00230"></a>00230 }
+<a name="l00231"></a>00231
+<a name="l00232"></a>00232 <span class="comment">/* Load the HAWKI images */</span>
+<a name="l00233"></a>00233 cpl_msg_info(__func__,<span class="stringliteral">"Loading combined frame"</span>);
+<a name="l00234"></a>00234 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00235"></a>00235 <span class="keywordflow">if</span> ((in[i] = <a class="code" href="group__hawki__load.html#ga5b9129188e69306c15cec2d4568ddeed" title="Load the chip of HAWKI image from a frameset in an image.">hawki_load_image</a>(combframes, 0, i+1,
+<a name="l00236"></a>00236 CPL_TYPE_FLOAT)) == NULL) {
+<a name="l00237"></a>00237 cpl_msg_error(__func__, <span class="stringliteral">"Cannot load chip nb %d"</span>, i+1) ;
+<a name="l00238"></a>00238 <span class="keywordflow">for</span> (j=0 ; j<i ; i++) cpl_image_delete(in[j]) ;
+<a name="l00239"></a>00239 cpl_frameset_delete(combframes);
+<a name="l00240"></a>00240 <span class="keywordflow">return</span> -1 ;
+<a name="l00241"></a>00241 }
+<a name="l00242"></a>00242 }
+<a name="l00243"></a>00243
+<a name="l00244"></a>00244 <span class="comment">/* Get the first input frame */</span>
+<a name="l00245"></a>00245 combframe = cpl_frameset_get_first(combframes);
+<a name="l00246"></a>00246 comb_filename = cpl_frame_get_filename(combframe);
+<a name="l00247"></a>00247
+<a name="l00248"></a>00248 <span class="comment">/* Get the POSX / POSY informations */</span>
+<a name="l00249"></a>00249 error_prevstate = cpl_errorstate_get();
+<a name="l00250"></a>00250 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00251"></a>00251 plist = cpl_propertylist_load_regexp(comb_filename, i+1, <span class="stringliteral">"QC"</span>, 0) ;
+<a name="l00252"></a>00252 posx[i] = <a class="code" href="group__hawki__pfits.html#ga88f1a9b44888686b6489fba06921f5a1" title="find out the relative X offset of the combined image wrt first image">hawki_pfits_get_comb_posx</a>(plist);
+<a name="l00253"></a>00253 posy[i] = <a class="code" href="group__hawki__pfits.html#ga5408b902329bdad15fd408d73fa6376e" title="find out the relative Y offset of the combined image wrt first image">hawki_pfits_get_comb_posy</a>(plist);
+<a name="l00254"></a>00254 cpl_propertylist_delete(plist) ;
+<a name="l00255"></a>00255 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00256"></a>00256 {
+<a name="l00257"></a>00257 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get POS infos for chip %d"</span>, i+1) ;
+<a name="l00258"></a>00258 <span class="keywordflow">return</span> -1 ;
+<a name="l00259"></a>00259 }
+<a name="l00260"></a>00260 }
+<a name="l00261"></a>00261
+<a name="l00262"></a>00262 <span class="comment">/* Compute the stitched image */</span>
+<a name="l00263"></a>00263 cpl_msg_info(__func__, <span class="stringliteral">"Computing the stiched image"</span>) ;
+<a name="l00264"></a>00264 <span class="keywordflow">if</span> ((stitched = <a class="code" href="group__hawki__utils.html#ga7f6d3694df0e3a441b20267a1e5894db" title="Apply the stitching.">hawki_images_stitch</a>(in, posx, posy)) == NULL) {
+<a name="l00265"></a>00265 cpl_msg_error(__func__, <span class="stringliteral">"Cannot stitch the images"</span>) ;
+<a name="l00266"></a>00266 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_image_delete(in[i]) ;
+<a name="l00267"></a>00267 <span class="keywordflow">return</span> -1 ;
+<a name="l00268"></a>00268 }
+<a name="l00269"></a>00269 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_image_delete(in[i]) ;
+<a name="l00270"></a>00270
+<a name="l00271"></a>00271 <span class="comment">/* Save the corrected image */</span>
+<a name="l00272"></a>00272 <span class="keywordflow">if</span> (hawki_step_stitch_save(stitched, combframe, parlist, frameset) == -1)
+<a name="l00273"></a>00273 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00274"></a>00274 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00275"></a>00275
+<a name="l00276"></a>00276 <span class="comment">/* Free and Return */</span>
+<a name="l00277"></a>00277 cpl_frameset_delete(combframes);
+<a name="l00278"></a>00278 cpl_image_delete(stitched);
+<a name="l00279"></a>00279
+<a name="l00280"></a>00280 <span class="comment">/* Return */</span>
+<a name="l00281"></a>00281 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00282"></a>00282 {
+<a name="l00283"></a>00283 cpl_msg_error(__func__,
+<a name="l00284"></a>00284 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00285"></a>00285 <span class="keywordflow">return</span> -1 ;
+<a name="l00286"></a>00286 }
+<a name="l00287"></a>00287 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00288"></a>00288 }
+<a name="l00289"></a>00289
+<a name="l00290"></a>00290 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00298"></a>00298 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00299"></a>00299 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_stitch_save
+<a name="l00300"></a>00300 (cpl_image * in,
+<a name="l00301"></a>00301 cpl_frame * combined,
+<a name="l00302"></a>00302 cpl_parameterlist * parlist,
+<a name="l00303"></a>00303 cpl_frameset * <span class="keyword">set</span>)
+<a name="l00304"></a>00304 {
+<a name="l00305"></a>00305 cpl_propertylist * plist;
+<a name="l00306"></a>00306 cpl_propertylist * wcslist;
+<a name="l00307"></a>00307 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_stitch"</span> ;
+<a name="l00308"></a>00308 <span class="keywordtype">int</span> ext_chip_1;
+<a name="l00309"></a>00309 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00310"></a>00310
+<a name="l00311"></a>00311 cpl_msg_indent_more();
+<a name="l00312"></a>00312
+<a name="l00313"></a>00313 <span class="comment">/* Create a propertylist for PRO.x */</span>
+<a name="l00314"></a>00314 plist = cpl_propertylist_new();
+<a name="l00315"></a>00315 cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE,
+<a name="l00316"></a>00316 HAWKI_PROTYPE_STITCHED) ;
+<a name="l00317"></a>00317 cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG,
+<a name="l00318"></a>00318 HAWKI_CALPRO_STITCHED) ;
+<a name="l00319"></a>00319
+<a name="l00320"></a>00320 <span class="comment">/* Handle WCS keys */</span>
+<a name="l00321"></a>00321 ext_chip_1 = 1;
+<a name="l00322"></a>00322 wcslist = cpl_propertylist_load_regexp(
+<a name="l00323"></a>00323 cpl_frame_get_filename(combined), ext_chip_1, HAWKI_HEADER_WCS, 0);
+<a name="l00324"></a>00324 cpl_propertylist_append(plist, wcslist);
+<a name="l00325"></a>00325
+<a name="l00326"></a>00326 <span class="comment">/* Save the image */</span>
+<a name="l00327"></a>00327 <span class="keywordflow">if</span>(cpl_dfs_save_image(<span class="keyword">set</span>,
+<a name="l00328"></a>00328 NULL,
+<a name="l00329"></a>00329 parlist,
+<a name="l00330"></a>00330 <span class="keyword">set</span>,
+<a name="l00331"></a>00331 NULL,
+<a name="l00332"></a>00332 in,
+<a name="l00333"></a>00333 CPL_BPP_IEEE_FLOAT,
+<a name="l00334"></a>00334 recipe_name,
+<a name="l00335"></a>00335 plist,
+<a name="l00336"></a>00336 NULL,
+<a name="l00337"></a>00337 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00338"></a>00338 <span class="stringliteral">"hawki_step_stitch.fits"</span>) != CPL_ERROR_NONE)
+<a name="l00339"></a>00339 cpl_msg_error(__func__,<span class="stringliteral">"Could not save stitched image"</span>);
+<a name="l00340"></a>00340
+<a name="l00341"></a>00341 cpl_propertylist_delete(plist) ;
+<a name="l00342"></a>00342 cpl_propertylist_delete(wcslist) ;
+<a name="l00343"></a>00343 cpl_msg_indent_less();
+<a name="l00344"></a>00344 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00345"></a>00345 {
+<a name="l00346"></a>00346 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00347"></a>00347 <span class="keywordflow">return</span> -1;
+<a name="l00348"></a>00348 }
+<a name="l00349"></a>00349 <span class="keywordflow">return</span> 0;
+<a name="l00350"></a>00350 }
+<a name="l00351"></a>00351
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__step__subtract__bkg_8c_source.html b/html/hawki__step__subtract__bkg_8c_source.html
new file mode 100644
index 0000000..290c51d
--- /dev/null
+++ b/html/hawki__step__subtract__bkg_8c_source.html
@@ -0,0 +1,532 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_step_subtract_bkg.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_step_subtract_bkg.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_step_subtract_bkg.c,v 1.17 2011/10/24 10:41:43 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2008 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:41:43 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.17 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00049"></a>00049 <span class="comment"> Structs</span>
+<a name="l00050"></a>00050 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00053"></a>00053 <span class="comment"> Functions prototypes</span>
+<a name="l00054"></a>00054 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00055"></a>00055
+<a name="l00056"></a>00056 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_create(cpl_plugin *) ;
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_exec(cpl_plugin *) ;
+<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_destroy(cpl_plugin *) ;
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00060"></a>00060
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_apply_one_to_one_save
+<a name="l00062"></a>00062 (cpl_frameset * objframes,
+<a name="l00063"></a>00063 cpl_frameset * bkgframes,
+<a name="l00064"></a>00064 cpl_parameterlist * parlist,
+<a name="l00065"></a>00065 cpl_frameset * recipe_framelist);
+<a name="l00066"></a>00066
+<a name="l00067"></a>00067 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_apply_one_to_all_save
+<a name="l00068"></a>00068 (cpl_frameset * objframes,
+<a name="l00069"></a>00069 cpl_frameset * bkgframes,
+<a name="l00070"></a>00070 cpl_parameterlist * recipe_parlist,
+<a name="l00071"></a>00071 cpl_frameset * recipe_framelist);
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_save
+<a name="l00074"></a>00074 (cpl_imagelist * obj_images,
+<a name="l00075"></a>00075 <span class="keywordtype">int</span> iserie,
+<a name="l00076"></a>00076 cpl_frameset * used_frameset,
+<a name="l00077"></a>00077 cpl_parameterlist * recipe_parlist,
+<a name="l00078"></a>00078 cpl_frameset * recipe_framelist);
+<a name="l00079"></a>00079
+<a name="l00080"></a>00080 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00081"></a>00081 <span class="comment"> Static variables</span>
+<a name="l00082"></a>00082 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_step_subtract_bkg_description[] =
+<a name="l00085"></a>00085 <span class="stringliteral">"hawki_step_subtract_bkg -- hawki background subtraction utility.\n"</span>
+<a name="l00086"></a>00086 <span class="stringliteral">"This recipe will subtract the given background to the science images.\n"</span>
+<a name="l00087"></a>00087 <span class="stringliteral">"The background can be obtained from the sky or object images\n"</span>
+<a name="l00088"></a>00088 <span class="stringliteral">"using the hawki_util_compute_bkg utility.\n"</span>
+<a name="l00089"></a>00089 <span class="stringliteral">"There are two modes of operation:\n"</span>
+<a name="l00090"></a>00090 <span class="stringliteral">"One single background image that it is subtracted to all object images.\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"As many background images as objects. A one to one relationship is applied.\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"obj_basic_cal-file.fits "</span>HAWKI_CALPRO_BASICCALIBRATED<span class="stringliteral">" or\n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"background-file.fits "</span>HAWKI_CALPRO_BKGIMAGE<span class="stringliteral">" \n"</span>;
+<a name="l00095"></a>00095
+<a name="l00096"></a>00096 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00097"></a>00097 <span class="comment"> Functions code</span>
+<a name="l00098"></a>00098 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00108"></a>00108 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00109"></a>00109 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00110"></a>00110 {
+<a name="l00111"></a>00111 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00112"></a>00112 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00113"></a>00113
+<a name="l00114"></a>00114 cpl_plugin_init(plugin,
+<a name="l00115"></a>00115 CPL_PLUGIN_API,
+<a name="l00116"></a>00116 HAWKI_BINARY_VERSION,
+<a name="l00117"></a>00117 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00118"></a>00118 <span class="stringliteral">"hawki_step_subtract_bkg"</span>,
+<a name="l00119"></a>00119 <span class="stringliteral">"Background subtraction utility"</span>,
+<a name="l00120"></a>00120 hawki_step_subtract_bkg_description,
+<a name="l00121"></a>00121 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00122"></a>00122 PACKAGE_BUGREPORT,
+<a name="l00123"></a>00123 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00124"></a>00124 hawki_step_subtract_bkg_create,
+<a name="l00125"></a>00125 hawki_step_subtract_bkg_exec,
+<a name="l00126"></a>00126 hawki_step_subtract_bkg_destroy) ;
+<a name="l00127"></a>00127
+<a name="l00128"></a>00128 cpl_pluginlist_append(list, plugin) ;
+<a name="l00129"></a>00129
+<a name="l00130"></a>00130 <span class="keywordflow">return</span> 0;
+<a name="l00131"></a>00131 }
+<a name="l00132"></a>00132
+<a name="l00133"></a>00133 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00142"></a>00142 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00143"></a>00143 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_create(cpl_plugin * plugin)
+<a name="l00144"></a>00144 {
+<a name="l00145"></a>00145 cpl_recipe * recipe ;
+<a name="l00146"></a>00146 <span class="comment">//cpl_parameter * p ;</span>
+<a name="l00147"></a>00147
+<a name="l00148"></a>00148 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00149"></a>00149 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00150"></a>00150 recipe = (cpl_recipe *)plugin ;
+<a name="l00151"></a>00151 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00152"></a>00152
+<a name="l00153"></a>00153 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00154"></a>00154 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00155"></a>00155 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00156"></a>00156 <span class="keywordflow">return</span> 1;
+<a name="l00157"></a>00157
+<a name="l00158"></a>00158 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00159"></a>00159 <span class="comment">/* None.. */</span>
+<a name="l00160"></a>00160
+<a name="l00161"></a>00161 <span class="comment">/* Return */</span>
+<a name="l00162"></a>00162 <span class="keywordflow">return</span> 0;
+<a name="l00163"></a>00163 }
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00171"></a>00171 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00172"></a>00172 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_exec(cpl_plugin * plugin)
+<a name="l00173"></a>00173 {
+<a name="l00174"></a>00174 cpl_recipe * recipe ;
+<a name="l00175"></a>00175
+<a name="l00176"></a>00176 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00177"></a>00177 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00178"></a>00178 recipe = (cpl_recipe *)plugin ;
+<a name="l00179"></a>00179 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/* Issue a banner */</span>
+<a name="l00182"></a>00182 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 <span class="keywordflow">return</span> hawki_step_subtract_bkg(recipe->parameters, recipe->frames) ;
+<a name="l00185"></a>00185 }
+<a name="l00186"></a>00186
+<a name="l00187"></a>00187 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00193"></a>00193 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00194"></a>00194 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_destroy(cpl_plugin * plugin)
+<a name="l00195"></a>00195 {
+<a name="l00196"></a>00196 cpl_recipe * recipe ;
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00199"></a>00199 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00200"></a>00200 recipe = (cpl_recipe *)plugin ;
+<a name="l00201"></a>00201 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00204"></a>00204 <span class="keywordflow">return</span> 0 ;
+<a name="l00205"></a>00205 }
+<a name="l00206"></a>00206
+<a name="l00207"></a>00207 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00214"></a>00214 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00215"></a>00215 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg(
+<a name="l00216"></a>00216 cpl_parameterlist * parlist,
+<a name="l00217"></a>00217 cpl_frameset * framelist)
+<a name="l00218"></a>00218 {
+<a name="l00219"></a>00219 <span class="keywordtype">int</span> nobj;
+<a name="l00220"></a>00220 <span class="keywordtype">int</span> nbkg;
+<a name="l00221"></a>00221 cpl_frameset * objframes;
+<a name="l00222"></a>00222 cpl_frameset * bkgframes;
+<a name="l00223"></a>00223
+<a name="l00224"></a>00224
+<a name="l00225"></a>00225 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00226"></a>00226 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist))
+<a name="l00227"></a>00227 {
+<a name="l00228"></a>00228 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00229"></a>00229 <span class="keywordflow">return</span> -1 ;
+<a name="l00230"></a>00230 }
+<a name="l00231"></a>00231
+<a name="l00232"></a>00232 <span class="comment">/* Identifying objects and bkg data frames */</span>
+<a name="l00233"></a>00233 cpl_msg_info(__func__, <span class="stringliteral">"Identifying objects and background data"</span>);
+<a name="l00234"></a>00234 objframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00235"></a>00235 (framelist, HAWKI_CALPRO_BASICCALIBRATED);
+<a name="l00236"></a>00236 <span class="keywordflow">if</span> (objframes == NULL)
+<a name="l00237"></a>00237 {
+<a name="l00238"></a>00238 cpl_msg_error(__func__, <span class="stringliteral">"No object frames provided (%s)"</span>,
+<a name="l00239"></a>00239 HAWKI_CALPRO_BASICCALIBRATED);
+<a name="l00240"></a>00240 <span class="keywordflow">return</span> -1 ;
+<a name="l00241"></a>00241 }
+<a name="l00242"></a>00242 <span class="comment">/* Retrieve bkg frames */</span>
+<a name="l00243"></a>00243 bkgframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00244"></a>00244 (framelist, HAWKI_CALPRO_BKGIMAGE);
+<a name="l00245"></a>00245 <span class="keywordflow">if</span> (bkgframes == NULL)
+<a name="l00246"></a>00246 {
+<a name="l00247"></a>00247 cpl_msg_error(__func__, <span class="stringliteral">"No background frames provided (%s)"</span>,
+<a name="l00248"></a>00248 HAWKI_CALPRO_BKGIMAGE);
+<a name="l00249"></a>00249 cpl_frameset_delete(objframes);
+<a name="l00250"></a>00250 <span class="keywordflow">return</span> -1 ;
+<a name="l00251"></a>00251 }
+<a name="l00252"></a>00252
+<a name="l00253"></a>00253 <span class="comment">/* Subtract the background */</span>
+<a name="l00254"></a>00254 nobj = cpl_frameset_get_size(objframes);
+<a name="l00255"></a>00255 nbkg = cpl_frameset_get_size(bkgframes);
+<a name="l00256"></a>00256 <span class="keywordflow">if</span>(nobj == nbkg)
+<a name="l00257"></a>00257 hawki_step_subtract_bkg_apply_one_to_one_save
+<a name="l00258"></a>00258 (objframes, bkgframes, parlist, framelist);
+<a name="l00259"></a>00259 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(nbkg == 1)
+<a name="l00260"></a>00260 hawki_step_subtract_bkg_apply_one_to_all_save
+<a name="l00261"></a>00261 (objframes, bkgframes, parlist, framelist);
+<a name="l00262"></a>00262 <span class="keywordflow">else</span>
+<a name="l00263"></a>00263 {
+<a name="l00264"></a>00264 cpl_msg_error(__func__,<span class="stringliteral">"Incompatible number of science and background"</span>
+<a name="l00265"></a>00265 <span class="stringliteral">" images."</span>);
+<a name="l00266"></a>00266 cpl_msg_error(__func__,<span class="stringliteral">"Supply only 1 bkg frame or as many as objects"</span>);
+<a name="l00267"></a>00267 cpl_frameset_delete(objframes);
+<a name="l00268"></a>00268 cpl_frameset_delete(bkgframes);
+<a name="l00269"></a>00269 <span class="keywordflow">return</span> -1;
+<a name="l00270"></a>00270 }
+<a name="l00271"></a>00271
+<a name="l00272"></a>00272 <span class="comment">/* Free resources */</span>
+<a name="l00273"></a>00273 cpl_frameset_delete(objframes);
+<a name="l00274"></a>00274 cpl_frameset_delete(bkgframes);
+<a name="l00275"></a>00275
+<a name="l00276"></a>00276 <span class="comment">/* Return */</span>
+<a name="l00277"></a>00277 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00278"></a>00278 {
+<a name="l00279"></a>00279 cpl_msg_error(__func__,
+<a name="l00280"></a>00280 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00281"></a>00281 <span class="keywordflow">return</span> -1 ;
+<a name="l00282"></a>00282 }
+<a name="l00283"></a>00283 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00284"></a>00284 }
+<a name="l00285"></a>00285
+<a name="l00286"></a>00286 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00295"></a>00295 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00296"></a>00296 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_apply_one_to_one_save
+<a name="l00297"></a>00297 (cpl_frameset * objframes,
+<a name="l00298"></a>00298 cpl_frameset * bkgframes,
+<a name="l00299"></a>00299 cpl_parameterlist * recipe_parlist,
+<a name="l00300"></a>00300 cpl_frameset * recipe_framelist)
+<a name="l00301"></a>00301 {
+<a name="l00302"></a>00302 <span class="keywordtype">int</span> iobj;
+<a name="l00303"></a>00303 <span class="keywordtype">int</span> nobjs;
+<a name="l00304"></a>00304
+<a name="l00305"></a>00305 <span class="comment">/* Subtract the background to each object frame */</span>
+<a name="l00306"></a>00306 cpl_msg_info(__func__,<span class="stringliteral">"Using a one to one relation btw objects and bkgs"</span>);
+<a name="l00307"></a>00307 nobjs = cpl_frameset_get_size(objframes);
+<a name="l00308"></a>00308 <span class="keywordflow">for</span>(iobj = 0; iobj < nobjs; ++iobj)
+<a name="l00309"></a>00309 {
+<a name="l00310"></a>00310 cpl_frame * obj_frame = NULL;
+<a name="l00311"></a>00311 cpl_frame * bkg_frame = NULL;
+<a name="l00312"></a>00312 cpl_imagelist * obj_images = NULL;
+<a name="l00313"></a>00313 cpl_imagelist * bkg_images = NULL;
+<a name="l00314"></a>00314 cpl_frameset * used_frameset;
+<a name="l00315"></a>00315
+<a name="l00316"></a>00316 <span class="comment">/* Allocate resources */</span>
+<a name="l00317"></a>00317 used_frameset = cpl_frameset_new();
+<a name="l00318"></a>00318
+<a name="l00319"></a>00319 <span class="comment">/* Read the object frame */</span>
+<a name="l00320"></a>00320 cpl_msg_indent_more();
+<a name="l00321"></a>00321 cpl_msg_info(__func__, <span class="stringliteral">"Applying correction to object %d"</span>, iobj+1) ;
+<a name="l00322"></a>00322 obj_frame = cpl_frameset_get_frame(objframes, iobj);
+<a name="l00323"></a>00323 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(obj_frame));
+<a name="l00324"></a>00324 <span class="keywordflow">if</span>(obj_frame != NULL)
+<a name="l00325"></a>00325 obj_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(obj_frame, CPL_TYPE_FLOAT);
+<a name="l00326"></a>00326 <span class="keywordflow">if</span>(obj_images == NULL)
+<a name="l00327"></a>00327 {
+<a name="l00328"></a>00328 cpl_msg_indent_less();
+<a name="l00329"></a>00329 cpl_msg_error(__func__, <span class="stringliteral">"Error reading obj image"</span>) ;
+<a name="l00330"></a>00330 cpl_frameset_delete(used_frameset);
+<a name="l00331"></a>00331 <span class="keywordflow">return</span> -1;
+<a name="l00332"></a>00332 }
+<a name="l00333"></a>00333
+<a name="l00334"></a>00334 <span class="comment">/* Read the bkg */</span>
+<a name="l00335"></a>00335 bkg_frame = cpl_frameset_get_frame(bkgframes, iobj);
+<a name="l00336"></a>00336 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(bkg_frame));
+<a name="l00337"></a>00337 <span class="keywordflow">if</span>(bkg_frame != NULL)
+<a name="l00338"></a>00338 bkg_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(bkg_frame, CPL_TYPE_FLOAT);
+<a name="l00339"></a>00339 <span class="keywordflow">if</span>(bkg_images == NULL)
+<a name="l00340"></a>00340 {
+<a name="l00341"></a>00341 cpl_msg_error(__func__, <span class="stringliteral">"Error reading background image"</span>) ;
+<a name="l00342"></a>00342 cpl_msg_indent_less();
+<a name="l00343"></a>00343 cpl_imagelist_delete(obj_images);
+<a name="l00344"></a>00344 cpl_frameset_delete(used_frameset);
+<a name="l00345"></a>00345 <span class="keywordflow">return</span> -1;
+<a name="l00346"></a>00346 }
+<a name="l00347"></a>00347
+<a name="l00348"></a>00348 <span class="comment">/* Make the correction */</span>
+<a name="l00349"></a>00349 <a class="code" href="group__hawki__calib.html#ga648180245b7cace291a654d5b31e5f75" title="Apply the background subtraction to the images.">hawki_bkg_imglist_calib</a>(obj_images, bkg_images);
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 <span class="comment">/* Save the subtracted frame */</span>
+<a name="l00352"></a>00352 <span class="keywordflow">if</span>(hawki_step_subtract_bkg_save(obj_images,
+<a name="l00353"></a>00353 iobj,
+<a name="l00354"></a>00354 used_frameset,
+<a name="l00355"></a>00355 recipe_parlist,
+<a name="l00356"></a>00356 recipe_framelist) != 0)
+<a name="l00357"></a>00357 cpl_msg_warning(__func__,<span class="stringliteral">"Some data could not be saved. "</span>
+<a name="l00358"></a>00358 <span class="stringliteral">"Check permisions or disk space"</span>);
+<a name="l00359"></a>00359
+<a name="l00360"></a>00360 <span class="comment">/* Free in loop */</span>
+<a name="l00361"></a>00361 cpl_msg_indent_less();
+<a name="l00362"></a>00362 cpl_imagelist_delete(obj_images);
+<a name="l00363"></a>00363 cpl_imagelist_delete(bkg_images);
+<a name="l00364"></a>00364 cpl_frameset_delete(used_frameset);
+<a name="l00365"></a>00365 }
+<a name="l00366"></a>00366
+<a name="l00367"></a>00367 <span class="comment">/* Exit */</span>
+<a name="l00368"></a>00368 <span class="keywordflow">return</span> 0;
+<a name="l00369"></a>00369 }
+<a name="l00370"></a>00370
+<a name="l00371"></a>00371 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00380"></a>00380 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00381"></a>00381 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_apply_one_to_all_save
+<a name="l00382"></a>00382 (cpl_frameset * objframes,
+<a name="l00383"></a>00383 cpl_frameset * bkgframes,
+<a name="l00384"></a>00384 cpl_parameterlist * recipe_parlist,
+<a name="l00385"></a>00385 cpl_frameset * recipe_framelist)
+<a name="l00386"></a>00386 {
+<a name="l00387"></a>00387 <span class="keywordtype">int</span> iobj;
+<a name="l00388"></a>00388 <span class="keywordtype">int</span> nobjs;
+<a name="l00389"></a>00389 cpl_frame * bkg_frame;
+<a name="l00390"></a>00390 cpl_imagelist * bkg_images = NULL;
+<a name="l00391"></a>00391
+<a name="l00392"></a>00392 <span class="comment">/* Read the bkg */</span>
+<a name="l00393"></a>00393 cpl_msg_info(__func__,<span class="stringliteral">"Using the same bkg for all the objects"</span>);
+<a name="l00394"></a>00394 bkg_frame = cpl_frameset_get_first(bkgframes);
+<a name="l00395"></a>00395 <span class="keywordflow">if</span>(bkg_frame != NULL)
+<a name="l00396"></a>00396 bkg_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(bkg_frame, CPL_TYPE_FLOAT);
+<a name="l00397"></a>00397 <span class="keywordflow">if</span>(bkg_images == NULL)
+<a name="l00398"></a>00398 {
+<a name="l00399"></a>00399 cpl_msg_error(__func__, <span class="stringliteral">"Error reading background image"</span>);
+<a name="l00400"></a>00400 <span class="keywordflow">return</span> -1;
+<a name="l00401"></a>00401 }
+<a name="l00402"></a>00402
+<a name="l00403"></a>00403 <span class="comment">/* Subtract the background to each object frame */</span>
+<a name="l00404"></a>00404 nobjs = cpl_frameset_get_size(objframes);
+<a name="l00405"></a>00405 <span class="keywordflow">for</span>(iobj = 0; iobj < nobjs; ++iobj)
+<a name="l00406"></a>00406 {
+<a name="l00407"></a>00407 cpl_frame * obj_frame;
+<a name="l00408"></a>00408 cpl_imagelist * obj_images = NULL;
+<a name="l00409"></a>00409 cpl_frameset * used_frameset;
+<a name="l00410"></a>00410
+<a name="l00411"></a>00411 <span class="comment">/* Allocate resources */</span>
+<a name="l00412"></a>00412 used_frameset = cpl_frameset_new();
+<a name="l00413"></a>00413
+<a name="l00414"></a>00414 <span class="comment">/* Read the object frame */</span>
+<a name="l00415"></a>00415 cpl_msg_indent_more();
+<a name="l00416"></a>00416 cpl_msg_info(__func__, <span class="stringliteral">"Applying correction to object %d"</span>, iobj+1) ;
+<a name="l00417"></a>00417 obj_frame = cpl_frameset_get_frame(objframes, iobj);
+<a name="l00418"></a>00418 <span class="keywordflow">if</span>(obj_frame != NULL)
+<a name="l00419"></a>00419 obj_images = <a class="code" href="group__hawki__load.html#gaa83706a01275860daf2d743f315e1751" title="Load all the chips of HAWKI images from a frame into an image list.">hawki_load_frame</a>(obj_frame, CPL_TYPE_FLOAT);
+<a name="l00420"></a>00420 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(obj_frame));
+<a name="l00421"></a>00421 cpl_frameset_insert(used_frameset, cpl_frame_duplicate(bkg_frame));
+<a name="l00422"></a>00422 <span class="keywordflow">if</span>(obj_images == NULL)
+<a name="l00423"></a>00423 {
+<a name="l00424"></a>00424 cpl_msg_indent_less();
+<a name="l00425"></a>00425 cpl_msg_error(__func__, <span class="stringliteral">"Error reading obj image"</span>) ;
+<a name="l00426"></a>00426 cpl_frameset_delete(used_frameset);
+<a name="l00427"></a>00427 <span class="keywordflow">return</span> -1;
+<a name="l00428"></a>00428 }
+<a name="l00429"></a>00429
+<a name="l00430"></a>00430 <span class="comment">/* Make the correction */</span>
+<a name="l00431"></a>00431 <a class="code" href="group__hawki__calib.html#ga648180245b7cace291a654d5b31e5f75" title="Apply the background subtraction to the images.">hawki_bkg_imglist_calib</a>(obj_images, bkg_images);
+<a name="l00432"></a>00432
+<a name="l00433"></a>00433 <span class="comment">/* Save the subtracted frame */</span>
+<a name="l00434"></a>00434 hawki_step_subtract_bkg_save(obj_images,
+<a name="l00435"></a>00435 iobj,
+<a name="l00436"></a>00436 used_frameset,
+<a name="l00437"></a>00437 recipe_parlist,
+<a name="l00438"></a>00438 recipe_framelist);
+<a name="l00439"></a>00439
+<a name="l00440"></a>00440 <span class="comment">/* Free in loop */</span>
+<a name="l00441"></a>00441 cpl_msg_indent_less();
+<a name="l00442"></a>00442 cpl_imagelist_delete(obj_images);
+<a name="l00443"></a>00443 cpl_frameset_delete(used_frameset);
+<a name="l00444"></a>00444 }
+<a name="l00445"></a>00445
+<a name="l00446"></a>00446 <span class="comment">/* Free and return */</span>
+<a name="l00447"></a>00447 cpl_imagelist_delete(bkg_images);
+<a name="l00448"></a>00448 <span class="keywordflow">return</span> 0;
+<a name="l00449"></a>00449 }
+<a name="l00450"></a>00450
+<a name="l00451"></a>00451 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00461"></a>00461 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00462"></a>00462 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_step_subtract_bkg_save
+<a name="l00463"></a>00463 (cpl_imagelist * obj_images,
+<a name="l00464"></a>00464 <span class="keywordtype">int</span> iserie,
+<a name="l00465"></a>00465 cpl_frameset * used_frameset,
+<a name="l00466"></a>00466 cpl_parameterlist * recipe_parlist,
+<a name="l00467"></a>00467 cpl_frameset * recipe_framelist)
+<a name="l00468"></a>00468 {
+<a name="l00469"></a>00469 <span class="keyword">const</span> cpl_frame * raw_reference;
+<a name="l00470"></a>00470 cpl_propertylist ** extproplists;
+<a name="l00471"></a>00471 <span class="keywordtype">char</span> filename[256] ;
+<a name="l00472"></a>00472 cpl_propertylist * inputlist ;
+<a name="l00473"></a>00473 <span class="keywordtype">int</span> ext_nb ;
+<a name="l00474"></a>00474 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_step_subtract_bkg"</span>;
+<a name="l00475"></a>00475 <span class="keywordtype">int</span> idet;
+<a name="l00476"></a>00476 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00477"></a>00477
+<a name="l00478"></a>00478 <span class="comment">/* Get the reference frame (the raw frame) */</span>
+<a name="l00479"></a>00479 raw_reference = irplib_frameset_get_first_from_group
+<a name="l00480"></a>00480 (used_frameset, CPL_FRAME_GROUP_RAW);
+<a name="l00481"></a>00481
+<a name="l00482"></a>00482 <span class="comment">/* Create the prop lists */</span>
+<a name="l00483"></a>00483 cpl_msg_indent_more();
+<a name="l00484"></a>00484 cpl_msg_info(__func__, <span class="stringliteral">"Creating the keywords list"</span>) ;
+<a name="l00485"></a>00485 extproplists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*));
+<a name="l00486"></a>00486 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00487"></a>00487 {
+<a name="l00488"></a>00488 <span class="comment">/* Get the extension number */</span>
+<a name="l00489"></a>00489 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00490"></a>00490 (cpl_frame_get_filename(raw_reference), idet+1);
+<a name="l00491"></a>00491
+<a name="l00492"></a>00492 <span class="comment">/* Allocate this property list */</span>
+<a name="l00493"></a>00493 extproplists[idet] = cpl_propertylist_new();
+<a name="l00494"></a>00494
+<a name="l00495"></a>00495 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00496"></a>00496 inputlist = cpl_propertylist_load_regexp(
+<a name="l00497"></a>00497 cpl_frame_get_filename(raw_reference), ext_nb,
+<a name="l00498"></a>00498 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00499"></a>00499 cpl_propertylist_append(extproplists[idet], inputlist);
+<a name="l00500"></a>00500 cpl_propertylist_delete(inputlist);
+<a name="l00501"></a>00501 inputlist = cpl_propertylist_load_regexp(
+<a name="l00502"></a>00502 cpl_frame_get_filename(raw_reference), ext_nb,
+<a name="l00503"></a>00503 HAWKI_HEADER_WCS, 0);
+<a name="l00504"></a>00504 cpl_propertylist_append(extproplists[idet], inputlist);
+<a name="l00505"></a>00505 cpl_propertylist_delete(inputlist);
+<a name="l00506"></a>00506 }
+<a name="l00507"></a>00507
+<a name="l00508"></a>00508 <span class="comment">/* Write the image */</span>
+<a name="l00509"></a>00509 snprintf(filename, 256, <span class="stringliteral">"hawki_step_subtract_bkg_%03d.fits"</span>, iserie+1);
+<a name="l00510"></a>00510 <a class="code" href="group__hawki__save.html#ga98c1ab4685617ddf7ea51d6e1337695d" title="Save a HAWKI_NB_DETECTORS extensions HAWKI image.">hawki_imagelist_save</a>(recipe_framelist,
+<a name="l00511"></a>00511 recipe_parlist,
+<a name="l00512"></a>00512 used_frameset,
+<a name="l00513"></a>00513 obj_images,
+<a name="l00514"></a>00514 recipe_name,
+<a name="l00515"></a>00515 HAWKI_CALPRO_BKG_SUBTRACTED,
+<a name="l00516"></a>00516 HAWKI_PROTYPE_BKG_SUBTRACTED,
+<a name="l00517"></a>00517 NULL,
+<a name="l00518"></a>00518 (<span class="keyword">const</span> cpl_propertylist**)extproplists,
+<a name="l00519"></a>00519 filename);
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="comment">/* Free and return */</span>
+<a name="l00522"></a>00522 cpl_msg_indent_less();
+<a name="l00523"></a>00523 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00524"></a>00524 {
+<a name="l00525"></a>00525 cpl_propertylist_delete(extproplists[idet]) ;
+<a name="l00526"></a>00526 }
+<a name="l00527"></a>00527 cpl_free(extproplists) ;
+<a name="l00528"></a>00528 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00529"></a>00529 {
+<a name="l00530"></a>00530 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00531"></a>00531 <span class="keywordflow">return</span> -1;
+<a name="l00532"></a>00532 }
+<a name="l00533"></a>00533 <span class="keywordflow">return</span> 0;
+<a name="l00534"></a>00534 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__tec__filtchk_8c_source.html b/html/hawki__tec__filtchk_8c_source.html
new file mode 100644
index 0000000..e82c512
--- /dev/null
+++ b/html/hawki__tec__filtchk_8c_source.html
@@ -0,0 +1,385 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_tec_filtchk.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_tec_filtchk.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_tec_filtchk.c,v 1.15 2011/10/24 10:41:32 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:41:32 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.15 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include <hawki_dfs.h></span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include <hawki_load.h></span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include <hawki_save.h></span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include <hawki_pfits.h></span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include <hawki_image_stats.h></span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include <hawki_utils.h></span>
+<a name="l00046"></a>00046
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00049"></a>00049 <span class="comment"> Functions prototypes</span>
+<a name="l00050"></a>00050 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_create(cpl_plugin *) ;
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_exec(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_destroy(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_frameset_stats
+<a name="l00058"></a>00058 (cpl_table ** target_stats,
+<a name="l00059"></a>00059 cpl_propertylist ** stats_stats,
+<a name="l00060"></a>00060 cpl_frameset * target_frames);
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_save
+<a name="l00063"></a>00063 (cpl_table ** target_stats,
+<a name="l00064"></a>00064 cpl_parameterlist * recipe_parlist,
+<a name="l00065"></a>00065 cpl_frameset * recipe_frameset,
+<a name="l00066"></a>00066 cpl_propertylist ** stats_stats,
+<a name="l00067"></a>00067 <span class="keyword">const</span> <span class="keywordtype">char</span> * calpro,
+<a name="l00068"></a>00068 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype);
+<a name="l00069"></a>00069
+<a name="l00070"></a>00070 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00071"></a>00071 <span class="comment"> Static variables</span>
+<a name="l00072"></a>00072 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00073"></a>00073
+<a name="l00074"></a>00074 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_tec_filtchk_description[] =
+<a name="l00075"></a>00075 <span class="stringliteral">"hawki_tec_filtchk -- Check pairs of flats taken with different filters.\n"</span>
+<a name="l00076"></a>00076 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"raw-file.fits "</span>HAWKI_TEC_FLAT_RAW<span class="stringliteral">"\n"</span>;
+<a name="l00078"></a>00078
+<a name="l00079"></a>00079 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00080"></a>00080 <span class="comment"> Functions code</span>
+<a name="l00081"></a>00081 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00082"></a>00082
+<a name="l00083"></a>00083 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00091"></a>00091 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00092"></a>00092 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00093"></a>00093 {
+<a name="l00094"></a>00094 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00095"></a>00095 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00096"></a>00096
+<a name="l00097"></a>00097 cpl_plugin_init(plugin,
+<a name="l00098"></a>00098 CPL_PLUGIN_API,
+<a name="l00099"></a>00099 HAWKI_BINARY_VERSION,
+<a name="l00100"></a>00100 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00101"></a>00101 <span class="stringliteral">"hawki_tec_filtchk"</span>,
+<a name="l00102"></a>00102 <span class="stringliteral">"Filter checking recipe"</span>,
+<a name="l00103"></a>00103 hawki_tec_filtchk_description,
+<a name="l00104"></a>00104 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00105"></a>00105 PACKAGE_BUGREPORT,
+<a name="l00106"></a>00106 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00107"></a>00107 hawki_tec_filtchk_create,
+<a name="l00108"></a>00108 hawki_tec_filtchk_exec,
+<a name="l00109"></a>00109 hawki_tec_filtchk_destroy) ;
+<a name="l00110"></a>00110
+<a name="l00111"></a>00111 cpl_pluginlist_append(list, plugin) ;
+<a name="l00112"></a>00112
+<a name="l00113"></a>00113 <span class="keywordflow">return</span> 0;
+<a name="l00114"></a>00114 }
+<a name="l00115"></a>00115
+<a name="l00116"></a>00116 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00125"></a>00125 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00126"></a>00126 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_create(cpl_plugin * plugin)
+<a name="l00127"></a>00127 {
+<a name="l00128"></a>00128 cpl_recipe * recipe ;
+<a name="l00129"></a>00129 <span class="comment">/* cpl_parameter * p ; */</span>
+<a name="l00130"></a>00130
+<a name="l00131"></a>00131 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00132"></a>00132 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00133"></a>00133 recipe = (cpl_recipe *)plugin ;
+<a name="l00134"></a>00134 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00135"></a>00135
+<a name="l00136"></a>00136 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00137"></a>00137 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00138"></a>00138 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00139"></a>00139 <span class="keywordflow">return</span> 1;
+<a name="l00140"></a>00140
+<a name="l00141"></a>00141 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00142"></a>00142 <span class="comment">/* None.. */</span>
+<a name="l00143"></a>00143
+<a name="l00144"></a>00144 <span class="comment">/* Return */</span>
+<a name="l00145"></a>00145 <span class="keywordflow">return</span> 0;
+<a name="l00146"></a>00146 }
+<a name="l00147"></a>00147
+<a name="l00148"></a>00148 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00154"></a>00154 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00155"></a>00155 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_exec(cpl_plugin * plugin)
+<a name="l00156"></a>00156 {
+<a name="l00157"></a>00157 cpl_recipe * recipe ;
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00160"></a>00160 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00161"></a>00161 recipe = (cpl_recipe *)plugin ;
+<a name="l00162"></a>00162 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00163"></a>00163
+<a name="l00164"></a>00164 <span class="comment">/* Issue a banner */</span>
+<a name="l00165"></a>00165 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 <span class="keywordflow">return</span> hawki_tec_filtchk(recipe->parameters, recipe->frames) ;
+<a name="l00168"></a>00168 }
+<a name="l00169"></a>00169
+<a name="l00170"></a>00170 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00176"></a>00176 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00177"></a>00177 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_destroy(cpl_plugin * plugin)
+<a name="l00178"></a>00178 {
+<a name="l00179"></a>00179 cpl_recipe * recipe ;
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00182"></a>00182 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00183"></a>00183 recipe = (cpl_recipe *)plugin ;
+<a name="l00184"></a>00184 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00185"></a>00185
+<a name="l00186"></a>00186 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00187"></a>00187 <span class="keywordflow">return</span> 0 ;
+<a name="l00188"></a>00188 }
+<a name="l00189"></a>00189
+<a name="l00190"></a>00190 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00197"></a>00197 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00198"></a>00198 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk(
+<a name="l00199"></a>00199 cpl_parameterlist * parlist,
+<a name="l00200"></a>00200 cpl_frameset * framelist)
+<a name="l00201"></a>00201 {
+<a name="l00202"></a>00202 cpl_frameset * frames ;
+<a name="l00203"></a>00203 cpl_table ** target_stats;
+<a name="l00204"></a>00204 cpl_propertylist ** stats_stats;
+<a name="l00205"></a>00205 <span class="keywordtype">int</span> idet;
+<a name="l00206"></a>00206 <span class="keywordtype">char</span> calpro[1024];
+<a name="l00207"></a>00207 <span class="keywordtype">char</span> protype[1024];
+<a name="l00208"></a>00208
+<a name="l00209"></a>00209 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00210"></a>00210 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist))
+<a name="l00211"></a>00211 {
+<a name="l00212"></a>00212 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00213"></a>00213 <span class="keywordflow">return</span> -1;
+<a name="l00214"></a>00214 }
+<a name="l00215"></a>00215
+<a name="l00216"></a>00216 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00217"></a>00217 cpl_msg_info(__func__, <span class="stringliteral">"Identifying input frames"</span>);
+<a name="l00218"></a>00218 frames = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist, HAWKI_TEC_FLAT_RAW) ;
+<a name="l00219"></a>00219 snprintf(calpro, 1024, HAWKI_CALPRO_FILTERPOSCHECK_STATS);
+<a name="l00220"></a>00220 snprintf(protype, 1024, HAWKI_PROTYPE_FILTERPOSCHECK_STATS);
+<a name="l00221"></a>00221 <span class="keywordflow">if</span> (frames == NULL)
+<a name="l00222"></a>00222 {
+<a name="l00223"></a>00223 cpl_msg_error(__func__,<span class="stringliteral">"Input files should be tagged %s"</span>,
+<a name="l00224"></a>00224 HAWKI_TEC_FLAT_RAW);
+<a name="l00225"></a>00225 <span class="keywordflow">return</span> -1;
+<a name="l00226"></a>00226 }
+<a name="l00227"></a>00227
+<a name="l00228"></a>00228 <span class="comment">/* Create the statistics table */</span>
+<a name="l00229"></a>00229 target_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table *));
+<a name="l00230"></a>00230 stats_stats = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist *));
+<a name="l00231"></a>00231 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00232"></a>00232 {
+<a name="l00233"></a>00233 target_stats[idet] = cpl_table_new(cpl_frameset_get_size(frames));
+<a name="l00234"></a>00234 stats_stats[idet] = cpl_propertylist_new();
+<a name="l00235"></a>00235 }
+<a name="l00236"></a>00236 <a class="code" href="group__hawki__image__stats.html#ga788a4b7f6fba705eddcebd1f2fe26fd6" title="Initialize the table with all the statistics columns.">hawki_image_stats_initialize</a>(target_stats);
+<a name="l00237"></a>00237
+<a name="l00238"></a>00238 <span class="comment">/* Compute actually the statistics */</span>
+<a name="l00239"></a>00239 hawki_tec_filtchk_frameset_stats(target_stats, stats_stats, frames);
+<a name="l00240"></a>00240
+<a name="l00241"></a>00241 <span class="comment">/* Saving the table product */</span>
+<a name="l00242"></a>00242 hawki_tec_filtchk_save
+<a name="l00243"></a>00243 (target_stats, parlist, framelist, stats_stats, calpro, protype);
+<a name="l00244"></a>00244
+<a name="l00245"></a>00245 <span class="comment">/* Free and return */</span>
+<a name="l00246"></a>00246 cpl_frameset_delete(frames);
+<a name="l00247"></a>00247 <span class="keywordflow">for</span>( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00248"></a>00248 {
+<a name="l00249"></a>00249 cpl_table_delete(target_stats[idet]);
+<a name="l00250"></a>00250 cpl_propertylist_delete(stats_stats[idet]);
+<a name="l00251"></a>00251 }
+<a name="l00252"></a>00252 cpl_free(target_stats);
+<a name="l00253"></a>00253 cpl_free(stats_stats);
+<a name="l00254"></a>00254
+<a name="l00255"></a>00255 <span class="comment">/* Return */</span>
+<a name="l00256"></a>00256 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00257"></a>00257 {
+<a name="l00258"></a>00258 cpl_msg_error(__func__,
+<a name="l00259"></a>00259 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00260"></a>00260 <span class="keywordflow">return</span> -1 ;
+<a name="l00261"></a>00261 }
+<a name="l00262"></a>00262 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00263"></a>00263 }
+<a name="l00264"></a>00264
+<a name="l00265"></a>00265 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00275"></a>00275 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00276"></a>00276 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_frameset_stats
+<a name="l00277"></a>00277 (cpl_table ** target_stats,
+<a name="l00278"></a>00278 cpl_propertylist ** stats_stats,
+<a name="l00279"></a>00279 cpl_frameset * target_frames)
+<a name="l00280"></a>00280 {
+<a name="l00281"></a>00281 <span class="keywordtype">int</span> iframe;
+<a name="l00282"></a>00282 <span class="keywordtype">int</span> nframes;
+<a name="l00283"></a>00283
+<a name="l00284"></a>00284 <span class="comment">/* Loop on the number of frames */</span>
+<a name="l00285"></a>00285 nframes = cpl_frameset_get_size(target_frames);
+<a name="l00286"></a>00286 cpl_msg_info(__func__, <span class="stringliteral">"Looping the target frames: %d frames"</span>, nframes);
+<a name="l00287"></a>00287 cpl_msg_indent_more();
+<a name="l00288"></a>00288 <span class="keywordflow">for</span>( iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l00289"></a>00289 {
+<a name="l00290"></a>00290 <span class="comment">/* Local storage variables */</span>
+<a name="l00291"></a>00291 cpl_frame * this_target_frame;
+<a name="l00292"></a>00292
+<a name="l00293"></a>00293 <span class="comment">/* Computing statistics for this frame */</span>
+<a name="l00294"></a>00294 cpl_msg_info(__func__, <span class="stringliteral">"Computing stats for frame: %d"</span>, iframe +1);
+<a name="l00295"></a>00295 this_target_frame = cpl_frameset_get_frame(target_frames, iframe);
+<a name="l00296"></a>00296 <a class="code" href="group__hawki__image__stats.html#ga07a4f45b2ba4af9420f7d8600dbbe836" title="Fills a table with the statistics of the four detectors of a frame.">hawki_image_stats_fill_from_frame</a>
+<a name="l00297"></a>00297 (target_stats, this_target_frame, iframe);
+<a name="l00298"></a>00298 }
+<a name="l00299"></a>00299 cpl_msg_indent_less();
+<a name="l00300"></a>00300
+<a name="l00301"></a>00301 <span class="comment">/* Compute stats of the stats */</span>
+<a name="l00302"></a>00302 <a class="code" href="group__hawki__image__stats.html#gaaf82f2c0930f1c2bfcbc5cbef16b3928" title="Make the statistics (over image serie) of the each image statistics.">hawki_image_stats_stats</a>(target_stats, stats_stats);
+<a name="l00303"></a>00303
+<a name="l00304"></a>00304 <span class="comment">/* Print info about the statistics */</span>
+<a name="l00305"></a>00305 hawki_image_stats_print(target_stats);
+<a name="l00306"></a>00306
+<a name="l00307"></a>00307 <span class="keywordflow">return</span> 0;
+<a name="l00308"></a>00308 }
+<a name="l00309"></a>00309
+<a name="l00310"></a>00310 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00320"></a>00320 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00321"></a>00321 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_tec_filtchk_save
+<a name="l00322"></a>00322 (cpl_table ** target_stats,
+<a name="l00323"></a>00323 cpl_parameterlist * recipe_parlist,
+<a name="l00324"></a>00324 cpl_frameset * recipe_frameset,
+<a name="l00325"></a>00325 cpl_propertylist ** stats_stats,
+<a name="l00326"></a>00326 <span class="keyword">const</span> <span class="keywordtype">char</span> * calpro,
+<a name="l00327"></a>00327 <span class="keyword">const</span> <span class="keywordtype">char</span> * protype)
+<a name="l00328"></a>00328 {
+<a name="l00329"></a>00329 <span class="keyword">const</span> cpl_frame * reference_frame;
+<a name="l00330"></a>00330 cpl_propertylist * referencelist;
+<a name="l00331"></a>00331 cpl_propertylist ** extlists;
+<a name="l00332"></a>00332 <span class="keywordtype">int</span> idet;
+<a name="l00333"></a>00333 <span class="keywordtype">int</span> ext_nb;
+<a name="l00334"></a>00334 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_tec_filtchk"</span>;
+<a name="l00335"></a>00335
+<a name="l00336"></a>00336 <span class="comment">/* Get the reference frame (the first one) */</span>
+<a name="l00337"></a>00337 reference_frame = cpl_frameset_get_first_const(recipe_frameset);
+<a name="l00338"></a>00338
+<a name="l00339"></a>00339 <span class="comment">/* Create the prop lists */</span>
+<a name="l00340"></a>00340 cpl_msg_info(__func__, <span class="stringliteral">"Creating the keywords list"</span>) ;
+<a name="l00341"></a>00341 referencelist = cpl_propertylist_load_regexp
+<a name="l00342"></a>00342 (cpl_frame_get_filename(reference_frame), 0,HAWKI_HEADER_EXT_FORWARD,0);
+<a name="l00343"></a>00343 extlists =
+<a name="l00344"></a>00344 cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*));
+<a name="l00345"></a>00345 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00346"></a>00346 {
+<a name="l00347"></a>00347 <span class="comment">/* Get the extension number */</span>
+<a name="l00348"></a>00348 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>
+<a name="l00349"></a>00349 (cpl_frame_get_filename(reference_frame), idet+1);
+<a name="l00350"></a>00350
+<a name="l00351"></a>00351 <span class="comment">/* Propagate the keywords from input frame extensions */</span>
+<a name="l00352"></a>00352 extlists[idet] = cpl_propertylist_load_regexp(
+<a name="l00353"></a>00353 cpl_frame_get_filename(reference_frame), ext_nb,
+<a name="l00354"></a>00354 HAWKI_HEADER_EXT_FORWARD, 0);
+<a name="l00355"></a>00355
+<a name="l00356"></a>00356 <span class="comment">/* Add the stats of the stats */</span>
+<a name="l00357"></a>00357 cpl_propertylist_append(extlists[idet],stats_stats[idet]);
+<a name="l00358"></a>00358 }
+<a name="l00359"></a>00359
+<a name="l00360"></a>00360 <span class="comment">/* Write the table with the statistics */</span>
+<a name="l00361"></a>00361 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(recipe_frameset,
+<a name="l00362"></a>00362 recipe_parlist,
+<a name="l00363"></a>00363 recipe_frameset,
+<a name="l00364"></a>00364 (<span class="keyword">const</span> cpl_table **)target_stats,
+<a name="l00365"></a>00365 recipe_name,
+<a name="l00366"></a>00366 calpro,
+<a name="l00367"></a>00367 protype,
+<a name="l00368"></a>00368 (<span class="keyword">const</span> cpl_propertylist*)referencelist,
+<a name="l00369"></a>00369 (<span class="keyword">const</span> cpl_propertylist**)extlists,
+<a name="l00370"></a>00370 <span class="stringliteral">"hawki_tec_filtchk_stats.fits"</span>);
+<a name="l00371"></a>00371
+<a name="l00372"></a>00372 <span class="comment">/* Free and return */</span>
+<a name="l00373"></a>00373 cpl_propertylist_delete(referencelist) ;
+<a name="l00374"></a>00374 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00375"></a>00375 {
+<a name="l00376"></a>00376 cpl_propertylist_delete(extlists[idet]) ;
+<a name="l00377"></a>00377 }
+<a name="l00378"></a>00378 cpl_free(extlists) ;
+<a name="l00379"></a>00379 <span class="keywordflow">return</span> 0;
+<a name="l00380"></a>00380 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__util__extinction_8c_source.html b/html/hawki__util__extinction_8c_source.html
new file mode 100644
index 0000000..d05587e
--- /dev/null
+++ b/html/hawki__util__extinction_8c_source.html
@@ -0,0 +1,543 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_util_extinction.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_util_extinction.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_util_extinction.c,v 1.3 2011/12/22 14:28:43 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/12/22 14:28:43 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.3 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <string.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <math.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_strehl.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "irplib_stdstar.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "irplib_cat.h"</span>
+<a name="l00044"></a>00044
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_calib.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "hawki_alloc.h"</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00054"></a>00054 <span class="comment"> Functions prototypes</span>
+<a name="l00055"></a>00055 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_create(cpl_plugin *) ;
+<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_exec(cpl_plugin *) ;
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_destroy(cpl_plugin *) ;
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="keyword">static</span> cpl_table ** hawki_util_extinction_reduce
+<a name="l00063"></a>00063 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l00064"></a>00064 <span class="keyword">const</span> <span class="keywordtype">char</span> * stdstars,
+<a name="l00065"></a>00065 <span class="keyword">const</span> <span class="keywordtype">char</span> * bpm,
+<a name="l00066"></a>00066 <span class="keyword">const</span> <span class="keywordtype">char</span> * flat,
+<a name="l00067"></a>00067 cpl_table ** raw_zpoint_stats,
+<a name="l00068"></a>00068 <span class="keywordtype">int</span> * star_labels,
+<a name="l00069"></a>00069 <span class="keywordtype">int</span> * det_labels,
+<a name="l00070"></a>00070 cpl_imagelist ** images);
+<a name="l00071"></a>00071 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_save_photsol
+<a name="l00072"></a>00072 (cpl_table ** photsol_table,
+<a name="l00073"></a>00073 cpl_frameset * zpoint_frames,
+<a name="l00074"></a>00074 cpl_parameterlist * parlist,
+<a name="l00075"></a>00075 cpl_frameset * <span class="keyword">set</span>);
+<a name="l00076"></a>00076 <span class="keyword">static</span> cpl_table ** hawki_util_extinction_photom
+<a name="l00077"></a>00077 (cpl_frameset * std_stars_photom);
+<a name="l00078"></a>00078 <span class="keyword">static</span> cpl_table * hawki_util_extinction_get_photomsol
+<a name="l00079"></a>00079 (cpl_table * std_stars_photom);
+<a name="l00080"></a>00080 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_compute_keywords
+<a name="l00081"></a>00081 (cpl_frameset * <span class="keyword">set</span>,
+<a name="l00082"></a>00082 <span class="keywordtype">int</span> * det_labels);
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00085"></a>00085 <span class="comment"> Static variables</span>
+<a name="l00086"></a>00086 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00087"></a>00087
+<a name="l00088"></a>00088
+<a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_util_extinction_description[] =
+<a name="l00090"></a>00090 <span class="stringliteral">"hawki_util_extinction -- Zero point recipe with extinction\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"The input of the recipe files listed in the Set Of Frames (sof-file)\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"must be tagged as:\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"hawki_util_extinction.fits ("</span>HAWKI_CALPRO_ZPOINT_TAB<span class="stringliteral">"): Zero point solution table\n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"The recipe creates as an output:\n"</span>
+<a name="l00095"></a>00095 <span class="stringliteral">"hawki_cal_photom.fits ("</span>HAWKI_CALPRO_PHOT_TAB<span class="stringliteral">"): Photometric solution\n"</span>
+<a name="l00096"></a>00096 <span class="stringliteral">"Return code:\n"</span>
+<a name="l00097"></a>00097 <span class="stringliteral">"esorex exits with an error code of 0 if the recipe completes successfully\n"</span>
+<a name="l00098"></a>00098 <span class="stringliteral">"or 1 otherwise"</span>;
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00101"></a>00101 <span class="comment"> Functions code</span>
+<a name="l00102"></a>00102 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00103"></a>00103
+<a name="l00104"></a>00104 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00112"></a>00112 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00113"></a>00113 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00114"></a>00114 {
+<a name="l00115"></a>00115 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00116"></a>00116 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00117"></a>00117
+<a name="l00118"></a>00118 cpl_plugin_init(plugin,
+<a name="l00119"></a>00119 CPL_PLUGIN_API,
+<a name="l00120"></a>00120 HAWKI_BINARY_VERSION,
+<a name="l00121"></a>00121 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00122"></a>00122 <span class="stringliteral">"hawki_util_extinction"</span>,
+<a name="l00123"></a>00123 <span class="stringliteral">"Zero point with extinction computation recipe"</span>,
+<a name="l00124"></a>00124 hawki_util_extinction_description,
+<a name="l00125"></a>00125 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00126"></a>00126 <span class="stringliteral">"cgarcia at eso.org"</span>,
+<a name="l00127"></a>00127 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00128"></a>00128 hawki_util_extinction_create,
+<a name="l00129"></a>00129 hawki_util_extinction_exec,
+<a name="l00130"></a>00130 hawki_util_extinction_destroy) ;
+<a name="l00131"></a>00131
+<a name="l00132"></a>00132 cpl_pluginlist_append(list, plugin) ;
+<a name="l00133"></a>00133
+<a name="l00134"></a>00134 <span class="keywordflow">return</span> 0;
+<a name="l00135"></a>00135 }
+<a name="l00136"></a>00136
+<a name="l00137"></a>00137 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00146"></a>00146 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00147"></a>00147 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_create(cpl_plugin * plugin)
+<a name="l00148"></a>00148 {
+<a name="l00149"></a>00149 cpl_recipe * recipe ;
+<a name="l00150"></a>00150 cpl_parameter * p ;
+<a name="l00151"></a>00151
+<a name="l00152"></a>00152 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00153"></a>00153 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00154"></a>00154 recipe = (cpl_recipe *)plugin ;
+<a name="l00155"></a>00155 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00156"></a>00156
+<a name="l00157"></a>00157 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00158"></a>00158 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00159"></a>00159 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00160"></a>00160 <span class="keywordflow">return</span> 1;
+<a name="l00161"></a>00161
+<a name="l00162"></a>00162 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00163"></a>00163
+<a name="l00164"></a>00164 <span class="comment">/* Return */</span>
+<a name="l00165"></a>00165 <span class="keywordflow">return</span> 0;
+<a name="l00166"></a>00166 }
+<a name="l00167"></a>00167
+<a name="l00168"></a>00168 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00174"></a>00174 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00175"></a>00175 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_exec(cpl_plugin * plugin)
+<a name="l00176"></a>00176 {
+<a name="l00177"></a>00177 cpl_recipe * recipe ;
+<a name="l00178"></a>00178
+<a name="l00179"></a>00179 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00180"></a>00180 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00181"></a>00181 recipe = (cpl_recipe *)plugin ;
+<a name="l00182"></a>00182 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184 <span class="comment">/* Issue a banner */</span>
+<a name="l00185"></a>00185 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00186"></a>00186
+<a name="l00187"></a>00187 <span class="keywordflow">return</span> hawki_util_extinction(recipe->parameters, recipe->frames) ;
+<a name="l00188"></a>00188 }
+<a name="l00189"></a>00189
+<a name="l00190"></a>00190 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00196"></a>00196 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00197"></a>00197 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_destroy(cpl_plugin * plugin)
+<a name="l00198"></a>00198 {
+<a name="l00199"></a>00199 cpl_recipe * recipe ;
+<a name="l00200"></a>00200
+<a name="l00201"></a>00201 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00202"></a>00202 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00203"></a>00203 recipe = (cpl_recipe *)plugin ;
+<a name="l00204"></a>00204 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00205"></a>00205
+<a name="l00206"></a>00206 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00207"></a>00207 <span class="keywordflow">return</span> 0 ;
+<a name="l00208"></a>00208 }
+<a name="l00209"></a>00209
+<a name="l00210"></a>00210 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00217"></a>00217 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00218"></a>00218 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction(
+<a name="l00219"></a>00219 cpl_parameterlist * parlist,
+<a name="l00220"></a>00220 cpl_frameset * framelist)
+<a name="l00221"></a>00221 {
+<a name="l00222"></a>00222 cpl_frameset * std_stars_photom ;
+<a name="l00223"></a>00223 cpl_table ** zpoint_tables;
+<a name="l00224"></a>00224
+<a name="l00225"></a>00225 <span class="comment">/* Initialise Output */</span>
+<a name="l00226"></a>00226 std_stars_photom = NULL ;
+<a name="l00227"></a>00227
+<a name="l00228"></a>00228 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00229"></a>00229 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00230"></a>00230 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00231"></a>00231 <span class="keywordflow">return</span> -1 ;
+<a name="l00232"></a>00232 }
+<a name="l00233"></a>00233
+<a name="l00234"></a>00234 <span class="comment">/* Retrieve zpoint tables */</span>
+<a name="l00235"></a>00235 <span class="keywordflow">if</span> ((std_stars_photom = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>
+<a name="l00236"></a>00236 (framelist, HAWKI_CALPRO_ZPOINT_TAB)) == NULL)
+<a name="l00237"></a>00237 {
+<a name="l00238"></a>00238 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find std stars info (%s)"</span>,
+<a name="l00239"></a>00239 HAWKI_CALPRO_ZPOINT_TAB);
+<a name="l00240"></a>00240 <span class="keywordflow">return</span> -1 ;
+<a name="l00241"></a>00241 }
+<a name="l00242"></a>00242
+<a name="l00243"></a>00243 <span class="comment">/* Compute the zpoint values */</span>
+<a name="l00244"></a>00244 cpl_msg_info(__func__, <span class="stringliteral">"Reduce the data"</span>) ;
+<a name="l00245"></a>00245 cpl_msg_indent_more() ;
+<a name="l00246"></a>00246 <span class="keywordflow">if</span> ((zpoint_tables = hawki_util_extinction_photom(std_stars_photom))==NULL)
+<a name="l00247"></a>00247 {
+<a name="l00248"></a>00248 cpl_msg_error(__func__, <span class="stringliteral">"Cannot compute photometric solution"</span>) ;
+<a name="l00249"></a>00249 cpl_frameset_delete(std_stars_photom) ;
+<a name="l00250"></a>00250 cpl_msg_indent_less() ;
+<a name="l00251"></a>00251 <span class="keywordflow">return</span> -1 ;
+<a name="l00252"></a>00252 }
+<a name="l00253"></a>00253 cpl_msg_indent_less() ;
+<a name="l00254"></a>00254
+<a name="l00255"></a>00255 <span class="comment">/* Save the products */</span>
+<a name="l00256"></a>00256 cpl_msg_info(__func__, <span class="stringliteral">"Save the products"</span>);
+<a name="l00257"></a>00257 cpl_msg_indent_more() ;
+<a name="l00258"></a>00258 <span class="keywordflow">if</span> (hawki_util_extinction_save_photsol
+<a name="l00259"></a>00259 (zpoint_tables, std_stars_photom,
+<a name="l00260"></a>00260 parlist, framelist) == -1)
+<a name="l00261"></a>00261 {
+<a name="l00262"></a>00262 cpl_msg_warning(__func__, <span class="stringliteral">"Data could not be saved. "</span>
+<a name="l00263"></a>00263 <span class="stringliteral">"Check permisions or disk space"</span>) ;
+<a name="l00264"></a>00264 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_tables) ;
+<a name="l00265"></a>00265 cpl_frameset_delete(std_stars_photom);
+<a name="l00266"></a>00266 cpl_msg_indent_less() ;
+<a name="l00267"></a>00267 <span class="keywordflow">return</span> -1 ;
+<a name="l00268"></a>00268 }
+<a name="l00269"></a>00269 cpl_msg_indent_less() ;
+<a name="l00270"></a>00270
+<a name="l00271"></a>00271 <span class="comment">/* Free and return */</span>
+<a name="l00272"></a>00272 cpl_frameset_delete(std_stars_photom);
+<a name="l00273"></a>00273 <a class="code" href="group__hawki__alloc.html#ga2c7746115db289a6cea907e2025d93bd" title="Deallocates a set of four tables.">hawki_table_delete</a>(zpoint_tables);
+<a name="l00274"></a>00274
+<a name="l00275"></a>00275 <span class="comment">/* Return */</span>
+<a name="l00276"></a>00276 <span class="keywordflow">if</span> (cpl_error_get_code()) <span class="keywordflow">return</span> -1 ;
+<a name="l00277"></a>00277 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00278"></a>00278 }
+<a name="l00279"></a>00279
+<a name="l00280"></a>00280 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00290"></a>00290 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00291"></a>00291 <span class="keyword">static</span> cpl_table ** hawki_util_extinction_photom
+<a name="l00292"></a>00292 (cpl_frameset * std_stars_photom)
+<a name="l00293"></a>00293
+<a name="l00294"></a>00294 {
+<a name="l00295"></a>00295 cpl_table ** photsol;
+<a name="l00296"></a>00296 <span class="keywordtype">int</span> nframes;
+<a name="l00297"></a>00297 <span class="keywordtype">double</span> extinction;
+<a name="l00298"></a>00298 cpl_bivector * iqe_res ;
+<a name="l00299"></a>00299 <span class="keywordtype">int</span> iframe;
+<a name="l00300"></a>00300 <span class="keywordtype">int</span> idet;
+<a name="l00301"></a>00301 <span class="keywordtype">int</span> jdet;
+<a name="l00302"></a>00302 <span class="keywordtype">int</span> iext;
+<a name="l00303"></a>00303 <span class="keywordtype">int</span> ext_nb;
+<a name="l00304"></a>00304 cpl_frame * ref_frame;
+<a name="l00305"></a>00305
+<a name="l00306"></a>00306 <span class="comment">/* Test entries */</span>
+<a name="l00307"></a>00307 <span class="keywordflow">if</span> (std_stars_photom == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00308"></a>00308
+<a name="l00309"></a>00309 <span class="comment">/* Initialise */</span>
+<a name="l00310"></a>00310 photsol = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table*));
+<a name="l00311"></a>00311 nframes = cpl_frameset_get_size(std_stars_photom) ;
+<a name="l00312"></a>00312
+<a name="l00313"></a>00313 <span class="comment">/* Get reference */</span>
+<a name="l00314"></a>00314 ref_frame = cpl_frameset_get_first(std_stars_photom);
+<a name="l00315"></a>00315 nframes = cpl_frameset_get_size(std_stars_photom);
+<a name="l00316"></a>00316
+<a name="l00317"></a>00317 <span class="comment">/* Loop on detectors */</span>
+<a name="l00318"></a>00318 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS; idet++)
+<a name="l00319"></a>00319 {
+<a name="l00320"></a>00320 cpl_table * merged_std_stars_photom;
+<a name="l00321"></a>00321
+<a name="l00322"></a>00322 cpl_msg_info(cpl_func, <span class="stringliteral">"Working on detector %d"</span>, idet +1);
+<a name="l00323"></a>00323 cpl_msg_indent_more();
+<a name="l00324"></a>00324 <span class="comment">/* Get the extension */</span>
+<a name="l00325"></a>00325 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(cpl_frame_get_filename(ref_frame), idet+1);
+<a name="l00326"></a>00326
+<a name="l00327"></a>00327 <span class="comment">/* Load all the tables and merge them */</span>
+<a name="l00328"></a>00328 <span class="keywordflow">for</span>( iframe = 0 ; iframe < nframes ; ++iframe)
+<a name="l00329"></a>00329 {
+<a name="l00330"></a>00330 cpl_frame * this_frame;
+<a name="l00331"></a>00331 cpl_table * this_table;
+<a name="l00332"></a>00332 <span class="comment">/* Get the current image */</span>
+<a name="l00333"></a>00333 this_frame = cpl_frameset_get_frame(std_stars_photom, iframe);
+<a name="l00334"></a>00334 <span class="keywordflow">if</span>(iframe == 0)
+<a name="l00335"></a>00335 merged_std_stars_photom = cpl_table_load
+<a name="l00336"></a>00336 (cpl_frame_get_filename(this_frame),ext_nb, 1);
+<a name="l00337"></a>00337 <span class="keywordflow">else</span>
+<a name="l00338"></a>00338 {
+<a name="l00339"></a>00339 cpl_table * this_table =
+<a name="l00340"></a>00340 cpl_table_load(cpl_frame_get_filename(this_frame),ext_nb, 1);
+<a name="l00341"></a>00341 cpl_table_insert(merged_std_stars_photom, this_table,
+<a name="l00342"></a>00342 cpl_table_get_nrow(merged_std_stars_photom));
+<a name="l00343"></a>00343 cpl_table_delete(this_table);
+<a name="l00344"></a>00344 }
+<a name="l00345"></a>00345 }
+<a name="l00346"></a>00346
+<a name="l00347"></a>00347 <span class="keywordflow">if</span>(cpl_table_get_nrow(merged_std_stars_photom) < 2)
+<a name="l00348"></a>00348 {
+<a name="l00349"></a>00349 cpl_msg_error(__func__, <span class="stringliteral">"%d stars found. At least 2 stars must be present"</span>,
+<a name="l00350"></a>00350 cpl_table_get_nrow(merged_std_stars_photom));
+<a name="l00351"></a>00351 cpl_table_delete(merged_std_stars_photom);
+<a name="l00352"></a>00352 <span class="keywordflow">return</span> NULL;
+<a name="l00353"></a>00353 }
+<a name="l00354"></a>00354 cpl_msg_info(__func__,<span class="stringliteral">"Number of star measurements %d"</span>,
+<a name="l00355"></a>00355 cpl_table_get_nrow(merged_std_stars_photom));
+<a name="l00356"></a>00356
+<a name="l00357"></a>00357 <span class="keywordflow">if</span>((photsol[idet] = hawki_util_extinction_get_photomsol
+<a name="l00358"></a>00358 (merged_std_stars_photom)) == NULL)
+<a name="l00359"></a>00359 {
+<a name="l00360"></a>00360 cpl_table_delete(merged_std_stars_photom);
+<a name="l00361"></a>00361 <span class="keywordflow">for</span>(jdet=0; jdet < idet; jdet++)
+<a name="l00362"></a>00362 cpl_table_delete(photsol[jdet]);
+<a name="l00363"></a>00363 cpl_free(photsol);
+<a name="l00364"></a>00364 <span class="keywordflow">return</span> NULL;
+<a name="l00365"></a>00365 }
+<a name="l00366"></a>00366
+<a name="l00367"></a>00367 cpl_table_delete(merged_std_stars_photom);
+<a name="l00368"></a>00368 cpl_msg_indent_less();
+<a name="l00369"></a>00369 }
+<a name="l00370"></a>00370 <span class="keywordflow">return</span> photsol;
+<a name="l00371"></a>00371 }
+<a name="l00372"></a>00372
+<a name="l00373"></a>00373 <span class="keyword">static</span> cpl_table * hawki_util_extinction_get_photomsol
+<a name="l00374"></a>00374 (cpl_table * std_stars_photom)
+<a name="l00375"></a>00375 {
+<a name="l00376"></a>00376 <span class="keyword">const</span> <span class="keywordtype">double</span> * instrmag;
+<a name="l00377"></a>00377 <span class="keyword">const</span> <span class="keywordtype">double</span> * airmass;
+<a name="l00378"></a>00378 <span class="keyword">const</span> <span class="keywordtype">double</span> * catmag;
+<a name="l00379"></a>00379 cpl_table * photsol;
+<a name="l00380"></a>00380 <span class="keywordtype">double</span> zeropoint;
+<a name="l00381"></a>00381 <span class="keywordtype">double</span> extcoeff;
+<a name="l00382"></a>00382 cpl_matrix * xpos;
+<a name="l00383"></a>00383 cpl_vector * ypos;
+<a name="l00384"></a>00384 cpl_polynomial * phot_coeff;
+<a name="l00385"></a>00385 <span class="keywordtype">int</span> nstars;
+<a name="l00386"></a>00386 <span class="keywordtype">int</span> istar;
+<a name="l00387"></a>00387 <span class="keyword">const</span> cpl_boolean sampsym = CPL_TRUE;
+<a name="l00388"></a>00388 <span class="keyword">const</span> cpl_size mindeg1d = 0;
+<a name="l00389"></a>00389 <span class="keyword">const</span> cpl_size maxdeg1d = 1;
+<a name="l00390"></a>00390 cpl_size pows;
+<a name="l00391"></a>00391
+<a name="l00392"></a>00392
+<a name="l00393"></a>00393 nstars = cpl_table_get_nrow(std_stars_photom);
+<a name="l00394"></a>00394
+<a name="l00395"></a>00395 photsol = cpl_table_new(1);
+<a name="l00396"></a>00396 instrmag = cpl_table_get_data_double_const
+<a name="l00397"></a>00397 (std_stars_photom, HAWKI_COL_ZPOINT_INSTRMAG);
+<a name="l00398"></a>00398 airmass = cpl_table_get_data_double_const
+<a name="l00399"></a>00399 (std_stars_photom, HAWKI_COL_ZPOINT_AIRMASS);
+<a name="l00400"></a>00400 catmag = cpl_table_get_data_double_const
+<a name="l00401"></a>00401 (std_stars_photom, HAWKI_COL_ZPOINT_STARMAG);
+<a name="l00402"></a>00402
+<a name="l00403"></a>00403 <span class="keywordflow">if</span>(instrmag == NULL || airmass == NULL || catmag == NULL)
+<a name="l00404"></a>00404 {
+<a name="l00405"></a>00405 cpl_msg_error(cpl_func, <span class="stringliteral">"Some of the following columns not found "</span>
+<a name="l00406"></a>00406 <span class="stringliteral">"in table: %s, %s, %s"</span>, HAWKI_COL_ZPOINT_INSTRMAG,
+<a name="l00407"></a>00407 HAWKI_COL_ZPOINT_AIRMASS, HAWKI_COL_ZPOINT_STARMAG);
+<a name="l00408"></a>00408 cpl_table_delete(photsol);
+<a name="l00409"></a>00409 <span class="keywordflow">return</span> NULL;
+<a name="l00410"></a>00410 }
+<a name="l00411"></a>00411
+<a name="l00412"></a>00412 cpl_table_new_column(photsol, HAWKI_COL_PHOT_FILTER, CPL_TYPE_STRING);
+<a name="l00413"></a>00413 cpl_table_new_column(photsol, HAWKI_COL_PHOT_ZEROPOINT, CPL_TYPE_DOUBLE);
+<a name="l00414"></a>00414 cpl_table_set_column_unit(photsol,HAWKI_COL_PHOT_ZEROPOINT,<span class="stringliteral">"mag"</span>);
+<a name="l00415"></a>00415 cpl_table_new_column(photsol, HAWKI_COL_PHOT_EXTCOEFF, CPL_TYPE_DOUBLE);
+<a name="l00416"></a>00416 cpl_table_set_column_unit(photsol,HAWKI_COL_PHOT_EXTCOEFF,<span class="stringliteral">"mag/airmass"</span>);
+<a name="l00417"></a>00417
+<a name="l00418"></a>00418 <span class="comment">/* Make the fit to get the coefficients */</span>
+<a name="l00419"></a>00419 xpos = cpl_matrix_new(1, nstars);
+<a name="l00420"></a>00420 ypos = cpl_vector_new(nstars);
+<a name="l00421"></a>00421 <span class="keywordflow">for</span>(istar = 0; istar < nstars; ++istar)
+<a name="l00422"></a>00422 {
+<a name="l00423"></a>00423 <span class="keywordtype">double</span> y;
+<a name="l00424"></a>00424 cpl_matrix_set(xpos, 0, istar, airmass[istar]);
+<a name="l00425"></a>00425 y = catmag[istar] + instrmag[istar];
+<a name="l00426"></a>00426 cpl_vector_set(ypos, istar, y);
+<a name="l00427"></a>00427 }
+<a name="l00428"></a>00428 <span class="comment">/* phot_coeff[0] --> ZP</span>
+<a name="l00429"></a>00429 <span class="comment"> * phot_coeff[1] --> -extcoeff</span>
+<a name="l00430"></a>00430 <span class="comment"> */</span>
+<a name="l00431"></a>00431 phot_coeff = cpl_polynomial_new(1);
+<a name="l00432"></a>00432 <span class="keywordflow">if</span>(cpl_polynomial_fit(phot_coeff, xpos, NULL, ypos, NULL,
+<a name="l00433"></a>00433 CPL_FALSE, &mindeg1d, &maxdeg1d) != CPL_ERROR_NONE)
+<a name="l00434"></a>00434 {
+<a name="l00435"></a>00435 cpl_msg_error(cpl_func,<span class="stringliteral">"Cannot get the photometric solution"</span>);
+<a name="l00436"></a>00436 cpl_table_delete(photsol);
+<a name="l00437"></a>00437 <span class="keywordflow">return</span> NULL;
+<a name="l00438"></a>00438 }
+<a name="l00439"></a>00439 cpl_matrix_delete(xpos);
+<a name="l00440"></a>00440 cpl_vector_delete(ypos);
+<a name="l00441"></a>00441 pows = 0;
+<a name="l00442"></a>00442 zeropoint = cpl_polynomial_get_coeff(phot_coeff, &pows);
+<a name="l00443"></a>00443 pows = 1;
+<a name="l00444"></a>00444 extcoeff = -cpl_polynomial_get_coeff(phot_coeff, &pows);
+<a name="l00445"></a>00445 cpl_polynomial_delete(phot_coeff);
+<a name="l00446"></a>00446
+<a name="l00447"></a>00447 cpl_table_set_double(photsol, HAWKI_COL_PHOT_ZEROPOINT, 0,
+<a name="l00448"></a>00448 zeropoint);
+<a name="l00449"></a>00449 cpl_table_set_double(photsol, HAWKI_COL_PHOT_EXTCOEFF, 0,
+<a name="l00450"></a>00450 extcoeff);
+<a name="l00451"></a>00451
+<a name="l00452"></a>00452 <span class="comment">/* Output results */</span>
+<a name="l00453"></a>00453 cpl_msg_indent_more();
+<a name="l00454"></a>00454 cpl_msg_info(__func__, <span class="stringliteral">"Zero point: %f"</span>, zeropoint);
+<a name="l00455"></a>00455 cpl_msg_info(__func__, <span class="stringliteral">"Extinction coefficient: %f"</span>, extcoeff);
+<a name="l00456"></a>00456 cpl_msg_indent_less();
+<a name="l00457"></a>00457
+<a name="l00458"></a>00458 <span class="keywordflow">return</span> photsol;
+<a name="l00459"></a>00459 }
+<a name="l00460"></a>00460
+<a name="l00461"></a>00461 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00470"></a>00470 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00471"></a>00471 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_extinction_save_photsol
+<a name="l00472"></a>00472 (cpl_table ** photsol_table,
+<a name="l00473"></a>00473 cpl_frameset * zpoint_frames,
+<a name="l00474"></a>00474 cpl_parameterlist * parlist,
+<a name="l00475"></a>00475 cpl_frameset * <span class="keyword">set</span>)
+<a name="l00476"></a>00476 {
+<a name="l00477"></a>00477 cpl_propertylist ** qclists ;
+<a name="l00478"></a>00478 <span class="keyword">const</span> <span class="keywordtype">char</span> * ref_filename;
+<a name="l00479"></a>00479 cpl_propertylist * inputlist ;
+<a name="l00480"></a>00480 <span class="keywordtype">int</span> ext_nb, nframes ;
+<a name="l00481"></a>00481 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_util_extinction"</span> ;
+<a name="l00482"></a>00482 <span class="keywordtype">int</span> idet;
+<a name="l00483"></a>00483 <span class="keywordtype">int</span> iframe;
+<a name="l00484"></a>00484 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00485"></a>00485
+<a name="l00486"></a>00486
+<a name="l00487"></a>00487 <span class="comment">/* Initialise */</span>
+<a name="l00488"></a>00488 nframes = cpl_frameset_get_size(<span class="keyword">set</span>) ;
+<a name="l00489"></a>00489
+<a name="l00490"></a>00490 <span class="comment">/* Get the reference frame */</span>
+<a name="l00491"></a>00491 ref_filename = <a class="code" href="group__hawki__save.html#gab9a3907dcbad413de986ee2e286a6536" title="Locate a filename where the extension <--> chip id relation can be derived.">hawki_get_extref_file</a>(<span class="keyword">set</span>);
+<a name="l00492"></a>00492
+<a name="l00493"></a>00493 <span class="comment">/* Create the QC lists for the extensions */</span>
+<a name="l00494"></a>00494 qclists = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_propertylist*)) ;
+<a name="l00495"></a>00495 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00496"></a>00496 {
+<a name="l00497"></a>00497 <span class="keywordtype">int</span> this_iframe = -1;
+<a name="l00498"></a>00498
+<a name="l00499"></a>00499 qclists[idet] = cpl_propertylist_new() ;
+<a name="l00500"></a>00500 <span class="comment">/* These QC are common to all extensions */</span>
+<a name="l00501"></a>00501
+<a name="l00502"></a>00502
+<a name="l00503"></a>00503 <span class="comment">/* Propagate some keywords from input raw frame extensions */</span>
+<a name="l00504"></a>00504 ext_nb=<a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(ref_filename, idet+1);
+<a name="l00505"></a>00505 inputlist = cpl_propertylist_load_regexp(ref_filename, ext_nb,
+<a name="l00506"></a>00506 HAWKI_HEADER_EXT_FORWARD, 0) ;
+<a name="l00507"></a>00507 cpl_propertylist_append(qclists[idet], inputlist) ;
+<a name="l00508"></a>00508 cpl_propertylist_delete(inputlist) ;
+<a name="l00509"></a>00509
+<a name="l00510"></a>00510 }
+<a name="l00511"></a>00511
+<a name="l00512"></a>00512 <span class="comment">/* Write the photometric table */</span>
+<a name="l00513"></a>00513 <a class="code" href="group__hawki__save.html#ga6c4661fb9fa1fe2e8335f2ebb4deeab9" title="Save a HAWKI_NB_DETECTORS extensions HAWKI table.">hawki_tables_save</a>(<span class="keyword">set</span>,
+<a name="l00514"></a>00514 parlist,
+<a name="l00515"></a>00515 zpoint_frames,
+<a name="l00516"></a>00516 (<span class="keyword">const</span> cpl_table **)photsol_table,
+<a name="l00517"></a>00517 recipe_name,
+<a name="l00518"></a>00518 HAWKI_CALPRO_PHOT_TAB,
+<a name="l00519"></a>00519 HAWKI_PROTYPE_PHOT_TAB,
+<a name="l00520"></a>00520 NULL,
+<a name="l00521"></a>00521 (<span class="keyword">const</span> cpl_propertylist **)qclists,
+<a name="l00522"></a>00522 <span class="stringliteral">"hawki_util_extinction.fits"</span>);
+<a name="l00523"></a>00523
+<a name="l00524"></a>00524 <span class="comment">/* Free */</span>
+<a name="l00525"></a>00525 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+<a name="l00526"></a>00526 cpl_propertylist_delete(qclists[idet]) ;
+<a name="l00527"></a>00527 }
+<a name="l00528"></a>00528 cpl_free(qclists) ;
+<a name="l00529"></a>00529
+<a name="l00530"></a>00530 <span class="comment">/* Free */</span>
+<a name="l00531"></a>00531 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate))
+<a name="l00532"></a>00532 {
+<a name="l00533"></a>00533 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00534"></a>00534 <span class="keywordflow">return</span> -1;
+<a name="l00535"></a>00535 }
+<a name="l00536"></a>00536 <span class="keywordflow">return</span> 0;
+<a name="l00537"></a>00537 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__util__gendist_8c_source.html b/html/hawki__util__gendist_8c_source.html
new file mode 100644
index 0000000..721cf45
--- /dev/null
+++ b/html/hawki__util__gendist_8c_source.html
@@ -0,0 +1,585 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_util_gendist.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_util_gendist.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_util_gendist.c,v 1.22 2011/10/24 10:40:50 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/10/24 10:40:50 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.22 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_distortion.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_save.h"</span>
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00049"></a>00049 <span class="comment"> Functions prototypes</span>
+<a name="l00050"></a>00050 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00051"></a>00051
+<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist_create(cpl_plugin *) ;
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist_exec(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist_destroy(cpl_plugin *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist(cpl_parameterlist *, cpl_frameset *) ;
+<a name="l00056"></a>00056 <span class="keyword">static</span> cpl_table * hawki_util_gendist_convert(<span class="keyword">const</span> <span class="keywordtype">char</span> *) ;
+<a name="l00057"></a>00057 <span class="keyword">static</span> hawki_distortion * hawki_util_gendist_convert_to_images
+<a name="l00058"></a>00058 (<span class="keyword">const</span> cpl_table * dist_tab,
+<a name="l00059"></a>00059 <span class="keywordtype">int</span> detector_nx,
+<a name="l00060"></a>00060 <span class="keywordtype">int</span> detector_ny);
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00063"></a>00063 <span class="comment"> Static variables</span>
+<a name="l00064"></a>00064 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_util_gendist_description[] =
+<a name="l00067"></a>00067 <span class="stringliteral">"hawki_util_gendist -- HAWK-I distortion calibration file creation.\n"</span>
+<a name="l00068"></a>00068 <span class="stringliteral">"The 4 files (chip 1 2 3 4) listed in the Set Of Frames (sof-file) \n"</span>
+<a name="l00069"></a>00069 <span class="stringliteral">"must be tagged:\n"</span>
+<a name="l00070"></a>00070 <span class="stringliteral">"raw-file_chip1.txt "</span>HAWKI_UTIL_DISTMAP_RAW<span class="stringliteral">"\n"</span>
+<a name="l00071"></a>00071 <span class="stringliteral">"raw-file_chip2.txt "</span>HAWKI_UTIL_DISTMAP_RAW<span class="stringliteral">"\n"</span>
+<a name="l00072"></a>00072 <span class="stringliteral">"raw-file_chip3.txt "</span>HAWKI_UTIL_DISTMAP_RAW<span class="stringliteral">"\n"</span>
+<a name="l00073"></a>00073 <span class="stringliteral">"raw-file_chip4.txt "</span>HAWKI_UTIL_DISTMAP_RAW<span class="stringliteral">"\n"</span> ;
+<a name="l00074"></a>00074
+<a name="l00075"></a>00075 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00076"></a>00076 <span class="comment"> Functions code</span>
+<a name="l00077"></a>00077 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00078"></a>00078
+<a name="l00079"></a>00079 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00087"></a>00087 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00088"></a>00088 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00089"></a>00089 {
+<a name="l00090"></a>00090 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00091"></a>00091 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00092"></a>00092
+<a name="l00093"></a>00093 cpl_plugin_init(plugin,
+<a name="l00094"></a>00094 CPL_PLUGIN_API,
+<a name="l00095"></a>00095 HAWKI_BINARY_VERSION,
+<a name="l00096"></a>00096 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00097"></a>00097 <span class="stringliteral">"hawki_util_gendist"</span>,
+<a name="l00098"></a>00098 <span class="stringliteral">"Distortion map creation"</span>,
+<a name="l00099"></a>00099 hawki_util_gendist_description,
+<a name="l00100"></a>00100 <span class="stringliteral">"Yves Jung"</span>,
+<a name="l00101"></a>00101 PACKAGE_BUGREPORT,
+<a name="l00102"></a>00102 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00103"></a>00103 hawki_util_gendist_create,
+<a name="l00104"></a>00104 hawki_util_gendist_exec,
+<a name="l00105"></a>00105 hawki_util_gendist_destroy) ;
+<a name="l00106"></a>00106
+<a name="l00107"></a>00107 cpl_pluginlist_append(list, plugin) ;
+<a name="l00108"></a>00108
+<a name="l00109"></a>00109 <span class="keywordflow">return</span> 0;
+<a name="l00110"></a>00110 }
+<a name="l00111"></a>00111
+<a name="l00112"></a>00112 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00121"></a>00121 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00122"></a>00122 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist_create(cpl_plugin * plugin)
+<a name="l00123"></a>00123 {
+<a name="l00124"></a>00124 cpl_recipe * recipe ;
+<a name="l00125"></a>00125 cpl_parameter * p ;
+<a name="l00126"></a>00126
+<a name="l00127"></a>00127 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00128"></a>00128 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00129"></a>00129 recipe = (cpl_recipe *)plugin ;
+<a name="l00130"></a>00130 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00131"></a>00131
+<a name="l00132"></a>00132 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00133"></a>00133 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00134"></a>00134 <span class="keywordflow">if</span> (recipe->parameters == NULL)
+<a name="l00135"></a>00135 <span class="keywordflow">return</span> 1;
+<a name="l00136"></a>00136
+<a name="l00137"></a>00137 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00138"></a>00138 <span class="comment">/* --dim_x */</span>
+<a name="l00139"></a>00139 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_util_gendist.dim_x"</span>,
+<a name="l00140"></a>00140 CPL_TYPE_INT, <span class="stringliteral">"Dimension of distortion image in X"</span>,
+<a name="l00141"></a>00141 <span class="stringliteral">"hawki.hawki_util_gendist"</span>, HAWKI_DET_NPIX_X);
+<a name="l00142"></a>00142 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"dim_x"</span>);
+<a name="l00143"></a>00143 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00144"></a>00144 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00145"></a>00145
+<a name="l00146"></a>00146 <span class="comment">/* --dim_y */</span>
+<a name="l00147"></a>00147 p = cpl_parameter_new_value(<span class="stringliteral">"hawki.hawki_util_gendist.dim_y"</span>,
+<a name="l00148"></a>00148 CPL_TYPE_INT, <span class="stringliteral">"Dimension of distortion image in Y"</span>,
+<a name="l00149"></a>00149 <span class="stringliteral">"hawki.hawki_util_gendist"</span>, HAWKI_DET_NPIX_Y);
+<a name="l00150"></a>00150 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"dim_y"</span>);
+<a name="l00151"></a>00151 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00152"></a>00152 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00153"></a>00153
+<a name="l00154"></a>00154
+<a name="l00155"></a>00155 <span class="comment">/* Return */</span>
+<a name="l00156"></a>00156 <span class="keywordflow">return</span> 0;
+<a name="l00157"></a>00157 }
+<a name="l00158"></a>00158
+<a name="l00159"></a>00159 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00165"></a>00165 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00166"></a>00166 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist_exec(cpl_plugin * plugin)
+<a name="l00167"></a>00167 {
+<a name="l00168"></a>00168 cpl_recipe * recipe ;
+<a name="l00169"></a>00169
+<a name="l00170"></a>00170 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00171"></a>00171 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00172"></a>00172 recipe = (cpl_recipe *)plugin ;
+<a name="l00173"></a>00173 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00174"></a>00174
+<a name="l00175"></a>00175 <span class="comment">/* Issue a banner */</span>
+<a name="l00176"></a>00176 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00177"></a>00177
+<a name="l00178"></a>00178 <span class="keywordflow">return</span> hawki_util_gendist(recipe->parameters, recipe->frames) ;
+<a name="l00179"></a>00179 }
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00187"></a>00187 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00188"></a>00188 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist_destroy(cpl_plugin * plugin)
+<a name="l00189"></a>00189 {
+<a name="l00190"></a>00190 cpl_recipe * recipe ;
+<a name="l00191"></a>00191
+<a name="l00192"></a>00192 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00193"></a>00193 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00194"></a>00194 recipe = (cpl_recipe *)plugin ;
+<a name="l00195"></a>00195 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00196"></a>00196
+<a name="l00197"></a>00197 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00198"></a>00198 <span class="keywordflow">return</span> 0 ;
+<a name="l00199"></a>00199 }
+<a name="l00200"></a>00200
+<a name="l00201"></a>00201 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00207"></a>00207 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00208"></a>00208 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_gendist
+<a name="l00209"></a>00209 (cpl_parameterlist * parlist,
+<a name="l00210"></a>00210 cpl_frameset * framelist)
+<a name="l00211"></a>00211 {
+<a name="l00212"></a>00212 cpl_frameset * rawframes;
+<a name="l00213"></a>00213 <span class="keyword">const</span> cpl_frame * cur_frame;
+<a name="l00214"></a>00214 <span class="keyword">const</span> <span class="keywordtype">char</span> * dist_name;
+<a name="l00215"></a>00215 cpl_table ** distortion_table;
+<a name="l00216"></a>00216 hawki_distortion ** distortion_im;
+<a name="l00217"></a>00217 cpl_propertylist * plist;
+<a name="l00218"></a>00218 cpl_propertylist * plist_ext;
+<a name="l00219"></a>00219 <span class="keywordtype">char</span> sval[64];
+<a name="l00220"></a>00220 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_util_gendist"</span>;
+<a name="l00221"></a>00221 <span class="keywordtype">int</span> iext;
+<a name="l00222"></a>00222 <span class="keywordtype">int</span> ichip;
+<a name="l00223"></a>00223 cpl_parameter * par;
+<a name="l00224"></a>00224 <span class="keywordtype">int</span> dim_x;
+<a name="l00225"></a>00225 <span class="keywordtype">int</span> dim_y;
+<a name="l00226"></a>00226
+<a name="l00227"></a>00227 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00228"></a>00228 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00229"></a>00229 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00230"></a>00230 <span class="keywordflow">return</span> -1 ;
+<a name="l00231"></a>00231 }
+<a name="l00232"></a>00232
+<a name="l00233"></a>00233 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00234"></a>00234 <span class="keywordflow">if</span> ((rawframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist,
+<a name="l00235"></a>00235 HAWKI_UTIL_DISTMAP_RAW)) == NULL) {
+<a name="l00236"></a>00236 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find raw frames in the input list"</span>) ;
+<a name="l00237"></a>00237 <span class="keywordflow">return</span> -1 ;
+<a name="l00238"></a>00238 }
+<a name="l00239"></a>00239
+<a name="l00240"></a>00240 <span class="comment">/* There should be HAWKI_NB_DETECTORS input frames ordered */</span>
+<a name="l00241"></a>00241 <span class="keywordflow">if</span> (cpl_frameset_get_size(rawframes) != HAWKI_NB_DETECTORS) {
+<a name="l00242"></a>00242 cpl_msg_error(__func__, <span class="stringliteral">"%d frames expected"</span>, HAWKI_NB_DETECTORS) ;
+<a name="l00243"></a>00243 cpl_frameset_delete(rawframes) ;
+<a name="l00244"></a>00244 <span class="keywordflow">return</span> -1 ;
+<a name="l00245"></a>00245 }
+<a name="l00246"></a>00246
+<a name="l00247"></a>00247 <span class="comment">/* Retrieve parameters */</span>
+<a name="l00248"></a>00248 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_util_gendist.dim_x"</span>) ;
+<a name="l00249"></a>00249 dim_x = cpl_parameter_get_int(par);
+<a name="l00250"></a>00250 par = cpl_parameterlist_find(parlist, <span class="stringliteral">"hawki.hawki_util_gendist.dim_y"</span>) ;
+<a name="l00251"></a>00251 dim_y = cpl_parameter_get_int(par);
+<a name="l00252"></a>00252
+<a name="l00253"></a>00253 <span class="comment">/* Allocate holder for the tables */</span>
+<a name="l00254"></a>00254 distortion_table = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(cpl_table*)) ;
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 <span class="comment">/* Loop on the chips */</span>
+<a name="l00257"></a>00257 <span class="keywordflow">for</span> (ichip=0 ; ichip<HAWKI_NB_DETECTORS ; ichip++) {
+<a name="l00258"></a>00258
+<a name="l00259"></a>00259 <span class="comment">/* Get the file name */</span>
+<a name="l00260"></a>00260 cur_frame = cpl_frameset_get_frame_const(rawframes, ichip) ;
+<a name="l00261"></a>00261 dist_name = cpl_frame_get_filename(cur_frame) ;
+<a name="l00262"></a>00262
+<a name="l00263"></a>00263 <span class="comment">/* Create the output table */</span>
+<a name="l00264"></a>00264 cpl_msg_info(__func__, <span class="stringliteral">"Create the output table for chip %d"</span>, ichip+1) ;
+<a name="l00265"></a>00265 <span class="keywordflow">if</span> ((distortion_table[ichip] = hawki_util_gendist_convert(dist_name)) == NULL) {
+<a name="l00266"></a>00266 <span class="keywordtype">int</span> j;
+<a name="l00267"></a>00267 cpl_msg_error(__func__, <span class="stringliteral">"Cannot create the output table"</span>) ;
+<a name="l00268"></a>00268 cpl_frameset_delete(rawframes) ;
+<a name="l00269"></a>00269 <span class="keywordflow">for</span> (j=0 ; j<ichip ; j++) cpl_table_delete(distortion_table[j]) ;
+<a name="l00270"></a>00270 cpl_free(distortion_table) ;
+<a name="l00271"></a>00271 <span class="keywordflow">return</span> -1 ;
+<a name="l00272"></a>00272 }
+<a name="l00273"></a>00273 }
+<a name="l00274"></a>00274
+<a name="l00275"></a>00275 <span class="comment">/* Write the table */</span>
+<a name="l00276"></a>00276 plist = cpl_propertylist_new() ;
+<a name="l00277"></a>00277 cpl_propertylist_append_string(plist, <span class="stringliteral">"INSTRUME"</span>, <span class="stringliteral">"HAWKI"</span>) ;
+<a name="l00278"></a>00278 cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE,
+<a name="l00279"></a>00279 HAWKI_PROTYPE_DISTORTION) ;
+<a name="l00280"></a>00280 cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG,
+<a name="l00281"></a>00281 HAWKI_CALPRO_DISTORTION) ;
+<a name="l00282"></a>00282
+<a name="l00283"></a>00283 plist_ext = cpl_propertylist_new() ;
+<a name="l00284"></a>00284 cpl_propertylist_prepend_string(plist_ext, <span class="stringliteral">"EXTNAME"</span>, <span class="stringliteral">"CHIP1.INT1"</span>) ;
+<a name="l00285"></a>00285 <span class="keywordflow">if</span> (cpl_dfs_save_table(framelist, NULL, parlist, rawframes, NULL,
+<a name="l00286"></a>00286 distortion_table[0], plist_ext, recipe_name,
+<a name="l00287"></a>00287 plist, NULL, PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00288"></a>00288 <span class="stringliteral">"hawki_util_gendist.fits"</span>) != CPL_ERROR_NONE) {
+<a name="l00289"></a>00289 cpl_msg_error(__func__, <span class="stringliteral">"Cannot save the first extension table"</span>) ;
+<a name="l00290"></a>00290 cpl_propertylist_delete(plist_ext) ;
+<a name="l00291"></a>00291 cpl_propertylist_delete(plist) ;
+<a name="l00292"></a>00292 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++)
+<a name="l00293"></a>00293 cpl_table_delete(distortion_table[iext]) ;
+<a name="l00294"></a>00294 cpl_free(distortion_table) ;
+<a name="l00295"></a>00295 cpl_frameset_delete(rawframes) ;
+<a name="l00296"></a>00296 <span class="keywordflow">return</span> -1 ;
+<a name="l00297"></a>00297 }
+<a name="l00298"></a>00298 cpl_propertylist_delete(plist) ;
+<a name="l00299"></a>00299 cpl_propertylist_delete(plist_ext) ;
+<a name="l00300"></a>00300
+<a name="l00301"></a>00301 <span class="comment">/* Save the extensions */</span>
+<a name="l00302"></a>00302 <span class="keywordflow">for</span> (iext=1 ; iext<HAWKI_NB_DETECTORS; iext++)
+<a name="l00303"></a>00303 {
+<a name="l00304"></a>00304 ichip = iext;
+<a name="l00305"></a>00305 <span class="comment">//This is the actual layout of the chips in raw HAWK-I images.</span>
+<a name="l00306"></a>00306 <span class="keywordflow">if</span>(iext == 2)
+<a name="l00307"></a>00307 ichip = 3;
+<a name="l00308"></a>00308 <span class="keywordflow">if</span>(iext == 3)
+<a name="l00309"></a>00309 ichip = 2;
+<a name="l00310"></a>00310 plist_ext = cpl_propertylist_new() ;
+<a name="l00311"></a>00311 sprintf(sval, <span class="stringliteral">"CHIP%d.INT1"</span>, ichip+1) ;
+<a name="l00312"></a>00312 cpl_propertylist_prepend_string(plist_ext, <span class="stringliteral">"EXTNAME"</span>, sval) ;
+<a name="l00313"></a>00313 cpl_table_save(distortion_table[ichip], NULL, plist_ext,
+<a name="l00314"></a>00314 <span class="stringliteral">"hawki_util_gendist.fits"</span>, CPL_IO_EXTEND);
+<a name="l00315"></a>00315 cpl_propertylist_delete(plist_ext) ;
+<a name="l00316"></a>00316 }
+<a name="l00317"></a>00317
+<a name="l00318"></a>00318 <span class="comment">/* Allocate holder for the distortion images */</span>
+<a name="l00319"></a>00319 distortion_im = cpl_malloc(HAWKI_NB_DETECTORS * <span class="keyword">sizeof</span>(hawki_distortion*));
+<a name="l00320"></a>00320
+<a name="l00321"></a>00321 <span class="comment">/* Loop on the chips */</span>
+<a name="l00322"></a>00322 <span class="keywordflow">for</span> (ichip=0 ; ichip<HAWKI_NB_DETECTORS ; ichip++)
+<a name="l00323"></a>00323 {
+<a name="l00324"></a>00324 <span class="comment">/* Get the file name */</span>
+<a name="l00325"></a>00325 cur_frame = cpl_frameset_get_frame_const(rawframes, ichip) ;
+<a name="l00326"></a>00326 dist_name = cpl_frame_get_filename(cur_frame) ;
+<a name="l00327"></a>00327
+<a name="l00328"></a>00328 <span class="comment">/* Create the output image */</span>
+<a name="l00329"></a>00329 cpl_msg_info(__func__, <span class="stringliteral">"Create the output images for extension %d"</span>, ichip+1) ;
+<a name="l00330"></a>00330 <span class="keywordflow">if</span> ((distortion_im[ichip] = hawki_util_gendist_convert_to_images
+<a name="l00331"></a>00331 (distortion_table[ichip], dim_x, dim_y)) == NULL)
+<a name="l00332"></a>00332 {
+<a name="l00333"></a>00333 <span class="keywordtype">int</span> j;
+<a name="l00334"></a>00334 cpl_msg_error(__func__,<span class="stringliteral">"Cannot create the output distortion images"</span>);
+<a name="l00335"></a>00335 cpl_frameset_delete(rawframes);
+<a name="l00336"></a>00336 <span class="keywordflow">for</span> (j=0 ;j < ichip; j++)
+<a name="l00337"></a>00337 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion_im[j]);
+<a name="l00338"></a>00338 cpl_free(distortion_im) ;
+<a name="l00339"></a>00339 <span class="keywordflow">return</span> -1 ;
+<a name="l00340"></a>00340 }
+<a name="l00341"></a>00341 }
+<a name="l00342"></a>00342
+<a name="l00343"></a>00343 <span class="comment">/* Write the distortion images */</span>
+<a name="l00344"></a>00344 plist = cpl_propertylist_new() ;
+<a name="l00345"></a>00345 cpl_propertylist_append_string(plist, <span class="stringliteral">"INSTRUME"</span>, <span class="stringliteral">"HAWKI"</span>);
+<a name="l00346"></a>00346 <span class="comment">//This two keywords are needed by QC. I do not why..</span>
+<a name="l00347"></a>00347 cpl_propertylist_append_string(plist, <span class="stringliteral">"MJD-OBS"</span>, <span class="stringliteral">"55128.5000000"</span>);
+<a name="l00348"></a>00348 cpl_propertylist_append_string(plist, <span class="stringliteral">"FOR_QC"</span>, <span class="stringliteral">"dummy.fits"</span>);
+<a name="l00349"></a>00349 cpl_propertylist_append_string(plist, <span class="stringliteral">"ORIGFILE"</span>,
+<a name="l00350"></a>00350 <span class="stringliteral">"hawki_util_gendist_distx.fits"</span>) ;
+<a name="l00351"></a>00351 <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>(framelist, parlist, rawframes,
+<a name="l00352"></a>00352 <span class="stringliteral">"hawki_util_gendist"</span>,
+<a name="l00353"></a>00353 HAWKI_CALPRO_DISTORTION_X,
+<a name="l00354"></a>00354 HAWKI_PROTYPE_DISTORTION_X,
+<a name="l00355"></a>00355 plist, <span class="stringliteral">"hawki_util_gendist_distx.fits"</span>);
+<a name="l00356"></a>00356 cpl_propertylist_erase(plist, <span class="stringliteral">"ORIGFILE"</span>);
+<a name="l00357"></a>00357 cpl_propertylist_append_string(plist, <span class="stringliteral">"ORIGFILE"</span>,
+<a name="l00358"></a>00358 <span class="stringliteral">"hawki_util_gendist_distx.fits"</span>) ;
+<a name="l00359"></a>00359 <a class="code" href="group__hawki__save.html#gaebd68d7422dd13901e999db3c951bd54" title="Save a main header and prepare it to store additional data units later on.">hawki_main_header_save</a>(framelist, parlist, rawframes,
+<a name="l00360"></a>00360 <span class="stringliteral">"hawki_util_gendist"</span>,
+<a name="l00361"></a>00361 HAWKI_CALPRO_DISTORTION_Y,
+<a name="l00362"></a>00362 HAWKI_PROTYPE_DISTORTION_Y,
+<a name="l00363"></a>00363 plist, <span class="stringliteral">"hawki_util_gendist_disty.fits"</span>);
+<a name="l00364"></a>00364 cpl_propertylist_delete(plist) ;
+<a name="l00365"></a>00365
+<a name="l00366"></a>00366 <span class="comment">/* Save the extensions */</span>
+<a name="l00367"></a>00367 <span class="comment">//There is kind of a hack here</span>
+<a name="l00368"></a>00368 <span class="comment">//We use the distortion table as a reference to save the distortion images</span>
+<a name="l00369"></a>00369 <span class="comment">//to have a proper layout of the detectors in the FITS file.</span>
+<a name="l00370"></a>00370 <span class="comment">//For that hawki_get_extref_file has been modified.</span>
+<a name="l00371"></a>00371 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS; iext++) {
+<a name="l00372"></a>00372 ichip = iext;
+<a name="l00373"></a>00373 <span class="comment">//This is the actual layout of the chips in raw HAWK-I images.</span>
+<a name="l00374"></a>00374 <span class="keywordflow">if</span>(iext == 2)
+<a name="l00375"></a>00375 ichip = 3;
+<a name="l00376"></a>00376 <span class="keywordflow">if</span>(iext == 3)
+<a name="l00377"></a>00377 ichip = 2;
+<a name="l00378"></a>00378 plist_ext = cpl_propertylist_new() ;
+<a name="l00379"></a>00379 cpl_propertylist_append_double(plist_ext, <span class="stringliteral">"CRVAL1"</span>,
+<a name="l00380"></a>00380 distortion_im[ichip]->x_crval);
+<a name="l00381"></a>00381 cpl_propertylist_append_double(plist_ext, <span class="stringliteral">"CRVAL2"</span>,
+<a name="l00382"></a>00382 distortion_im[ichip]->y_crval);
+<a name="l00383"></a>00383 cpl_propertylist_append_double(plist_ext, <span class="stringliteral">"CDELT1"</span>,
+<a name="l00384"></a>00384 distortion_im[ichip]->x_cdelt);
+<a name="l00385"></a>00385 cpl_propertylist_append_double(plist_ext, <span class="stringliteral">"CDELT2"</span>,
+<a name="l00386"></a>00386 distortion_im[ichip]->y_cdelt);
+<a name="l00387"></a>00387 cpl_propertylist_append_double(plist_ext, <span class="stringliteral">"CRPIX1"</span>, 1);
+<a name="l00388"></a>00388 cpl_propertylist_append_double(plist_ext, <span class="stringliteral">"CRPIX2"</span>, 1);
+<a name="l00389"></a>00389 cpl_propertylist_append_string(plist_ext, <span class="stringliteral">"CTYPE1"</span>, <span class="stringliteral">""</span>);
+<a name="l00390"></a>00390 cpl_propertylist_append_string(plist_ext, <span class="stringliteral">"CTYPE2"</span>, <span class="stringliteral">""</span>);
+<a name="l00391"></a>00391 cpl_propertylist_append_string(plist_ext, <span class="stringliteral">"CUNIT1"</span>, <span class="stringliteral">""</span>);
+<a name="l00392"></a>00392 cpl_propertylist_append_string(plist_ext, <span class="stringliteral">"CUNIT2"</span>, <span class="stringliteral">""</span>);
+<a name="l00393"></a>00393 <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>(framelist, distortion_im[ichip]->dist_x, iext + 1,
+<a name="l00394"></a>00394 plist_ext, <span class="stringliteral">"hawki_util_gendist_distx.fits"</span>);
+<a name="l00395"></a>00395 <a class="code" href="group__hawki__save.html#gab2873c1ec09ba834aaa284f003bc6acc" title="Save an image into a given extension.">hawki_image_ext_save</a>(framelist, distortion_im[ichip]->dist_y, iext + 1,
+<a name="l00396"></a>00396 plist_ext, <span class="stringliteral">"hawki_util_gendist_disty.fits"</span>);
+<a name="l00397"></a>00397 cpl_propertylist_delete(plist_ext);
+<a name="l00398"></a>00398 }
+<a name="l00399"></a>00399
+<a name="l00400"></a>00400 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++)
+<a name="l00401"></a>00401 cpl_table_delete(distortion_table[iext]);
+<a name="l00402"></a>00402 cpl_free(distortion_table) ;
+<a name="l00403"></a>00403
+<a name="l00404"></a>00404 <span class="keywordflow">for</span> (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++)
+<a name="l00405"></a>00405 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(distortion_im[iext]);
+<a name="l00406"></a>00406 cpl_free(distortion_im) ;
+<a name="l00407"></a>00407 cpl_frameset_delete(rawframes) ;
+<a name="l00408"></a>00408
+<a name="l00409"></a>00409
+<a name="l00410"></a>00410 <span class="comment">/* Return */</span>
+<a name="l00411"></a>00411 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00412"></a>00412 {
+<a name="l00413"></a>00413 cpl_msg_error(__func__,
+<a name="l00414"></a>00414 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00415"></a>00415 <span class="keywordflow">return</span> -1 ;
+<a name="l00416"></a>00416 }
+<a name="l00417"></a>00417 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00418"></a>00418 }
+<a name="l00419"></a>00419
+<a name="l00420"></a>00420 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00445"></a>00445 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00446"></a>00446 <span class="keyword">static</span> cpl_table * hawki_util_gendist_convert(<span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00447"></a>00447 {
+<a name="l00448"></a>00448 cpl_table * out ;
+<a name="l00449"></a>00449 <span class="keywordtype">int</span> nbentries ;
+<a name="l00450"></a>00450 FILE * in ;
+<a name="l00451"></a>00451 <span class="keywordtype">double</span> dxgc, dygc ;
+<a name="l00452"></a>00452 <span class="keywordtype">int</span> i, j ;
+<a name="l00453"></a>00453 <span class="keywordtype">char</span> line[1024];
+<a name="l00454"></a>00454
+<a name="l00455"></a>00455 <span class="comment">/* Check entries */</span>
+<a name="l00456"></a>00456 <span class="keywordflow">if</span> (filename == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00457"></a>00457
+<a name="l00458"></a>00458 <span class="comment">/* Get the number of lines */</span>
+<a name="l00459"></a>00459 nbentries = 0 ;
+<a name="l00460"></a>00460 <span class="keywordflow">if</span> ((in = fopen(filename, <span class="stringliteral">"r"</span>)) == NULL) {
+<a name="l00461"></a>00461 <span class="keywordflow">return</span> NULL ;
+<a name="l00462"></a>00462 }
+<a name="l00463"></a>00463 <span class="keywordflow">while</span> (fgets(line, 1024, in) != NULL) {
+<a name="l00464"></a>00464 <span class="keywordflow">if</span> (line[0] != <span class="charliteral">'#'</span>) nbentries ++ ;
+<a name="l00465"></a>00465 }
+<a name="l00466"></a>00466 fclose(in) ;
+<a name="l00467"></a>00467
+<a name="l00468"></a>00468 <span class="comment">/* Create the table */</span>
+<a name="l00469"></a>00469 out = cpl_table_new(nbentries);
+<a name="l00470"></a>00470 cpl_table_new_column(out, HAWKI_COL_DIST_DXGC, CPL_TYPE_DOUBLE);
+<a name="l00471"></a>00471 cpl_table_set_column_unit(out, HAWKI_COL_DIST_DXGC, <span class="stringliteral">"pixels"</span>);
+<a name="l00472"></a>00472 cpl_table_new_column(out, HAWKI_COL_DIST_DYGC, CPL_TYPE_DOUBLE);
+<a name="l00473"></a>00473 cpl_table_set_column_unit(out, HAWKI_COL_DIST_DYGC, <span class="stringliteral">"pixels"</span>);
+<a name="l00474"></a>00474 cpl_table_new_column(out, HAWKI_COL_DIST_I, CPL_TYPE_INT);
+<a name="l00475"></a>00475 cpl_table_set_column_unit(out, HAWKI_COL_DIST_I, <span class="stringliteral">"pixels"</span>);
+<a name="l00476"></a>00476 cpl_table_new_column(out, HAWKI_COL_DIST_J, CPL_TYPE_INT);
+<a name="l00477"></a>00477 cpl_table_set_column_unit(out, HAWKI_COL_DIST_J, <span class="stringliteral">"pixels"</span>);
+<a name="l00478"></a>00478
+<a name="l00479"></a>00479 <span class="comment">/* Parse the file */</span>
+<a name="l00480"></a>00480 <span class="keywordflow">if</span> ((in = fopen(filename, <span class="stringliteral">"r"</span>)) == NULL) {
+<a name="l00481"></a>00481 cpl_table_delete(out) ;
+<a name="l00482"></a>00482 <span class="keywordflow">return</span> NULL ;
+<a name="l00483"></a>00483 }
+<a name="l00484"></a>00484 nbentries = 0 ;
+<a name="l00485"></a>00485 <span class="keywordflow">while</span> (fgets(line, 1024, in) != NULL) {
+<a name="l00486"></a>00486 <span class="keywordflow">if</span> (line[0] != <span class="charliteral">'#'</span>) {
+<a name="l00487"></a>00487 <span class="keywordflow">if</span> (sscanf(line, <span class="stringliteral">"%lg %lg %d %d"</span>,
+<a name="l00488"></a>00488 &dxgc, &dygc, &i, &j) != 4) {
+<a name="l00489"></a>00489 cpl_msg_error(__func__, <span class="stringliteral">"Bad line %d"</span>, nbentries+1) ;
+<a name="l00490"></a>00490 cpl_table_delete(out) ;
+<a name="l00491"></a>00491 <span class="keywordflow">return</span> NULL ;
+<a name="l00492"></a>00492 }
+<a name="l00493"></a>00493 cpl_table_set_double(out, HAWKI_COL_DIST_DXGC, nbentries, dxgc);
+<a name="l00494"></a>00494 cpl_table_set_double(out, HAWKI_COL_DIST_DYGC, nbentries, dygc);
+<a name="l00495"></a>00495 cpl_table_set_int(out, HAWKI_COL_DIST_I, nbentries, i);
+<a name="l00496"></a>00496 cpl_table_set_int(out, HAWKI_COL_DIST_J, nbentries, j);
+<a name="l00497"></a>00497 nbentries ++ ;
+<a name="l00498"></a>00498 }
+<a name="l00499"></a>00499 }
+<a name="l00500"></a>00500 fclose(in) ;
+<a name="l00501"></a>00501
+<a name="l00502"></a>00502 <span class="keywordflow">return</span> out ;
+<a name="l00503"></a>00503 }
+<a name="l00504"></a>00504
+<a name="l00505"></a>00505 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00523"></a>00523 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00524"></a>00524 <span class="keyword">static</span> hawki_distortion * hawki_util_gendist_convert_to_images
+<a name="l00525"></a>00525 (<span class="keyword">const</span> cpl_table * dist_tab,
+<a name="l00526"></a>00526 <span class="keywordtype">int</span> detector_nx,
+<a name="l00527"></a>00527 <span class="keywordtype">int</span> detector_ny)
+<a name="l00528"></a>00528 {
+<a name="l00529"></a>00529 hawki_distortion * out ;
+<a name="l00530"></a>00530 <span class="keywordtype">int</span> nbentries ;
+<a name="l00531"></a>00531 <span class="keywordtype">int</span> ngrid;
+<a name="l00532"></a>00532 <span class="keyword">const</span> <span class="keywordtype">int</span> * i_ptr;
+<a name="l00533"></a>00533 <span class="keyword">const</span> <span class="keywordtype">int</span> * j_ptr;
+<a name="l00534"></a>00534 cpl_array * i_vec;
+<a name="l00535"></a>00535 cpl_array * j_vec;
+<a name="l00536"></a>00536 <span class="keywordtype">int</span> irow;
+<a name="l00537"></a>00537
+<a name="l00538"></a>00538
+<a name="l00539"></a>00539 <span class="comment">/* Check entries */</span>
+<a name="l00540"></a>00540 <span class="keywordflow">if</span> (dist_tab == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00541"></a>00541
+<a name="l00542"></a>00542 <span class="comment">/* Create the table */</span>
+<a name="l00543"></a>00543 nbentries = cpl_table_get_nrow(dist_tab);
+<a name="l00544"></a>00544 ngrid = sqrt(nbentries);
+<a name="l00545"></a>00545 <span class="keywordflow">if</span>(ngrid * ngrid != nbentries)
+<a name="l00546"></a>00546 {
+<a name="l00547"></a>00547 cpl_msg_error(__func__,<span class="stringliteral">"Only square grids are supported"</span>);
+<a name="l00548"></a>00548 <span class="keywordflow">return</span> NULL;
+<a name="l00549"></a>00549 }
+<a name="l00550"></a>00550 out = <a class="code" href="group__hawki__distortion.html#gae37defaaf5c0bd86686df3285b89763d" title="Allocate a new distortion solution.">hawki_distortion_grid_new</a>(detector_nx, detector_ny, ngrid);
+<a name="l00551"></a>00551
+<a name="l00552"></a>00552 <span class="comment">/* Get the crval, cdelt */</span>
+<a name="l00553"></a>00553 i_ptr = cpl_table_get_data_int_const(dist_tab, HAWKI_COL_DIST_I);
+<a name="l00554"></a>00554 i_vec = cpl_array_wrap_int((<span class="keywordtype">int</span> *)i_ptr, nbentries);
+<a name="l00555"></a>00555 out->x_crval = cpl_array_get_min(i_vec);
+<a name="l00556"></a>00556 out->x_cdelt = (cpl_array_get_max(i_vec) - cpl_array_get_min(i_vec)) /
+<a name="l00557"></a>00557 (ngrid - 1);
+<a name="l00558"></a>00558 cpl_array_unwrap(i_vec);
+<a name="l00559"></a>00559 j_ptr = cpl_table_get_data_int_const(dist_tab, HAWKI_COL_DIST_J);
+<a name="l00560"></a>00560 j_vec = cpl_array_wrap_int((<span class="keywordtype">int</span> *)j_ptr, nbentries);
+<a name="l00561"></a>00561 out->y_crval = cpl_array_get_min(j_vec);
+<a name="l00562"></a>00562 out->y_cdelt = (cpl_array_get_max(j_vec) - cpl_array_get_min(j_vec)) /
+<a name="l00563"></a>00563 (ngrid - 1);
+<a name="l00564"></a>00564 cpl_array_unwrap(j_vec);
+<a name="l00565"></a>00565
+<a name="l00566"></a>00566
+<a name="l00567"></a>00567 <span class="comment">/* Fill the image */</span>
+<a name="l00568"></a>00568 <span class="keywordflow">for</span>(irow = 0; irow < nbentries; ++irow)
+<a name="l00569"></a>00569 {
+<a name="l00570"></a>00570 <span class="keywordtype">double</span> i_ima;
+<a name="l00571"></a>00571 <span class="keywordtype">double</span> j_ima;
+<a name="l00572"></a>00572 <span class="keywordtype">double</span> dx;
+<a name="l00573"></a>00573 <span class="keywordtype">double</span> dy;
+<a name="l00574"></a>00574 <span class="keywordtype">int</span> null;
+<a name="l00575"></a>00575
+<a name="l00576"></a>00576 i_ima = (cpl_table_get_int(dist_tab, HAWKI_COL_DIST_I, irow, &null) -
+<a name="l00577"></a>00577 out->x_crval) / out->x_cdelt;
+<a name="l00578"></a>00578 <span class="keywordflow">if</span>(floor(i_ima) != i_ima)
+<a name="l00579"></a>00579 {
+<a name="l00580"></a>00580 cpl_msg_error(__func__, <span class="stringliteral">" The distortion tables must be defined "</span>
+<a name="l00581"></a>00581 <span class="stringliteral">"in a regular grid"</span>);
+<a name="l00582"></a>00582 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(out);
+<a name="l00583"></a>00583 <span class="keywordflow">return</span> NULL;
+<a name="l00584"></a>00584 }
+<a name="l00585"></a>00585 j_ima = (cpl_table_get_int(dist_tab, HAWKI_COL_DIST_J, irow, &null) -
+<a name="l00586"></a>00586 out->y_crval) / out->y_cdelt;
+<a name="l00587"></a>00587 <span class="keywordflow">if</span>(floor(j_ima) != j_ima)
+<a name="l00588"></a>00588 {
+<a name="l00589"></a>00589 cpl_msg_error(__func__, <span class="stringliteral">" The distortion tables must be defined "</span>
+<a name="l00590"></a>00590 <span class="stringliteral">"in a regular grid"</span>);
+<a name="l00591"></a>00591 <a class="code" href="group__hawki__distortion.html#ga12a902f30ad5f4a6012b9df508d06712" title="Deallocates a hawki_distortion structure.">hawki_distortion_delete</a>(out);
+<a name="l00592"></a>00592 <span class="keywordflow">return</span> NULL;
+<a name="l00593"></a>00593 }
+<a name="l00594"></a>00594 dx = cpl_table_get_double(dist_tab, HAWKI_COL_DIST_DXGC, irow, &null);
+<a name="l00595"></a>00595 dy = cpl_table_get_double(dist_tab, HAWKI_COL_DIST_DYGC, irow, &null);
+<a name="l00596"></a>00596
+<a name="l00597"></a>00597 cpl_image_set(out->dist_x, (<span class="keywordtype">int</span>)i_ima + 1, (<span class="keywordtype">int</span>)j_ima + 1, dx);
+<a name="l00598"></a>00598 cpl_image_set(out->dist_y, (<span class="keywordtype">int</span>)i_ima + 1, (<span class="keywordtype">int</span>)j_ima + 1, dy);
+<a name="l00599"></a>00599 }
+<a name="l00600"></a>00600
+<a name="l00601"></a>00601 <span class="keywordflow">return</span> out ;
+<a name="l00602"></a>00602 }
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__util__stdstars_8c_source.html b/html/hawki__util__stdstars_8c_source.html
new file mode 100644
index 0000000..15f54a8
--- /dev/null
+++ b/html/hawki__util__stdstars_8c_source.html
@@ -0,0 +1,319 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_util_stdstars.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_dd1f22bf73a30aa083e3126f80060e44.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_util_stdstars.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_util_stdstars.c,v 1.16 2011/07/06 08:21:36 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/07/06 08:21:36 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.16 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include "irplib_utils.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "irplib_stdstar.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_dfs.h"</span>
+<a name="l00046"></a>00046
+<a name="l00047"></a>00047 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00048"></a>00048 <span class="comment"> Functions prototypes</span>
+<a name="l00049"></a>00049 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00050"></a>00050
+<a name="l00051"></a>00051 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars_create(cpl_plugin *) ;
+<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars_exec(cpl_plugin *) ;
+<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars_destroy(cpl_plugin *) ;
+<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars(cpl_frameset *) ;
+<a name="l00055"></a>00055 <span class="keyword">static</span> cpl_table * hawki_util_stdstars_convert(<span class="keyword">const</span> <span class="keywordtype">char</span> *) ;
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00058"></a>00058 <span class="comment"> Static variables</span>
+<a name="l00059"></a>00059 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00060"></a>00060
+<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">char</span> hawki_util_stdstars_description[] =
+<a name="l00062"></a>00062 <span class="stringliteral">"hawki_util_stdstars -- HAWK-I standard stars catalog creation.\n"</span>
+<a name="l00063"></a>00063 <span class="stringliteral">"The files listed in the Set Of Frames (sof-file) must be tagged:\n"</span>
+<a name="l00064"></a>00064 <span class="stringliteral">"raw-file.txt "</span>HAWKI_UTIL_STDSTARS_RAW<span class="stringliteral">"\n"</span> ;
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00067"></a>00067 <span class="comment"> Functions code</span>
+<a name="l00068"></a>00068 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00069"></a>00069
+<a name="l00070"></a>00070 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00078"></a>00078 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00079"></a>00079 <span class="keywordtype">int</span> cpl_plugin_get_info(cpl_pluginlist * list)
+<a name="l00080"></a>00080 {
+<a name="l00081"></a>00081 cpl_recipe * recipe = cpl_calloc(1, <span class="keyword">sizeof</span>(*recipe)) ;
+<a name="l00082"></a>00082 cpl_plugin * plugin = &recipe->interface ;
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 cpl_plugin_init(plugin,
+<a name="l00085"></a>00085 CPL_PLUGIN_API,
+<a name="l00086"></a>00086 HAWKI_BINARY_VERSION,
+<a name="l00087"></a>00087 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00088"></a>00088 <span class="stringliteral">"hawki_util_stdstars"</span>,
+<a name="l00089"></a>00089 <span class="stringliteral">"Standard stars catalog creation"</span>,
+<a name="l00090"></a>00090 hawki_util_stdstars_description,
+<a name="l00091"></a>00091 <span class="stringliteral">"Cesar Enrique Garcia Dabo"</span>,
+<a name="l00092"></a>00092 PACKAGE_BUGREPORT,
+<a name="l00093"></a>00093 <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(),
+<a name="l00094"></a>00094 hawki_util_stdstars_create,
+<a name="l00095"></a>00095 hawki_util_stdstars_exec,
+<a name="l00096"></a>00096 hawki_util_stdstars_destroy) ;
+<a name="l00097"></a>00097
+<a name="l00098"></a>00098 cpl_pluginlist_append(list, plugin) ;
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="keywordflow">return</span> 0;
+<a name="l00101"></a>00101 }
+<a name="l00102"></a>00102
+<a name="l00103"></a>00103 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00112"></a>00112 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00113"></a>00113 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars_create(cpl_plugin * plugin)
+<a name="l00114"></a>00114 {
+<a name="l00115"></a>00115 cpl_recipe * recipe ;
+<a name="l00116"></a>00116
+<a name="l00117"></a>00117 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00118"></a>00118 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00119"></a>00119 recipe = (cpl_recipe *)plugin ;
+<a name="l00120"></a>00120 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00121"></a>00121
+<a name="l00122"></a>00122 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00123"></a>00123 recipe->parameters = cpl_parameterlist_new() ;
+<a name="l00124"></a>00124
+<a name="l00125"></a>00125 <span class="comment">/* Return */</span>
+<a name="l00126"></a>00126 <span class="keywordflow">return</span> 0;
+<a name="l00127"></a>00127 }
+<a name="l00128"></a>00128
+<a name="l00129"></a>00129 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00135"></a>00135 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00136"></a>00136 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars_exec(cpl_plugin * plugin)
+<a name="l00137"></a>00137 {
+<a name="l00138"></a>00138 cpl_recipe * recipe ;
+<a name="l00139"></a>00139
+<a name="l00140"></a>00140 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00141"></a>00141 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00142"></a>00142 recipe = (cpl_recipe *)plugin ;
+<a name="l00143"></a>00143 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00144"></a>00144
+<a name="l00145"></a>00145 <span class="comment">/* Issue a banner */</span>
+<a name="l00146"></a>00146 <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>();
+<a name="l00147"></a>00147
+<a name="l00148"></a>00148 <span class="keywordflow">return</span> hawki_util_stdstars(recipe->frames) ;
+<a name="l00149"></a>00149 }
+<a name="l00150"></a>00150
+<a name="l00151"></a>00151 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00157"></a>00157 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00158"></a>00158 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars_destroy(cpl_plugin * plugin)
+<a name="l00159"></a>00159 {
+<a name="l00160"></a>00160 cpl_recipe * recipe ;
+<a name="l00161"></a>00161
+<a name="l00162"></a>00162 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00163"></a>00163 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00164"></a>00164 recipe = (cpl_recipe *)plugin ;
+<a name="l00165"></a>00165 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 cpl_parameterlist_delete(recipe->parameters) ;
+<a name="l00168"></a>00168 <span class="keywordflow">return</span> 0 ;
+<a name="l00169"></a>00169 }
+<a name="l00170"></a>00170
+<a name="l00171"></a>00171 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00177"></a>00177 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00178"></a>00178 <span class="keyword">static</span> <span class="keywordtype">int</span> hawki_util_stdstars(
+<a name="l00179"></a>00179 cpl_frameset * framelist)
+<a name="l00180"></a>00180 {
+<a name="l00181"></a>00181 cpl_frameset * rawframes ;
+<a name="l00182"></a>00182 <span class="keyword">const</span> <span class="keywordtype">char</span> * recipe_name = <span class="stringliteral">"hawki_util_stdstars"</span> ;
+<a name="l00183"></a>00183
+<a name="l00184"></a>00184
+<a name="l00185"></a>00185 <span class="comment">/* Identify the RAW and CALIB frames in the input frameset */</span>
+<a name="l00186"></a>00186 <span class="keywordflow">if</span> (<a class="code" href="group__hawki__dfs.html#ga6d79b77b5f9d13aa0ceeb461410bb03b" title="Set the group as RAW or CALIB in a frameset.">hawki_dfs_set_groups</a>(framelist)) {
+<a name="l00187"></a>00187 cpl_msg_error(__func__, <span class="stringliteral">"Cannot identify RAW and CALIB frames"</span>) ;
+<a name="l00188"></a>00188 <span class="keywordflow">return</span> -1 ;
+<a name="l00189"></a>00189 }
+<a name="l00190"></a>00190
+<a name="l00191"></a>00191 <span class="comment">/* Retrieve raw frames */</span>
+<a name="l00192"></a>00192 <span class="keywordflow">if</span> ((rawframes = <a class="code" href="group__hawki__load.html#ga080ffcf787c686caacf741989e6e796a" title="Extract the frames with the given tag from a frameset.">hawki_extract_frameset</a>(framelist,
+<a name="l00193"></a>00193 HAWKI_UTIL_STDSTARS_RAW)) == NULL) {
+<a name="l00194"></a>00194 cpl_msg_error(__func__, <span class="stringliteral">"Cannot find raw frames in the input list"</span>) ;
+<a name="l00195"></a>00195 <span class="keywordflow">return</span> -1 ;
+<a name="l00196"></a>00196 }
+<a name="l00197"></a>00197
+<a name="l00198"></a>00198 <span class="comment">/* Write the catalog */</span>
+<a name="l00199"></a>00199 <span class="keywordflow">if</span> (irplib_stdstar_write_catalogs(framelist,
+<a name="l00200"></a>00200 rawframes,
+<a name="l00201"></a>00201 recipe_name,
+<a name="l00202"></a>00202 HAWKI_CALPRO_STDSTARS,
+<a name="l00203"></a>00203 HAWKI_PROTYPE_STDSTARS,
+<a name="l00204"></a>00204 PACKAGE <span class="stringliteral">"/"</span> PACKAGE_VERSION,
+<a name="l00205"></a>00205 <span class="stringliteral">"HAWKI"</span>,
+<a name="l00206"></a>00206 hawki_util_stdstars_convert) == -1) {
+<a name="l00207"></a>00207 cpl_msg_error(__func__, <span class="stringliteral">"Cannot write the catalogs"</span>) ;
+<a name="l00208"></a>00208 cpl_frameset_delete(rawframes) ;
+<a name="l00209"></a>00209 <span class="keywordflow">return</span> -1 ;
+<a name="l00210"></a>00210 }
+<a name="l00211"></a>00211 cpl_frameset_delete(rawframes) ;
+<a name="l00212"></a>00212
+<a name="l00213"></a>00213 <span class="comment">/* Return */</span>
+<a name="l00214"></a>00214 <span class="keywordflow">if</span> (cpl_error_get_code())
+<a name="l00215"></a>00215 {
+<a name="l00216"></a>00216 cpl_msg_error(__func__,
+<a name="l00217"></a>00217 <span class="stringliteral">"HAWK-I pipeline could not recover from previous errors"</span>);
+<a name="l00218"></a>00218 <span class="keywordflow">return</span> -1 ;
+<a name="l00219"></a>00219 }
+<a name="l00220"></a>00220 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0 ;
+<a name="l00221"></a>00221 }
+<a name="l00222"></a>00222
+<a name="l00223"></a>00223 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00244"></a>00244 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00245"></a>00245 <span class="keyword">static</span> cpl_table * hawki_util_stdstars_convert(<span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
+<a name="l00246"></a>00246 {
+<a name="l00247"></a>00247 cpl_table * out ;
+<a name="l00248"></a>00248 <span class="keywordtype">int</span> nfilters ;
+<a name="l00249"></a>00249 <span class="keyword">const</span> <span class="keywordtype">char</span> * filters[4];
+<a name="l00250"></a>00250 <span class="keywordtype">double</span> mags[4] ;
+<a name="l00251"></a>00251 <span class="keywordtype">int</span> nbentries ;
+<a name="l00252"></a>00252 FILE * in ;
+<a name="l00253"></a>00253 <span class="keywordtype">char</span> line[1024];
+<a name="l00254"></a>00254 <span class="keywordtype">double</span> ra, dec ;
+<a name="l00255"></a>00255 <span class="keywordtype">char</span> sname[512];
+<a name="l00256"></a>00256 <span class="keywordtype">char</span> stype[512];
+<a name="l00257"></a>00257 <span class="keywordtype">int</span> i ;
+<a name="l00258"></a>00258
+<a name="l00259"></a>00259 <span class="comment">/* Check entries */</span>
+<a name="l00260"></a>00260 <span class="keywordflow">if</span> (filename == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00261"></a>00261
+<a name="l00262"></a>00262 <span class="comment">/* Initialise */</span>
+<a name="l00263"></a>00263 nfilters = 4 ;
+<a name="l00264"></a>00264 filters[0] = <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_J) ;
+<a name="l00265"></a>00265 filters[1] = <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_H) ;
+<a name="l00266"></a>00266 filters[2] = <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_K) ;
+<a name="l00267"></a>00267 filters[3] = <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(HAWKI_BAND_Y) ;
+<a name="l00268"></a>00268
+<a name="l00269"></a>00269 <span class="comment">/* Get the number of lines */</span>
+<a name="l00270"></a>00270 nbentries = 0 ;
+<a name="l00271"></a>00271 <span class="keywordflow">if</span> ((in = fopen(filename, <span class="stringliteral">"r"</span>)) == NULL) {
+<a name="l00272"></a>00272 <span class="keywordflow">return</span> NULL ;
+<a name="l00273"></a>00273 }
+<a name="l00274"></a>00274 <span class="keywordflow">while</span> (fgets(line, 1024, in) != NULL) {
+<a name="l00275"></a>00275 <span class="keywordflow">if</span> (line[0] != <span class="charliteral">'#'</span>) nbentries ++ ;
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277 fclose(in) ;
+<a name="l00278"></a>00278
+<a name="l00279"></a>00279 <span class="comment">/* Create the table */</span>
+<a name="l00280"></a>00280 out = cpl_table_new(nbentries);
+<a name="l00281"></a>00281 cpl_table_new_column(out, IRPLIB_STDSTAR_STAR_COL, CPL_TYPE_STRING);
+<a name="l00282"></a>00282 cpl_table_new_column(out, IRPLIB_STDSTAR_TYPE_COL, CPL_TYPE_STRING);
+<a name="l00283"></a>00283 cpl_table_new_column(out, IRPLIB_STDSTAR_RA_COL, CPL_TYPE_DOUBLE);
+<a name="l00284"></a>00284 cpl_table_new_column(out, IRPLIB_STDSTAR_DEC_COL, CPL_TYPE_DOUBLE);
+<a name="l00285"></a>00285 <span class="keywordflow">for</span> (i=0 ; i<nfilters ; i++)
+<a name="l00286"></a>00286 cpl_table_new_column(out, filters[i], CPL_TYPE_DOUBLE);
+<a name="l00287"></a>00287
+<a name="l00288"></a>00288 <span class="comment">/* Parse the file */</span>
+<a name="l00289"></a>00289 <span class="keywordflow">if</span> ((in = fopen(filename, <span class="stringliteral">"r"</span>)) == NULL) {
+<a name="l00290"></a>00290 cpl_table_delete(out) ;
+<a name="l00291"></a>00291 <span class="keywordflow">return</span> NULL ;
+<a name="l00292"></a>00292 }
+<a name="l00293"></a>00293 nbentries = 0 ;
+<a name="l00294"></a>00294 <span class="keywordflow">while</span> (fgets(line, 1024, in) != NULL) {
+<a name="l00295"></a>00295 <span class="keywordflow">if</span> (line[0] != <span class="charliteral">'#'</span>) {
+<a name="l00296"></a>00296 <span class="keywordflow">if</span> (sscanf(line, <span class="stringliteral">"%s %lg %lg %s %lg %lg %lg %lg"</span>,
+<a name="l00297"></a>00297 sname, &ra, &dec, stype, &(mags[0]), &(mags[1]),
+<a name="l00298"></a>00298 &(mags[2]), &(mags[3])) != 8) {
+<a name="l00299"></a>00299 cpl_table_delete(out) ;
+<a name="l00300"></a>00300 <span class="keywordflow">return</span> NULL ;
+<a name="l00301"></a>00301 }
+<a name="l00302"></a>00302 cpl_table_set_string(out, IRPLIB_STDSTAR_STAR_COL,nbentries, sname);
+<a name="l00303"></a>00303 cpl_table_set_string(out, IRPLIB_STDSTAR_TYPE_COL,nbentries, stype);
+<a name="l00304"></a>00304 cpl_table_set_double(out, IRPLIB_STDSTAR_RA_COL, nbentries, ra);
+<a name="l00305"></a>00305 cpl_table_set_double(out, IRPLIB_STDSTAR_DEC_COL, nbentries, dec);
+<a name="l00306"></a>00306 <span class="keywordflow">for</span> (i=0 ; i<nfilters ; i++)
+<a name="l00307"></a>00307 cpl_table_set_double(out, filters[i], nbentries, mags[i]);
+<a name="l00308"></a>00308 nbentries ++ ;
+<a name="l00309"></a>00309 }
+<a name="l00310"></a>00310 }
+<a name="l00311"></a>00311 fclose(in) ;
+<a name="l00312"></a>00312
+<a name="l00313"></a>00313 <span class="keywordflow">return</span> out ;
+<a name="l00314"></a>00314 }
+<a name="l00315"></a>00315
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__utils_8c_source.html b/html/hawki__utils_8c_source.html
new file mode 100644
index 0000000..993fe7a
--- /dev/null
+++ b/html/hawki__utils_8c_source.html
@@ -0,0 +1,1130 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_utils.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_utils.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_utils.c,v 1.53 2012/04/26 15:18:04 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2012/04/26 15:18:04 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.53 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "irplib_cat.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "irplib_wcs.h"</span>
+<a name="l00043"></a>00043
+<a name="l00044"></a>00044 <span class="preprocessor">#include "hawki_utils.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "hawki_pfits.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "hawki_load.h"</span>
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00053"></a>00053
+<a name="l00056"></a>00056 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00064"></a>00064 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00065"></a><a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a">00065</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(<span class="keywordtype">void</span>)
+<a name="l00066"></a>00066 {
+<a name="l00067"></a>00067 <span class="keyword">const</span> <span class="keywordtype">char</span> * hawki_license =
+<a name="l00068"></a>00068 <span class="stringliteral">"This file is part of the HAWKI Instrument Pipeline\n"</span>
+<a name="l00069"></a>00069 <span class="stringliteral">"Copyright (C) 2002,2011 European Southern Observatory\n"</span>
+<a name="l00070"></a>00070 <span class="stringliteral">"\n"</span>
+<a name="l00071"></a>00071 <span class="stringliteral">"This program is free software; you can redistribute it and/or modify\n"</span>
+<a name="l00072"></a>00072 <span class="stringliteral">"it under the terms of the GNU General Public License as published by\n"</span>
+<a name="l00073"></a>00073 <span class="stringliteral">"the Free Software Foundation; either version 2 of the License, or\n"</span>
+<a name="l00074"></a>00074 <span class="stringliteral">"(at your option) any later version.\n"</span>
+<a name="l00075"></a>00075 <span class="stringliteral">"\n"</span>
+<a name="l00076"></a>00076 <span class="stringliteral">"This program is distributed in the hope that it will be useful,\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"</span>
+<a name="l00078"></a>00078 <span class="stringliteral">"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"</span>
+<a name="l00079"></a>00079 <span class="stringliteral">"GNU General Public License for more details.\n"</span>
+<a name="l00080"></a>00080 <span class="stringliteral">"\n"</span>
+<a name="l00081"></a>00081 <span class="stringliteral">"You should have received a copy of the GNU General Public License\n"</span>
+<a name="l00082"></a>00082 <span class="stringliteral">"along with this program; if not, write to the Free Software\n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"Foundation, Inc., 59 Temple Place, Suite 330, Boston, \n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"MA 02111-1307 USA"</span> ;
+<a name="l00085"></a>00085 <span class="keywordflow">return</span> hawki_license ;
+<a name="l00086"></a>00086 }
+<a name="l00087"></a>00087
+<a name="l00088"></a>00088 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00092"></a>00092 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00093"></a><a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566">00093</a> <span class="keywordtype">void</span> <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>(<span class="keywordtype">void</span>)
+<a name="l00094"></a>00094 {
+<a name="l00095"></a>00095 cpl_msg_info(__func__, <span class="stringliteral">"*****************************************"</span>);
+<a name="l00096"></a>00096 cpl_msg_info(__func__, <span class="stringliteral">"Welcome to HAWK-I Pipeline release %s"</span>,
+<a name="l00097"></a>00097 <a class="code" href="group__hawki__utils.html#ga4e8a1eeb0faaa8793bdb37b7450c33e3" title="Returns the version of the pipeline.">hawki_get_version</a>());
+<a name="l00098"></a>00098 cpl_msg_info(__func__, <span class="stringliteral">"*****************************************"</span>);
+<a name="l00099"></a>00099 }
+<a name="l00100"></a>00100
+<a name="l00101"></a>00101 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00105"></a>00105 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00106"></a><a class="code" href="group__hawki__utils.html#ga4e8a1eeb0faaa8793bdb37b7450c33e3">00106</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#ga4e8a1eeb0faaa8793bdb37b7450c33e3" title="Returns the version of the pipeline.">hawki_get_version</a>(<span class="keywordtype">void</span>)
+<a name="l00107"></a>00107 {
+<a name="l00108"></a>00108 <span class="keywordflow">return</span> PACKAGE_VERSION;
+<a name="l00109"></a>00109 }
+<a name="l00110"></a>00110
+<a name="l00111"></a>00111 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00118"></a>00118 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00119"></a><a class="code" href="group__hawki__utils.html#ga292d87e3996e9bb4331980a41d8b45bb">00119</a> cpl_image * <a class="code" href="group__hawki__utils.html#ga292d87e3996e9bb4331980a41d8b45bb" title="Compute the bpm from the dark (hot pixels)">hawki_compute_darkbpm</a>(
+<a name="l00120"></a>00120 <span class="keyword">const</span> cpl_image * in,
+<a name="l00121"></a>00121 <span class="keywordtype">double</span> sigma)
+<a name="l00122"></a>00122 {
+<a name="l00123"></a>00123 <span class="keywordtype">double</span> med, stdev, threshold ;
+<a name="l00124"></a>00124 cpl_image * bpm ;
+<a name="l00125"></a>00125 cpl_image * bpm_int ;
+<a name="l00126"></a>00126
+<a name="l00127"></a>00127 <span class="comment">/* Test entries */</span>
+<a name="l00128"></a>00128 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00129"></a>00129 <span class="keywordflow">if</span> (sigma <= 0) <span class="keywordflow">return</span> NULL ;
+<a name="l00130"></a>00130
+<a name="l00131"></a>00131 bpm = cpl_image_duplicate(in);
+<a name="l00132"></a>00132
+<a name="l00133"></a>00133 <span class="comment">/* Compute the threshold */</span>
+<a name="l00134"></a>00134 med = cpl_image_get_median_dev(bpm, &stdev) ;
+<a name="l00135"></a>00135 threshold = med + sigma*stdev ;
+<a name="l00136"></a>00136 cpl_msg_info(__func__, <span class="stringliteral">"Threshold : %g = %g + %g * %g"</span>,
+<a name="l00137"></a>00137 threshold, med, sigma, stdev) ;
+<a name="l00138"></a>00138
+<a name="l00139"></a>00139 <span class="comment">/* Compute the bpm */</span>
+<a name="l00140"></a>00140 cpl_image_threshold(bpm, threshold, threshold, 0.0, 1.0) ;
+<a name="l00141"></a>00141
+<a name="l00142"></a>00142 <span class="comment">/* Convert */</span>
+<a name="l00143"></a>00143 bpm_int = cpl_image_cast(bpm, CPL_TYPE_INT) ;
+<a name="l00144"></a>00144 cpl_image_delete(bpm) ;
+<a name="l00145"></a>00145
+<a name="l00146"></a>00146 <span class="keywordflow">return</span> bpm_int ;
+<a name="l00147"></a>00147 }
+<a name="l00148"></a>00148
+<a name="l00149"></a>00149 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00162"></a>00162 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00163"></a>00163 cpl_image * <a class="code" href="group__hawki__utils.html#ga5d0deca1786f42488784c23e361d0877" title="Compute the bpm from the flat (aka cold pixels mask)">hawki_compute_flatbpm</a>
+<a name="l00164"></a><a class="code" href="group__hawki__utils.html#ga5d0deca1786f42488784c23e361d0877">00164</a> (<span class="keyword">const</span> cpl_image * in,
+<a name="l00165"></a>00165 <span class="keywordtype">double</span> sigma,
+<a name="l00166"></a>00166 <span class="keywordtype">double</span> lowval,
+<a name="l00167"></a>00167 <span class="keywordtype">double</span> highval)
+<a name="l00168"></a>00168 {
+<a name="l00169"></a>00169 cpl_mask * kernel ;
+<a name="l00170"></a>00170 cpl_image * filtered ;
+<a name="l00171"></a>00171 <span class="keywordtype">double</span> med, stdev, threshold ;
+<a name="l00172"></a>00172 cpl_image * bpm_sigma;
+<a name="l00173"></a>00173 cpl_image * bpm_lowhigh;
+<a name="l00174"></a>00174 cpl_image * bpm;
+<a name="l00175"></a>00175 cpl_image * bpm_int ;
+<a name="l00176"></a>00176
+<a name="l00177"></a>00177 <span class="comment">/* Test entries */</span>
+<a name="l00178"></a>00178 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00179"></a>00179 <span class="keywordflow">if</span> (sigma <= 0) <span class="keywordflow">return</span> NULL ;
+<a name="l00180"></a>00180
+<a name="l00181"></a>00181 <span class="comment">/* Filter the input image */</span>
+<a name="l00182"></a>00182 kernel = cpl_mask_new(3, 3) ;
+<a name="l00183"></a>00183 cpl_mask_not(kernel) ;
+<a name="l00184"></a>00184 filtered = cpl_image_new(cpl_image_get_size_x(in), cpl_image_get_size_y(in),
+<a name="l00185"></a>00185 cpl_image_get_type(in));
+<a name="l00186"></a>00186 cpl_image_filter_mask(filtered, in, kernel, CPL_FILTER_MEDIAN,
+<a name="l00187"></a>00187 CPL_BORDER_FILTER);
+<a name="l00188"></a>00188 cpl_mask_delete(kernel) ;
+<a name="l00189"></a>00189
+<a name="l00190"></a>00190 <span class="comment">/* Remove the low freq signal */</span>
+<a name="l00191"></a>00191 bpm_sigma = cpl_image_subtract_create(in, filtered) ;
+<a name="l00192"></a>00192 cpl_image_delete(filtered) ;
+<a name="l00193"></a>00193
+<a name="l00194"></a>00194 <span class="comment">/* Compute the threshold */</span>
+<a name="l00195"></a>00195 med = cpl_image_get_median_dev(bpm_sigma, &stdev) ;
+<a name="l00196"></a>00196 threshold = med + sigma*stdev ;
+<a name="l00197"></a>00197 cpl_msg_info(__func__, <span class="stringliteral">"Threshold : %g = %g + %g * %g"</span>,
+<a name="l00198"></a>00198 threshold, med, sigma, stdev) ;
+<a name="l00199"></a>00199
+<a name="l00200"></a>00200 <span class="comment">/* Compute the bpm with the sigma values */</span>
+<a name="l00201"></a>00201 cpl_image_threshold(bpm_sigma, threshold, threshold, 0.0, 1.0) ;
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 <span class="comment">/* Count the pixels below and above the lowval and highval */</span>
+<a name="l00204"></a>00204 bpm_lowhigh = cpl_image_duplicate(in);
+<a name="l00205"></a>00205 <a class="code" href="group__hawki__utils.html#ga8ad7002b08a8f9dff942f46b3f3456f0" title="Create an image with a given value for pixels within a range and another value for pixels outside tha...">hawki_image_inverse_threshold</a>(bpm_lowhigh, lowval, highval, 0.0, 1.0);
+<a name="l00206"></a>00206
+<a name="l00207"></a>00207 <span class="comment">/* Merge both masks */</span>
+<a name="l00208"></a>00208 bpm = cpl_image_add_create(bpm_sigma, bpm_lowhigh);
+<a name="l00209"></a>00209 cpl_image_threshold(bpm, 0.0, 1.0, 0.0, 1.0);
+<a name="l00210"></a>00210
+<a name="l00211"></a>00211 <span class="comment">/* Convert */</span>
+<a name="l00212"></a>00212 bpm_int = cpl_image_cast(bpm, CPL_TYPE_INT) ;
+<a name="l00213"></a>00213 cpl_image_delete(bpm) ;
+<a name="l00214"></a>00214 cpl_image_delete(bpm_sigma);
+<a name="l00215"></a>00215 cpl_image_delete(bpm_lowhigh);
+<a name="l00216"></a>00216
+<a name="l00217"></a>00217 <span class="keywordflow">return</span> bpm_int ;
+<a name="l00218"></a>00218 }
+<a name="l00219"></a>00219
+<a name="l00220"></a>00220 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00239"></a>00239 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00240"></a>00240 cpl_error_code <a class="code" href="group__hawki__utils.html#ga8ad7002b08a8f9dff942f46b3f3456f0" title="Create an image with a given value for pixels within a range and another value for pixels outside tha...">hawki_image_inverse_threshold</a>
+<a name="l00241"></a><a class="code" href="group__hawki__utils.html#ga8ad7002b08a8f9dff942f46b3f3456f0">00241</a> (cpl_image * image_in,
+<a name="l00242"></a>00242 <span class="keywordtype">double</span> lo_valid,
+<a name="l00243"></a>00243 <span class="keywordtype">double</span> hi_valid,
+<a name="l00244"></a>00244 <span class="keywordtype">double</span> assign_in_range,
+<a name="l00245"></a>00245 <span class="keywordtype">double</span> assign_out_range)
+<a name="l00246"></a>00246 {
+<a name="l00247"></a>00247 <span class="keywordtype">int</span> i;
+<a name="l00248"></a>00248 <span class="keywordtype">int</span> npix;
+<a name="l00249"></a>00249
+<a name="l00250"></a>00250 cpl_ensure_code(image_in != NULL, CPL_ERROR_NULL_INPUT);
+<a name="l00251"></a>00251 cpl_ensure_code(lo_valid <= hi_valid, CPL_ERROR_ILLEGAL_INPUT);
+<a name="l00252"></a>00252
+<a name="l00253"></a>00253 <span class="comment">/* Get number of pixels of image */</span>
+<a name="l00254"></a>00254 npix = cpl_image_get_size_x(image_in) * cpl_image_get_size_y(image_in);
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 <span class="comment">/* Switch on image type */</span>
+<a name="l00257"></a>00257 <span class="keywordflow">switch</span> (cpl_image_get_type(image_in))
+<a name="l00258"></a>00258 {
+<a name="l00259"></a>00259 <span class="keywordflow">case</span> CPL_TYPE_DOUBLE: {
+<a name="l00260"></a>00260 <span class="keywordtype">double</span> * pdi = cpl_image_get_data_double(image_in);
+<a name="l00261"></a>00261 <span class="keywordflow">for</span> (i=0; i<npix; i++) {
+<a name="l00262"></a>00262 <span class="keywordflow">if</span> ((pdi[i]>lo_valid) && (pdi[i]<hi_valid))
+<a name="l00263"></a>00263 pdi[i] = (double)assign_in_range;
+<a name="l00264"></a>00264 <span class="keywordflow">else</span>
+<a name="l00265"></a>00265 pdi[i] = (double)assign_out_range;
+<a name="l00266"></a>00266 }
+<a name="l00267"></a>00267 <span class="keywordflow">break</span>;
+<a name="l00268"></a>00268 }
+<a name="l00269"></a>00269 <span class="keywordflow">case</span> CPL_TYPE_FLOAT: {
+<a name="l00270"></a>00270 <span class="keywordtype">float</span> * pdi = cpl_image_get_data_float(image_in);
+<a name="l00271"></a>00271 <span class="keywordflow">for</span> (i=0; i<npix; i++) {
+<a name="l00272"></a>00272 <span class="keywordflow">if</span> ((pdi[i]>lo_valid) && (pdi[i]<hi_valid))
+<a name="l00273"></a>00273 pdi[i] = (float)assign_in_range;
+<a name="l00274"></a>00274 <span class="keywordflow">else</span>
+<a name="l00275"></a>00275 pdi[i] = (float)assign_out_range;
+<a name="l00276"></a>00276 }
+<a name="l00277"></a>00277 <span class="keywordflow">break</span>;
+<a name="l00278"></a>00278 }
+<a name="l00279"></a>00279 <span class="keywordflow">case</span> CPL_TYPE_INT: {
+<a name="l00280"></a>00280 <span class="keywordtype">int</span> * pdi = cpl_image_get_data_int(image_in);
+<a name="l00281"></a>00281 <span class="keywordflow">for</span> (i=0; i<npix; i++) {
+<a name="l00282"></a>00282 <span class="keywordflow">if</span> (((<span class="keywordtype">double</span>)pdi[i]>lo_valid) && ((<span class="keywordtype">double</span>)pdi[i]<hi_valid))
+<a name="l00283"></a>00283 pdi[i] = (int)assign_in_range;
+<a name="l00284"></a>00284 <span class="keywordflow">else</span>
+<a name="l00285"></a>00285 pdi[i] = (int)assign_out_range;
+<a name="l00286"></a>00286 }
+<a name="l00287"></a>00287 <span class="keywordflow">break</span>;
+<a name="l00288"></a>00288 }
+<a name="l00289"></a>00289 <span class="keywordflow">default</span>:
+<a name="l00290"></a>00290 cpl_ensure_code(0, CPL_ERROR_INVALID_TYPE);
+<a name="l00291"></a>00291 }
+<a name="l00292"></a>00292 <span class="keywordflow">return</span> CPL_ERROR_NONE;
+<a name="l00293"></a>00293 }
+<a name="l00294"></a>00294
+<a name="l00295"></a>00295 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00303"></a>00303 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00304"></a>00304 cpl_image * <a class="code" href="group__hawki__utils.html#ga7f6d3694df0e3a441b20267a1e5894db" title="Apply the stitching.">hawki_images_stitch</a>
+<a name="l00305"></a><a class="code" href="group__hawki__utils.html#ga7f6d3694df0e3a441b20267a1e5894db">00305</a> (cpl_image ** ima,
+<a name="l00306"></a>00306 <span class="keywordtype">double</span> * x,
+<a name="l00307"></a>00307 <span class="keywordtype">double</span> * y)
+<a name="l00308"></a>00308 {
+<a name="l00309"></a>00309 <span class="keywordtype">int</span> lx, ly ;
+<a name="l00310"></a>00310 cpl_image * ima_ext[HAWKI_NB_DETECTORS] ;
+<a name="l00311"></a>00311 cpl_imagelist * in ;
+<a name="l00312"></a>00312 cpl_bivector * offsets ;
+<a name="l00313"></a>00313 <span class="keywordtype">double</span> * offsets_x ;
+<a name="l00314"></a>00314 <span class="keywordtype">double</span> * offsets_y ;
+<a name="l00315"></a>00315 cpl_image ** combined ;
+<a name="l00316"></a>00316 cpl_image * stitched ;
+<a name="l00317"></a>00317 <span class="keywordtype">int</span> i ;
+<a name="l00318"></a>00318
+<a name="l00319"></a>00319 <span class="comment">/* Test entries */</span>
+<a name="l00320"></a>00320 <span class="keywordflow">if</span> (ima == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00321"></a>00321 <span class="keywordflow">if</span> (x == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00322"></a>00322 <span class="keywordflow">if</span> (y == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00323"></a>00323
+<a name="l00324"></a>00324 <span class="comment">/* Take the smallest size */</span>
+<a name="l00325"></a>00325 lx = cpl_image_get_size_x(ima[0]) ;
+<a name="l00326"></a>00326 ly = cpl_image_get_size_y(ima[0]) ;
+<a name="l00327"></a>00327 <span class="keywordflow">for</span> (i=1 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00328"></a>00328 <span class="keywordflow">if</span> (lx > cpl_image_get_size_x(ima[i]))
+<a name="l00329"></a>00329 lx = cpl_image_get_size_x(ima[i]) ;
+<a name="l00330"></a>00330 <span class="keywordflow">if</span> (ly > cpl_image_get_size_y(ima[i]))
+<a name="l00331"></a>00331 ly = cpl_image_get_size_y(ima[i]) ;
+<a name="l00332"></a>00332 }
+<a name="l00333"></a>00333
+<a name="l00334"></a>00334 <span class="comment">/* Create the image list */</span>
+<a name="l00335"></a>00335 in = cpl_imagelist_new() ;
+<a name="l00336"></a>00336 <span class="keywordflow">for</span> (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+<a name="l00337"></a>00337 ima_ext[i] = cpl_image_extract(ima[i], 1, 1, lx, ly) ;
+<a name="l00338"></a>00338 cpl_imagelist_set(in, ima_ext[i], i) ;
+<a name="l00339"></a>00339 }
+<a name="l00340"></a>00340
+<a name="l00341"></a>00341 <span class="comment">/* Create the offsets */</span>
+<a name="l00342"></a>00342 offsets = cpl_bivector_new(HAWKI_NB_DETECTORS) ;
+<a name="l00343"></a>00343 offsets_x = cpl_bivector_get_x_data(offsets) ;
+<a name="l00344"></a>00344 offsets_y = cpl_bivector_get_y_data(offsets) ;
+<a name="l00345"></a>00345 offsets_x[0] = HAWKI_DET1_POSX ;
+<a name="l00346"></a>00346 offsets_y[0] = HAWKI_DET1_POSY ;
+<a name="l00347"></a>00347 offsets_x[1] = x[0] - x[1] + HAWKI_DET2_POSX ;
+<a name="l00348"></a>00348 offsets_y[1] = y[0] - y[1] + HAWKI_DET2_POSY ;
+<a name="l00349"></a>00349 offsets_x[2] = x[0] - x[2] + HAWKI_DET3_POSX ;
+<a name="l00350"></a>00350 offsets_y[2] = y[0] - y[2] + HAWKI_DET3_POSY ;
+<a name="l00351"></a>00351 offsets_x[3] = x[0] - x[3] + HAWKI_DET4_POSX ;
+<a name="l00352"></a>00352 offsets_y[3] = y[0] - y[3] + HAWKI_DET4_POSY ;
+<a name="l00353"></a>00353
+<a name="l00354"></a>00354 <span class="comment">/* Recombine the images */</span>
+<a name="l00355"></a>00355 <span class="keywordflow">if</span> ((combined = cpl_geom_img_offset_saa(in, offsets,
+<a name="l00356"></a>00356 CPL_KERNEL_DEFAULT, 0, 0, CPL_GEOM_UNION, NULL, NULL)) == NULL)
+<a name="l00357"></a>00357 {
+<a name="l00358"></a>00358 cpl_msg_error(__func__, <span class="stringliteral">"Cannot recombine the images"</span>) ;
+<a name="l00359"></a>00359 cpl_bivector_delete(offsets) ;
+<a name="l00360"></a>00360 cpl_imagelist_delete(in) ;
+<a name="l00361"></a>00361 <span class="keywordflow">return</span> NULL ;
+<a name="l00362"></a>00362 }
+<a name="l00363"></a>00363 cpl_bivector_delete(offsets) ;
+<a name="l00364"></a>00364 cpl_imagelist_delete(in) ;
+<a name="l00365"></a>00365
+<a name="l00366"></a>00366 <span class="comment">/* Return */</span>
+<a name="l00367"></a>00367 stitched = combined[0] ;
+<a name="l00368"></a>00368 cpl_image_delete(combined[1]) ;
+<a name="l00369"></a>00369 cpl_free(combined) ;
+<a name="l00370"></a>00370 <span class="keywordflow">return</span> stitched ;
+<a name="l00371"></a>00371 }
+<a name="l00372"></a>00372
+<a name="l00373"></a>00373 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00383"></a>00383 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00384"></a><a class="code" href="group__hawki__utils.html#gaa24cf39f777ab8389419b3d18a8bec96">00384</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#gaa24cf39f777ab8389419b3d18a8bec96" title="Apply the harmonization.">hawki_apply_harmonization</a>(
+<a name="l00385"></a>00385 cpl_imagelist * in,
+<a name="l00386"></a>00386 <span class="keywordtype">double</span> h1,
+<a name="l00387"></a>00387 <span class="keywordtype">double</span> h2,
+<a name="l00388"></a>00388 <span class="keywordtype">double</span> h3,
+<a name="l00389"></a>00389 <span class="keywordtype">double</span> h4)
+<a name="l00390"></a>00390 {
+<a name="l00391"></a>00391 <span class="comment">/* Test entries */</span>
+<a name="l00392"></a>00392 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00393"></a>00393
+<a name="l00394"></a>00394 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 0), h1) ;
+<a name="l00395"></a>00395 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 1), h2) ;
+<a name="l00396"></a>00396 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 2), h3) ;
+<a name="l00397"></a>00397 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 3), h4) ;
+<a name="l00398"></a>00398
+<a name="l00399"></a>00399 <span class="keywordflow">return</span> 0 ;
+<a name="l00400"></a>00400 }
+<a name="l00401"></a>00401
+<a name="l00402"></a>00402 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00421"></a>00421 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00422"></a><a class="code" href="group__hawki__utils.html#ga367515ebe3345fcd79c2849879633ebf">00422</a> <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#ga367515ebe3345fcd79c2849879633ebf" title="Compute the harmonization.">hawki_compute_harmonization</a>(
+<a name="l00423"></a>00423 <span class="keyword">const</span> cpl_imagelist * in,
+<a name="l00424"></a>00424 <span class="keywordtype">double</span> * h1,
+<a name="l00425"></a>00425 <span class="keywordtype">double</span> * h2,
+<a name="l00426"></a>00426 <span class="keywordtype">double</span> * h3,
+<a name="l00427"></a>00427 <span class="keywordtype">double</span> * h4,
+<a name="l00428"></a>00428 <span class="keywordtype">double</span> * h)
+<a name="l00429"></a>00429 {
+<a name="l00430"></a>00430 <span class="keywordtype">int</span> width = 64 ;
+<a name="l00431"></a>00431 <span class="keywordtype">int</span> nx, ny ;
+<a name="l00432"></a>00432 <span class="keyword">const</span> cpl_image * ima ;
+<a name="l00433"></a>00433 <span class="keywordtype">double</span> avg1, avg2, avg3, avg4 ;
+<a name="l00434"></a>00434 <span class="keywordtype">double</span> val1, val2 ;
+<a name="l00435"></a>00435 <span class="keywordtype">int</span> llx, lly, urx, ury ;
+<a name="l00436"></a>00436
+<a name="l00437"></a>00437 <span class="comment">/* Test entries */</span>
+<a name="l00438"></a>00438 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00439"></a>00439 <span class="keywordflow">if</span> (h1==NULL || h2==NULL || h3==NULL || h4==NULL || h==NULL) <span class="keywordflow">return</span> -1 ;
+<a name="l00440"></a>00440
+<a name="l00441"></a>00441 <span class="comment">/* Compute the avg1 */</span>
+<a name="l00442"></a>00442 ima = cpl_imagelist_get_const(in, 0) ;
+<a name="l00443"></a>00443 nx = cpl_image_get_size_x(ima) ;
+<a name="l00444"></a>00444 ny = cpl_image_get_size_y(ima) ;
+<a name="l00445"></a>00445 llx = 1 ; lly = ny - width + 1 ; urx = nx ; ury = ny ;
+<a name="l00446"></a>00446 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00447"></a>00447 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00448"></a>00448 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 1"</span>) ;
+<a name="l00449"></a>00449 <span class="keywordflow">return</span> -1 ;
+<a name="l00450"></a>00450 }
+<a name="l00451"></a>00451 llx = nx - width + 1 ; lly = 1 ; urx = nx ; ury = ny ;
+<a name="l00452"></a>00452 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00453"></a>00453 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00454"></a>00454 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 1"</span>) ;
+<a name="l00455"></a>00455 <span class="keywordflow">return</span> -1 ;
+<a name="l00456"></a>00456 }
+<a name="l00457"></a>00457 avg1 = (val1 + val2) / 2.0 ;
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 <span class="comment">/* Compute the avg2 */</span>
+<a name="l00460"></a>00460 ima = cpl_imagelist_get_const(in, 1) ;
+<a name="l00461"></a>00461 nx = cpl_image_get_size_x(ima) ;
+<a name="l00462"></a>00462 ny = cpl_image_get_size_y(ima) ;
+<a name="l00463"></a>00463 llx = 1 ; lly = 1 ; urx = width ; ury = ny ;
+<a name="l00464"></a>00464 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00465"></a>00465 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00466"></a>00466 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 2"</span>) ;
+<a name="l00467"></a>00467 <span class="keywordflow">return</span> -1 ;
+<a name="l00468"></a>00468 }
+<a name="l00469"></a>00469 llx = 1 ; lly = ny - width + 1 ; urx = nx ; ury = ny ;
+<a name="l00470"></a>00470 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00471"></a>00471 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00472"></a>00472 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 2"</span>) ;
+<a name="l00473"></a>00473 <span class="keywordflow">return</span> -1 ;
+<a name="l00474"></a>00474 }
+<a name="l00475"></a>00475 avg2 = (val1 + val2) / 2.0 ;
+<a name="l00476"></a>00476
+<a name="l00477"></a>00477 <span class="comment">/* Compute the avg3 */</span>
+<a name="l00478"></a>00478 ima = cpl_imagelist_get_const(in, 2) ;
+<a name="l00479"></a>00479 nx = cpl_image_get_size_x(ima) ;
+<a name="l00480"></a>00480 ny = cpl_image_get_size_y(ima) ;
+<a name="l00481"></a>00481 llx = 1 ; lly = 1 ; urx = nx ; ury = width ;
+<a name="l00482"></a>00482 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00483"></a>00483 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00484"></a>00484 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 3"</span>) ;
+<a name="l00485"></a>00485 <span class="keywordflow">return</span> -1 ;
+<a name="l00486"></a>00486 }
+<a name="l00487"></a>00487 llx = nx - width + 1 ; lly = 1 ; urx = nx ; ury = ny ;
+<a name="l00488"></a>00488 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00489"></a>00489 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00490"></a>00490 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 3"</span>) ;
+<a name="l00491"></a>00491 <span class="keywordflow">return</span> -1 ;
+<a name="l00492"></a>00492 }
+<a name="l00493"></a>00493 avg3 = (val1 + val2) / 2.0 ;
+<a name="l00494"></a>00494
+<a name="l00495"></a>00495 <span class="comment">/* Compute the avg4 */</span>
+<a name="l00496"></a>00496 ima = cpl_imagelist_get_const(in, 3) ;
+<a name="l00497"></a>00497 nx = cpl_image_get_size_x(ima) ;
+<a name="l00498"></a>00498 ny = cpl_image_get_size_y(ima) ;
+<a name="l00499"></a>00499 llx = 1 ; lly = 1 ; urx = width ; ury = ny ;
+<a name="l00500"></a>00500 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00501"></a>00501 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00502"></a>00502 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 4"</span>) ;
+<a name="l00503"></a>00503 <span class="keywordflow">return</span> -1 ;
+<a name="l00504"></a>00504 }
+<a name="l00505"></a>00505 llx = 1 ; lly = 1 ; urx = nx ; ury = width ;
+<a name="l00506"></a>00506 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
+<a name="l00507"></a>00507 <span class="keywordflow">if</span> (cpl_error_get_code()) {
+<a name="l00508"></a>00508 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get statistics from chip 4"</span>) ;
+<a name="l00509"></a>00509 <span class="keywordflow">return</span> -1 ;
+<a name="l00510"></a>00510 }
+<a name="l00511"></a>00511 avg4 = (val1 + val2) / 2.0 ;
+<a name="l00512"></a>00512
+<a name="l00513"></a>00513 <span class="comment">/* Compute h */</span>
+<a name="l00514"></a>00514 *h = (avg1 + avg2 + avg3 + avg4) / 4.0 ;
+<a name="l00515"></a>00515
+<a name="l00516"></a>00516 *h1 = *h / avg1 ;
+<a name="l00517"></a>00517 *h2 = *h / avg2 ;
+<a name="l00518"></a>00518 *h3 = *h / avg3 ;
+<a name="l00519"></a>00519 *h4 = *h / avg4 ;
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="keywordflow">return</span> 0 ;
+<a name="l00522"></a>00522 }
+<a name="l00523"></a>00523
+<a name="l00524"></a>00524 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00530"></a>00530 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00531"></a><a class="code" href="group__hawki__utils.html#ga49279015ecc6c4dcc6a00de6ed6109bd">00531</a> cpl_image * <a class="code" href="group__hawki__utils.html#ga49279015ecc6c4dcc6a00de6ed6109bd" title="Compute the large scale background.">hawki_compute_lsbg</a>(<span class="keyword">const</span> cpl_image * in)
+<a name="l00532"></a>00532 {
+<a name="l00533"></a>00533 cpl_image * out ;
+<a name="l00534"></a>00534 cpl_image * tmp ;
+<a name="l00535"></a>00535 cpl_image * filtered ;
+<a name="l00536"></a>00536 cpl_image * subsampled ;
+<a name="l00537"></a>00537 cpl_mask * kernel ;
+<a name="l00538"></a>00538 <span class="keywordtype">int</span> nscales ;
+<a name="l00539"></a>00539 cpl_polynomial * poly ;
+<a name="l00540"></a>00540 cpl_bivector * xy_pos ;
+<a name="l00541"></a>00541 cpl_vector * vals ;
+<a name="l00542"></a>00542 <span class="keywordtype">int</span> quad_sz, nbpoints, lx, ly, nx, ny ;
+<a name="l00543"></a>00543 <span class="keywordtype">double</span> * pxy_pos_x ;
+<a name="l00544"></a>00544 <span class="keywordtype">double</span> * pxy_pos_y ;
+<a name="l00545"></a>00545 <span class="keywordtype">double</span> * pvals ;
+<a name="l00546"></a>00546 <span class="keywordtype">float</span> * pima ;
+<a name="l00547"></a>00547 <span class="keywordtype">int</span> i, j ;
+<a name="l00548"></a>00548
+<a name="l00549"></a>00549 <span class="comment">/* Check entries */</span>
+<a name="l00550"></a>00550 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00551"></a>00551 nx = cpl_image_get_size_x(in) ;
+<a name="l00552"></a>00552 ny = cpl_image_get_size_y(in) ;
+<a name="l00553"></a>00553
+<a name="l00554"></a>00554 <span class="comment">/* Initialise */</span>
+<a name="l00555"></a>00555 nscales = 7 ;
+<a name="l00556"></a>00556 tmp = (cpl_image *)in ;
+<a name="l00557"></a>00557 subsampled = NULL ;
+<a name="l00558"></a>00558
+<a name="l00559"></a>00559 <span class="comment">/* Check entries */</span>
+<a name="l00560"></a>00560 quad_sz = pow(2, (<span class="keywordtype">double</span>)nscales) ;
+<a name="l00561"></a>00561 lx = nx / quad_sz ;
+<a name="l00562"></a>00562 ly = ny / quad_sz ;
+<a name="l00563"></a>00563 nbpoints = lx * ly ;
+<a name="l00564"></a>00564 <span class="keywordflow">if</span> (quad_sz >= nx || quad_sz >= ny) <span class="keywordflow">return</span> NULL ;
+<a name="l00565"></a>00565
+<a name="l00566"></a>00566 <span class="comment">/* Create filter kernel */</span>
+<a name="l00567"></a>00567 kernel = cpl_mask_new(3, 3) ;
+<a name="l00568"></a>00568 cpl_mask_not(kernel) ;
+<a name="l00569"></a>00569
+<a name="l00570"></a>00570 <span class="comment">/* Loop nscales times */</span>
+<a name="l00571"></a>00571 <span class="keywordflow">for</span> (i=0 ; i<nscales ; i++) {
+<a name="l00572"></a>00572
+<a name="l00573"></a>00573 <span class="comment">/* Filter the image */</span>
+<a name="l00574"></a>00574 filtered = cpl_image_new(cpl_image_get_size_x(tmp),
+<a name="l00575"></a>00575 cpl_image_get_size_y(tmp),
+<a name="l00576"></a>00576 cpl_image_get_type(tmp));
+<a name="l00577"></a>00577 cpl_image_filter_mask(filtered, in, kernel, CPL_FILTER_MEDIAN,
+<a name="l00578"></a>00578 CPL_BORDER_FILTER);
+<a name="l00579"></a>00579 <span class="keywordflow">if</span> (i>0) cpl_image_delete(tmp) ;
+<a name="l00580"></a>00580
+<a name="l00581"></a>00581 <span class="comment">/* Subsample the image */</span>
+<a name="l00582"></a>00582 subsampled = cpl_image_extract_subsample(filtered, 2, 2) ;
+<a name="l00583"></a>00583 cpl_image_delete(filtered) ;
+<a name="l00584"></a>00584
+<a name="l00585"></a>00585 tmp = subsampled ;
+<a name="l00586"></a>00586 }
+<a name="l00587"></a>00587 cpl_mask_delete(kernel) ;
+<a name="l00588"></a>00588
+<a name="l00589"></a>00589 <span class="comment">/* Check nbpoints */</span>
+<a name="l00590"></a>00590 <span class="keywordflow">if</span> (nbpoints !=
+<a name="l00591"></a>00591 cpl_image_get_size_x(subsampled)*cpl_image_get_size_y(subsampled)) {
+<a name="l00592"></a>00592 cpl_msg_error(__func__, <span class="stringliteral">"Invalid size"</span>) ;
+<a name="l00593"></a>00593 cpl_image_delete(subsampled) ;
+<a name="l00594"></a>00594 <span class="keywordflow">return</span> NULL ;
+<a name="l00595"></a>00595 }
+<a name="l00596"></a>00596
+<a name="l00597"></a>00597 <span class="comment">/* Create anchor points for the fit */</span>
+<a name="l00598"></a>00598 xy_pos = cpl_bivector_new(nbpoints) ;
+<a name="l00599"></a>00599 vals = cpl_vector_new(nbpoints) ;
+<a name="l00600"></a>00600 pxy_pos_x = cpl_bivector_get_x_data(xy_pos) ;
+<a name="l00601"></a>00601 pxy_pos_y = cpl_bivector_get_y_data(xy_pos) ;
+<a name="l00602"></a>00602 pvals = cpl_vector_get_data(vals) ;
+<a name="l00603"></a>00603 pima = cpl_image_get_data_float(subsampled) ;
+<a name="l00604"></a>00604 <span class="keywordflow">for</span> (j=0 ; j<ly ; j++) {
+<a name="l00605"></a>00605 <span class="keywordflow">for</span> (i=0 ; i<lx ; i++) {
+<a name="l00606"></a>00606 pxy_pos_x[i+j*lx] = i * quad_sz + quad_sz/2 ;
+<a name="l00607"></a>00607 pxy_pos_y[i+j*lx] = j * quad_sz + quad_sz/2 ;
+<a name="l00608"></a>00608 pvals[i+j*lx] = (double)pima[i+j*lx];
+<a name="l00609"></a>00609 }
+<a name="l00610"></a>00610 }
+<a name="l00611"></a>00611 cpl_image_delete(subsampled) ;
+<a name="l00612"></a>00612
+<a name="l00613"></a>00613 <span class="comment">/* Fit the polynomial */</span>
+<a name="l00614"></a>00614 <span class="keywordflow">if</span> ((poly = cpl_polynomial_fit_2d_create(xy_pos, vals, 3, NULL)) == NULL) {
+<a name="l00615"></a>00615 cpl_msg_error(__func__, <span class="stringliteral">"Cannot fit the polynomial"</span>) ;
+<a name="l00616"></a>00616 cpl_bivector_delete(xy_pos) ;
+<a name="l00617"></a>00617 cpl_vector_delete(vals) ;
+<a name="l00618"></a>00618 <span class="keywordflow">return</span> NULL ;
+<a name="l00619"></a>00619 }
+<a name="l00620"></a>00620 cpl_bivector_delete(xy_pos) ;
+<a name="l00621"></a>00621 cpl_vector_delete(vals) ;
+<a name="l00622"></a>00622
+<a name="l00623"></a>00623 <span class="comment">/* Regenerate the big bgd image */</span>
+<a name="l00624"></a>00624 out = cpl_image_duplicate(in) ;
+<a name="l00625"></a>00625 cpl_image_fill_polynomial(out, poly, 1.0, 1.0, 1.0, 1.0) ;
+<a name="l00626"></a>00626 cpl_polynomial_delete(poly) ;
+<a name="l00627"></a>00627
+<a name="l00628"></a>00628 <span class="keywordflow">return</span> out ;
+<a name="l00629"></a>00629 }
+<a name="l00630"></a>00630
+<a name="l00631"></a>00631 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00638"></a>00638 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00639"></a><a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9">00639</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>(
+<a name="l00640"></a>00640 <span class="keyword">const</span> cpl_frameset * in,
+<a name="l00641"></a>00641 <span class="keyword">const</span> <span class="keywordtype">char</span> * tag)
+<a name="l00642"></a>00642 {
+<a name="l00643"></a>00643 <span class="keyword">const</span> cpl_frame * cur_frame ;
+<a name="l00644"></a>00644
+<a name="l00645"></a>00645 <span class="comment">/* Get the frame */</span>
+<a name="l00646"></a>00646 <span class="keywordflow">if</span> ((cur_frame = cpl_frameset_find_const(in, tag)) == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00647"></a>00647 <span class="keywordflow">return</span> cpl_frame_get_filename(cur_frame) ;
+<a name="l00648"></a>00648 }
+<a name="l00649"></a>00649
+<a name="l00650"></a>00650 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00656"></a>00656 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00657"></a><a class="code" href="group__hawki__utils.html#ga6d85879fd8b8895544f7787e8a6ddade">00657</a> hawki_band <a class="code" href="group__hawki__utils.html#ga6d85879fd8b8895544f7787e8a6ddade" title="Get the band.">hawki_get_band</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * f)
+<a name="l00658"></a>00658 {
+<a name="l00659"></a>00659 <span class="keywordflow">if</span> (!strcmp(f, <span class="stringliteral">"J"</span>)) <span class="keywordflow">return</span> HAWKI_BAND_J ;
+<a name="l00660"></a>00660 <span class="keywordflow">if</span> (!strcmp(f, <span class="stringliteral">"H"</span>)) <span class="keywordflow">return</span> HAWKI_BAND_H ;
+<a name="l00661"></a>00661 <span class="keywordflow">if</span> (!strcmp(f, <span class="stringliteral">"K"</span>)) <span class="keywordflow">return</span> HAWKI_BAND_K ;
+<a name="l00662"></a>00662 <span class="keywordflow">if</span> (!strcmp(f, <span class="stringliteral">"Ks"</span>)) <span class="keywordflow">return</span> HAWKI_BAND_K ;
+<a name="l00663"></a>00663 <span class="keywordflow">if</span> (!strcmp(f, <span class="stringliteral">"Y"</span>)) <span class="keywordflow">return</span> HAWKI_BAND_Y ;
+<a name="l00664"></a>00664 <span class="keywordflow">return</span> HAWKI_BAND_UNKNOWN ;
+<a name="l00665"></a>00665 }
+<a name="l00666"></a>00666
+<a name="l00667"></a>00667 <span class="comment">/*-------------------------------------------------------------------------*/</span>
+<a name="l00673"></a>00673 <span class="comment">/*--------------------------------------------------------------------------*/</span>
+<a name="l00674"></a><a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4">00674</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>(hawki_band band)
+<a name="l00675"></a>00675 {
+<a name="l00676"></a>00676 <span class="keywordflow">switch</span> (band) {
+<a name="l00677"></a>00677 <span class="keywordflow">case</span> HAWKI_BAND_J: <span class="keywordflow">return</span> <span class="stringliteral">"J"</span> ;
+<a name="l00678"></a>00678 <span class="keywordflow">case</span> HAWKI_BAND_H: <span class="keywordflow">return</span> <span class="stringliteral">"H"</span> ;
+<a name="l00679"></a>00679 <span class="keywordflow">case</span> HAWKI_BAND_K: <span class="keywordflow">return</span> <span class="stringliteral">"K"</span> ;
+<a name="l00680"></a>00680 <span class="keywordflow">case</span> HAWKI_BAND_Y: <span class="keywordflow">return</span> <span class="stringliteral">"Y"</span> ;
+<a name="l00681"></a>00681 <span class="keywordflow">default</span>: <span class="keywordflow">return</span> <span class="stringliteral">"Unknown"</span> ;
+<a name="l00682"></a>00682 }
+<a name="l00683"></a>00683 }
+<a name="l00684"></a>00684
+<a name="l00685"></a>00685 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00694"></a>00694 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00695"></a><a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd">00695</a> cpl_bivector * <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>(<span class="keyword">const</span> cpl_frameset * fset)
+<a name="l00696"></a>00696 {
+<a name="l00697"></a>00697 cpl_bivector * offsets ;
+<a name="l00698"></a>00698 <span class="keywordtype">double</span> * offsets_x ;
+<a name="l00699"></a>00699 <span class="keywordtype">double</span> * offsets_y ;
+<a name="l00700"></a>00700 <span class="keyword">const</span> cpl_frame * frame ;
+<a name="l00701"></a>00701 cpl_propertylist * plist ;
+<a name="l00702"></a>00702 <span class="keywordtype">int</span> nfiles ;
+<a name="l00703"></a>00703 <span class="keywordtype">int</span> i ;
+<a name="l00704"></a>00704 cpl_errorstate error_prevstate = cpl_errorstate_get();
+<a name="l00705"></a>00705
+<a name="l00706"></a>00706
+<a name="l00707"></a>00707 <span class="comment">/* Test entries */</span>
+<a name="l00708"></a>00708 <span class="keywordflow">if</span> (fset == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00709"></a>00709
+<a name="l00710"></a>00710 <span class="comment">/* Create the offsets bi vector */</span>
+<a name="l00711"></a>00711 nfiles = cpl_frameset_get_size(fset) ;
+<a name="l00712"></a>00712 offsets = cpl_bivector_new(nfiles) ;
+<a name="l00713"></a>00713 offsets_x = cpl_bivector_get_x_data(offsets) ;
+<a name="l00714"></a>00714 offsets_y = cpl_bivector_get_y_data(offsets) ;
+<a name="l00715"></a>00715 <span class="keywordflow">for</span> (i=0 ; i<nfiles ; i++) {
+<a name="l00716"></a>00716
+<a name="l00717"></a>00717 <span class="comment">/* X and Y offsets */</span>
+<a name="l00718"></a>00718 frame = cpl_frameset_get_frame_const(fset, i) ;
+<a name="l00719"></a>00719 plist=cpl_propertylist_load(cpl_frame_get_filename(frame),0);
+<a name="l00720"></a>00720 offsets_x[i] = <a class="code" href="group__hawki__pfits.html#ga8074b7ef4524abfeb10bef68c4cfdf5e" title="find out the cumulative offset in X">hawki_pfits_get_cumoffsetx</a>(plist) ;
+<a name="l00721"></a>00721 offsets_y[i] = <a class="code" href="group__hawki__pfits.html#ga21f640e98b8f695ac6229e9f15d46aca" title="find out the cumulative offset in Y">hawki_pfits_get_cumoffsety</a>(plist) ;
+<a name="l00722"></a>00722 cpl_propertylist_delete(plist) ;
+<a name="l00723"></a>00723 <span class="keywordflow">if</span>(!cpl_errorstate_is_equal(error_prevstate ))
+<a name="l00724"></a>00724 {
+<a name="l00725"></a>00725 cpl_msg_error(__func__, <span class="stringliteral">"Cannot get offsets from header"</span>) ;
+<a name="l00726"></a>00726 cpl_bivector_delete(offsets) ;
+<a name="l00727"></a>00727 <span class="keywordflow">return</span> NULL ;
+<a name="l00728"></a>00728 }
+<a name="l00729"></a>00729 }
+<a name="l00730"></a>00730 <span class="keywordflow">return</span> offsets ;
+<a name="l00731"></a>00731 }
+<a name="l00732"></a>00732
+<a name="l00733"></a>00733 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00739"></a>00739 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00740"></a><a class="code" href="group__hawki__utils.html#ga7b165e9e91b6c6519595109b36d4fb46">00740</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#ga7b165e9e91b6c6519595109b36d4fb46" title="Get the mean airmass for a set of frames.">hawki_get_mean_airmass</a>(cpl_frameset * <span class="keyword">set</span>)
+<a name="l00741"></a>00741 {
+<a name="l00742"></a>00742 <span class="keywordtype">int</span> nframes;
+<a name="l00743"></a>00743 cpl_frame * cur_frame;
+<a name="l00744"></a>00744 cpl_propertylist * plist;
+<a name="l00745"></a>00745 <span class="keywordtype">int</span> iframe;
+<a name="l00746"></a>00746 <span class="keywordtype">double</span> mean_airmass = 0.0;
+<a name="l00747"></a>00747
+<a name="l00748"></a>00748 <span class="comment">/* Test inputs */</span>
+<a name="l00749"></a>00749 <span class="keywordflow">if</span> (<span class="keyword">set</span> == NULL) <span class="keywordflow">return</span> -1;
+<a name="l00750"></a>00750
+<a name="l00751"></a>00751 <span class="comment">/* Initialize */</span>
+<a name="l00752"></a>00752 nframes = cpl_frameset_get_size(<span class="keyword">set</span>);
+<a name="l00753"></a>00753
+<a name="l00754"></a>00754 <span class="keywordflow">for</span> (iframe=0 ; iframe<nframes ; iframe++)
+<a name="l00755"></a>00755 {
+<a name="l00756"></a>00756 cur_frame = cpl_frameset_get_frame(<span class="keyword">set</span>, iframe);
+<a name="l00757"></a>00757 plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0);
+<a name="l00758"></a>00758 mean_airmass += <a class="code" href="group__hawki__pfits.html#ga4e7f03745ede13d9d2db3eddccd857df" title="find out airmass start">hawki_pfits_get_airmass_start</a>(plist) +
+<a name="l00759"></a>00759 <a class="code" href="group__hawki__pfits.html#gafccabad8d0fcc65a0ed27d1dff7ae8e3" title="find out airmass end">hawki_pfits_get_airmass_end</a>(plist);
+<a name="l00760"></a>00760 cpl_propertylist_delete(plist);
+<a name="l00761"></a>00761 }
+<a name="l00762"></a>00762 mean_airmass /= 2. * nframes;
+<a name="l00763"></a>00763
+<a name="l00764"></a>00764 <span class="comment">/* Free and return */</span>
+<a name="l00765"></a>00765 <span class="keywordflow">return</span> mean_airmass;
+<a name="l00766"></a>00766 }
+<a name="l00767"></a>00767
+<a name="l00768"></a>00768 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00780"></a>00780 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00781"></a>00781 <span class="keywordtype">int</span> * <a class="code" href="group__hawki__utils.html#ga024bd2557115d5d7d3265dbcbb3b1884" title="Get the frames in which the star is for a given chip.">hawki_detectors_labelise</a>
+<a name="l00782"></a><a class="code" href="group__hawki__utils.html#ga024bd2557115d5d7d3265dbcbb3b1884">00782</a> (<span class="keyword">const</span> cpl_frameset * in)
+<a name="l00783"></a>00783 {
+<a name="l00784"></a>00784 <span class="keywordtype">int</span> * labels ;
+<a name="l00785"></a>00785 cpl_bivector * offsets ;
+<a name="l00786"></a>00786 <span class="keywordtype">int</span> nframes ;
+<a name="l00787"></a>00787 <span class="keywordtype">double</span> * poff_x ;
+<a name="l00788"></a>00788 <span class="keywordtype">double</span> * poff_y ;
+<a name="l00789"></a>00789 <span class="keywordtype">double</span> off_x_mean;
+<a name="l00790"></a>00790 <span class="keywordtype">double</span> off_y_mean;
+<a name="l00791"></a>00791 <span class="keywordtype">int</span> i ;
+<a name="l00792"></a>00792
+<a name="l00793"></a>00793 <span class="comment">/* Check entries */</span>
+<a name="l00794"></a>00794 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> NULL ;
+<a name="l00795"></a>00795
+<a name="l00796"></a>00796 <span class="comment">/* Initialise */</span>
+<a name="l00797"></a>00797 nframes = cpl_frameset_get_size(in) ;
+<a name="l00798"></a>00798
+<a name="l00799"></a>00799 <span class="comment">/* Get the offsets */</span>
+<a name="l00800"></a>00800 <span class="keywordflow">if</span> ((offsets = <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>((cpl_frameset *)in)) == NULL) {
+<a name="l00801"></a>00801 cpl_msg_error(__func__, <span class="stringliteral">"Cannot read the offsets"</span>) ;
+<a name="l00802"></a>00802 <span class="keywordflow">return</span> NULL ;
+<a name="l00803"></a>00803 }
+<a name="l00804"></a>00804 poff_x = cpl_bivector_get_x_data(offsets) ;
+<a name="l00805"></a>00805 poff_y = cpl_bivector_get_y_data(offsets) ;
+<a name="l00806"></a>00806
+<a name="l00807"></a>00807 <span class="comment">/* Get the mean offsets */</span>
+<a name="l00808"></a>00808 off_x_mean = cpl_vector_get_mean(cpl_bivector_get_x(offsets));
+<a name="l00809"></a>00809 off_y_mean = cpl_vector_get_mean(cpl_bivector_get_y(offsets));
+<a name="l00810"></a>00810
+<a name="l00811"></a>00811 <span class="comment">/* Allocate labels */</span>
+<a name="l00812"></a>00812 labels = cpl_malloc(nframes * <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>)) ;
+<a name="l00813"></a>00813 <span class="keywordflow">for</span> (i=0 ; i<nframes ; i++) {
+<a name="l00814"></a>00814 <span class="keywordflow">if</span> (poff_x[i] - off_x_mean <= 0 && poff_y[i] - off_y_mean <= 0)
+<a name="l00815"></a>00815 labels[i] = 1 ;
+<a name="l00816"></a>00816 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (poff_x[i] - off_x_mean >= 0 && poff_y[i] - off_y_mean <= 0)
+<a name="l00817"></a>00817 labels[i] = 2 ;
+<a name="l00818"></a>00818 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (poff_x[i] - off_x_mean >= 0 && poff_y[i] - off_y_mean >= 0)
+<a name="l00819"></a>00819 labels[i] = 3 ;
+<a name="l00820"></a>00820 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (poff_x[i] - off_x_mean <= 0 && poff_y[i] - off_y_mean >= 0)
+<a name="l00821"></a>00821 labels[i] = 4 ;
+<a name="l00822"></a>00822 <span class="keywordflow">else</span> labels[i] = 0 ;
+<a name="l00823"></a>00823 }
+<a name="l00824"></a>00824 cpl_bivector_delete(offsets) ;
+<a name="l00825"></a>00825 <span class="keywordflow">return</span> labels ;
+<a name="l00826"></a>00826 }
+<a name="l00827"></a>00827
+<a name="l00828"></a>00828 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00835"></a>00835 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00836"></a>00836 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#gabee84f3ed597df9a6ae97f07fc2204a0" title="Get the frames in which the star is for a given chip.">hawki_detectors_locate_star</a>
+<a name="l00837"></a><a class="code" href="group__hawki__utils.html#gabee84f3ed597df9a6ae97f07fc2204a0">00837</a> (<span class="keyword">const</span> cpl_frameset * in,
+<a name="l00838"></a>00838 <span class="keywordtype">double</span> star_ra,
+<a name="l00839"></a>00839 <span class="keywordtype">double</span> star_dec,
+<a name="l00840"></a>00840 <span class="keywordtype">int</span> * labels)
+<a name="l00841"></a>00841 {
+<a name="l00842"></a>00842 <span class="keywordtype">int</span> nframes;
+<a name="l00843"></a>00843 <span class="keywordtype">int</span> idet, iframe;
+<a name="l00844"></a>00844
+<a name="l00845"></a>00845 <span class="comment">/* Check entries */</span>
+<a name="l00846"></a>00846 <span class="keywordflow">if</span> (in == NULL) <span class="keywordflow">return</span> -1;
+<a name="l00847"></a>00847
+<a name="l00848"></a>00848 <span class="comment">/* Initialise */</span>
+<a name="l00849"></a>00849 nframes = cpl_frameset_get_size(in) ;
+<a name="l00850"></a>00850
+<a name="l00851"></a>00851 <span class="comment">/* Allocate labels */</span>
+<a name="l00852"></a>00852 <span class="keywordflow">for</span> (iframe=0 ; iframe<nframes ; iframe++)
+<a name="l00853"></a>00853 {
+<a name="l00854"></a>00854 <span class="keyword">const</span> <span class="keywordtype">char</span> * filename;
+<a name="l00855"></a>00855 filename = cpl_frame_get_filename
+<a name="l00856"></a>00856 (cpl_frameset_get_frame_const(in, iframe));
+<a name="l00857"></a>00857
+<a name="l00858"></a>00858 <span class="keywordflow">for</span> (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+<a name="l00859"></a>00859 {
+<a name="l00860"></a>00860 cpl_propertylist * main_header;
+<a name="l00861"></a>00861 cpl_propertylist * ext_header;
+<a name="l00862"></a>00862 cpl_wcs * wcs;
+<a name="l00863"></a>00863 <span class="keywordtype">double</span> naxis1, naxis2;
+<a name="l00864"></a>00864 <span class="keywordtype">double</span> star_x, star_y;
+<a name="l00865"></a>00865
+<a name="l00866"></a>00866 <span class="comment">/* Get the headers */</span>
+<a name="l00867"></a>00867 main_header = cpl_propertylist_load(filename, 0);
+<a name="l00868"></a>00868 ext_header = cpl_propertylist_load
+<a name="l00869"></a>00869 (filename, <a class="code" href="group__hawki__load.html#gac0cd4814dd4a106963bb5e639132aac1" title="Get the extension corresponding to the wished chip.">hawki_get_ext_from_detector</a>(filename,idet + 1));
+<a name="l00870"></a>00870
+<a name="l00871"></a>00871 <span class="comment">/* Get the position of the star in pixels */</span>
+<a name="l00872"></a>00872 wcs = cpl_wcs_new_from_propertylist(ext_header);
+<a name="l00873"></a>00873 <span class="keywordflow">if</span>(wcs == NULL)
+<a name="l00874"></a>00874 {
+<a name="l00875"></a>00875 cpl_msg_error(__func__, <span class="stringliteral">"Could not get WCS info"</span>);
+<a name="l00876"></a>00876 cpl_propertylist_delete(ext_header);
+<a name="l00877"></a>00877 cpl_propertylist_delete(main_header);
+<a name="l00878"></a>00878 <span class="keywordflow">return</span> -1;
+<a name="l00879"></a>00879 }
+<a name="l00880"></a>00880 <span class="keywordflow">if</span>(irplib_wcs_radectoxy(wcs, star_ra, star_dec, &star_x, &star_y)
+<a name="l00881"></a>00881 != CPL_ERROR_NONE)
+<a name="l00882"></a>00882 {
+<a name="l00883"></a>00883 cpl_errorstate_set(CPL_ERROR_NONE);
+<a name="l00884"></a>00884 }
+<a name="l00885"></a>00885
+<a name="l00886"></a>00886 <span class="comment">/* Check for the limits */</span>
+<a name="l00887"></a>00887 naxis1 = (double)<a class="code" href="group__hawki__pfits.html#ga509576593bbfc282745eae7d29a89102" title="Get the number of pixels in axis 1.">hawki_pfits_get_naxis1</a>(ext_header);
+<a name="l00888"></a>00888 naxis2 = (double)<a class="code" href="group__hawki__pfits.html#gaabcefe7bbad8cb43ad652970057d0356" title="Get the number of pixels in axis 2.">hawki_pfits_get_naxis2</a>(ext_header);
+<a name="l00889"></a>00889 <span class="keywordflow">if</span>(star_x > 0 && star_x < naxis1 && star_y > 0 && star_y < naxis2)
+<a name="l00890"></a>00890 {
+<a name="l00891"></a>00891 labels[iframe] = idet + 1;
+<a name="l00892"></a>00892 }
+<a name="l00893"></a>00893
+<a name="l00894"></a>00894 <span class="comment">/* Free */</span>
+<a name="l00895"></a>00895 cpl_propertylist_delete(ext_header);
+<a name="l00896"></a>00896 cpl_propertylist_delete(main_header);
+<a name="l00897"></a>00897 cpl_wcs_delete(wcs);
+<a name="l00898"></a>00898 }
+<a name="l00899"></a>00899 <span class="keywordflow">if</span>(labels[iframe] == 0)
+<a name="l00900"></a>00900 {
+<a name="l00901"></a>00901 cpl_msg_error(__func__,<span class="stringliteral">"Frame %d does not contain the star in any "</span>
+<a name="l00902"></a>00902 <span class="stringliteral">"detector"</span>, iframe + 1);
+<a name="l00903"></a>00903 }
+<a name="l00904"></a>00904 }
+<a name="l00905"></a>00905 <span class="keywordflow">return</span> 0;
+<a name="l00906"></a>00906 }
+<a name="l00907"></a>00907
+<a name="l00908"></a>00908 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00916"></a>00916 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00917"></a>00917 <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#gaba8fca8aa585fed96efc75545bfc6b04" title="Gets the maximum value of a vector according to an array of flags.">hawki_vector_get_max_select</a>
+<a name="l00918"></a><a class="code" href="group__hawki__utils.html#gaba8fca8aa585fed96efc75545bfc6b04">00918</a> (<span class="keyword">const</span> cpl_vector * <span class="keyword">self</span>, <span class="keyword">const</span> cpl_vector * valid)
+<a name="l00919"></a>00919 {
+<a name="l00920"></a>00920 <span class="keywordtype">double</span> max_val = DBL_MIN;
+<a name="l00921"></a>00921 <span class="keywordtype">int</span> initialized = 0;
+<a name="l00922"></a>00922 <span class="keywordtype">int</span> ival;
+<a name="l00923"></a>00923 <span class="keywordtype">int</span> nvals;
+<a name="l00924"></a>00924
+<a name="l00925"></a>00925 nvals = cpl_vector_get_size(<span class="keyword">self</span>);
+<a name="l00926"></a>00926 <span class="keywordflow">for</span>(ival = 0; ival < nvals; ++ival)
+<a name="l00927"></a>00927 {
+<a name="l00928"></a>00928 <span class="keywordflow">if</span>(cpl_vector_get(valid, ival) >= -0.5)
+<a name="l00929"></a>00929 {
+<a name="l00930"></a>00930 <span class="keywordflow">if</span>(!initialized)
+<a name="l00931"></a>00931 {
+<a name="l00932"></a>00932 max_val = cpl_vector_get(<span class="keyword">self</span>, ival);
+<a name="l00933"></a>00933 initialized = 1;
+<a name="l00934"></a>00934 }
+<a name="l00935"></a>00935 <span class="keywordflow">if</span>(cpl_vector_get(<span class="keyword">self</span>, ival) > max_val)
+<a name="l00936"></a>00936 max_val = cpl_vector_get(<span class="keyword">self</span>, ival);
+<a name="l00937"></a>00937 }
+<a name="l00938"></a>00938 }
+<a name="l00939"></a>00939 <span class="keywordflow">return</span> max_val;
+<a name="l00940"></a>00940 }
+<a name="l00941"></a>00941
+<a name="l00942"></a>00942 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00950"></a>00950 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00951"></a>00951 <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#ga29ae7b4052fd284d8b01f33e127c2846" title="Gets the minimum value of a vector according to an array of flags.">hawki_vector_get_min_select</a>
+<a name="l00952"></a><a class="code" href="group__hawki__utils.html#ga29ae7b4052fd284d8b01f33e127c2846">00952</a> (<span class="keyword">const</span> cpl_vector * <span class="keyword">self</span>, <span class="keyword">const</span> cpl_vector * valid)
+<a name="l00953"></a>00953 {
+<a name="l00954"></a>00954 <span class="keywordtype">double</span> min_val = DBL_MAX;
+<a name="l00955"></a>00955 <span class="keywordtype">int</span> initialized = 0;
+<a name="l00956"></a>00956 <span class="keywordtype">int</span> ival;
+<a name="l00957"></a>00957 <span class="keywordtype">int</span> nvals;
+<a name="l00958"></a>00958
+<a name="l00959"></a>00959 nvals = cpl_vector_get_size(<span class="keyword">self</span>);
+<a name="l00960"></a>00960 <span class="keywordflow">for</span>(ival = 0; ival < nvals; ++ival)
+<a name="l00961"></a>00961 {
+<a name="l00962"></a>00962 <span class="keywordflow">if</span>(cpl_vector_get(valid, ival) >= -0.5)
+<a name="l00963"></a>00963 {
+<a name="l00964"></a>00964 <span class="keywordflow">if</span>(!initialized)
+<a name="l00965"></a>00965 {
+<a name="l00966"></a>00966 min_val = cpl_vector_get(<span class="keyword">self</span>, ival);
+<a name="l00967"></a>00967 initialized = 1;
+<a name="l00968"></a>00968 }
+<a name="l00969"></a>00969 <span class="keywordflow">if</span>(cpl_vector_get(<span class="keyword">self</span>, ival) < min_val)
+<a name="l00970"></a>00970 min_val = cpl_vector_get(<span class="keyword">self</span>, ival);
+<a name="l00971"></a>00971 }
+<a name="l00972"></a>00972 }
+<a name="l00973"></a>00973 <span class="keywordflow">return</span> min_val;
+<a name="l00974"></a>00974 }
+<a name="l00975"></a>00975
+<a name="l00976"></a>00976 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00982"></a>00982 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00983"></a><a class="code" href="group__hawki__utils.html#gac64c154f22c4d25e242833fbe75da886">00983</a> <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#gac64c154f22c4d25e242833fbe75da886" title="Compute the histogram mode.">hawki_vector_get_mode</a>(cpl_vector * vec)
+<a name="l00984"></a>00984 {
+<a name="l00985"></a>00985 <span class="keywordtype">int</span> nb ;
+<a name="l00986"></a>00986 <span class="keywordtype">int</span> nbins ;
+<a name="l00987"></a>00987 <span class="keywordtype">double</span> min, max ;
+<a name="l00988"></a>00988 <span class="keywordtype">double</span> bin_size ;
+<a name="l00989"></a>00989 cpl_bivector * hist ;
+<a name="l00990"></a>00990 cpl_vector * hist_x ;
+<a name="l00991"></a>00991 cpl_vector * hist_y ;
+<a name="l00992"></a>00992 <span class="keywordtype">double</span> cur_val ;
+<a name="l00993"></a>00993 <span class="keywordtype">int</span> cur_bin ;
+<a name="l00994"></a>00994 <span class="keywordtype">double</span> max_val ;
+<a name="l00995"></a>00995 <span class="keywordtype">int</span> max_bin ;
+<a name="l00996"></a>00996 <span class="keywordtype">double</span> mode ;
+<a name="l00997"></a>00997 <span class="keywordtype">int</span> i ;
+<a name="l00998"></a>00998
+<a name="l00999"></a>00999 <span class="comment">/* Test entries */</span>
+<a name="l01000"></a>01000 <span class="keywordflow">if</span> (vec == NULL) <span class="keywordflow">return</span> -1.0 ;
+<a name="l01001"></a>01001
+<a name="l01002"></a>01002 <span class="comment">/* Initialise */</span>
+<a name="l01003"></a>01003 nb = cpl_vector_get_size(vec) ;
+<a name="l01004"></a>01004
+<a name="l01005"></a>01005 <span class="comment">/* Create the histogram */</span>
+<a name="l01006"></a>01006 nbins = 10 ;
+<a name="l01007"></a>01007 min = cpl_vector_get_min(vec) ;
+<a name="l01008"></a>01008 max = cpl_vector_get_max(vec) ;
+<a name="l01009"></a>01009 bin_size = (max-min)/nbins ;
+<a name="l01010"></a>01010 hist = cpl_bivector_new(nbins) ;
+<a name="l01011"></a>01011 hist_x = cpl_bivector_get_x(hist) ;
+<a name="l01012"></a>01012 hist_y = cpl_bivector_get_y(hist) ;
+<a name="l01013"></a>01013 cpl_vector_fill(hist_x, 0.0) ;
+<a name="l01014"></a>01014 cpl_vector_fill(hist_y, 0.0) ;
+<a name="l01015"></a>01015 <span class="keywordflow">for</span> (i=0 ; i<nbins ; i++) {
+<a name="l01016"></a>01016 cpl_vector_set(hist_x, i, min + i * bin_size) ;
+<a name="l01017"></a>01017 }
+<a name="l01018"></a>01018 <span class="keywordflow">for</span> (i=0 ; i<nb ; i++) {
+<a name="l01019"></a>01019 cur_val = cpl_vector_get(vec, i) ;
+<a name="l01020"></a>01020 cur_bin = (int)((cur_val - min) / bin_size) ;
+<a name="l01021"></a>01021 <span class="keywordflow">if</span> (cur_bin >= nbins) cur_bin -= 1.0 ;
+<a name="l01022"></a>01022 cur_val = cpl_vector_get(hist_y, cur_bin) ;
+<a name="l01023"></a>01023 cur_val += 1.0 ;
+<a name="l01024"></a>01024 cpl_vector_set(hist_y, cur_bin, cur_val) ;
+<a name="l01025"></a>01025 }
+<a name="l01026"></a>01026
+<a name="l01027"></a>01027 <span class="comment">/* Get the mode of the histogram */</span>
+<a name="l01028"></a>01028 max_val = cpl_vector_get(hist_y, 0) ;
+<a name="l01029"></a>01029 max_bin = 0 ;
+<a name="l01030"></a>01030 <span class="keywordflow">for</span> (i=0 ; i<nbins ; i++) {
+<a name="l01031"></a>01031 cur_val = cpl_vector_get(hist_y, i) ;
+<a name="l01032"></a>01032 <span class="keywordflow">if</span> (cur_val > max_val) {
+<a name="l01033"></a>01033 max_val = cur_val ;
+<a name="l01034"></a>01034 max_bin = i ;
+<a name="l01035"></a>01035 }
+<a name="l01036"></a>01036 }
+<a name="l01037"></a>01037 mode = cpl_vector_get(hist_x, max_bin) ;
+<a name="l01038"></a>01038 cpl_bivector_delete(hist) ;
+<a name="l01039"></a>01039 <span class="keywordflow">return</span> mode ;
+<a name="l01040"></a>01040 }
+<a name="l01041"></a>01041
+<a name="l01042"></a>01042 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01050"></a>01050 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01051"></a>01051 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#ga4c041169d43f161a8c9d7f23d7fc57a7" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_double_keys</a>
+<a name="l01052"></a><a class="code" href="group__hawki__utils.html#ga4c041169d43f161a8c9d7f23d7fc57a7">01052</a> (cpl_frameset * frames, <span class="keywordtype">double</span> (*func)(<span class="keyword">const</span> cpl_propertylist *))
+<a name="l01053"></a>01053 {
+<a name="l01054"></a>01054 <span class="keywordtype">int</span> iframe;
+<a name="l01055"></a>01055 <span class="keywordtype">double</span> value = 0;
+<a name="l01056"></a>01056
+<a name="l01057"></a>01057 <span class="keywordflow">if</span>(cpl_frameset_get_size(frames) < 2)
+<a name="l01058"></a>01058 <span class="keywordflow">return</span> 1;
+<a name="l01059"></a>01059
+<a name="l01060"></a>01060 <span class="keywordflow">for</span>(iframe = 0; iframe < cpl_frameset_get_size(frames); ++iframe)
+<a name="l01061"></a>01061 {
+<a name="l01062"></a>01062 cpl_propertylist * header;
+<a name="l01063"></a>01063 header = cpl_propertylist_load(
+<a name="l01064"></a>01064 cpl_frame_get_filename(
+<a name="l01065"></a>01065 cpl_frameset_get_frame_const(frames, iframe)),0);
+<a name="l01066"></a>01066 <span class="keywordflow">if</span>(iframe == 0)
+<a name="l01067"></a>01067 value = (func)(header);
+<a name="l01068"></a>01068 <span class="keywordflow">else</span>
+<a name="l01069"></a>01069 <span class="keywordflow">if</span>(value != (func)(header))
+<a name="l01070"></a>01070 {
+<a name="l01071"></a>01071 cpl_propertylist_delete(header);
+<a name="l01072"></a>01072 <span class="keywordflow">return</span> 0;
+<a name="l01073"></a>01073 }
+<a name="l01074"></a>01074 cpl_propertylist_delete(header);
+<a name="l01075"></a>01075 }
+<a name="l01076"></a>01076 <span class="keywordflow">return</span> 1;
+<a name="l01077"></a>01077 }
+<a name="l01078"></a>01078
+<a name="l01079"></a>01079 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01087"></a>01087 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01088"></a>01088 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_int_keys</a>
+<a name="l01089"></a><a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663">01089</a> (cpl_frameset * frames, <span class="keywordtype">int</span> (*func)(<span class="keyword">const</span> cpl_propertylist *))
+<a name="l01090"></a>01090 {
+<a name="l01091"></a>01091 <span class="keywordtype">int</span> iframe;
+<a name="l01092"></a>01092 <span class="keywordtype">int</span> value = 0;
+<a name="l01093"></a>01093
+<a name="l01094"></a>01094 <span class="keywordflow">if</span>(cpl_frameset_get_size(frames) < 2)
+<a name="l01095"></a>01095 <span class="keywordflow">return</span> 1;
+<a name="l01096"></a>01096
+<a name="l01097"></a>01097 <span class="keywordflow">for</span>(iframe = 0; iframe < cpl_frameset_get_size(frames); ++iframe)
+<a name="l01098"></a>01098 {
+<a name="l01099"></a>01099 cpl_propertylist * header;
+<a name="l01100"></a>01100 header = cpl_propertylist_load(
+<a name="l01101"></a>01101 cpl_frame_get_filename(
+<a name="l01102"></a>01102 cpl_frameset_get_frame_const(frames, iframe)),0);
+<a name="l01103"></a>01103 <span class="keywordflow">if</span>(iframe == 0)
+<a name="l01104"></a>01104 value = (func)(header);
+<a name="l01105"></a>01105 <span class="keywordflow">else</span>
+<a name="l01106"></a>01106 <span class="keywordflow">if</span>(value != (func)(header))
+<a name="l01107"></a>01107 {
+<a name="l01108"></a>01108 cpl_propertylist_delete(header);
+<a name="l01109"></a>01109 <span class="keywordflow">return</span> 0;
+<a name="l01110"></a>01110 }
+<a name="l01111"></a>01111 cpl_propertylist_delete(header);
+<a name="l01112"></a>01112 }
+<a name="l01113"></a>01113 <span class="keywordflow">return</span> 1;
+<a name="l01114"></a>01114 }
+<a name="l01115"></a>01115
+<a name="l01116"></a>01116 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01126"></a>01126 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01127"></a><a class="code" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3">01127</a> <span class="keywordtype">void</span> <a class="code" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3" title="This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)">hawki_utils_ra2str</a>(<span class="keywordtype">char</ [...]
+<a name="l01128"></a>01128 {
+<a name="l01129"></a>01129 <span class="keywordtype">double</span> a,b;
+<a name="l01130"></a>01130 <span class="keywordtype">double</span> seconds;
+<a name="l01131"></a>01131 <span class="keywordtype">char</span> tstring[64];
+<a name="l01132"></a>01132 <span class="keywordtype">int</span> hours;
+<a name="l01133"></a>01133 <span class="keywordtype">int</span> minutes;
+<a name="l01134"></a>01134 <span class="keywordtype">int</span> ltstr;
+<a name="l01135"></a>01135 <span class="keywordtype">double</span> dsgn;
+<a name="l01136"></a>01136
+<a name="l01137"></a>01137 <span class="comment">/* Keep RA between 0 and 360 */</span>
+<a name="l01138"></a>01138 <span class="keywordflow">if</span> (ra < 0.0 )
+<a name="l01139"></a>01139 {
+<a name="l01140"></a>01140 ra = -ra;
+<a name="l01141"></a>01141 dsgn = -1.0;
+<a name="l01142"></a>01142 }
+<a name="l01143"></a>01143 <span class="keywordflow">else</span>
+<a name="l01144"></a>01144 dsgn = 1.0;
+<a name="l01145"></a>01145 ra = fmod(ra, 360.0);
+<a name="l01146"></a>01146 ra *= dsgn;
+<a name="l01147"></a>01147 <span class="keywordflow">if</span> (ra < 0.0)
+<a name="l01148"></a>01148 ra = ra + 360.0;
+<a name="l01149"></a>01149
+<a name="l01150"></a>01150 a = ra / 15.0;
+<a name="l01151"></a>01151
+<a name="l01152"></a>01152 <span class="comment">/* Convert to hours */</span>
+<a name="l01153"></a>01153 hours = (int) a;
+<a name="l01154"></a>01154
+<a name="l01155"></a>01155 <span class="comment">/* Compute minutes */</span>
+<a name="l01156"></a>01156 b = (a - (double)hours) * 60.0;
+<a name="l01157"></a>01157 minutes = (int) b;
+<a name="l01158"></a>01158
+<a name="l01159"></a>01159 <span class="comment">/* Compute seconds */</span>
+<a name="l01160"></a>01160 seconds = (b - (double)minutes) * 60.0;
+<a name="l01161"></a>01161
+<a name="l01162"></a>01162 <span class="keywordflow">if</span> (seconds > 59.99)
+<a name="l01163"></a>01163 {
+<a name="l01164"></a>01164 seconds = 0.0;
+<a name="l01165"></a>01165 minutes = minutes + 1;
+<a name="l01166"></a>01166 }
+<a name="l01167"></a>01167 <span class="keywordflow">if</span> (minutes > 59)
+<a name="l01168"></a>01168 {
+<a name="l01169"></a>01169 minutes = 0;
+<a name="l01170"></a>01170 hours = hours + 1;
+<a name="l01171"></a>01171 }
+<a name="l01172"></a>01172 hours = hours % 24;
+<a name="l01173"></a>01173 (void) sprintf (tstring,<span class="stringliteral">"%02d:%02d:%05.2f"</span>,hours,minutes,seconds);
+<a name="l01174"></a>01174
+<a name="l01175"></a>01175 <span class="comment">/* Move formatted string to returned string */</span>
+<a name="l01176"></a>01176 ltstr = (int) strlen (tstring);
+<a name="l01177"></a>01177 <span class="keywordflow">if</span> (ltstr < length_str-1)
+<a name="l01178"></a>01178 strcpy (str, tstring);
+<a name="l01179"></a>01179 <span class="keywordflow">else</span>
+<a name="l01180"></a>01180 {
+<a name="l01181"></a>01181 strncpy (str, tstring, length_str-1);
+<a name="l01182"></a>01182 str[length_str-1] = 0;
+<a name="l01183"></a>01183 }
+<a name="l01184"></a>01184 <span class="keywordflow">return</span>;
+<a name="l01185"></a>01185 }
+<a name="l01186"></a>01186
+<a name="l01187"></a>01187 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01197"></a>01197 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l01198"></a><a class="code" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6">01198</a> <span class="keywordtype">void</span> <a class="code" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6" title="This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2...">hawki_utils_dec2str</a>(<span class="keywordtype">char</span> * str, <span class="keywordtype">int</span> length_str, <span class="keywordtype"> [...]
+<a name="l01199"></a>01199 {
+<a name="l01200"></a>01200 <span class="keywordtype">double</span> a, b, dsgn, deg1;
+<a name="l01201"></a>01201 <span class="keywordtype">double</span> seconds;
+<a name="l01202"></a>01202 <span class="keywordtype">char</span> sign;
+<a name="l01203"></a>01203 <span class="keywordtype">int</span> degrees;
+<a name="l01204"></a>01204 <span class="keywordtype">int</span> minutes;
+<a name="l01205"></a>01205 <span class="keywordtype">int</span> ltstr;
+<a name="l01206"></a>01206 <span class="keywordtype">char</span> tstring[64];
+<a name="l01207"></a>01207
+<a name="l01208"></a>01208 <span class="comment">/* Keep angle between -180 and 360 degrees */</span>
+<a name="l01209"></a>01209 deg1 = dec;
+<a name="l01210"></a>01210 <span class="keywordflow">if</span> (deg1 < 0.0 )
+<a name="l01211"></a>01211 {
+<a name="l01212"></a>01212 deg1 = -deg1;
+<a name="l01213"></a>01213 dsgn = -1.0;
+<a name="l01214"></a>01214 }
+<a name="l01215"></a>01215 <span class="keywordflow">else</span>
+<a name="l01216"></a>01216 dsgn = 1.0;
+<a name="l01217"></a>01217 deg1 = fmod(deg1, 360.0);
+<a name="l01218"></a>01218 deg1 *= dsgn;
+<a name="l01219"></a>01219 <span class="keywordflow">if</span> (deg1 <= -180.0)
+<a name="l01220"></a>01220 deg1 = deg1 + 360.0;
+<a name="l01221"></a>01221
+<a name="l01222"></a>01222 a = deg1;
+<a name="l01223"></a>01223
+<a name="l01224"></a>01224 <span class="comment">/* Set sign and do all the rest with a positive */</span>
+<a name="l01225"></a>01225 <span class="keywordflow">if</span> (a < 0)
+<a name="l01226"></a>01226 {
+<a name="l01227"></a>01227 sign = <span class="charliteral">'-'</span>;
+<a name="l01228"></a>01228 a = -a;
+<a name="l01229"></a>01229 }
+<a name="l01230"></a>01230 <span class="keywordflow">else</span>
+<a name="l01231"></a>01231 sign = <span class="charliteral">'+'</span>;
+<a name="l01232"></a>01232
+<a name="l01233"></a>01233 <span class="comment">/* Convert to degrees */</span>
+<a name="l01234"></a>01234 degrees = (int) a;
+<a name="l01235"></a>01235
+<a name="l01236"></a>01236 <span class="comment">/* Compute minutes */</span>
+<a name="l01237"></a>01237 b = (a - (double)degrees) * 60.0;
+<a name="l01238"></a>01238 minutes = (int) b;
+<a name="l01239"></a>01239
+<a name="l01240"></a>01240 <span class="comment">/* Compute seconds */</span>
+<a name="l01241"></a>01241 seconds = (b - (double)minutes) * 60.0;
+<a name="l01242"></a>01242
+<a name="l01243"></a>01243 <span class="keywordflow">if</span> (seconds > 59.99)
+<a name="l01244"></a>01244 {
+<a name="l01245"></a>01245 seconds = 0.0;
+<a name="l01246"></a>01246 minutes = minutes + 1;
+<a name="l01247"></a>01247 }
+<a name="l01248"></a>01248 <span class="keywordflow">if</span> (minutes > 59)
+<a name="l01249"></a>01249 {
+<a name="l01250"></a>01250 minutes = 0;
+<a name="l01251"></a>01251 degrees = degrees + 1;
+<a name="l01252"></a>01252 }
+<a name="l01253"></a>01253 (void) sprintf (tstring,<span class="stringliteral">"%c%02d:%02d:%05.2f"</span>,sign,degrees,minutes,seconds);
+<a name="l01254"></a>01254
+<a name="l01255"></a>01255 <span class="comment">/* Move formatted string to returned string */</span>
+<a name="l01256"></a>01256 ltstr = (int) strlen (tstring);
+<a name="l01257"></a>01257 <span class="keywordflow">if</span> (ltstr < length_str-1)
+<a name="l01258"></a>01258 strcpy (str, tstring);
+<a name="l01259"></a>01259 <span class="keywordflow">else</span>
+<a name="l01260"></a>01260 {
+<a name="l01261"></a>01261 strncpy (str, tstring, length_str-1);
+<a name="l01262"></a>01262 str[length_str-1] = 0;
+<a name="l01263"></a>01263 }
+<a name="l01264"></a>01264 <span class="keywordflow">return</span>;
+<a name="l01265"></a>01265 }
+<a name="l01266"></a>01266
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__utils_8h_source.html b/html/hawki__utils_8h_source.html
new file mode 100644
index 0000000..e910e80
--- /dev/null
+++ b/html/hawki__utils_8h_source.html
@@ -0,0 +1,203 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_utils.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_utils.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_utils.h,v 1.41 2011/09/16 15:18:04 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2011/09/16 15:18:04 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.41 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_UTILS_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_UTILS_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> New types</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="keyword">typedef</span> <span class="keyword">enum</span> _HAWKI_BAND_ {
+<a name="l00042"></a>00042 HAWKI_BAND_J,
+<a name="l00043"></a>00043 HAWKI_BAND_H,
+<a name="l00044"></a>00044 HAWKI_BAND_K,
+<a name="l00045"></a>00045 HAWKI_BAND_Y,
+<a name="l00046"></a>00046 HAWKI_BAND_UNKNOWN
+<a name="l00047"></a>00047 } hawki_band ;
+<a name="l00048"></a>00048
+<a name="l00049"></a>00049 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00050"></a>00050 <span class="comment"> Define</span>
+<a name="l00051"></a>00051 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="preprocessor">#define HAWKI_NB_DETECTORS 4</span>
+<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_PHOT_STAR_RADIUS 30.0</span>
+<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET_NPIX_X 2048</span>
+<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET_NPIX_Y 2048</span>
+<a name="l00057"></a>00057 <span class="preprocessor"></span>
+<a name="l00058"></a>00058 <span class="comment">/* Input from commissionning 1 report */</span>
+<a name="l00059"></a>00059 <span class="preprocessor">#define HAWKI_DET1_POSX 0</span>
+<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET1_POSY 0</span>
+<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET2_POSX 2048 + 153</span>
+<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET2_POSY 0 + 3</span>
+<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET3_POSX 2048 + 157</span>
+<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET3_POSY 2048 + 144</span>
+<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET4_POSX 0 + 5</span>
+<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_DET4_POSY 2048 + 142</span>
+<a name="l00067"></a>00067 <span class="preprocessor"></span>
+<a name="l00068"></a>00068 <span class="preprocessor">#define HAWKI_NB_VC 32</span>
+<a name="l00069"></a>00069 <span class="preprocessor"></span>
+<a name="l00070"></a>00070 <span class="preprocessor">#define HAWKI_HEADER_EXT_FORWARD "DET CHIP|DET WIN NX|DET WIN NY|DET WIN STARTX|DET WIN STARTY"</span>
+<a name="l00071"></a>00071 <span class="preprocessor"></span>
+<a name="l00072"></a>00072 <span class="preprocessor">#define HAWKI_HEADER_WCS "CTYPE1|CTYPE2|CRVAL1|CRVAL2|CRPIX1|CRPIX2|CD1_1|CD1_2|CD2_1|CD2_2"</span>
+<a name="l00073"></a>00073 <span class="preprocessor"></span>
+<a name="l00074"></a>00074 <span class="preprocessor">#define HAWKI_HEADER_COMB_OFFSETS "ESO QC COMBINED"</span>
+<a name="l00075"></a>00075 <span class="preprocessor"></span>
+<a name="l00076"></a>00076 <span class="preprocessor">#define HAWKI_HEADER_PRI_TOPAF "^(ARCFILE|MJD-OBS|INSTRUME|ESO TPL ID|ESO TPL NEXP|ESO DPR CATG|ESO DPR TECH|ESO DPR TYPE|DATE-OBS|ESO INS GRAT NAME|ESO INS GRAT WLEN|ESO INS OPTI1 ID|ESO OBS ID|ESO DET MINDIT|ESO DET RSPEED|ESO DET DIT|ESO DET NDIT|ESO DET NCORRS NAME|ESO INS FILT1 NAME|ESO INS FILT2 NAME|ESO MODE NAME|ESO NDSAMPLES)$" </span>
+<a name="l00077"></a>00077 <span class="preprocessor"></span>
+<a name="l00078"></a>00078 <span class="preprocessor">#define HAWKI_HEADER_EXT_TOPAF "ESO DET CHIP ID|ESO DET CHIP NO|ESO DET CHIP LIVE"</span>
+<a name="l00079"></a>00079 <span class="preprocessor"></span>
+<a name="l00080"></a>00080 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00081"></a>00081 <span class="comment"> Prototypes</span>
+<a name="l00082"></a>00082 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="group__hawki__utils.html#gadfbb9f93a998ca86bbe90dbf808e5566" title="Issue a banner with the pipeline version.">hawki_print_banner</a>(<span class="keywordtype">void</span>);
+<a name="l00085"></a>00085 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#gafde011eb3e31e78d4d01cc9c26e2d33a" title="Get the pipeline copyright and license.">hawki_get_license</a>(<span class="keywordtype">void</span>);
+<a name="l00086"></a>00086 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#ga4e8a1eeb0faaa8793bdb37b7450c33e3" title="Returns the version of the pipeline.">hawki_get_version</a>(<span class="keywordtype">void</span>);
+<a name="l00087"></a>00087
+<a name="l00088"></a>00088 cpl_image * <a class="code" href="group__hawki__utils.html#ga49279015ecc6c4dcc6a00de6ed6109bd" title="Compute the large scale background.">hawki_compute_lsbg</a>
+<a name="l00089"></a>00089 (<span class="keyword">const</span> cpl_image * in);
+<a name="l00090"></a>00090 cpl_image * <a class="code" href="group__hawki__utils.html#ga292d87e3996e9bb4331980a41d8b45bb" title="Compute the bpm from the dark (hot pixels)">hawki_compute_darkbpm</a>
+<a name="l00091"></a>00091 (<span class="keyword">const</span> cpl_image * in,
+<a name="l00092"></a>00092 <span class="keywordtype">double</span> sigma);
+<a name="l00093"></a>00093 cpl_image * <a class="code" href="group__hawki__utils.html#ga5d0deca1786f42488784c23e361d0877" title="Compute the bpm from the flat (aka cold pixels mask)">hawki_compute_flatbpm</a>
+<a name="l00094"></a>00094 (<span class="keyword">const</span> cpl_image * in,
+<a name="l00095"></a>00095 <span class="keywordtype">double</span> sigma,
+<a name="l00096"></a>00096 <span class="keywordtype">double</span> lowval,
+<a name="l00097"></a>00097 <span class="keywordtype">double</span> highval);
+<a name="l00098"></a>00098 cpl_error_code <a class="code" href="group__hawki__utils.html#ga8ad7002b08a8f9dff942f46b3f3456f0" title="Create an image with a given value for pixels within a range and another value for pixels outside tha...">hawki_image_inverse_threshold</a>
+<a name="l00099"></a>00099 (cpl_image * image_in,
+<a name="l00100"></a>00100 <span class="keywordtype">double</span> lo_valid,
+<a name="l00101"></a>00101 <span class="keywordtype">double</span> hi_valid,
+<a name="l00102"></a>00102 <span class="keywordtype">double</span> assign_in_range,
+<a name="l00103"></a>00103 <span class="keywordtype">double</span> assign_out_range);
+<a name="l00104"></a>00104 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#gaa24cf39f777ab8389419b3d18a8bec96" title="Apply the harmonization.">hawki_apply_harmonization</a>
+<a name="l00105"></a>00105 (cpl_imagelist * in,
+<a name="l00106"></a>00106 <span class="keywordtype">double</span> h1,
+<a name="l00107"></a>00107 <span class="keywordtype">double</span> h2,
+<a name="l00108"></a>00108 <span class="keywordtype">double</span> h3,
+<a name="l00109"></a>00109 <span class="keywordtype">double</span> h4);
+<a name="l00110"></a>00110 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#ga367515ebe3345fcd79c2849879633ebf" title="Compute the harmonization.">hawki_compute_harmonization</a>
+<a name="l00111"></a>00111 (<span class="keyword">const</span> cpl_imagelist * in,
+<a name="l00112"></a>00112 <span class="keywordtype">double</span> * h1,
+<a name="l00113"></a>00113 <span class="keywordtype">double</span> * h2,
+<a name="l00114"></a>00114 <span class="keywordtype">double</span> * h3,
+<a name="l00115"></a>00115 <span class="keywordtype">double</span> * h4,
+<a name="l00116"></a>00116 <span class="keywordtype">double</span> * h);
+<a name="l00117"></a>00117 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#ga0ee9f37ad441f9fcc16865b34f9459a9" title="Extract the filename ffor the first frame of the given tag.">hawki_extract_first_filename</a>
+<a name="l00118"></a>00118 (<span class="keyword">const</span> cpl_frameset * in,
+<a name="l00119"></a>00119 <span class="keyword">const</span> <span class="keywordtype">char</span> * tag);
+<a name="l00120"></a>00120 hawki_band <a class="code" href="group__hawki__utils.html#ga6d85879fd8b8895544f7787e8a6ddade" title="Get the band.">hawki_get_band</a>
+<a name="l00121"></a>00121 (<span class="keyword">const</span> <span class="keywordtype">char</span> * band);
+<a name="l00122"></a>00122 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="group__hawki__utils.html#ga49b3f45aa7c812c0a90faf073998dbc4" title="Return a band name.">hawki_std_band_name</a>
+<a name="l00123"></a>00123 (hawki_band band);
+<a name="l00124"></a>00124 cpl_image * <a class="code" href="group__hawki__utils.html#ga7f6d3694df0e3a441b20267a1e5894db" title="Apply the stitching.">hawki_images_stitch</a>
+<a name="l00125"></a>00125 (cpl_image ** ima,
+<a name="l00126"></a>00126 <span class="keywordtype">double</span> * x,
+<a name="l00127"></a>00127 <span class="keywordtype">double</span> * y);
+<a name="l00128"></a>00128 cpl_bivector * <a class="code" href="group__hawki__utils.html#ga4c2e0ffe688ffdfd93f0d61c60ac91fd" title="Get the nominal header offsets from a set of frames.">hawki_get_header_tel_offsets</a>
+<a name="l00129"></a>00129 (<span class="keyword">const</span> cpl_frameset * frameset);
+<a name="l00130"></a>00130 <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#ga7b165e9e91b6c6519595109b36d4fb46" title="Get the mean airmass for a set of frames.">hawki_get_mean_airmass</a>(cpl_frameset * <span class="keyword">set</span>);
+<a name="l00131"></a>00131 <span class="keywordtype">int</span> * <a class="code" href="group__hawki__utils.html#ga024bd2557115d5d7d3265dbcbb3b1884" title="Get the frames in which the star is for a given chip.">hawki_detectors_labelise</a>
+<a name="l00132"></a>00132 (<span class="keyword">const</span> cpl_frameset * frameset);
+<a name="l00133"></a>00133 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#gabee84f3ed597df9a6ae97f07fc2204a0" title="Get the frames in which the star is for a given chip.">hawki_detectors_locate_star</a>
+<a name="l00134"></a>00134 (<span class="keyword">const</span> cpl_frameset * in,
+<a name="l00135"></a>00135 <span class="keywordtype">double</span> star_ra,
+<a name="l00136"></a>00136 <span class="keywordtype">double</span> star_dec,
+<a name="l00137"></a>00137 <span class="keywordtype">int</span> * labels);
+<a name="l00138"></a>00138 <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#ga29ae7b4052fd284d8b01f33e127c2846" title="Gets the minimum value of a vector according to an array of flags.">hawki_vector_get_min_select</a>
+<a name="l00139"></a>00139 (<span class="keyword">const</span> cpl_vector * <span class="keyword">self</span>, <span class="keyword">const</span> cpl_vector * valid);
+<a name="l00140"></a>00140 <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#gaba8fca8aa585fed96efc75545bfc6b04" title="Gets the maximum value of a vector according to an array of flags.">hawki_vector_get_max_select</a>
+<a name="l00141"></a>00141 (<span class="keyword">const</span> cpl_vector * <span class="keyword">self</span>, <span class="keyword">const</span> cpl_vector * valid);
+<a name="l00142"></a>00142 <span class="keywordtype">double</span> <a class="code" href="group__hawki__utils.html#gac64c154f22c4d25e242833fbe75da886" title="Compute the histogram mode.">hawki_vector_get_mode</a>(cpl_vector * vec);
+<a name="l00143"></a>00143 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#ga4c041169d43f161a8c9d7f23d7fc57a7" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_double_keys</a>
+<a name="l00144"></a>00144 (cpl_frameset * frames, <span class="keywordtype">double</span> (*func)(<span class="keyword">const</span> cpl_propertylist *));
+<a name="l00145"></a>00145 <span class="keywordtype">int</span> <a class="code" href="group__hawki__utils.html#ga8c1508e389b7fd0da8fbda451ffd1663" title="Check that all the frames share the same value of a given keyword.">hawki_utils_check_equal_int_keys</a>
+<a name="l00146"></a>00146 (cpl_frameset * frames, <span class="keywordtype">int</span> (*func)(<span class="keyword">const</span> cpl_propertylist *));
+<a name="l00147"></a>00147 <span class="keywordtype">void</span> <a class="code" href="group__hawki__utils.html#gaa6f925bb6e5320dcd0f06ad5238813b3" title="This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)">hawki_utils_ra2str</a>(<span class="keywordtype">char</span> * str, <span class="keywordtype">int</span> length_str, <span class="keywordtype" [...]
+<a name="l00148"></a>00148 <span class="keywordtype">void</span> <a class="code" href="group__hawki__utils.html#ga38bbbd4f8537d1cab5cfba056bd8edf6" title="This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2...">hawki_utils_dec2str</a>(<span class="keywordtype">char</span> * str, <span class="keywordtype">int</span> length_str, <span class="keywordtype">double</span> dec);
+<a name="l00149"></a>00149 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__variance_8c_source.html b/html/hawki__variance_8c_source.html
new file mode 100644
index 0000000..bfbe3ba
--- /dev/null
+++ b/html/hawki__variance_8c_source.html
@@ -0,0 +1,172 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_variance.c Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_variance.c</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_variance.c,v 1.2 2009/03/13 11:52:06 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/03/13 11:52:06 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.2 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <float.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "hawki_variance.h"</span>
+<a name="l00042"></a>00042
+<a name="l00043"></a>00043 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00047"></a>00047 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00048"></a>00048
+<a name="l00051"></a>00051 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00079"></a>00079 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00080"></a>00080 cpl_image * <a class="code" href="group__hawki__variance.html#ga0de4bc882b19eb5d32599f6ec2c3eecc" title="Create the associated variance of a raw image.">hawki_image_create_variance</a>
+<a name="l00081"></a><a class="code" href="group__hawki__variance.html#ga0de4bc882b19eb5d32599f6ec2c3eecc">00081</a> (<span class="keyword">const</span> cpl_image * image,
+<a name="l00082"></a>00082 <span class="keywordtype">double</span> gain,
+<a name="l00083"></a>00083 <span class="keywordtype">double</span> ron,
+<a name="l00084"></a>00084 <span class="keywordtype">int</span> ndit,
+<a name="l00085"></a>00085 <span class="keywordtype">int</span> ndsamples)
+<a name="l00086"></a>00086 {
+<a name="l00087"></a>00087 cpl_image * variance;
+<a name="l00088"></a>00088 <span class="keywordtype">float</span> * variance_p;
+<a name="l00089"></a>00089 <span class="keyword">const</span> <span class="keywordtype">float</span> * image_p;
+<a name="l00090"></a>00090 <span class="keywordtype">int</span> pix;
+<a name="l00091"></a>00091 <span class="keywordtype">int</span> npix;
+<a name="l00092"></a>00092 <span class="keywordtype">double</span> poisson_contrib;
+<a name="l00093"></a>00093 <span class="keywordtype">double</span> poisson_factor;
+<a name="l00094"></a>00094 <span class="keywordtype">double</span> ron_contrib;
+<a name="l00095"></a>00095
+<a name="l00096"></a>00096
+<a name="l00097"></a>00097 <span class="comment">/* Test entries */</span>
+<a name="l00098"></a>00098 <span class="keywordflow">if</span> (image == NULL) <span class="keywordflow">return</span> NULL;
+<a name="l00099"></a>00099
+<a name="l00100"></a>00100 <span class="comment">/* Create new image */</span>
+<a name="l00101"></a>00101 variance = cpl_image_duplicate(image);
+<a name="l00102"></a>00102
+<a name="l00103"></a>00103 <span class="comment">/* Loop on pixels */</span>
+<a name="l00104"></a>00104 variance_p = cpl_image_get_data(variance);
+<a name="l00105"></a>00105 image_p = cpl_image_get_data_const(image);
+<a name="l00106"></a>00106 npix = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+<a name="l00107"></a>00107 <span class="comment">/* TODO: There is a Delta_t factor that appears in the Vacca article</span>
+<a name="l00108"></a>00108 <span class="comment"> * that is not reflexed here! */</span>
+<a name="l00109"></a>00109 ron_contrib = 12 * ron * ron / (gain * gain * ndsamples * ndit) *
+<a name="l00110"></a>00110 (ndsamples - 1) / (ndsamples + 1);
+<a name="l00111"></a>00111 poisson_factor = 6. / (5. * gain * ndsamples * ndit) *
+<a name="l00112"></a>00112 (ndsamples * ndsamples + 1) / (ndsamples + 1);
+<a name="l00113"></a>00113 <span class="keywordflow">for</span>(pix = 0; pix < npix; ++pix)
+<a name="l00114"></a>00114 {
+<a name="l00115"></a>00115 <span class="comment">/* TODO: Include the effect of saturation in the TLI mode used by HAWK-I */</span>
+<a name="l00116"></a>00116 poisson_contrib = poisson_factor * fabs(image_p[pix]);
+<a name="l00117"></a>00117 variance_p[pix] = poisson_contrib + ron_contrib;
+<a name="l00118"></a>00118 }
+<a name="l00119"></a>00119
+<a name="l00120"></a>00120 <span class="comment">/* Return */</span>
+<a name="l00121"></a>00121 <span class="keywordflow">return</span> variance;
+<a name="l00122"></a>00122 }
+<a name="l00123"></a>00123
+<a name="l00124"></a>00124 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00157"></a>00157 <span class="comment">/*----------------------------------------------------------------------------*/</span>
+<a name="l00158"></a>00158 cpl_imagelist * <a class="code" href="group__hawki__variance.html#ga3077d7b2029de0416fabed98bc092818" title="Create the associated variance of raw imagelist.">hawki_imglist_create_variances_and_delete</a>
+<a name="l00159"></a><a class="code" href="group__hawki__variance.html#ga3077d7b2029de0416fabed98bc092818">00159</a> (cpl_imagelist * imagelist_raw,
+<a name="l00160"></a>00160 <span class="keywordtype">double</span> gain,
+<a name="l00161"></a>00161 <span class="keywordtype">double</span> ron,
+<a name="l00162"></a>00162 <span class="keywordtype">int</span> ndit,
+<a name="l00163"></a>00163 <span class="keywordtype">int</span> ndsamples)
+<a name="l00164"></a>00164 {
+<a name="l00165"></a>00165 cpl_imagelist * variances;
+<a name="l00166"></a>00166
+<a name="l00167"></a>00167 variances = cpl_imagelist_new();
+<a name="l00168"></a>00168 <span class="comment">/* Loop on the frames */</span>
+<a name="l00169"></a>00169 <span class="keywordflow">while</span>(cpl_imagelist_get_size(imagelist_raw) > 0)
+<a name="l00170"></a>00170 {
+<a name="l00171"></a>00171 cpl_image * variance;
+<a name="l00172"></a>00172
+<a name="l00173"></a>00173 variance = <a class="code" href="group__hawki__variance.html#ga0de4bc882b19eb5d32599f6ec2c3eecc" title="Create the associated variance of a raw image.">hawki_image_create_variance</a>
+<a name="l00174"></a>00174 (cpl_imagelist_get(imagelist_raw, 0), gain, ron, ndit, ndsamples);
+<a name="l00175"></a>00175 cpl_imagelist_set(variances, variance,
+<a name="l00176"></a>00176 cpl_imagelist_get_size(variances));
+<a name="l00177"></a>00177 cpl_image_delete(cpl_imagelist_unset(imagelist_raw, 0));
+<a name="l00178"></a>00178 }
+<a name="l00179"></a>00179 <span class="keywordflow">return</span> variances;
+<a name="l00180"></a>00180 }
+<a name="l00181"></a>00181
+<a name="l00182"></a>00182
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/hawki__variance_8h_source.html b/html/hawki__variance_8h_source.html
new file mode 100644
index 0000000..6b7ae12
--- /dev/null
+++ b/html/hawki__variance_8h_source.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: hawki_variance.h Source File</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_61a4ab009ead72bcdcfcf8e0d997aa51.html">hawki</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">hawki_variance.h</div> </div>
+</div>
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: hawki_variance.h,v 1.2 2009/03/13 11:52:14 cgarcia Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the HAWKI Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: cgarcia $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2009/03/13 11:52:14 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.2 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: hawki-1_8_9 $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifndef HAWKI_VARIANCE_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define HAWKI_VARIANCE_H</span>
+<a name="l00030"></a>00030 <span class="preprocessor"></span>
+<a name="l00031"></a>00031 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00032"></a>00032 <span class="comment"> Includes</span>
+<a name="l00033"></a>00033 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00034"></a>00034
+<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00036"></a>00036
+<a name="l00037"></a>00037 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00038"></a>00038 <span class="comment"> Prototypes</span>
+<a name="l00039"></a>00039 <span class="comment"> -----------------------------------------------------------------------------*/</span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 cpl_image * <a class="code" href="group__hawki__variance.html#ga0de4bc882b19eb5d32599f6ec2c3eecc" title="Create the associated variance of a raw image.">hawki_image_create_variance</a>
+<a name="l00042"></a>00042 (<span class="keyword">const</span> cpl_image * image,
+<a name="l00043"></a>00043 <span class="keywordtype">double</span> gain,
+<a name="l00044"></a>00044 <span class="keywordtype">double</span> ron,
+<a name="l00045"></a>00045 <span class="keywordtype">int</span> ndit,
+<a name="l00046"></a>00046 <span class="keywordtype">int</span> ndsamples);
+<a name="l00047"></a>00047
+<a name="l00048"></a>00048 cpl_imagelist * <a class="code" href="group__hawki__variance.html#ga3077d7b2029de0416fabed98bc092818" title="Create the associated variance of raw imagelist.">hawki_imglist_create_variances_and_delete</a>
+<a name="l00049"></a>00049 (cpl_imagelist * imagelist_raw,
+<a name="l00050"></a>00050 <span class="keywordtype">double</span> gain,
+<a name="l00051"></a>00051 <span class="keywordtype">double</span> ron,
+<a name="l00052"></a>00052 <span class="keywordtype">int</span> ndit,
+<a name="l00053"></a>00053 <span class="keywordtype">int</span> ndsamples);
+<a name="l00054"></a>00054
+<a name="l00055"></a>00055 <span class="preprocessor">#endif</span>
+</pre></div></div>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/index.html b/html/index.html
new file mode 100644
index 0000000..8ebc6c3
--- /dev/null
+++ b/html/index.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Main Page</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li class="current"><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">HAWKI Pipeline Reference Manual Documentation</div> </div>
+</div>
+<div class="contents">
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/jquery.js b/html/jquery.js
new file mode 100644
index 0000000..c052173
--- /dev/null
+++ b/html/jquery.js
@@ -0,0 +1,54 @@
+/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return [...]
+var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([ [...]
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[ [...]
+{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.no [...]
+{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"oldd [...]
+/*
+ * jQuery UI 1.7.2
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */
+jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentP [...]
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.o [...]
+{s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relativ [...]
+/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
+ * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php).
+ * Date: 2/8/2008
+ * @author Ariel Flesler
+ * @version 1.3.2
+ */
+;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':i [...]
+
diff --git a/html/modules.html b/html/modules.html
new file mode 100644
index 0000000..798a763
--- /dev/null
+++ b/html/modules.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: Modules</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li class="current"><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Modules</div> </div>
+</div>
+<div class="contents">
+<div class="textblock">Here is a list of all modules:</div><ul>
+<li><a class="el" href="group__hawki__alloc.html">Allocation rutines</a></li>
+<li><a class="el" href="group__hawki__image__stats.html">Compute several statistics on images</a></li>
+<li><a class="el" href="group__hawki__calib.html">Basic calibration Utilities</a></li>
+<li><a class="el" href="group__hawki__combine.html">Images combination routines</a></li>
+<li><a class="el" href="group__hawki__dfs.html">DFS related functions</a></li>
+<li><a class="el" href="group__hawki__distortion.html">Distortion correction</a></li>
+<li><a class="el" href="group__hawki__load.html">Loading related functions</a></li>
+<li><a class="el" href="group__hawki__mask.html">Mask manipulation</a></li>
+<li><a class="el" href="group__hawki__obj__det.html">Functionality related to catalogue matching</a></li>
+<li><a class="el" href="group__hawki__pfits.html">FITS header protected access</a></li>
+<li><a class="el" href="group__hawki__properties__tel.html">Manipulates QC keywords from the telescope</a></li>
+<li><a class="el" href="group__hawki__save.html">Saving related functions</a></li>
+<li><a class="el" href="group__hawki__utils.html">Miscellaneous Utilities</a></li>
+<li><a class="el" href="group__hawki__variance.html">Variance estimation for raw images.</a></li>
+</ul>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/nav_f.png b/html/nav_f.png
new file mode 100644
index 0000000..1b07a16
Binary files /dev/null and b/html/nav_f.png differ
diff --git a/html/nav_h.png b/html/nav_h.png
new file mode 100644
index 0000000..01f5fa6
Binary files /dev/null and b/html/nav_h.png differ
diff --git a/html/open.png b/html/open.png
new file mode 100644
index 0000000..7b35d2c
Binary files /dev/null and b/html/open.png differ
diff --git a/html/struct__hawki__distortion__obj__function__args__.html b/html/struct__hawki__distortion__obj__function__args__.html
new file mode 100644
index 0000000..f972ae7
--- /dev/null
+++ b/html/struct__hawki__distortion__obj__function__args__.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>HAWKI Pipeline Reference Manual: _hawki_distortion_obj_function_args_ Struct Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<!-- Generated by Doxygen 1.7.4 -->
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">HAWKI Pipeline Reference Manual <span id="projectnumber">1.8.9</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">_hawki_distortion_obj_function_args_ Struct Reference<div class="ingroups"><a class="el" href="group__hawki__distortion.html">Distortion correction</a></div></div> </div>
+</div>
+<div class="contents">
+<!-- doxytag: class="_hawki_distortion_obj_function_args_" --><table class="memberdecls">
+</table>
+<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<div class="textblock"><p>This private structure allows to pass parameters to the minimization function used to compute the distortion solution </p>
+<dl class="see"><dt><b>See also:</b></dt><dd>hawki_distortion_compute_solution </dd></dl>
+
+<p>Definition at line <a class="el" href="hawki__distortion_8c_source.html#l00069">69</a> of file <a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a>.</p>
+</div><hr/>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="hawki__distortion_8c_source.html">hawki_distortion.c</a></li>
+</ul>
+</div>
+<hr class="footer"/><address class="footer"><small>Generated on Tue May 22 2012 for HAWKI Pipeline Reference Manual by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/html/tab_a.png b/html/tab_a.png
new file mode 100644
index 0000000..2d99ef2
Binary files /dev/null and b/html/tab_a.png differ
diff --git a/html/tab_b.png b/html/tab_b.png
new file mode 100644
index 0000000..b2c3d2b
Binary files /dev/null and b/html/tab_b.png differ
diff --git a/html/tab_h.png b/html/tab_h.png
new file mode 100644
index 0000000..c11f48f
Binary files /dev/null and b/html/tab_h.png differ
diff --git a/html/tab_s.png b/html/tab_s.png
new file mode 100644
index 0000000..978943a
Binary files /dev/null and b/html/tab_s.png differ
diff --git a/html/tabs.css b/html/tabs.css
new file mode 100644
index 0000000..2192056
--- /dev/null
+++ b/html/tabs.css
@@ -0,0 +1,59 @@
+.tabs, .tabs2, .tabs3 {
+ background-image: url('tab_b.png');
+ width: 100%;
+ z-index: 101;
+ font-size: 13px;
+}
+
+.tabs2 {
+ font-size: 10px;
+}
+.tabs3 {
+ font-size: 9px;
+}
+
+.tablist {
+ margin: 0;
+ padding: 0;
+ display: table;
+}
+
+.tablist li {
+ float: left;
+ display: table-cell;
+ background-image: url('tab_b.png');
+ line-height: 36px;
+ list-style: none;
+}
+
+.tablist a {
+ display: block;
+ padding: 0 20px;
+ font-weight: bold;
+ background-image:url('tab_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color: #283A5D;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ text-decoration: none;
+ outline: none;
+}
+
+.tabs3 .tablist a {
+ padding: 0 10px;
+}
+
+.tablist a:hover {
+ background-image: url('tab_h.png');
+ background-repeat:repeat-x;
+ color: #fff;
+ text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+ text-decoration: none;
+}
+
+.tablist li.current a {
+ background-image: url('tab_a.png');
+ background-repeat:repeat-x;
+ color: #fff;
+ text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+}
diff --git a/irplib/Makefile.am b/irplib/Makefile.am
new file mode 100644
index 0000000..2a5e64e
--- /dev/null
+++ b/irplib/Makefile.am
@@ -0,0 +1,87 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the irplib package
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+SUBDIRS = . tests
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = irplib_flat.h \
+ irplib_calib.h \
+ irplib_cat.h \
+ irplib_distortion.h \
+ irplib_framelist.h \
+ irplib_utils.h \
+ irplib_oddeven.h \
+ irplib_slitpos.h \
+ irplib_strehl.h \
+ irplib_stdstar.h \
+ irplib_plugin.h \
+ irplib_polynomial.h \
+ irplib_ppm.h \
+ irplib_spectrum.h \
+ irplib_match_cats.h \
+ irplib_hist.h \
+ irplib_wavecal.h \
+ irplib_wavecal_impl.h \
+ irplib_wcs.h \
+ irplib_wlxcorr.h \
+ irplib_mkmaster.h \
+ irplib_ksigma_clip.h \
+ irplib_ksigma_clip_body.h
+
+pkginclude_HEADERS =
+
+noinst_LTLIBRARIES = libirplib.la
+
+libirplib_la_SOURCES = irplib_flat.c \
+ irplib_calib.c \
+ irplib_cat.c \
+ irplib_distortion.c \
+ irplib_framelist.c \
+ irplib_match_cats.c \
+ irplib_utils.c \
+ irplib_oddeven.c \
+ irplib_slitpos.c \
+ irplib_stdstar.c \
+ irplib_plugin.c \
+ irplib_polynomial.c \
+ irplib_ppm.c \
+ irplib_spectrum.c \
+ irplib_strehl.c \
+ irplib_hist.c \
+ irplib_wavecal.c \
+ irplib_wcs.c \
+ irplib_wlxcorr.c \
+ irplib_mkmaster.c \
+ irplib_ksigma_clip.c
+
+libirplib_la_LDFLAGS = $(CPL_LDFLAGS)
+libirplib_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE)
+libirplib_la_DEPENDENCIES =
diff --git a/irplib/Makefile.in b/irplib/Makefile.in
new file mode 100644
index 0000000..3d7bdf7
--- /dev/null
+++ b/irplib/Makefile.in
@@ -0,0 +1,809 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = irplib
+DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am_libirplib_la_OBJECTS = irplib_flat.lo irplib_calib.lo irplib_cat.lo \
+ irplib_distortion.lo irplib_framelist.lo irplib_match_cats.lo \
+ irplib_utils.lo irplib_oddeven.lo irplib_slitpos.lo \
+ irplib_stdstar.lo irplib_plugin.lo irplib_polynomial.lo \
+ irplib_ppm.lo irplib_spectrum.lo irplib_strehl.lo \
+ irplib_hist.lo irplib_wavecal.lo irplib_wcs.lo \
+ irplib_wlxcorr.lo irplib_mkmaster.lo irplib_ksigma_clip.lo
+libirplib_la_OBJECTS = $(am_libirplib_la_OBJECTS)
+libirplib_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libirplib_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libirplib_la_SOURCES)
+DIST_SOURCES = $(libirplib_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(pkgincludedir)"
+HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+DISTCLEANFILES = *~
+SUBDIRS = . tests
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
+INCLUDES = $(all_includes)
+noinst_HEADERS = irplib_flat.h \
+ irplib_calib.h \
+ irplib_cat.h \
+ irplib_distortion.h \
+ irplib_framelist.h \
+ irplib_utils.h \
+ irplib_oddeven.h \
+ irplib_slitpos.h \
+ irplib_strehl.h \
+ irplib_stdstar.h \
+ irplib_plugin.h \
+ irplib_polynomial.h \
+ irplib_ppm.h \
+ irplib_spectrum.h \
+ irplib_match_cats.h \
+ irplib_hist.h \
+ irplib_wavecal.h \
+ irplib_wavecal_impl.h \
+ irplib_wcs.h \
+ irplib_wlxcorr.h \
+ irplib_mkmaster.h \
+ irplib_ksigma_clip.h \
+ irplib_ksigma_clip_body.h
+
+pkginclude_HEADERS =
+noinst_LTLIBRARIES = libirplib.la
+libirplib_la_SOURCES = irplib_flat.c \
+ irplib_calib.c \
+ irplib_cat.c \
+ irplib_distortion.c \
+ irplib_framelist.c \
+ irplib_match_cats.c \
+ irplib_utils.c \
+ irplib_oddeven.c \
+ irplib_slitpos.c \
+ irplib_stdstar.c \
+ irplib_plugin.c \
+ irplib_polynomial.c \
+ irplib_ppm.c \
+ irplib_spectrum.c \
+ irplib_strehl.c \
+ irplib_hist.c \
+ irplib_wavecal.c \
+ irplib_wcs.c \
+ irplib_wlxcorr.c \
+ irplib_mkmaster.c \
+ irplib_ksigma_clip.c
+
+libirplib_la_LDFLAGS = $(CPL_LDFLAGS)
+libirplib_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE)
+libirplib_la_DEPENDENCIES =
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign irplib/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign irplib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libirplib.la: $(libirplib_la_OBJECTS) $(libirplib_la_DEPENDENCIES)
+ $(libirplib_la_LINK) $(libirplib_la_OBJECTS) $(libirplib_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_calib.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_cat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_distortion.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_flat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_framelist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_hist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_ksigma_clip.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_match_cats.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_mkmaster.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_oddeven.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_plugin.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_polynomial.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_ppm.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_slitpos.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_spectrum.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_stdstar.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_strehl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_utils.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wavecal.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wcs.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wlxcorr.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(pkgincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-pkgincludeHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pkgincludeHEADERS \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-pkgincludeHEADERS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/irplib/irplib_calib.c b/irplib/irplib_calib.c
new file mode 100644
index 0000000..82a4657
--- /dev/null
+++ b/irplib/irplib_calib.c
@@ -0,0 +1,646 @@
+/* $Id: irplib_calib.c,v 1.17 2009/02/17 08:05:25 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2009/02/17 08:05:25 $
+ * $Revision: 1.17 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_calib.h"
+
+static int
+irplib_get_clean_mean_window(cpl_image* img,
+ const int llx,
+ const int lly,
+ const int urx, int ury,
+ const int kappa,
+ const int nclip,
+ double* clean_mean,
+ double* clean_stdev);
+
+static double irplib_pfits_get_dit(const cpl_propertylist * plist);
+static double irplib_pfits_get_exp_time(const cpl_propertylist* plist);
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_calib Functions for calibrations
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+/*---------------------------------------------------------------------------*/
+/**
+ @brief find out the character string associated to the DIT keyword
+ in a propertylist
+ @param plist propertylist
+ @return dit value
+ */
+/*---------------------------------------------------------------------------*/
+static double irplib_pfits_get_dit(const cpl_propertylist * plist)
+{
+ return cpl_propertylist_get_double(plist,"ESO DET DIT");
+}
+
+/*---------------------------------------------------------------------------*/
+/**
+ @brief find out the character string associated to the EXPTIME keyword
+ @param plist propertylist
+ @return keyword value
+ */
+/*---------------------------------------------------------------------------*/
+static double irplib_pfits_get_exp_time(const cpl_propertylist* plist)
+{
+
+ return cpl_propertylist_get_double(plist,"EXPTIME");
+
+}
+
+
+/**
+ @brief Get clean mean and stdev of an image over a window
+ @param img input image
+ @param llx input lower left x image's window coordinate
+ @param lly input lower left y image's window coordinate
+ @param urx input upper right y image's window coordinate
+ @param ury input upper right y image's window coordinate
+ @param kappa input kappa of kappa-sigma clip
+ @param nclip input max no of kappa-sigma clip iterations
+ @param clean_mean output upper right y image's window coordinate
+ @param clean_stdev output upper right y image's window coordinate
+ @return pixel scale
+ */
+
+
+static int
+irplib_get_clean_mean_window(cpl_image* img,
+ const int llx,
+ const int lly,
+ const int urx, int ury,
+ const int kappa,
+ const int nclip,
+ double* clean_mean,
+ double* clean_stdev)
+{
+
+
+ double mean=0;
+ double stdev=0;
+ double threshold=0;
+ double lo_cut=0;
+ double hi_cut=0;
+ cpl_mask* mask=NULL;
+ cpl_image* tmp=NULL;
+ cpl_stats* stats=NULL;
+ int i=0;
+
+ tmp=cpl_image_extract(img,llx,lly,urx,ury);
+ cpl_image_accept_all(tmp);
+ for(i=0;i<nclip;i++) {
+
+
+ cpl_stats_delete(stats);
+ stats = cpl_stats_new_from_image(tmp, CPL_STATS_MEAN | CPL_STATS_STDEV);
+ mean = cpl_stats_get_mean(stats);
+ stdev = cpl_stats_get_stdev(stats);
+
+ threshold=kappa*stdev;
+ lo_cut=mean-threshold;
+ hi_cut=mean+threshold;
+
+ cpl_image_accept_all(tmp);
+ mask=cpl_mask_threshold_image_create(tmp,lo_cut,hi_cut);
+
+ cpl_mask_not(mask);
+ cpl_image_reject_from_mask(tmp,mask);
+ cpl_mask_delete(mask);
+
+
+ }
+ *clean_mean=mean;
+ *clean_stdev=stdev;
+ cpl_image_delete(tmp);
+ cpl_stats_delete(stats);
+
+ return 0;
+
+
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/**
+ @brief Computes the detector's gain
+ @param son the input frameset of linearity on-flat fields
+ @param sof the input frameset of linearity off-flat fields
+ @param zone pointer to an integer array with locations (llx,lly,urx,ury)
+ of region where a clean mean and noise are computed
+ @param kappa value of kappa in kappa-sigma clipping
+ @param nclip number of kappa-sigma clipping iterations
+
+ @return pointer to a table containing single gain evaluations
+ @note:
+ #1 input frames need to have defined FITS keyword EXPTIME
+ #2 input frames need to have defined FITS keyword DIT
+ */
+/*---------------------------------------------------------------------------*/
+
+
+cpl_table*
+irplib_compute_gain(
+ cpl_frameset* son,
+ cpl_frameset* sof,
+ int* zone,
+ const int kappa,
+ const int nclip)
+{
+
+ cpl_frame* frm=NULL;
+
+ cpl_image* img_on1=NULL;
+ cpl_image* img_on2=NULL;
+ cpl_image* img_on_dif=NULL;
+
+ cpl_image* img_of1=NULL;
+ cpl_image* img_of2=NULL;
+ cpl_image* img_of_dif=NULL;
+
+ cpl_table* res_tbl=NULL;
+ cpl_vector* dit_on=NULL;
+ cpl_vector* dit_of=NULL;
+ cpl_vector* exptime_on=NULL;
+ cpl_vector* exptime_of=NULL;
+ cpl_propertylist* plist=NULL;
+
+ int non=0;
+ int nof=0;
+ int nfr=0;
+ int llx;
+ int lly;
+ int urx;
+ int ury;
+
+ double avg_on1=0;
+ double avg_on2=0;
+ double avg_of1=0;
+ double avg_of2=0;
+ double avg_on_dif=0;
+ double avg_of_dif=0;
+ double std=0;
+
+ double sig_on_dif=0;
+ double sig_of_dif=0;
+ char* name=NULL;
+ int i=0;
+ int m=0;
+
+ double gain=0;
+ double dit_ref=0;
+ double dit_tmp=0;
+ double exptime_ref=0;
+ double exptime_tmp=0;
+
+
+ non = cpl_frameset_get_size(son);
+ nof = cpl_frameset_get_size(sof);
+ nfr = (non <= nof) ? non : nof;
+
+ dit_on=cpl_vector_new(nfr);
+ dit_of=cpl_vector_new(nfr);
+ exptime_on=cpl_vector_new(nfr);
+ exptime_of=cpl_vector_new(nfr);
+
+ for(i=0;i<nfr;i++) {
+
+ frm=cpl_frameset_get_frame(son,i);
+ name=(char*)cpl_frame_get_filename(frm);
+ plist=cpl_propertylist_load(name,0);
+ dit_ref=irplib_pfits_get_dit(plist);
+ exptime_ref=(double)irplib_pfits_get_exp_time(plist);
+ cpl_propertylist_delete(plist);
+ cpl_vector_set(dit_on,i,dit_ref);
+ cpl_vector_set(exptime_on,i,exptime_ref);
+
+ frm=cpl_frameset_get_frame(sof,i);
+ name=(char*)cpl_frame_get_filename(frm);
+ plist=cpl_propertylist_load(name,0);
+ dit_ref=irplib_pfits_get_dit(plist);
+ exptime_ref=(double)irplib_pfits_get_exp_time(plist);
+ cpl_propertylist_delete(plist);
+ cpl_vector_set(dit_of,i,dit_ref);
+ cpl_vector_set(exptime_of,i,exptime_ref);
+
+ }
+
+
+ llx=zone[0];
+ lly=zone[1];
+ urx=zone[2];
+ ury=zone[3];
+
+
+
+ res_tbl=cpl_table_new(nfr);
+ cpl_table_new_column(res_tbl,"adu", CPL_TYPE_DOUBLE);
+ cpl_table_new_column(res_tbl,"gain", CPL_TYPE_DOUBLE);
+
+ for(i=0;i<nfr;i++) {
+ frm=cpl_frameset_get_frame(son,i);
+ name=(char*)cpl_frame_get_filename(frm);
+ img_on1=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
+
+ frm=cpl_frameset_get_frame(sof,i);
+ name=(char*)cpl_frame_get_filename(frm);
+ img_of1=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
+
+
+ dit_ref=cpl_vector_get(dit_on,i);
+ exptime_ref=cpl_vector_get(exptime_on,i);
+
+
+ for(m=0;m<nfr; m++) {
+ if(m != i) {
+ frm=cpl_frameset_get_frame(son,m);
+ name=(char*)cpl_frame_get_filename(frm);
+ dit_tmp=cpl_vector_get(dit_on,m);
+ exptime_tmp=cpl_vector_get(exptime_on,m);
+ if(dit_tmp == dit_ref && exptime_tmp == exptime_ref) {
+ img_on2=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
+ frm=cpl_frameset_get_frame(sof,m);
+ name=(char*)cpl_frame_get_filename(frm);
+ img_of2=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
+
+ img_on_dif=cpl_image_subtract_create(img_on1,img_on2);
+ img_of_dif=cpl_image_subtract_create(img_of1,img_of2);
+
+ irplib_get_clean_mean_window(img_on1,llx,lly,urx,ury,kappa,
+ nclip,&avg_on1,&std);
+ irplib_get_clean_mean_window(img_on2,llx,lly,urx,ury,kappa,
+ nclip,&avg_on2,&std);
+ irplib_get_clean_mean_window(img_of1,llx,lly,urx,ury,kappa,
+ nclip,&avg_of1,&std);
+ irplib_get_clean_mean_window(img_of2,llx,lly,urx,ury,kappa,
+ nclip,&avg_of2,&std);
+ irplib_get_clean_mean_window(img_on_dif,llx,lly,urx,ury,kappa,
+ nclip,&avg_on_dif,&sig_on_dif);
+ irplib_get_clean_mean_window(img_of_dif,llx,lly,urx,ury,kappa,
+ nclip,&avg_of_dif,&sig_of_dif);
+
+ cpl_image_delete(img_on2);
+ cpl_image_delete(img_of2);
+ cpl_image_delete(img_on_dif);
+ cpl_image_delete(img_of_dif);
+
+ gain=((avg_on1+avg_on2)-(avg_of1+avg_of2))/
+ ((sig_on_dif*sig_on_dif)-(sig_of_dif*sig_of_dif));
+
+ cpl_table_set_double(res_tbl,"gain",m,gain);
+ cpl_table_set_double(res_tbl,"adu",m,
+ ((avg_on1+avg_on2)/2-(avg_of1+avg_of2)/2));
+
+ }
+ }
+ }
+ cpl_image_delete(img_on1);
+ cpl_image_delete(img_of1);
+ }
+
+
+ cpl_vector_delete(dit_on);
+ cpl_vector_delete(dit_of);
+ cpl_vector_delete(exptime_on);
+ cpl_vector_delete(exptime_of);
+
+ return res_tbl;
+
+}
+
+/* --------------------------------------------------------------------------*/
+/**
+ @brief Computes the detector's linearity
+ @param son the input frameset of linearity on flat fields
+ @param sof the input frameset of linearity off flat fields
+ @return pointer to a table containing linearity evaluations
+ @note:
+ #2 input frames need to have defined FITS keyword EXPTIME
+ #3 input frames need to have defined FITS keyword DIT
+ */
+/*---------------------------------------------------------------------------*/
+
+
+cpl_table* irplib_compute_linearity(cpl_frameset* son, cpl_frameset* sof)
+{
+
+
+ cpl_frame* frm=NULL;
+
+ int* status=0;
+ int non=0;
+ int nof=0;
+ int nfr=0;
+ int i=0;
+ double med_on=0;
+ double avg_on=0;
+ double med_of=0;
+ double avg_of=0;
+ double med_dit=0;
+ double avg_dit=0;
+
+ double med=0;
+ double avg=0;
+
+ char* name=NULL;
+ cpl_image* img=NULL;
+ cpl_vector* vec_adl=NULL;
+ cpl_vector* vec_dit=NULL;
+ cpl_vector* vec_avg=NULL;
+ cpl_vector* vec_med=NULL;
+ cpl_vector* vec_avg_dit=NULL;
+ cpl_vector* vec_med_dit=NULL;
+ cpl_propertylist* plist=NULL;
+
+ double dit=0;
+ cpl_table* lin_tbl=NULL;
+
+
+ non = cpl_frameset_get_size(son);
+ nof = cpl_frameset_get_size(sof);
+ nfr = (non <= nof) ? non : nof;
+
+ lin_tbl=cpl_table_new(nfr);
+ cpl_table_new_column(lin_tbl,"med", CPL_TYPE_DOUBLE);
+ cpl_table_new_column(lin_tbl,"avg", CPL_TYPE_DOUBLE);
+ cpl_table_new_column(lin_tbl,"med_dit", CPL_TYPE_DOUBLE);
+ cpl_table_new_column(lin_tbl,"avg_dit", CPL_TYPE_DOUBLE);
+ cpl_table_new_column(lin_tbl,"dit", CPL_TYPE_DOUBLE);
+ vec_med=cpl_vector_new(nfr);
+ vec_avg=cpl_vector_new(nfr);
+ vec_med_dit=cpl_vector_new(nfr);
+ vec_avg_dit=cpl_vector_new(nfr);
+ vec_dit=cpl_vector_new(nfr);
+ vec_adl=cpl_vector_new(nfr);
+ for(i=0;i<nfr;i++) {
+ frm=cpl_frameset_get_frame(son,i);
+ name=(char*)cpl_frame_get_filename(frm);
+ img=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
+ med_on=cpl_image_get_median(img);
+ avg_on=cpl_image_get_mean(img);
+ cpl_image_delete(img);
+
+ frm=cpl_frameset_get_frame(sof,i);
+ name=(char*)cpl_frame_get_filename(frm);
+ img=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
+ med_of=cpl_image_get_median(img);
+ avg_of=cpl_image_get_mean(img);
+ cpl_image_delete(img);
+ med=med_on-med_of;
+ avg=avg_on-avg_of;
+ plist=cpl_propertylist_load(name,0);
+ dit=(double)irplib_pfits_get_dit(plist);
+ cpl_propertylist_delete(plist);
+ avg_dit=avg/dit;
+ med_dit=med/dit;
+
+ cpl_vector_set(vec_dit,i,dit);
+ cpl_vector_set(vec_avg,i,avg);
+ cpl_vector_set(vec_med,i,med);
+ cpl_vector_set(vec_avg_dit,i,avg_dit);
+ cpl_vector_set(vec_med_dit,i,med_dit);
+
+
+ cpl_table_set_double(lin_tbl,"dit",i,dit);
+ cpl_table_set_double(lin_tbl,"med",i,med);
+ cpl_table_set_double(lin_tbl,"avg",i,avg);
+ cpl_table_set_double(lin_tbl,"med_dit",i,med_dit);
+ cpl_table_set_double(lin_tbl,"avg_dit",i,avg_dit);
+
+ }
+ cpl_table_new_column(lin_tbl,"adl", CPL_TYPE_DOUBLE);
+ med_dit=cpl_vector_get_mean(vec_med_dit);
+ avg_dit=cpl_vector_get_mean(vec_avg_dit);
+
+ for(i=0;i<nfr;i++) {
+ dit = cpl_table_get_double(lin_tbl,"dit",i,status);
+ cpl_vector_set(vec_adl,i,dit*med_dit);
+ cpl_table_set_double(lin_tbl,"adl",i,dit*med_dit);
+ }
+
+
+ cpl_vector_delete(vec_dit);
+ cpl_vector_delete(vec_adl);
+ cpl_vector_delete(vec_avg);
+ cpl_vector_delete(vec_med);
+ cpl_vector_delete(vec_avg_dit);
+ cpl_vector_delete(vec_med_dit);
+
+
+ return lin_tbl;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the detector linearity correction
+ @param ilist the input image list
+ @param detlin_a the a coeffs
+ @param detlin_b the b coeffs
+ @param detlin_c the c coeffs
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_detlin_correct(
+ cpl_imagelist * ilist,
+ const char * detlin_a,
+ const char * detlin_b,
+ const char * detlin_c)
+{
+ cpl_image * ima ;
+ cpl_image * imb ;
+ cpl_image * imc ;
+ float * pima ;
+ float * pimb ;
+ float * pimc ;
+ float * pdata ;
+ int nx, ny, ni ;
+ double coeff_1, coeff_2, val ;
+ int i, j ;
+
+ /* Test entries */
+ if (!ilist || !detlin_a || !detlin_b || !detlin_c) return -1 ;
+
+ /* Load the 3 coeffs images */
+ ima = cpl_image_load(detlin_a, CPL_TYPE_FLOAT, 0, 0) ;
+ imb = cpl_image_load(detlin_b, CPL_TYPE_FLOAT, 0, 0) ;
+ imc = cpl_image_load(detlin_c, CPL_TYPE_FLOAT, 0, 0) ;
+ if (!ima || !imb || !imc) {
+ cpl_msg_error(cpl_func, "Cannot load the detlin images") ;
+ if (ima) cpl_image_delete(ima) ;
+ if (imb) cpl_image_delete(imb) ;
+ if (imc) cpl_image_delete(imc) ;
+ return -1 ;
+ }
+ pima = cpl_image_get_data_float(ima) ;
+ pimb = cpl_image_get_data_float(imb) ;
+ pimc = cpl_image_get_data_float(imc) ;
+
+ /* Test sizes */
+ nx = cpl_image_get_size_x(cpl_imagelist_get(ilist, 0)) ;
+ ny = cpl_image_get_size_y(cpl_imagelist_get(ilist, 0)) ;
+ ni = cpl_imagelist_get_size(ilist) ;
+ if ((cpl_image_get_size_x(ima) != nx) ||
+ (cpl_image_get_size_x(imb) != nx) ||
+ (cpl_image_get_size_x(imc) != nx) ||
+ (cpl_image_get_size_y(ima) != ny) ||
+ (cpl_image_get_size_y(imb) != ny) ||
+ (cpl_image_get_size_y(imc) != ny)) {
+ cpl_msg_error(cpl_func, "Incompatible sizes") ;
+ cpl_image_delete(ima) ;
+ cpl_image_delete(imb) ;
+ cpl_image_delete(imc) ;
+ return -1 ;
+ }
+
+ /* Loop on pixels */
+ for (i=0 ; i<nx*ny ; i++) {
+ /* Compute the coefficients */
+ if (fabs(pima[i]) < 1e-30) {
+ coeff_1 = coeff_2 = (double)0.0 ;
+ } else {
+ coeff_1 = (double)pimb[i] / (double)pima[i] ;
+ coeff_2 = (double)pimc[i] / (double)pima[i] ;
+ }
+ /* Correct this pixel in each plane */
+ for (j=0 ; j<ni ; j++) {
+ pdata = cpl_image_get_data_float(cpl_imagelist_get(ilist, j)) ;
+ val = (double)pdata[i] ;
+ pdata[i]=(float)(val+coeff_1*val*val+coeff_2*val*val*val) ;
+ }
+ }
+ /* Free and return */
+ cpl_image_delete(ima) ;
+ cpl_image_delete(imb) ;
+ cpl_image_delete(imc) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the calibration to the frames
+ @param ilist the input image list
+ @param flat the flat field
+ @param dark the dark
+ @param bpm the bad pixels map
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_flat_dark_bpm_calib(
+ cpl_imagelist * ilist,
+ const char * flat,
+ const char * dark,
+ const char * bpm)
+{
+ cpl_image * dark_image ;
+ cpl_image * flat_image ;
+ cpl_mask * bpm_im_bin ;
+ cpl_image * bpm_im_int ;
+ int i ;
+
+ /* Test entries */
+ if (ilist == NULL) return -1 ;
+
+ /* Dark correction */
+ if (dark != NULL) {
+ cpl_msg_info(cpl_func, "Subtract the dark to the images") ;
+ /* Load the dark image */
+ if ((dark_image = cpl_image_load(dark, CPL_TYPE_FLOAT, 0, 0)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load the dark %s", dark) ;
+ return -1 ;
+ }
+ /* Apply the dark correction to the images */
+ if (cpl_imagelist_subtract_image(ilist, dark_image)!=CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot apply the dark to the images") ;
+ cpl_image_delete(dark_image) ;
+ return -1 ;
+ }
+ cpl_image_delete(dark_image) ;
+ }
+
+ /* Flat-field correction */
+ if (flat != NULL) {
+ cpl_msg_info(cpl_func, "Divide the images by the flatfield") ;
+ /* Load the flat image */
+ if ((flat_image = cpl_image_load(flat, CPL_TYPE_FLOAT, 0, 0)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load the flat field %s", flat) ;
+ return -1 ;
+ }
+ /* Apply the flatfield correction to the images */
+ if (cpl_imagelist_divide_image(ilist, flat_image)!=CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot apply the flatfield to the images") ;
+ cpl_image_delete(flat_image) ;
+ return -1 ;
+ }
+ cpl_image_delete(flat_image) ;
+ }
+
+ /* Correct the bad pixels if requested */
+ if (bpm != NULL) {
+ cpl_msg_info(cpl_func, "Correct the bad pixels in the images") ;
+ /* Load the bad pixels image */
+ if ((bpm_im_int = cpl_image_load(bpm, CPL_TYPE_INT, 0, 0)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load the bad pixel map %s", bpm) ;
+ return -1 ;
+ }
+ /* Convert the map from integer to binary */
+ bpm_im_bin = cpl_mask_threshold_image_create(bpm_im_int, -0.5, 0.5) ;
+ cpl_mask_not(bpm_im_bin) ;
+ cpl_image_delete(bpm_im_int) ;
+ /* Apply the bad pixels cleaning */
+ for (i=0 ; i<cpl_imagelist_get_size(ilist) ; i++) {
+ cpl_image_reject_from_mask(cpl_imagelist_get(ilist, i), bpm_im_bin);
+ if (cpl_detector_interpolate_rejected(
+ cpl_imagelist_get(ilist, i)) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot clean the bad pixels in obj %d",
+ i+1);
+ cpl_mask_delete(bpm_im_bin) ;
+ return -1 ;
+ }
+ }
+ cpl_mask_delete(bpm_im_bin) ;
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/**@}*/
+
diff --git a/irplib/irplib_calib.h b/irplib/irplib_calib.h
new file mode 100644
index 0000000..92fbfd8
--- /dev/null
+++ b/irplib/irplib_calib.h
@@ -0,0 +1,49 @@
+/* $Id: irplib_calib.h,v 1.8 2007/02/12 10:34:51 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2007/02/12 10:34:51 $
+ * $Revision: 1.8 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_CALIB_H
+#define IRPLIB_CALIB_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+cpl_table*
+irplib_compute_gain(
+ cpl_frameset* son,
+ cpl_frameset* sof,
+ int* zone1,
+ const int kappa1,
+ const int nclip1);
+cpl_table* irplib_compute_linearity(cpl_frameset* son, cpl_frameset* sof);
+int irplib_flat_dark_bpm_calib(cpl_imagelist *, const char *, const char *,
+ const char *);
+int irplib_detlin_correct(cpl_imagelist *, const char *, const char *,
+ const char *);
+
+#endif
diff --git a/irplib/irplib_cat.c b/irplib/irplib_cat.c
new file mode 100644
index 0000000..b0a1c73
--- /dev/null
+++ b/irplib/irplib_cat.c
@@ -0,0 +1,469 @@
+/* $Id: irplib_cat.c,v 1.10 2009/12/01 12:34:25 cgarcia Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: cgarcia $
+ * $Date: 2009/12/01 12:34:25 $
+ * $Revision: 1.10 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <libgen.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_cat.h"
+#include "irplib_wcs.h"
+
+#define FILENAME_SZBUF 1024
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_cat Functions for accessing catalogues
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*---------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Find the name of the standard catalogue being used and its location
+ * @param index
+ * The frame for the index FITS file
+ * @param catpath
+ * The full path to the catalgoue FITS files
+ * @param catname
+ * The name of the catalogue
+ * @return
+ * CPL_ERROR_NONE if sucess
+ * CPL_ERROR_FILE_IO if the file does not exist or the header cannot be read.
+ *
+ * Find the name of the standard catalogue being used and its location.
+ * The former should be in a header keyword in the specified FITS
+ * file. The latter is the full path of the FITS file. Both values
+ * need to be deallocated when you're finished with them.
+*/
+/*---------------------------------------------------------------------------*/
+
+int irplib_2mass_get_catpars
+(const cpl_frame * master_index,
+ char ** catpath,
+ char ** catname)
+{
+ cpl_propertylist * p;
+ const char * unk = "unknown";
+ char * fname;
+ int status = CPL_ERROR_NONE;
+
+ /* Initialise a few things */
+ *catpath = NULL;
+ *catname = NULL;
+
+ /* First get the full path to the index file and make sure it exists */
+ fname = cpl_strdup(cpl_frame_get_filename(master_index));
+ if (access((const char *)fname,R_OK) != 0)
+ {
+ cpl_msg_error(__func__,"Can't access index file %s",fname);
+ cpl_free(fname);
+ return CPL_ERROR_FILE_IO;
+ }
+ *catpath = cpl_strdup(dirname(fname));
+
+ /* Try to load the propertylist. If it is not possible signal a fatal
+ error since this probably means the whole file is messed up */
+ if ((p = cpl_propertylist_load(cpl_frame_get_filename(master_index),0)) == NULL)
+ {
+ cpl_msg_error(__func__,"Can't load index file header %s",fname);
+ cpl_free(*catpath);
+ cpl_free(fname);
+ return CPL_ERROR_FILE_IO;
+ }
+
+ /* If there is a catalogue name in the header then send it back. If there
+ isn't then give a default name and send a warning */
+ if (cpl_propertylist_has(p,"CATNAME"))
+ {
+ *catname = cpl_strdup(cpl_propertylist_get_string(p,"CATNAME"));
+ status = CPL_ERROR_NONE;
+ } else {
+ *catname = cpl_strdup(unk);
+ cpl_msg_warning(__func__,"Property CATNAME not in index file header %s",
+ fname);
+ }
+
+ /* Free and return */
+ cpl_free(fname);
+ cpl_propertylist_delete(p);
+ return(status);
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Get coverage in ra, dec of a frame
+ * @param plist
+ * Input property list
+ * @param ext_search
+ * Factor for an extra box search.
+ * @param ra1
+ * Lower RA
+ * @param ra2
+ * Upper RA
+ * @param dec1
+ * Lower Dec
+ * @param dec2
+ * Upper Dec
+ * @return
+ * CPL_ERROR_NONE if sucess.
+ * CPL_ERROR_DATA_NOT_FOUND if wcs is not valid
+ *
+ * Given a WCS solution this routine works out the min and max equatorial
+ * coordinates covered by the image.
+ */
+/*---------------------------------------------------------------------------*/
+
+cpl_error_code irplib_cat_get_image_limits
+(const cpl_wcs * wcs,
+ float ext_search,
+ double * ra1,
+ double * ra2,
+ double * dec1,
+ double * dec2)
+{
+ double ra;
+ double dec;
+ double x;
+ double y;
+ double dra;
+ double ddec;
+ double min_4q;
+ double max_1q;
+ int first_quad;
+ int fourth_quad;
+ const int * naxes;
+ long i;
+ long j;
+ const cpl_array * a;
+
+ /* Initialise these in case of failure later*/
+ *ra1 = 0.0;
+ *ra2 = 0.0;
+ *dec1 = 0.0;
+ *dec2 = 0.0;
+
+ /* Grab the WCS info from the property list */
+ if (wcs == NULL)
+ return CPL_ERROR_DATA_NOT_FOUND;
+
+ /* Get the size of the data array */
+
+ a = cpl_wcs_get_image_dims(wcs);
+ if(a == NULL)
+ return CPL_ERROR_ILLEGAL_INPUT;
+ naxes = cpl_array_get_data_int_const(a);
+
+ /* Find the RA and Dec limits of the image */
+
+ *ra1 = 370.0;
+ *ra2 = -370.0;
+ *dec1 = 95.0;
+ *dec2 = -95.0;
+ first_quad = 0;
+ fourth_quad = 0;
+ min_4q = 370.0;
+ max_1q = 0.0;
+ for (j = 1; j < naxes[1]; j += 10) {
+ y = (double)j;
+ for (i = 1; i < naxes[0]; i += 10) {
+ x = (double)i;
+ irplib_wcs_xytoradec(wcs,x,y,&ra,&dec);
+ if (ra >= 0.0 && ra <= 90.0) {
+ first_quad = 1;
+ if(ra > max_1q)
+ max_1q = ra;
+ } else if (ra >= 270.0 && ra <= 360.0) {
+ fourth_quad = 1;
+ if(ra - 360.0 < min_4q)
+ min_4q = ra - 360.0;
+ }
+ if(ra < *ra1)
+ *ra1 = ra;
+ if(ra > *ra2)
+ *ra2 = ra;
+ if(dec < *dec1)
+ *dec1 = dec;
+ if(dec > *dec2)
+ *dec2 = dec;
+ }
+ }
+
+ /* Now have a look to see if you had RA values in both the first and
+ fourth quadrants. If you have, then make the minimum RA a negative
+ value. This will be the signal to the caller that you have the
+ wraparound... */
+
+ if (first_quad && fourth_quad) {
+ *ra1 = min_4q;
+ *ra2 = max_1q;
+ }
+
+ /* Pad out search a bit */
+ if (ext_search)
+ {
+ dra = 0.5*ext_search*(*ra2 - *ra1);
+ *ra1 -= dra;
+ *ra2 += dra;
+ ddec = 0.5*ext_search*(*dec2 - *dec1);
+ *dec1 -= ddec;
+ *dec2 += ddec;
+ }
+
+ /* Exit */
+ return CPL_ERROR_NONE;
+}
+
+/*---------------------------------------------------------------------------*/
+/**
+ *
+ * @brief
+ * Extract standards from the 2mass catalogue
+ * @param path
+ * The full path to the catalogue FITS files and index.
+ * @param ramin1
+ * The minimum RA, this can be negative in the case the area wraps around
+ * the equinox.
+ * @param ramax1
+ * The maximum RA
+ * @param decmin
+ * The minimum Declination
+ * @param decmax
+ * The maximum Declination
+ * @return
+ * A table structure with the extracted catalogue objects
+ *
+ *
+ * The FITS tables containing the 2mass psc catalogue are searched
+ * to find all of the objects within an input equatorial area. Deals
+ * with the sigularity at the equinox, but not at the poles.
+ */
+/*---------------------------------------------------------------------------*/
+
+cpl_table * irplib_2mass_extract
+(char *path,
+ float ramin,
+ float ramax,
+ float decmin,
+ float decmax)
+{
+ cpl_table *t,*s;
+ cpl_table *out;
+ int i,nrows,start,finish,first_index,last_index,irow,init,j;
+ int first_index_ra,last_index_ra,wrap,iwrap;
+ float dectest,ratest,ramin_wrap,ramax_wrap;
+ char fullname[FILENAME_SZBUF];
+ cpl_array *a;
+ const char *deccol[] = {"Dec"};
+ cpl_propertylist *p;
+
+ /* Create an output table */
+
+ out = cpl_table_new(0);
+ init = 1;
+
+ /* Create a cpl array */
+
+ /* deccol will NOT be modified */
+ a = cpl_array_wrap_string((char **)deccol,1);
+
+ /* Is there a wrap around problem? */
+
+ wrap = (ramin < 0.0 && ramax > 0.0) ? 2 : 1;
+
+ /* Loop for each query. If there is a wrap around problem then we need 2
+ queries. If not, then we only need 1 */
+
+ for (iwrap = 0; iwrap < wrap; iwrap++) {
+ if (wrap == 2) {
+ if (iwrap == 0) {
+ ramin_wrap = ramin + 360.0;
+ ramax_wrap = 360.0;
+ } else {
+ ramin_wrap = 0.000001;
+ ramax_wrap = ramax;
+ }
+ } else {
+ ramin_wrap = ramin;
+ ramax_wrap = ramax;
+ }
+
+ /* Find out where in the index to look */
+
+ first_index_ra = (int)ramin_wrap;
+ last_index_ra = (int)ramax_wrap;
+ if(last_index_ra > 359)
+ last_index_ra = 359;
+
+ /* Look at the min and max RA and decide which files need to be
+ opened. */
+
+ for (i = first_index_ra; i <= last_index_ra; i++)
+ {
+
+ /* Ok, we've found one that needs opening. Read the file with
+ the relevant CPL call */
+
+ (void)snprintf(fullname,FILENAME_SZBUF,"%s/npsc%03d.fits",path,i);
+
+ /* Read the propertylist so that you know how many rows there
+ are in the table */
+
+ p = cpl_propertylist_load(fullname,1);
+ if (p == NULL)
+ {
+ cpl_error_set_message_macro(__func__,CPL_ERROR_DATA_NOT_FOUND,
+ __FILE__, __LINE__, "2mass file %s missing",fullname);
+ cpl_table_delete(out);
+ cpl_array_unwrap(a);
+ return(NULL);
+ }
+ nrows = cpl_propertylist_get_int(p, "NAXIS2");
+ cpl_propertylist_delete(p);
+
+ /* Load various rows until you find the Dec range that you
+ have specified. First the minimum Dec */
+
+ start = 0;
+ finish = nrows;
+ first_index = nrows/2;
+ while (finish - start >= 2)
+ {
+ t = cpl_table_load_window(fullname, 1, 0, a, first_index, 1);
+ dectest = cpl_table_get_float(t, "Dec", 0, NULL);
+ cpl_table_delete(t);
+ if (dectest < decmin)
+ {
+ start = first_index;
+ first_index = (first_index + finish)/2;
+ }
+ else
+ {
+ finish = first_index;
+ first_index = (first_index + start)/2;
+ }
+ }
+
+ /* Load various rows until you find the Dec range that you
+ have specified. Now the maximum Dec */
+
+ start = first_index;
+ finish = nrows;
+ last_index = start + (finish - start)/2;
+ while (finish - start >= 2)
+ {
+ t = cpl_table_load_window(fullname, 1, 0, a, last_index, 1);
+ dectest = cpl_table_get_float(t, "Dec", 0, NULL);
+ cpl_table_delete(t);
+ if (dectest < decmax)
+ {
+ start = last_index;
+ last_index = (last_index + finish)/2;
+ }
+ else
+ {
+ finish = last_index;
+ last_index = (last_index + start)/2;
+ }
+ }
+ if (last_index < first_index)
+ last_index = first_index;
+
+ /* Ok now now load all the rows in the relevant dec limits */
+
+ nrows = last_index - first_index + 1;
+ if ((t = cpl_table_load_window(fullname, 1, 0, NULL, first_index,
+ nrows)) == NULL)
+ {
+ cpl_error_set_message_macro(__func__,CPL_ERROR_DATA_NOT_FOUND,
+ __FILE__, __LINE__, "Error in subset of 2mass file %s ",
+ fullname);
+ cpl_table_delete(out);
+ cpl_array_unwrap(a);
+ return (NULL);
+ }
+ cpl_table_unselect_all(t);
+
+ /* Right, we now know what range of rows to search. Go through
+ these and pick the ones that are in the correct range of RA.
+ If a row qualifies, then 'select' it. */
+
+ for (j = 0; j < nrows; j++)
+ {
+ ratest = cpl_table_get_float(t, "RA", j, NULL);
+ if (cpl_error_get_code() != CPL_ERROR_NONE)
+ {
+ cpl_error_set_message_macro(__func__,CPL_ERROR_DATA_NOT_FOUND,
+ __FILE__, __LINE__, "No RA column in 2mass file %s",
+ fullname);
+ cpl_table_delete(t);
+ cpl_array_unwrap(a);
+ cpl_table_delete(out);
+ return (NULL);
+ }
+ if (ratest >= ramin_wrap && ratest <= ramax_wrap)
+ cpl_table_select_row(t, j);
+ }
+
+ /* Extract the rows that have been selected now and append them
+ onto the output table */
+
+ s = cpl_table_extract_selected(t);
+ if (init == 1)
+ {
+ cpl_table_copy_structure(out, t);
+ init = 0;
+ }
+ irow = cpl_table_get_nrow(out) + 1;
+ cpl_table_insert(out, s, irow);
+
+ /* Tidy up */
+
+ cpl_table_delete(t);
+ cpl_table_delete(s);
+ }
+ }
+
+ /* Ok, now just return the table and get out of here */
+
+ cpl_array_unwrap(a);
+ return(out);
+}
+/**@}*/
+
diff --git a/irplib/irplib_cat.h b/irplib/irplib_cat.h
new file mode 100644
index 0000000..39264a5
--- /dev/null
+++ b/irplib/irplib_cat.h
@@ -0,0 +1,57 @@
+/* $Id: irplib_cat.h,v 1.5 2009/12/16 14:49:52 cgarcia Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: cgarcia $
+ * $Date: 2009/12/16 14:49:52 $
+ * $Revision: 1.5 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_CAT_H
+#define IRPLIB_CAT_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+int irplib_2mass_get_catpars
+(const cpl_frame *master_index,
+ char **catpath,
+ char **catname);
+
+cpl_table * irplib_2mass_extract
+(char *path,
+ float ramin,
+ float ramax,
+ float decmin,
+ float decmax);
+
+cpl_error_code irplib_cat_get_image_limits
+(const cpl_wcs * wcs,
+ float ext_search,
+ double * ra1,
+ double * ra2,
+ double * dec1,
+ double * dec2);
+
+#endif
diff --git a/irplib/irplib_distortion.c b/irplib/irplib_distortion.c
new file mode 100644
index 0000000..a3482ed
--- /dev/null
+++ b/irplib/irplib_distortion.c
@@ -0,0 +1,1398 @@
+/* $Id: irplib_distortion.c,v 1.51 2012/02/03 15:08:14 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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: llundin $
+ * $Date: 2012/02/03 15:08:14 $
+ * $Revision: 1.51 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#include <cpl.h>
+
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+
+#if defined CPL_VERSION_CODE && CPL_VERSION_CODE <= CPL_VERSION(5, 92, 0)
+#define cpl_apertures_get_pos_x cpl_apertures_get_max_x
+#endif
+
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+#include "irplib_distortion.h"
+
+#include "irplib_flat.h"
+#include "irplib_utils.h"
+#include "irplib_polynomial.h"
+
+#include <math.h>
+#include <float.h>
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define IRPLIB_MAX(A,B) ((A) > (B) ? (A) : (B))
+#define IRPLIB_MIN(A,B) ((A) < (B) ? (A) : (B))
+
+#define ARC_MINGOODPIX 100
+#define ARC_MINARCLENFACT 2.0
+#define ARC_MINNBARCS 4
+#define ARC_RANGE_FACT 3.0
+#define ARC_WINDOWSIZE 32
+
+#define TRESH_MEDIAN_MIN 0.0
+#define TRESH_SIGMA_MAX 200.0
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_distortion Distortion correction functions
+ */
+/*----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static cpl_apertures * irplib_distortion_detect_arcs(cpl_image *,
+ cpl_image **, int, int, double, int, int, int, int);
+static cpl_error_code irplib_distortion_fill_border(cpl_image *, int, int,
+ int, int, double);
+static int irplib_distortion_threshold1d(cpl_image *, double, cpl_image *,
+ double);
+static cpl_error_code irplib_distortion_purge_arcs(cpl_apertures **, cpl_image *,
+ const cpl_image *, int, int,
+ double);
+static cpl_error_code irplib_distortion_fill_arc_positions(cpl_bivector *,
+ cpl_vector *,
+ const cpl_image *,
+ const cpl_image *,
+ const cpl_apertures *);
+
+static double irplib_distortion_get_row_centroid(const cpl_image *,
+ const cpl_image *, int, int);
+
+static int irplib_distortion_sub_hor_lowpass(cpl_image *, int);
+static cpl_image * irplib_distortion_remove_ramp(const cpl_image *);
+
+static cpl_error_code irplib_image_filter_background_line(cpl_image *,
+ const cpl_image *, int, cpl_boolean) ;
+
+static cpl_error_code irplib_polynomial_fit_2d(cpl_polynomial *,
+ const cpl_bivector *,
+ const cpl_vector *, int,
+ double, double *);
+
+static cpl_matrix * irplib_matrix_product_normal_create(const cpl_matrix *);
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Estimate the distortion using vertical curved arc lines
+ @param org the input image
+ @param xmin
+ @param ymin Define the zone to take into account
+ @param xmax
+ @param ymax
+ @param auto_ramp_sub To automatically clean the image before detection
+ @param arc_sat Saturation threshold for the arc lines
+ @param max_arc_width Maximum arc width allowed in pixels
+ @param kappa Kappa for arc detection (0.33 = good default)
+ @param degree The positive degree of the fitted polynomial
+ @param arcs The found arc lines, *arcs is NULL on error
+ @return The 2d polynomial describing the distortion or NULL in error case
+ @see cpl_image_warp_polynomial()
+ @note The arc lines are expected to be vertical.
+
+ If (Xi, yi) define positions on the curved arc lines, and (xi, yi) the
+ associated positions on the straight arc lines, the created polynomial is
+ Xi = P(xi, yi).
+
+ The polynomial has the property for all xi that xi = P(xi, (Ny+1)/2),
+ where Ny is the Y-size, i.e. the polynomial transformation does not move
+ the points on the detector center line, y = (Ny+1)/2.
+
+ The returned polynomial can passed to cpl_image_warp_polynomial() to correct
+ the image.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_polynomial * irplib_distortion_estimate(
+ const cpl_image * org,
+ int xmin,
+ int ymin,
+ int xmax,
+ int ymax,
+ int auto_ramp_sub,
+ int arc_sat,
+ int max_arc_width,
+ double kappa,
+ int degree,
+ cpl_apertures ** arcs)
+{
+ cpl_image * local_im;
+ cpl_image * filtered;
+ cpl_image * label_image;
+ double rightmost, leftmost;
+ cpl_bivector * grid;
+ cpl_vector * values_to_fit;
+ int n_arcs;
+ cpl_polynomial * poly2d;
+ double mse = 0.0;
+ const int nx = cpl_image_get_size_x(org);
+ const int ny = cpl_image_get_size_y(org);
+ const int min_arc_range = (int)(nx / ARC_RANGE_FACT);
+ int i;
+
+ /* Check entries */
+ cpl_ensure(org != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(kappa >= 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(max_arc_width > 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ /* The background may vary strongly along the vertical line. */
+ /* Detect and rm background with a 1+2*max_arc_width x 1 median filter */
+
+ filtered = cpl_image_new(nx, ny, cpl_image_get_type(org));
+
+ irplib_image_filter_background_line(filtered, org, max_arc_width, CPL_TRUE);
+
+ if (auto_ramp_sub) {
+ local_im = irplib_distortion_remove_ramp(filtered);
+ cpl_image_delete(filtered);
+ } else {
+ local_im = filtered;
+ }
+
+ cpl_error_ensure(local_im != NULL, cpl_error_get_code(),
+ return(NULL), "Cannot clean the image");
+
+ /* Detect the arcs in the input image */
+ *arcs = irplib_distortion_detect_arcs(local_im, &label_image, arc_sat,
+ max_arc_width, kappa, xmin, ymin,
+ xmax, ymax);
+ if (*arcs == NULL) {
+ cpl_image_delete(local_im);
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Cannot detect the arcs");
+ return NULL;
+ }
+ n_arcs = cpl_apertures_get_size(*arcs);
+ cpl_msg_info(cpl_func, "%d detected arcs", n_arcs);
+
+ /* Check that the arcs are not concentrated in the same zone */
+ rightmost = leftmost = cpl_apertures_get_pos_x(*arcs, 1);
+ for (i=1; i<n_arcs; i++) {
+ if (cpl_apertures_get_pos_x(*arcs, i+1) < leftmost)
+ leftmost = cpl_apertures_get_pos_x(*arcs, i+1);
+ if (cpl_apertures_get_pos_x(*arcs, i+1) > rightmost)
+ rightmost = cpl_apertures_get_pos_x(*arcs, i+1);
+ }
+ if ((int)(rightmost-leftmost) < min_arc_range) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "too narrow range (%g-%g)<%d",
+ rightmost, leftmost, min_arc_range);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "too narrow range");
+#endif
+ cpl_apertures_delete(*arcs);
+ cpl_image_delete(local_im);
+ cpl_image_delete(label_image);
+ *arcs = NULL;
+ return NULL;
+ }
+
+ /* Create a 2-D deformation grid with detected arcs */
+ cpl_msg_info(cpl_func, "Create deformation grid");
+ grid = cpl_bivector_new(n_arcs * ny);
+ values_to_fit = cpl_vector_new(n_arcs * ny);
+
+ if (irplib_distortion_fill_arc_positions(grid, values_to_fit, local_im,
+ label_image, *arcs)){
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "cannot get arcs positions");
+ cpl_apertures_delete(*arcs);
+ cpl_image_delete(local_im);
+ cpl_image_delete(label_image);
+ *arcs = NULL;
+ return NULL;
+ }
+ cpl_image_delete(label_image);
+ cpl_image_delete(local_im);
+
+ /* Apply the fitting */
+ poly2d = cpl_polynomial_new(2);
+ if (irplib_polynomial_fit_2d(poly2d, grid, values_to_fit, degree,
+ 0.5*(ny+1), &mse)) {
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "cannot apply the 2d fit");
+ cpl_bivector_delete(grid);
+ cpl_vector_delete(values_to_fit);
+ cpl_apertures_delete(*arcs);
+ *arcs = NULL;
+ return NULL;
+ }
+
+ cpl_msg_info(cpl_func,
+ "Fitted a %d. degree 2D-polynomial to %"CPL_SIZE_FORMAT" points "
+ "with mean-square error: %g", degree,
+ cpl_vector_get_size(values_to_fit), mse);
+
+ /* Free and return */
+ cpl_bivector_delete(grid);
+ cpl_vector_delete(values_to_fit);
+ return poly2d;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Detect the vertical arcs in an image
+ @param im the input image
+ @param label_im the output label image
+ @param arc_sat Saturation threshold for the arcs
+ @param max_arc_width Maximum arc width allowed
+ @param kappa For arcs detection (0.33 is a good default)
+ @param xmin
+ @param ymin Define the zone to take into account
+ @param xmax
+ @param ymax
+ @return The arcs or NULL in error case
+
+ The arcs are expected to be vertical.
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_apertures * irplib_distortion_detect_arcs(
+ cpl_image * im,
+ cpl_image ** label_im,
+ int arc_sat,
+ int max_arc_width,
+ double kappa,
+ int xmin,
+ int ymin,
+ int xmax,
+ int ymax)
+{
+ const int ny = cpl_image_get_size_y(im);
+ /* Set min_arclen */
+ const int min_arclen = (int)(ny / ARC_MINARCLENFACT);
+ cpl_image * filt_im;
+ cpl_mask * filter;
+ cpl_image * collapsed;
+ cpl_mask * bin_im;
+ double threshold, fillval, median_val, sigma;
+ cpl_apertures * det;
+ cpl_size nobj;
+ int ngoodpix;
+
+ /* Default values for output parameters */
+ *label_im = NULL;
+
+ /* Clear zones to be ignored (to avoid false detections) */
+ median_val = cpl_image_get_median_dev(im, &sigma);
+ fillval = median_val-sigma/2.0;
+ if (irplib_distortion_fill_border(im, xmin, ymin, xmax, ymax, fillval)) {
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "cannot fill bad zones");
+ return NULL;
+ }
+
+ /* Subtract a low-pass */
+ filt_im = cpl_image_duplicate(im);
+ if (irplib_distortion_sub_hor_lowpass(filt_im, ARC_WINDOWSIZE) == -1) {
+ cpl_image_delete(filt_im);
+ return NULL;
+ }
+
+ /* Get relevant stats for thresholding */
+ median_val = cpl_image_get_median_dev(filt_im, &sigma);
+
+ /* Correct median_val and sigma if necessary */
+ if (median_val < TRESH_MEDIAN_MIN) median_val = TRESH_MEDIAN_MIN;
+ if (sigma > TRESH_SIGMA_MAX) sigma = TRESH_SIGMA_MAX;
+
+ /* Set the threshold */
+ threshold = median_val + sigma * kappa;
+
+ /* Collapse the image */
+ collapsed = cpl_image_collapse_median_create(filt_im, 0, 0, 0);
+
+ /* Threshold to keep only the arcs - use of the collapsed image */
+ if (irplib_distortion_threshold1d(filt_im, median_val, collapsed, 0.0)==-1) {
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "cannot threshold the filtered image");
+ cpl_image_delete(filt_im);
+ cpl_image_delete(collapsed);
+ return NULL;
+ }
+ cpl_image_delete(collapsed);
+
+ /* Binarize the image */
+ bin_im = cpl_mask_threshold_image_create(filt_im, threshold,
+ DBL_MAX);
+ cpl_image_delete(filt_im);
+ if (bin_im == NULL) {
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "cannot binarise the image");
+ return NULL;
+ }
+
+ /* Test if there are enough good pixels */
+ ngoodpix = cpl_mask_count(bin_im);
+ if (ngoodpix < ARC_MINGOODPIX) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "Too few (%d) white pixels", ngoodpix);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "Too few white pixels");
+#endif
+ cpl_mask_delete(bin_im);
+ return NULL;
+ }
+
+ /* Apply a morphological opening to clean the isolated pixels */
+ filter = cpl_mask_new(3, 3);
+ cpl_mask_not(filter);
+ cpl_mask_filter(bin_im, bin_im, filter, CPL_FILTER_OPENING,
+ CPL_BORDER_ZERO);
+ cpl_mask_delete(filter);
+
+ /* Labelize pixel map to a label image */
+ *label_im = cpl_image_labelise_mask_create(bin_im, &nobj);
+ cpl_mask_delete(bin_im);
+
+ /* Compute statistics on objects */
+ if ((det = cpl_apertures_new_from_image(im, *label_im)) == NULL) {
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Cannot compute arcs stats");
+ cpl_image_delete(*label_im);
+ *label_im = NULL;
+ return NULL;
+ }
+
+ /* Purge non-relevant arcs */
+ if (irplib_distortion_purge_arcs(&det, *label_im, im, min_arclen,
+ max_arc_width, arc_sat)) {
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Cannot purge the arcs");
+ cpl_image_delete(*label_im);
+ *label_im = NULL;
+ cpl_apertures_delete(det);
+ return NULL;
+ }
+ if (cpl_apertures_get_size(det) < ARC_MINNBARCS) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Not enough valid arcs (%"CPL_SIZE_FORMAT" < %d)",
+ cpl_apertures_get_size(det), ARC_MINNBARCS);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Not enough valid arcs, min="
+ IRPLIB_STRINGIFY(ARC_MINNBARCS));
+#endif
+ cpl_image_delete(*label_im);
+ *label_im = NULL;
+ cpl_apertures_delete(det);
+ return NULL;
+ }
+
+ /* Return */
+ return det;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Fill the image border with the given constant
+ @param self Image of pixel-type float to be modified
+ @param xmin Fill xmin-1 leftmost column(s) (No fill for xmin <= 1)
+ @param ymin Fill ymin-1 first row(s) (No fill for ymin <= 1)
+ @param xmax Fill nx-xmax rightmost column(s) (No fill for xmax >= nx)
+ @param ymax Fill ny-ymax last row(s) (No fill for ymax >= ny)
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_distortion_fill_border(cpl_image * self,
+ int xmin,
+ int ymin,
+ int xmax,
+ int ymax,
+ double fillval)
+{
+ const int nx = cpl_image_get_size_x(self);
+ const int ny = cpl_image_get_size_y(self);
+ float * pfi = cpl_image_get_data_float(self);
+ const float fvalue = (float)fillval;
+ int i, j;
+
+
+ cpl_ensure_code(pfi != NULL, cpl_error_get_code());
+
+ /* Ensure validity of pixel buffer access */
+ xmin = IRPLIB_MIN(xmin, nx+1);
+ ymax = IRPLIB_MIN(ymax, ny);
+
+ /* - and avoid double access */
+ xmax = IRPLIB_MAX(xmax, xmin - 1);
+ ymin = IRPLIB_MIN(ymin, ymax + 1);
+
+ /* Fill the zone */
+
+ for (j = 0; j < ymin-1; j++) {
+ for (i = 0; i < nx; i++) {
+ pfi[i+j*nx] = fvalue;
+ }
+ }
+ /* assert( j == IRPLIB_MAX(0, ymin-1) ); */
+
+ for (; j < ymax; j++) {
+ for (i = 0; i < xmin-1; i++) {
+ pfi[i+j*nx] = fvalue;
+ }
+ for (i = xmax; i < nx; i++) {
+ pfi[i+j*nx] = fvalue;
+ }
+ }
+ /* assert( j == IRPLIB_MAX(0, ymax) ); */
+
+ for (; j < ny; j++) {
+ for (i = 0; i < nx; i++) {
+ pfi[i+j*nx] = fvalue;
+ }
+ }
+
+ return CPL_ERROR_NONE;
+}
+
+static int irplib_distortion_threshold1d(
+ cpl_image * im,
+ double threshold,
+ cpl_image * im1d,
+ double newval)
+{
+ float * pim;
+ float * pim1d;
+ int nx, ny;
+ int i, j;
+
+ /* Check entries */
+ if (im == NULL) return -1;
+ if (im1d == NULL) return -1;
+ if (cpl_image_get_type(im) != CPL_TYPE_FLOAT) return -1;
+ if (cpl_image_get_type(im1d) != CPL_TYPE_FLOAT) return -1;
+
+ /* Get access to the im / im1d data */
+ pim = cpl_image_get_data_float(im);
+ pim1d = cpl_image_get_data_float(im1d);
+ nx = cpl_image_get_size_x(im);
+ ny = cpl_image_get_size_y(im);
+
+ /* Apply the thresholding */
+ for (i=0; i<nx; i++)
+ if (pim1d[i] < threshold) {
+ for (j=0; j<ny; j++) pim[i+j*nx] = (float)newval;
+ }
+
+ /* Return */
+ return 0;
+}
+
+static int irplib_distortion_sub_hor_lowpass(
+ cpl_image * im,
+ int filt_size)
+{
+ cpl_vector * linehi;
+ cpl_vector * linelo;
+ cpl_vector * avglinehi;
+ cpl_vector * avglinelo;
+ double * pavglinehi;
+ float * pim;
+ int lopos, hipos, nx, ny;
+ int i, j;
+
+ /* Test entries */
+ if (im == NULL) return -1;
+ if (filt_size <= 0) return -1;
+
+ /* Initialise */
+ nx = cpl_image_get_size_x(im);
+ ny = cpl_image_get_size_y(im);
+ lopos = (int)(ny/4);
+ hipos = (int)(3*ny/4);
+
+ /* Get the vectors out of the image */
+ if ((linehi = cpl_vector_new_from_image_row(im, hipos)) == NULL) {
+ return -1;
+ }
+ if ((linelo = cpl_vector_new_from_image_row(im, lopos)) == NULL) {
+ cpl_vector_delete(linehi);
+ return -1;
+ }
+
+ /* Filter the vectors */
+ if ((avglinehi = cpl_vector_filter_median_create(linehi,
+ filt_size)) == NULL) {
+ cpl_vector_delete(linehi);
+ cpl_vector_delete(linelo);
+ return -1;
+ }
+ cpl_vector_delete(linehi);
+
+ if ((avglinelo = cpl_vector_filter_median_create(linelo,
+ filt_size)) == NULL) {
+ cpl_vector_delete(linelo);
+ cpl_vector_delete(avglinehi);
+ return -1;
+ }
+ cpl_vector_delete(linelo);
+
+ /* Average the filtered vectors to get the low freq signal */
+ cpl_vector_add(avglinehi, avglinelo);
+ cpl_vector_delete(avglinelo);
+ cpl_vector_divide_scalar(avglinehi, 2.0);
+
+ /* Subtract the low frequency signal */
+ pavglinehi = cpl_vector_get_data(avglinehi);
+ pim = cpl_image_get_data_float(im);
+ for (i=0; i<nx; i++) {
+ for (j=0; j<ny; j++) {
+ pim[i+j*nx] -= pavglinehi[i];
+ }
+ }
+ cpl_vector_delete(avglinehi);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Purge apertures that don't look like arc lines
+ @param self Aperture object pointer
+ @param lab_im Label image, to be relabelled
+ @param arc_im Image with arc lines
+ @param min_arclen Arc line criterion
+ @param max_arcwidth Arc line criterion
+ @param arc_sat Arc line criterion
+ @return a newly allocated clean image
+ */
+/*----------------------------------------------------------------------------*/
+static
+cpl_error_code irplib_distortion_purge_arcs(cpl_apertures ** self,
+ cpl_image * lab_im,
+ const cpl_image * arc_im,
+ int min_arclen,
+ int max_arcwidth,
+ double arc_sat)
+{
+ const double ycenter = 0.5 * (1 + cpl_image_get_size_y(arc_im));
+ int narcs;
+ int nkeep = 0;
+ int ifirst = 1;
+ int * relabel;
+ int i;
+
+ /* Check entries */
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+
+ /* Get number of arcs */
+ narcs = cpl_apertures_get_size(*self);
+
+ cpl_ensure_code(narcs > 0, CPL_ERROR_DATA_NOT_FOUND);
+ cpl_ensure_code(cpl_image_get_type(lab_im) == CPL_TYPE_INT,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Allocate relabel array with default relabelling to zero */
+ relabel = cpl_calloc(narcs, sizeof(int));
+
+ /* Loop on the different arcs candidates */
+ for (i = 0; i < narcs; i++) {
+ /* Test if the current object is a valid arc */
+ const int arclen = 1
+ + cpl_apertures_get_top(*self, i+1)
+ - cpl_apertures_get_bottom(*self, i+1);
+
+ if (cpl_apertures_get_top(*self, i+1) < ycenter) continue;
+ if (cpl_apertures_get_bottom(*self, i+1) > ycenter) continue;
+
+ if (arclen > min_arclen) {
+ const int arcwidth = 1
+ + cpl_apertures_get_right(*self, i+1)
+ - cpl_apertures_get_left(*self, i+1);
+ if (arcwidth < max_arcwidth) {
+ const int edge = cpl_apertures_get_left_y(*self, i+1);
+ if (edge > 0) {
+ const double mean = cpl_apertures_get_mean(*self, i+1);
+ if (mean < arc_sat) {
+ relabel[i] = ++nkeep;
+ /* Relabeling, if any, starts with ifirst */
+ if (nkeep == i+1) ifirst = nkeep;
+ }
+ }
+ }
+ }
+ }
+
+ if (nkeep < narcs) {
+ /* Update the labelised image by erasing non valid arcs */
+ int * plabim = cpl_image_get_data_int(lab_im);
+ const int npix = cpl_image_get_size_x(lab_im)
+ * cpl_image_get_size_y(lab_im);
+
+ if (nkeep == 0) {
+ cpl_free(relabel);
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "All %d arc(s) are invalid", narcs);
+#else
+ return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "All arcs are invalid");
+#endif
+ }
+
+ for (i = 0; i < npix; i++) {
+ const int label = plabim[i];
+
+ if (label < 0 || label > narcs) break;
+ if (label >= ifirst) plabim[i] = relabel[label-1];
+ }
+
+ if (i < npix) {
+ /* lab_im is not a valid label image */
+ cpl_free(relabel);
+ return cpl_error_set(cpl_func, plabim[i] < 0
+ ? CPL_ERROR_ILLEGAL_INPUT
+ : CPL_ERROR_INCOMPATIBLE_INPUT);
+ }
+
+ /* Purge the bad arcs */
+ cpl_apertures_delete(*self);
+ *self = cpl_apertures_new_from_image(arc_im, lab_im);
+
+ }
+
+ cpl_free(relabel);
+
+ cpl_msg_info(cpl_func, "Purged %d of %d arcs (1st purged=%d)", narcs - nkeep,
+ narcs, ifirst);
+
+ /* arc_im may be invalid */
+ cpl_ensure_code(*self != NULL, cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the fitting points for the 2D-polynomial
+ @param grid Positions in the image (may be shortened), (1,1) for first
+ @param fitvalues Fitting values in the image (may be shortened)
+ @param in 2D-spectrum with curvature
+ @param label_im Corresponding label image
+ @param det Corresponding apertures
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+
+ Sample arcs along all rows.
+ Fit to centroid of center row, i.e. center row is fix-points of transform.
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code
+irplib_distortion_fill_arc_positions(cpl_bivector * grid,
+ cpl_vector * fitvalues,
+ const cpl_image * in,
+ const cpl_image * label_im,
+ const cpl_apertures * det)
+{
+ const int narcs = cpl_apertures_get_size(det);
+ int nfitvals = cpl_vector_get_size(fitvalues);
+ const int nx = cpl_image_get_size_x(label_im);
+ const int ny = cpl_image_get_size_y(label_im);
+ cpl_image * filt_img;
+ cpl_mask * kernel;
+ cpl_vector * gridx = cpl_bivector_get_x(grid);
+ cpl_vector * gridy = cpl_bivector_get_y(grid);
+ cpl_polynomial* dist1d;
+ cpl_matrix * dist1dx = NULL;
+ cpl_vector * dist1dy = NULL;
+ double * dgridx;
+ double * dgridy;
+ double * dfitv;
+ int ndone = 0;
+ int i, obj;
+
+ cpl_ensure_code(nfitvals > 0, CPL_ERROR_DATA_NOT_FOUND);
+ cpl_ensure_code(narcs > 0, CPL_ERROR_DATA_NOT_FOUND);
+ cpl_ensure_code(cpl_image_get_type(label_im) == CPL_TYPE_INT,
+ CPL_ERROR_TYPE_MISMATCH);
+
+ /* Ensure space for output */
+ if (nfitvals < narcs * ny) {
+ nfitvals = narcs * ny;
+ cpl_vector_set_size(fitvalues, nfitvals);
+ }
+ if (cpl_vector_get_size(gridx) < nfitvals ||
+ cpl_vector_get_size(gridy) < nfitvals) {
+ cpl_vector_set_size(gridx, nfitvals);
+ cpl_vector_set_size(gridy, nfitvals);
+ }
+
+ /* Get data after resizing */
+ dgridx = cpl_vector_get_data(gridx);
+ dgridy = cpl_vector_get_data(gridy);
+ dfitv = cpl_vector_get_data(fitvalues);
+
+ /* Median filter on input image */
+ kernel = cpl_mask_new(3, 3);
+ cpl_mask_not(kernel);
+ filt_img = cpl_image_new(nx, ny, cpl_image_get_type(in));
+ cpl_image_filter_mask(filt_img, in, kernel, CPL_FILTER_MEDIAN,
+ CPL_BORDER_FILTER);
+ cpl_mask_delete(kernel);
+
+ dist1d = cpl_polynomial_new(1);
+
+ for (obj = 0; obj < narcs; obj++) {
+ /* Find the reference X-coordinate for the arc */
+ const int * plabel_im = cpl_image_get_data_int_const(label_im);
+ const int ndist1d = cpl_apertures_get_top(det, obj+1)
+ - cpl_apertures_get_bottom(det, obj+1) + 1;
+ cpl_boolean sampsym = CPL_TRUE;
+ int j, prevj = 0;
+ int k = 0;
+
+ (void)cpl_matrix_unwrap(dist1dx);
+ (void)cpl_vector_unwrap(dist1dy);
+ dist1dx = cpl_matrix_wrap(1, ndist1d, dgridy + ndone);
+ dist1dy = cpl_vector_wrap(ndist1d, dfitv + ndone);
+
+ /* Find out the X coord. at all Y positions on the arc */
+
+ for (j = cpl_apertures_get_bottom(det, obj+1)-1;
+ j < cpl_apertures_get_top(det, obj+1); j++) {
+
+ for (i = 0; i < nx; i++) {
+ if (plabel_im[i + j * nx] == obj + 1) break;
+ }
+ if (i < nx) {
+ /* Found 1st pixel of aperture obj+1 in row j+1 */
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ const double x_finepos
+ = irplib_distortion_get_row_centroid(filt_img, label_im,
+ i, j);
+ if (!cpl_errorstate_is_equal(prestate)) {
+ irplib_error_recover(prestate, "Could not find X-position "
+ "for line %d at y=%d (x=%d)",
+ obj+1, j+1, i+1);
+ } else if (x_finepos >= 0.0) {
+ cpl_matrix_set(dist1dx, 0, k, 1.0 + j);
+ cpl_vector_set(dist1dy, k, 1.0 + x_finepos);
+ if (k > 0 && j != 1 + prevj) sampsym = CPL_FALSE;
+ prevj = j;
+ k++;
+ }
+ }
+ }
+ if (k > 0) {
+ double ref_xpos, grad;
+ cpl_error_code error;
+ const cpl_boolean did_drop = k != ndist1d;
+ const cpl_size mindeg = 0;
+ const cpl_size maxdeg = 2;
+
+ if (did_drop) {
+ /* Set correct size */
+ dist1dx = cpl_matrix_wrap(1, k, cpl_matrix_unwrap(dist1dx));
+ dist1dy = cpl_vector_wrap(k, cpl_vector_unwrap(dist1dy));
+ }
+
+ error = cpl_polynomial_fit(dist1d, dist1dx, &sampsym, dist1dy, NULL,
+ CPL_FALSE, &mindeg, &maxdeg);
+ if (error) {
+ cpl_msg_error(cpl_func, "1D-fit failed");
+ break;
+ }
+
+ ref_xpos = cpl_polynomial_eval_1d(dist1d, 0.5 * (ny + 1), &grad);
+
+ for (j = cpl_apertures_get_bottom(det, obj+1)-1;
+ j < cpl_apertures_get_top(det, obj+1); j++) {
+ const double xpos = cpl_polynomial_eval_1d(dist1d, j+1.0, NULL);
+
+ dfitv [ndone] = xpos;
+ dgridx[ndone] = ref_xpos;
+ /* Wrapping dist1dx does _not_ take care of dgridy,
+ in case of "Could not find X-position " */
+ if (did_drop)
+ dgridy[ndone] = 1.0 + j;
+ ndone++;
+ }
+ cpl_msg_info(cpl_func, "Line %d has center gradient %g", obj+1,
+ grad);
+ }
+ }
+
+ cpl_image_delete(filt_img);
+ cpl_polynomial_delete(dist1d);
+ (void)cpl_matrix_unwrap(dist1dx);
+ (void)cpl_vector_unwrap(dist1dy);
+
+ cpl_msg_info(cpl_func, "Found %d fitting points ("
+ "expected up to %d points)", ndone, nfitvals);
+
+ cpl_ensure_code(obj == narcs, cpl_error_get_code());
+
+ cpl_ensure_code(ndone > 0, CPL_ERROR_DATA_NOT_FOUND);
+
+ cpl_vector_set_size(fitvalues, ndone);
+ cpl_vector_set_size(gridx, ndone);
+ cpl_vector_set_size(gridy, ndone);
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the X-centroid of the row y (y=0 for first)
+ @param im Input image
+ @param label_im Label image
+ @param x Start column of the line profile (0 for first)
+ @param y Start row (0 for first)
+ @return a newly allocated clean image
+ @note All object pixels must have column positions of at least x
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_distortion_get_row_centroid(const cpl_image * im,
+ const cpl_image * label_im,
+ int x,
+ int y)
+{
+ const int nx = cpl_image_get_size_x(im);
+ const int ny = cpl_image_get_size_y(im);
+ const int ynx = y * nx;
+ const float * pim = cpl_image_get_data_float_const(im);
+ const int * plabel_im = cpl_image_get_data_int_const(label_im);
+ int firstpos = -1;
+ int lastpos = -1;
+ int maxpos = x;
+ int objnum;
+ double wsum = 0.0;
+ double sum = 0.0;
+ double max = 0.0;
+
+ cpl_ensure(pim != NULL, cpl_error_get_code(), -1.0);
+ cpl_ensure(plabel_im != NULL, cpl_error_get_code(), -2.0);
+ cpl_ensure(x >= 0, CPL_ERROR_ILLEGAL_INPUT, -3.0);
+ cpl_ensure(y >= 0, CPL_ERROR_ILLEGAL_INPUT, -4.0);
+ cpl_ensure(x < nx, CPL_ERROR_ILLEGAL_INPUT, -5.0);
+ cpl_ensure(y < ny, CPL_ERROR_ILLEGAL_INPUT, -6.0);
+
+ max = (double)pim[x + ynx];
+ objnum = plabel_im[x + ynx];
+
+ /* While we stay in the same object... */
+ do {
+ const double val = (double)pim[x + ynx];
+
+ if (val > 0.0) { /* FIXME: Handle this exception better */
+ wsum += x * val;
+ sum += val;
+
+ if (firstpos < 0) firstpos = x;
+ lastpos = x;
+
+ if (val > max) {
+ max = val;
+ maxpos = x;
+ }
+ }
+
+
+ /* Next point */
+ x++;
+
+ } while (x < nx && objnum == plabel_im[x + ynx]);
+
+ cpl_ensure(sum > 0.0, CPL_ERROR_DATA_NOT_FOUND, -7.0);
+
+ /*
+ assert( 0 <= maxpos && maxpos < nx );
+ assert( objnum == plabel_im[maxpos + ynx] );
+ assert( wsum >= 0.0 );
+ */
+
+ return (wsum < sum * firstpos || wsum > sum * lastpos)
+ ? maxpos : wsum / sum;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Detect and remove a dark ramp in an image
+ @param in input image
+ @return a newly allocated clean image
+ */
+/*----------------------------------------------------------------------------*/
+#define IS_NB_TESTPOINTS 8
+#define IS_MIN_SLOPE 0.01
+#define IS_MAX_SLOPE_DIF 0.075
+#define IS_MAX_FIT_EDGE_DIF 0.05
+#define IS_MIN_RAMP 10.0
+#define IS_MAX_MNERR 13.0
+#define IS_MAX_MNERR_DIF 8.0
+#define IS_MAX_INTER_DIF 20.0
+#define IS_SKIPZONE 2.5
+#define SQR(x) ((x)*(x))
+static cpl_image * irplib_distortion_remove_ramp(const cpl_image * in)
+{
+ int ramp_present;
+ const int nx = cpl_image_get_size_x(in);
+ const int ny = cpl_image_get_size_y(in);
+ const int yhi = (int)(ny/2);
+ const int ylo = yhi - 1;
+ int y;
+ cpl_vector * tmp_vector;
+ cpl_bivector * testpointlo;
+ double * testpointlo_x;
+ double * testpointlo_y;
+ cpl_bivector * testpointhi;
+ double * testpointhi_x;
+ double * testpointhi_y;
+ const int spacing = ny / (IS_SKIPZONE*IS_NB_TESTPOINTS);
+ double rampdif, fitslope;
+ double * pol_coefhi,
+ * pol_coeflo;
+ cpl_vector * median;
+ double * median_data;
+ double medianerrlo, medianerrhi;
+ double slope;
+ cpl_image * out;
+ float * pout;
+ float val;
+ int i, j;
+
+ cpl_ensure(cpl_image_get_type(in) == CPL_TYPE_FLOAT,
+ CPL_ERROR_UNSUPPORTED_MODE, NULL);
+
+ if (ny < IS_SKIPZONE * IS_NB_TESTPOINTS){
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "image has %d lines, min="
+ IRPLIB_STRINGIFY(IS_SKIPZONE) "*"
+ IRPLIB_STRINGIFY(IS_NB_TESTPOINTS), ny);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "image has too few lines, min="
+ IRPLIB_STRINGIFY(IS_SKIPZONE) "*"
+ IRPLIB_STRINGIFY(IS_NB_TESTPOINTS));
+#endif
+ return NULL;
+ }
+
+ /* Fill the vectors */
+ testpointhi = cpl_bivector_new(IS_NB_TESTPOINTS);
+ testpointhi_x = cpl_bivector_get_x_data(testpointhi);
+ testpointhi_y = cpl_bivector_get_y_data(testpointhi);
+ testpointlo = cpl_bivector_new(IS_NB_TESTPOINTS);
+ testpointlo_x = cpl_bivector_get_x_data(testpointlo);
+ testpointlo_y = cpl_bivector_get_y_data(testpointlo);
+ for (i=0; i<IS_NB_TESTPOINTS; i++) {
+ y = yhi + i * spacing;
+ tmp_vector = cpl_vector_new_from_image_row(in, y+1);
+ testpointhi_x[i] = y - ny / 2;
+ testpointhi_y[i] = cpl_vector_get_median_const(tmp_vector);
+ cpl_vector_delete(tmp_vector);
+ y = ylo - i * spacing;
+ tmp_vector = cpl_vector_new_from_image_row(in, y+1);
+ testpointlo_x[IS_NB_TESTPOINTS-i-1] = y;
+ testpointlo_y[IS_NB_TESTPOINTS-i-1]=cpl_vector_get_median_const(tmp_vector);
+ cpl_vector_delete(tmp_vector);
+ }
+
+ /* Apply the fit */
+ pol_coefhi = irplib_flat_fit_slope_robust(testpointhi_x,
+ testpointhi_y, IS_NB_TESTPOINTS);
+ pol_coeflo = irplib_flat_fit_slope_robust(testpointlo_x,
+ testpointlo_y, IS_NB_TESTPOINTS);
+
+ /* Compute the errors */
+ median = cpl_vector_new(IS_NB_TESTPOINTS);
+ median_data = cpl_vector_get_data(median);
+ for (i=0; i<IS_NB_TESTPOINTS; i++) {
+ median_data[i]=SQR(testpointhi_y[i]
+ - pol_coefhi[0] - pol_coefhi[1] * testpointhi_x[i]);
+ }
+ medianerrhi = cpl_vector_get_median(median);
+ for (i=0; i<IS_NB_TESTPOINTS; i++) {
+ median_data[i]=SQR(testpointlo_y[i]
+ - pol_coeflo[0] - pol_coeflo[1] * testpointlo_x[i]);
+ }
+ medianerrlo = cpl_vector_get_median(median);
+ cpl_vector_delete(median);
+ rampdif = testpointlo_y[IS_NB_TESTPOINTS-1] - testpointhi_y[0];
+ slope = rampdif / (ny/2.0);
+ fitslope = (pol_coefhi[1] + pol_coeflo[1]) / 2.0;
+
+ cpl_bivector_delete(testpointlo);
+ cpl_bivector_delete(testpointhi);
+
+ /* Decide if there is a ramp or not */
+ if (fabs(rampdif)<IS_MIN_RAMP ||
+ fabs(pol_coefhi[1]) < IS_MIN_SLOPE ||
+ fabs(pol_coeflo[1]) < IS_MIN_SLOPE ||
+ pol_coefhi[1]/pol_coeflo[1]<0.5 ||
+ pol_coefhi[1]/pol_coeflo[1]>2.0 ||
+ fabs(pol_coefhi[1]-pol_coeflo[1])>IS_MAX_SLOPE_DIF ||
+ fabs(pol_coefhi[0]-pol_coeflo[0]) > IS_MAX_INTER_DIF ||
+ medianerrlo> IS_MAX_MNERR ||
+ medianerrhi> IS_MAX_MNERR ||
+ fabs(medianerrlo-medianerrhi) >IS_MAX_MNERR_DIF ||
+ fabs(slope-fitslope) > IS_MAX_FIT_EDGE_DIF ||
+ slope/fitslope<0.5 ||
+ slope/fitslope>2.0) ramp_present = 0;
+ else ramp_present = 1;
+
+ cpl_free(pol_coeflo);
+ cpl_free(pol_coefhi);
+
+ /* Correct the ramp if it is there */
+ out = cpl_image_duplicate(in);
+ pout = cpl_image_get_data_float(out);
+ if (ramp_present == 1) {
+ for (j=0; j<ny/2; j++) {
+ val = slope * (j-ny/2);
+ for (i=0; i<nx; i++)
+ pout[i+j*nx] -= val;
+ }
+ for (j=ny/2; j<ny; j++) {
+ val = slope * (j-ny);
+ for (i=0; i<nx; i++)
+ pout[i+j*nx] -= val;
+ }
+
+ }
+
+ return out;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Filter the background of an image with horizontal or vertical lines
+ @param self Filtered image
+ @param other Image to filter, use NULL for in-place filtering
+ @param hsize Filtering half-size, total size is 1 + 2 * hsize
+ @param vertical True iff the lines are vertical
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ If the background varies strongly along the line, it can be detected
+ and removed with a unit width 1+2*hsize median filter, where hsize is an
+ upper bound on the line width.
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_image_filter_background_line(cpl_image * self,
+ const cpl_image * other,
+ int hsize,
+ cpl_boolean vertical)
+{
+ const int nx = cpl_image_get_size_x(self);
+ const int ny = cpl_image_get_size_y(self);
+ const int msize = 1 + 2 * hsize;
+ cpl_mask * mask;
+ cpl_image * background;
+ cpl_error_code error = CPL_ERROR_NONE;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ if (other == NULL) other = self;
+
+ mask = vertical ? cpl_mask_new(msize, 1) : cpl_mask_new(1, msize);
+
+ error |= cpl_mask_not(mask);
+
+ background = cpl_image_new(nx, ny, cpl_image_get_type(other));
+
+ error |= cpl_image_filter_mask(background, other, mask, CPL_FILTER_MEDIAN,
+ CPL_BORDER_FILTER);
+ cpl_mask_delete(mask);
+
+ if (self != other) {
+ error |= cpl_image_copy(self, other, 1, 1);
+ }
+
+ error |= cpl_image_subtract(self, background);
+ cpl_image_delete(background);
+
+ return error ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
+}
+
+
+
+/**
+ * @internal
+ * @brief Create and compute A = B * transpose(B)
+ *
+ * @param self M x N Matrix
+ * @return Pointer to created M x M product matrix, or @c NULL on error.
+ * @note Only the upper triangle of A is computed, while the elements
+ * below the main diagonal have undefined values.
+ * @see cpl_matrix_product_normal_create()
+ *
+ * @error
+ * <table class="ec" align="center">
+ * <tr>
+ * <td class="ecl">CPL_ERROR_NULL_INPUT</td>
+ * <td class="ecr">
+ * Any input matrix is a <tt>NULL</tt> pointer.
+ * </td>
+ * </tr>
+ * </table>
+ * @enderror
+ *
+ * To destroy the new matrix the function @c cpl_matrix_delete() should
+ * be used.
+ */
+
+static cpl_matrix * irplib_matrix_product_normal_create(const cpl_matrix * self)
+{
+
+ double sum;
+ cpl_matrix * product;
+ const double * ai = cpl_matrix_get_data_const(self);
+ const double * aj;
+ double * bwrite;
+ const int m = cpl_matrix_get_nrow(self);
+ const int n = cpl_matrix_get_ncol(self);
+ int i, j, k;
+
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+#if 0
+ /* Initialize all values to zero.
+ This is done to avoid access of uninitilized memory, in case
+ someone passes the matrix to for example cpl_matrix_dump(). */
+ product = cpl_matrix_new(m, m);
+ bwrite = cpl_matrix_get_data(product);
+#else
+ bwrite = (double *) cpl_malloc(m * m * sizeof(double));
+ product = cpl_matrix_wrap(m, m, bwrite);
+#endif
+
+ /* The result at (i,j) is the dot-product of i'th and j'th row */
+ for (i = 0; i < m; i++, bwrite += m, ai += n) {
+ aj = ai; /* aj points to first entry in j'th row */
+ for (j = i; j < m; j++, aj += n) {
+ sum = 0.0;
+ for (k = 0; k < n; k++) {
+ sum += ai[k] * aj[k];
+ }
+ bwrite[j] = sum;
+ }
+ }
+
+ return product;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Fit a 2D-polynomial to a 2D-surface in a least squares sense
+ @param xy_pos Bivector positions of the surface to fit.
+ @param values Vector of values of the surface to fit.
+ @param degree Positive polynomial degree
+ @param fixy Fix-point in Y
+ @param mse Iff mse is not null, the mean squared error on success
+ @return The fitted polynomial or NULL on error
+ @see cpl_polynomial_fit_2d_createe
+ @note The fix-point is not supported by cpl_polynomial_fit_2d_create()
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_polynomial_fit_2d(cpl_polynomial * self,
+ const cpl_bivector * xy_pos,
+ const cpl_vector * values,
+ int degree, double fixy,
+ double * mse)
+{
+
+ const int np = cpl_bivector_get_size(xy_pos);
+ /* Number of unknowns to determine in one dimension */
+ const int nc1 = 1+degree;
+ /* Number of unknowns to determine */
+ /* P_{i,0} = 0, except P_{1,0} = 1 */
+ const int nc = nc1 * (1 + nc1) / 2 - nc1;
+ cpl_matrix * mv; /* The transpose of the Vandermonde matrix */
+ cpl_matrix * mh; /* Block-Hankel matrix, V'*V */
+ cpl_matrix * mb;
+ cpl_matrix * mx;
+#ifdef IRPLIB_DISTORTION_ASSERT
+ const double * coeffs1d;
+#endif
+ double * dmv;
+ cpl_vector * xhat;
+ cpl_vector * yhat;
+ cpl_vector * zhat;
+ cpl_size powers[2];
+ int degx, degy;
+ int i, j;
+ cpl_error_code error;
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 2,
+ CPL_ERROR_INVALID_TYPE);
+ cpl_ensure_code(np > 0, cpl_error_get_code());
+ cpl_ensure_code(values != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_vector_get_size(values) == np,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+
+ cpl_ensure_code(degree > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(np >= nc, CPL_ERROR_DATA_NOT_FOUND);
+
+ /* transform zero-point to fixy */
+ yhat = cpl_vector_duplicate(cpl_bivector_get_y_const(xy_pos));
+ cpl_vector_subtract_scalar(yhat, fixy);
+
+ /* - and ensure P(y) = y on center line */
+ xhat = cpl_vector_duplicate(cpl_bivector_get_x_const(xy_pos));
+ zhat = cpl_vector_duplicate(values);
+ cpl_vector_subtract(zhat, xhat);
+
+ /* Initialize matrices */
+ /* mv contains the polynomial terms in the order described */
+ /* above in each row, for each input point. */
+ dmv = (double*)cpl_malloc(nc*np*sizeof(double));
+ mv = cpl_matrix_wrap(nc, np, dmv);
+
+ /* Has redundant FLOPs, appears to improve accuracy */
+ for (i=0; i < np; i++) {
+ const double x = cpl_vector_get(xhat, i);
+ const double y = cpl_vector_get(yhat, i);
+ double xvalue;
+ double yvalue = y;
+ j = 0;
+ for (degy = 1; degy <= degree; degy++) {
+ xvalue = 1;
+ for (degx = 0; degx <= degree-degy; degx++, j++) {
+ dmv[np * j + i] = xvalue * yvalue;
+ xvalue *= x;
+ }
+ yvalue *= y;
+ }
+ /* cx_assert( j == nc ); */
+ }
+ cpl_vector_delete(xhat);
+ cpl_vector_delete(yhat);
+
+ /* mb contains the values, it is not modified */
+ mb = cpl_matrix_wrap(np, 1, cpl_vector_get_data(zhat));
+
+ /* Form the right hand side of the normal equations */
+ mx = cpl_matrix_product_create(mv, mb);
+
+ cpl_matrix_unwrap(mb);
+ cpl_vector_delete(zhat);
+
+ /* Form the matrix of the normal equations */
+ mh = irplib_matrix_product_normal_create(mv);
+ cpl_matrix_delete(mv);
+
+ /* Solve XA=B by a least-square solution (aka pseudo-inverse). */
+ error = cpl_matrix_decomp_chol(mh) || cpl_matrix_solve_chol(mh, mx);
+
+ cpl_matrix_delete(mh);
+
+ if (error) {
+ cpl_matrix_delete(mx);
+ cpl_ensure_code(0, error);
+ }
+
+ /* Store coefficients for output */
+
+#ifdef IRPLIB_DISTORTION_ASSERT
+ coeffs1d = cpl_matrix_get_data(mx);
+#endif
+
+ j = 0;
+ for (degy = 1; degy <= degree; degy++) {
+ powers[1] = degy;
+ for (degx = 0; degx <= degree-degy; degx++, j++) {
+ powers[0] = degx;
+ /* cx_assert( coeffs1d[j] == cpl_matrix_get(mx, j, 0) ); */
+ cpl_polynomial_set_coeff(self, powers, cpl_matrix_get(mx, j, 0));
+ }
+ }
+ /* cx_assert( j == nc ); */
+
+ cpl_matrix_delete(mx);
+
+ /* P_{1,0} = 1 */
+ powers[0] = 1;
+ powers[1] = 0;
+ cpl_polynomial_set_coeff(self, powers, 1.0);
+
+ /* Transform the polynomial back in Y */
+ cpl_polynomial_shift_1d(self, 1, -fixy);
+
+ /* If requested, compute mean squared error */
+ if (mse != NULL) {
+ const cpl_vector * x_pos = cpl_bivector_get_x_const(xy_pos);
+ const cpl_vector * y_pos = cpl_bivector_get_y_const(xy_pos);
+ cpl_vector * x_val = cpl_vector_new(2);
+ double residue;
+
+ *mse = 0;
+ for (i=0; i<np; i++) {
+ cpl_vector_set(x_val, 0, cpl_vector_get(x_pos, i));
+ cpl_vector_set(x_val, 1, cpl_vector_get(y_pos, i));
+ /* Subtract from the true value, square, accumulate */
+ residue = cpl_vector_get(values, i)
+ - cpl_polynomial_eval(self, x_val);
+ *mse += residue * residue;
+ }
+ cpl_vector_delete(x_val);
+ /* Average the error term */
+ *mse /= np;
+ }
+
+ return CPL_ERROR_NONE;
+}
+
diff --git a/irplib/irplib_distortion.h b/irplib/irplib_distortion.h
new file mode 100644
index 0000000..25d63f5
--- /dev/null
+++ b/irplib/irplib_distortion.h
@@ -0,0 +1,44 @@
+/* $Id: irplib_distortion.h,v 1.5 2006/07/26 14:47:34 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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: yjung $
+ * $Date: 2006/07/26 14:47:34 $
+ * $Revision: 1.5 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_DISTORTION_H
+#define IRPLIB_DISTORTION_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_polynomial * irplib_distortion_estimate(const cpl_image *, int, int, int,
+ int, int, int, int, double, int, cpl_apertures **) ;
+
+#endif
diff --git a/irplib/irplib_flat.c b/irplib/irplib_flat.c
new file mode 100644
index 0000000..6f46559
--- /dev/null
+++ b/irplib/irplib_flat.c
@@ -0,0 +1,402 @@
+/* $Id: irplib_flat.c,v 1.15 2007/08/07 12:15:41 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/08/07 12:15:41 $
+ * $Revision: 1.15 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_flat.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static double * irplib_flat_fit_proportional(double *, double *, int) ;
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_flat Functions for flatfielding
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute a flat-field out of a set of exposures.
+ @param raw Input image set
+ @param mode 0 for proportional, 1 for robust fit
+ @return 1 newly allocated set of 2 or 3 images
+
+ The input is assumed to be a cube containing planes of different intensities
+ (usually increasing or decreasing). Typical inputs are: twilight data sets,
+ halogen lamp, or skies of different airmasses in the thermal regime.
+
+ The input image list must be of type float.
+
+ In robust mode, the output is a set of 3 images.
+ The first image contains a regression map, i.e. for each pixel position on
+ the detector, a curve is plotted of the pixel intensity in each plane
+ against the median intensity of the plane. A slope is fit, and the gain
+ factor is stored into this first image.
+
+ The second image contains the y-intercepts of the slope fit. It is usually
+ good to check it out in case of failures.
+
+ The third image contains the sum of squared errors for each fit.
+ The fit is using a robust least-squares criterion rejecting outliers. This
+ is the algorithm to use with big telescopes like the VLT, which collect so
+ much light that objects are actually seen in the twilight sky.
+
+ In proportional mode, the output is a set of 2 images.
+ The first image contains a regression map.
+ The second image contains the sum of squared errors for each fit.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * irplib_flat_fit_set(
+ cpl_imagelist * raw,
+ int mode)
+{
+ double * plane_med = NULL ;
+ double * slope = NULL ;
+ cpl_image * gain = NULL ;
+ double * pgain = NULL ;
+ cpl_image * intercept = NULL ;
+ double * pintercept = NULL ;
+ cpl_image * sq_err = NULL ;
+ double * psq_err = NULL ;
+ double * timeline = NULL ;
+ float * raw_im_data = NULL ;
+ cpl_imagelist * result = NULL ;
+ const int nx = cpl_image_get_size_x(cpl_imagelist_get(raw, 0));
+ const int ny = cpl_image_get_size_y(cpl_imagelist_get(raw, 0));
+ const int ni = cpl_imagelist_get_size(raw);
+ int i, j ;
+
+ /* Check entries */
+ if (raw==NULL) return NULL ;
+ if ((mode != 0) && (mode != 1)) return NULL ;
+ if (cpl_image_get_type(cpl_imagelist_get(raw, 0)) != CPL_TYPE_FLOAT)
+ return NULL ;
+ if (cpl_imagelist_get_size(raw) <= 1) return NULL ;
+
+ /* Compute median for all planes */
+ plane_med = cpl_malloc(ni * sizeof(double)) ;
+ for (i=0 ; i<ni ; i++)
+ plane_med[i] = cpl_image_get_median(cpl_imagelist_get(raw, i));
+
+ /* Create result images */
+ gain = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE) ;
+ pgain = cpl_image_get_data_double(gain) ;
+ if (mode == 1) {
+ intercept = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE) ;
+ pintercept = cpl_image_get_data_double(intercept) ;
+ }
+ sq_err = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE) ;
+ psq_err = cpl_image_get_data_double(sq_err) ;
+ timeline = cpl_malloc(ni * sizeof(double)) ;
+
+ /* Loop on all pixel positions */
+ cpl_msg_info(cpl_func, "Computing gains for all positions (long)...") ;
+ for (i=0 ; i<nx * ny ; i++) {
+ /* extract time line */
+ for (j=0 ; j<ni ; j++) {
+ raw_im_data = cpl_image_get_data_float(cpl_imagelist_get(raw, j)) ;
+ timeline[j] = (double)raw_im_data[i] ;
+ }
+ /* Fit slope to this time line */
+ if (mode == 1) {
+ slope = irplib_flat_fit_slope_robust(plane_med, timeline, ni) ;
+ pintercept[i] = slope[0] ;
+ pgain[i] = slope[1] ;
+ psq_err[i] = slope[2] ;
+ /* Set results in output images */
+ } else {
+ slope = irplib_flat_fit_proportional(plane_med, timeline, ni) ;
+ /* Set results in output images */
+ pgain[i] = slope[0] ;
+ psq_err[i] = slope[1] ;
+ }
+ cpl_free(slope);
+ }
+ cpl_free(plane_med) ;
+ cpl_free(timeline) ;
+
+ /* Return */
+ result = cpl_imagelist_new() ;
+ if (mode == 1) {
+ cpl_imagelist_set(result, gain, 0) ;
+ cpl_imagelist_set(result, intercept, 1) ;
+ cpl_imagelist_set(result, sq_err, 2) ;
+ } else {
+ cpl_imagelist_set(result, gain, 0) ;
+ cpl_imagelist_set(result, sq_err, 1) ;
+ }
+ return result ;
+}
+
+/* @cond */
+#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
+#define MAX_ITERATE 30
+/* @endcond */
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Fit a slope to a list of points (robust fit).
+ @param x x coordinates
+ @param y y coordinates
+ @param np number of points
+ @return Pointer to newly allocated array of 3 doubles.
+
+ The slope to fit has the following kind of equation:
+ y = c[0] + c[1] * x
+
+ The returned coefficients are defined as:
+ c[0] is the y-intercept.
+ c[1] is the slope.
+ c[2] is the median squared error of the fit.
+ This is a very robust slope fit. It tolerates up to 50% of outliers in input.
+ */
+/*----------------------------------------------------------------------------*/
+double * irplib_flat_fit_slope_robust(
+ double * x,
+ double * y,
+ int np)
+{
+ double * c ;
+ double aa, bb, bcomp, b1, b2, del, abdevt, f, f1, f2, sigb, temp,
+ d, sum ;
+ double sx, sy, sxy, sxx, chisq ;
+ cpl_vector * arr ;
+ double * parr ;
+ double aa_ls, bb_ls ;
+ int iter ;
+ int i ;
+
+ /* Check entries */
+ if (x==NULL || y==NULL) return NULL ;
+
+ c = cpl_malloc(3 * sizeof(double)) ;
+
+ sx = sy = sxx = sxy = 0.00 ;
+ for (i=0 ; i<np ; i++) {
+ sx += x[i];
+ sy += y[i];
+ sxy += x[i] * y[i];
+ sxx += x[i] * x[i];
+ }
+
+ del = np * sxx - sx * sx;
+ aa_ls = aa = (sxx * sy - sx * sxy) / del;
+ bb_ls = bb = (np * sxy - sx * sy) / del;
+
+ chisq = 0.00 ;
+ for (i=0;i<np;i++) {
+ temp = y[i] - (aa+bb*x[i]) ;
+ temp *= temp ;
+ chisq += temp ;
+ }
+
+ arr = cpl_vector_new(np) ;
+ parr = cpl_vector_get_data(arr) ;
+ sigb = sqrt(chisq/del);
+ b1 = bb ;
+
+ bcomp = b1 ;
+ sum = 0.00 ;
+ for (i=0 ; i<np ; i++) {
+ parr[i] = y[i] - bcomp * x[i];
+ }
+ aa = cpl_vector_get_median(arr); /* arr permuted */
+ abdevt = 0.0;
+ for (i=0 ; i<np ; i++) {
+ d = y[i] - (bcomp * x[i] + aa);
+ abdevt += fabs(d);
+ if (fabs(y[i]) > 1e-7) d /= fabs(y[i]);
+ if (fabs(d) > 1e-7) sum += (d >= 0.0 ? x[i] : -x[i]);
+ }
+ f1 = sum ;
+ b2 = bb + SIGN(3.0 * sigb, f1);
+ bcomp = b2 ;
+ sum = 0.00 ;
+ for (i=0 ; i<np ; i++) parr[i] = y[i] - bcomp * x[i];
+ aa = cpl_vector_get_median(arr); /* arr permuted */
+ abdevt = 0.0;
+ for (i=0 ; i<np ; i++) {
+ d = y[i] - (bcomp * x[i] + aa);
+ abdevt += fabs(d);
+ if (fabs(y[i]) > 1e-7) d /= fabs(y[i]);
+ if (fabs(d) > 1e-7) sum += (d >= 0.0 ? x[i] : -x[i]);
+ }
+ f2 = sum ;
+
+ if (fabs(b2-b1)<1e-7) {
+ c[0] = aa ;
+ c[1] = bb ;
+ c[2] = abdevt / (double)np;
+ cpl_vector_delete(arr);
+ return c ;
+ }
+
+ iter = 0 ;
+ while (f1*f2 > 0.0) {
+ bb = 2.0*b2-b1;
+ b1 = b2;
+ f1 = f2;
+ b2 = bb;
+
+ bcomp = b2 ;
+ sum = 0.00 ;
+ for (i=0 ; i<np ; i++) parr[i] = y[i] - bcomp * x[i];
+ aa = cpl_vector_get_median(arr); /* arr permuted */
+ abdevt = 0.0;
+ for (i=0 ; i<np ; i++) {
+ d = y[i] - (bcomp * x[i] + aa);
+ abdevt += fabs(d);
+ if (fabs(y[i]) > 1e-7) d /= fabs(y[i]);
+ if (fabs(d) > 1e-7) sum += (d >= 0.0 ? x[i] : -x[i]);
+ }
+ f2 = sum ;
+ iter++;
+ if (iter>=MAX_ITERATE) break ;
+ }
+ if (iter>=MAX_ITERATE) {
+ c[0] = aa_ls ;
+ c[1] = bb_ls ;
+ c[2] = -1.0 ;
+ cpl_vector_delete(arr);
+ return c ;
+ }
+
+ sigb = 0.01 * sigb;
+ while (fabs(b2-b1) > sigb) {
+ bb = 0.5 * (b1 + b2) ;
+ if ((fabs(bb-b1)<1e-7) || (fabs(bb-b2)<1e-7)) break;
+ bcomp = bb ;
+ sum = 0.00 ;
+ for (i=0 ; i<np ; i++) parr[i] = y[i] - bcomp * x[i];
+ aa = cpl_vector_get_median(arr); /* arr permuted */
+ abdevt = 0.0;
+ for (i=0 ; i<np ; i++) {
+ d = y[i] - (bcomp * x[i] + aa);
+ abdevt += fabs(d);
+ if (fabs(y[i]) > 1e-7) d /= fabs(y[i]);
+ if (fabs(d) > 1e-7) sum += (d >= 0.0 ? x[i] : -x[i]);
+ }
+ f = sum ;
+
+ if (f*f1 >= 0.0) {
+ f1=f;
+ b1=bb;
+ } else {
+ f2=f;
+ b2=bb;
+ }
+ }
+ cpl_vector_delete(arr) ;
+ c[0]=aa;
+ c[1]=bb;
+ c[2]=abdevt/np;
+ return c ;
+}
+#undef MAX_ITERATE
+#undef SIGN
+
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute a=y/x for all given points
+ @param x x coordinates
+ @param y y coordinates
+ @param np number of points
+ @return Pointer to newly allocated array of two doubles.
+
+ This function takes in input a list of points supposed all aligned
+ on a slope going through the origin (of equation y=ax). It computes
+ the slope a = y/x for all points, and returns a pointer to two
+ doubles:
+
+ \begin{itemize}
+ \item The median slope.
+ \item The mean squared error.
+ \end{itemize}
+
+ Returning the median of all slopes makes it very robust to outliers.
+ A more precise method would be to make a histogram of all slopes and
+ take the maximum (i.e. the mode of the distribution). It can be
+ shown that the median approximates the mode quite well for a large
+ number of points.
+ */
+/*----------------------------------------------------------------------------*/
+#define FITPROP_BIG_SLOPE 1e30
+static double * irplib_flat_fit_proportional(
+ double * x,
+ double * y,
+ int np)
+{
+ cpl_vector * slopes ;
+ double * pslopes ;
+ double * med_slope ;
+ double val ;
+ double sq_err ;
+ int i ;
+
+ /* Check entries */
+ if (x==NULL || y==NULL) return NULL ;
+
+ slopes = cpl_vector_new(np) ;
+ pslopes = cpl_vector_get_data(slopes) ;
+ for (i=0 ; i<np ; i++) {
+ if (fabs(x[i])>1e-30) pslopes[i] = y[i] / x[i] ;
+ else pslopes[i] = FITPROP_BIG_SLOPE ;
+ }
+ med_slope = cpl_malloc(2 * sizeof(double));
+ med_slope[0] = cpl_vector_get_median(slopes); /* slopes permuted */
+ cpl_vector_delete(slopes);
+
+ sq_err = 0.00 ;
+ for (i=0 ; i<np ; i++) {
+ val = med_slope[0] * x[i] ;
+ sq_err += (val-y[i])*(val-y[i]) ;
+ }
+ sq_err /= (double)np ;
+ med_slope[1] = sq_err ;
+
+ return med_slope ;
+#undef FITPROP_BIG_SLOPE
+}
+
+
+
diff --git a/irplib/irplib_flat.h b/irplib/irplib_flat.h
new file mode 100644
index 0000000..b319cf0
--- /dev/null
+++ b/irplib/irplib_flat.h
@@ -0,0 +1,40 @@
+/* $Id: irplib_flat.h,v 1.4 2005/09/15 11:47:16 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2005/09/15 11:47:16 $
+ * $Revision: 1.4 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_FLAT_H
+#define IRPLIB_FLAT_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+cpl_imagelist * irplib_flat_fit_set(cpl_imagelist *, int) ;
+double * irplib_flat_fit_slope_robust(double *, double *, int) ;
+
+#endif
diff --git a/irplib/irplib_framelist.c b/irplib/irplib_framelist.c
new file mode 100644
index 0000000..c812f8d
--- /dev/null
+++ b/irplib/irplib_framelist.c
@@ -0,0 +1,1289 @@
+/* $Id: irplib_framelist.c,v 1.29 2012/02/03 13:55:14 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2012/02/03 13:55:14 $
+ * $Revision: 1.29 $
+ * $Name: hawki-1_8_9 $
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <regex.h>
+#include <math.h>
+#include <assert.h>
+
+#include <cpl.h>
+
+#include "irplib_framelist.h"
+
+
+/*-----------------------------------------------------------------------------
+ New types
+ -----------------------------------------------------------------------------*/
+
+/* @cond */
+struct _irplib_framelist_ {
+ int size;
+ cpl_frame ** frame;
+ cpl_propertylist ** propertylist;
+
+};
+/* @endcond */
+
+/*-----------------------------------------------------------------------------
+ Private funcions
+ -----------------------------------------------------------------------------*/
+
+static void irplib_framelist_set_size(irplib_framelist *)
+#if defined __GNUC__ && __GNUC__ >= 4
+ __attribute__((nonnull))
+#endif
+;
+
+static cpl_boolean irplib_property_equal(const cpl_propertylist *,
+ const cpl_propertylist *,
+ const char *, cpl_type, double,
+ char **, char **)
+#if defined __GNUC__ && __GNUC__ >= 4
+ __attribute__((nonnull))
+#endif
+;
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_framelist Lists of frames with properties.
+
+ This module implements a container type for frames and their propertylists.
+ It differs from the cpl_frameset in these ways:
+ 1) A propertylist can be associated to each frame
+ 2) Access by index is a O(1)-operation
+ 3) It can not be corrupted due to caching bugs (e.g. DFS02731).
+
+ @par Synopsis:
+ @code
+ #include <irplib_framelist.h>
+ @endcode
+
+ @par Example:
+ @code
+
+ static int rrecipe(cpl_frameset * frameset)
+ {
+ // Error handling omitted for brevity
+
+ irplib_framelist * allframes = irplib_framelist_cast(frameset);
+
+ // Get raw frames of either type
+ irplib_framelist * rawframes = irplib_framelist_extract_regexp(allframes,
+ "^("
+ RAW_TYPE1 "|"
+ RAW_TYPE2 ")$",
+ CPL_FALSE);
+
+ // Load the list of images
+ cpl_imagelist * ilist = irplib_imagelist_load_framelist(rawframes,
+ CPL_TYPE_FLOAT,
+ 0, 0);
+
+ const cpl_propertylist * plist;
+
+ // A regular expression of the FITS cards needed by this recipe
+ const char cards[] = "^(RA|DEC|EXPTIME)$";
+ double ra, dec;
+
+
+ // Load the specified FITS cards for all raw frames
+ irplib_framelist_load_propertylist_all(rawframes, 0, cards, CPL_FALSE));
+
+
+ // Verify the presence and uniformity of the FITS cards
+ if (irplib_framelist_contains(rawframes, "RA",
+ CPL_TYPE_DOUBLE, CPL_TRUE, 1e-5)) {
+ // RA is missing in one or more headers
+ // - or it varies by more than 1e-5
+ }
+
+ if (irplib_framelist_contains(rawframes, "DEC",
+ CPL_TYPE_DOUBLE, CPL_TRUE, 1e-5)) {
+ // DEC is missing in one or more headers
+ // - or it varies by more than 1e-5
+ }
+
+ // Process the FITS cards
+ plist = irplib_framelist_get_propertylist_const(rawframes, 0);
+
+ ra = cpl_propertylist_get_double(plist, "RA");
+ dec = cpl_propertylist_get_double(plist, "DEC");
+
+ // Object deallocation
+ irplib_framelist_delete(allframes);
+ irplib_framelist_delete(rawframes);
+ cpl_imagelist_delete(ilist);
+
+ return 0;
+
+ }
+
+ @endcode
+
+
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*-----------------------------------------------------------------------------
+ Function codes
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create an empty framelist
+ @return 1 newly allocated irplib_framelist
+ @note The returned irplib_framelist must be deallocated using
+ irplib_framelist_delete()
+
+ */
+/*----------------------------------------------------------------------------*/
+irplib_framelist * irplib_framelist_new(void)
+{
+
+ return (irplib_framelist *) cpl_calloc(1, sizeof(irplib_framelist));
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Deallocate an irplib_framelist with its frames and properties
+ @param self the framelist
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_framelist_delete(irplib_framelist * self)
+{
+
+ irplib_framelist_empty(self);
+ cpl_free(self);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create an irplib_framelist from a cpl_framelist
+ @param frameset The cpl_frameset
+ @return 1 newly allocated irplib_framelist or NULL on error
+ @note The returned irplib_framelist must be deallocated using
+ irplib_framelist_delete()
+
+ */
+/*----------------------------------------------------------------------------*/
+irplib_framelist * irplib_framelist_cast(const cpl_frameset * frameset)
+{
+
+ irplib_framelist * self;
+ const cpl_frame * frame;
+ int i;
+
+
+ cpl_ensure(frameset != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ /* The function cannot fail now */
+ self = irplib_framelist_new();
+
+ for (i = 0, frame = cpl_frameset_get_first_const(frameset);
+ frame != NULL;
+ i++, frame = cpl_frameset_get_next_const(frameset)) {
+
+ cpl_frame * copy = cpl_frame_duplicate(frame);
+
+ const cpl_error_code error = irplib_framelist_set(self, copy, i);
+
+ assert(error == CPL_ERROR_NONE);
+
+ }
+
+ assert(self->size == cpl_frameset_get_size(frameset));
+
+ return self;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create a CPL frameset from an irplib_framelist
+ @param self The framelist
+ @return 1 newly allocated cpl_frameset or NULL on error
+ @note The returned cpl_frameset must be deallocated using
+ cpl_frameset_delete()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_frameset * irplib_frameset_cast(const irplib_framelist * self)
+{
+
+ cpl_frameset * new;
+ int i;
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ /* The function cannot fail now */
+ new = cpl_frameset_new();
+
+ for (i = 0; i < self->size; i++) {
+ cpl_frame * frame = cpl_frame_duplicate(self->frame[i]);
+ const cpl_error_code error = cpl_frameset_insert(new, frame);
+
+ assert(error == CPL_ERROR_NONE);
+
+ }
+
+ assert(self->size == cpl_frameset_get_size(new));
+
+ return new;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extract the frames with the given tag from a framelist
+ @param self A non-empty framelist
+ @param tag The frame tag to search for.
+ @return The newly created framelist or NULL on error
+ @see cpl_frameset_find
+ @note Any propertylists of the extracted frames are also extracted.
+ It is an error if no matching frames are found, in which case
+ an error is set.
+
+ */
+/*----------------------------------------------------------------------------*/
+irplib_framelist * irplib_framelist_extract(const irplib_framelist * self,
+ const char * tag)
+{
+
+ irplib_framelist * new;
+ int i, newsize;
+
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(tag != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ new = irplib_framelist_new();
+ newsize = 0;
+
+ for (i = 0; i < self->size; i++) {
+ const cpl_frame * frame = self->frame[i];
+ const char * ftag = cpl_frame_get_tag(frame);
+ cpl_frame * copy;
+ cpl_error_code error;
+
+ if (ftag == NULL) {
+ /* The frame is ill-formed */
+ irplib_framelist_delete(new);
+ cpl_ensure(0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ }
+
+ if (strcmp(tag, ftag)) continue;
+
+ copy = cpl_frame_duplicate(frame);
+
+ error = irplib_framelist_set(new, copy, newsize);
+ assert(error == CPL_ERROR_NONE);
+
+ if (self->propertylist[i] != NULL) new->propertylist[newsize]
+ = cpl_propertylist_duplicate(self->propertylist[i]);
+
+ newsize++;
+ }
+
+ assert( newsize == new->size );
+
+ if (newsize == 0) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "The list of %d frame(s) has no frames "
+ "with tag: %s", self->size, tag);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "The list of frame(s) has no frames "
+ "with the given tag");
+#endif
+ irplib_framelist_delete(new);
+ new = NULL;
+ }
+
+ return new;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extract the frames with the given tag from a framelist
+ @param self A non-empty framelist
+ @param regexp The regular expression of frame tag(s) to search for.
+ @param invert Boolean to invert the sense of the pattern matching.
+ @return The newly created framelist or NULL on error
+ @see irplib_framelist_extract
+
+ */
+/*----------------------------------------------------------------------------*/
+irplib_framelist * irplib_framelist_extract_regexp(const irplib_framelist* self,
+ const char * regexp,
+ cpl_boolean invert)
+{
+
+ irplib_framelist * new;
+ int error;
+ int i, newsize;
+ const int xor = invert == CPL_FALSE ? 0 : 1;
+ regex_t re;
+
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(regexp != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ error = regcomp(&re, regexp, REG_EXTENDED | REG_NOSUB);
+ cpl_ensure(!error, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ new = irplib_framelist_new();
+ newsize = 0;
+
+ for (i = 0; i < self->size; i++) {
+ const cpl_frame * frame = self->frame[i];
+ const char * tag = cpl_frame_get_tag(frame);
+ cpl_frame * copy;
+
+ if (tag == NULL) {
+ /* The frame is ill-formed */
+ irplib_framelist_delete(new);
+ regfree(&re);
+ cpl_ensure(0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ }
+
+ if ((regexec(&re, tag, (size_t)0, NULL, 0) == REG_NOMATCH ? 1 : 0)
+ ^ xor) continue;
+
+ copy = cpl_frame_duplicate(frame);
+
+ error = (int)irplib_framelist_set(new, copy, newsize);
+ assert(error == CPL_ERROR_NONE);
+
+ if (self->propertylist[i] != NULL) new->propertylist[newsize]
+ = cpl_propertylist_duplicate(self->propertylist[i]);
+
+ newsize++;
+
+ }
+
+ regfree(&re);
+
+ assert( newsize == new->size );
+
+ if (newsize == 0) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "The list of %d frame(s) has no frames "
+ "that match: %s", self->size, regexp);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "The list of frames has no frames "
+ "that match the regular expression");
+#endif
+ irplib_framelist_delete(new);
+ new = NULL;
+ }
+
+ return new;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the size of a framelist
+ @param self The framelist
+ @return The size or a negative number on error
+
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_framelist_get_size(const irplib_framelist * self)
+{
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1);
+
+ return self->size;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the specified frame from the framelist
+ @param self The framelist
+ @param pos position (0 for first)
+ @return The frame or NULL on error
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_frame * irplib_framelist_get(irplib_framelist * self, int pos)
+{
+ return (cpl_frame *)irplib_framelist_get_const(self, pos);
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the specified frame from the framelist
+ @param self The framelist
+ @param pos position (0 for first)
+ @return The frame or NULL on error
+
+ */
+/*----------------------------------------------------------------------------*/
+const cpl_frame * irplib_framelist_get_const(const irplib_framelist * self,
+ int pos)
+{
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(pos >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL);
+
+ return self->frame[pos];
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Duplicate a propertylist to the specified position in the framelist
+ @param self The framelist to modify
+ @param pos position (0 for first).
+ @param list The propertylist to copy
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_set_propertylist(irplib_framelist * self,
+ int pos,
+ const cpl_propertylist * list)
+{
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(list != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pos >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ cpl_propertylist_delete(self->propertylist[pos]);
+
+ self->propertylist[pos] = cpl_propertylist_duplicate(list);
+
+ cpl_ensure_code(self->propertylist[pos] != NULL, cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the propertylist of the specified frame in the framelist
+ @param self The framelist
+ @param pos position (0 for first)
+ @return The propertylist or NULL on error
+ @note The propertylist must first be created, for example with
+ irplib_framelist_load_propertylist(self, pos, ...), otherwise
+ an error occurs.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_propertylist * irplib_framelist_get_propertylist(irplib_framelist * self,
+ int pos)
+{
+
+ return (cpl_propertylist *)irplib_framelist_get_propertylist_const(self,
+ pos);
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the propertylist of the specified frame in the framelist
+ @param self The framelist
+ @param pos position (0 for first)
+ @return The propertylist or NULL on error
+ @note The propertylist must first be created, for example with
+ irplib_framelist_load_propertylist(self, pos, ...), otherwise
+ an error occurs.
+
+ */
+/*----------------------------------------------------------------------------*/
+const cpl_propertylist * irplib_framelist_get_propertylist_const(
+ const irplib_framelist * self,
+ int pos)
+{
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(pos >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL);
+
+ cpl_ensure(self->propertylist[pos] != NULL,
+ CPL_ERROR_DATA_NOT_FOUND, NULL);
+
+ return self->propertylist[pos];
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the propertylist of the specified frame in the framelist
+ @param self The framelist to modify
+ @param pos position (0 for first).
+ @param ind The index of the date set to read
+ @param regexp The regular expression of properties to load
+ @param invert Boolean to invert the sense of the pattern matching.
+ @return CPL_ERROR_NONE or the relevant CPL error code
+ @see cpl_propertylist_load_regexp()
+ @note Use a regexp of ".?" to load all properties. If a propertylist
+ already exists it is deleted and replaced by the new one.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_load_propertylist(irplib_framelist * self,
+ int pos, int ind,
+ const char * regexp,
+ cpl_boolean invert)
+{
+
+ const char * filename;
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(regexp != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pos >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ filename = cpl_frame_get_filename(self->frame[pos]);
+
+ cpl_ensure_code(filename != NULL, cpl_error_get_code());
+
+ cpl_propertylist_delete(self->propertylist[pos]);
+
+ self->propertylist[pos] = cpl_propertylist_load_regexp(filename, ind,
+ regexp,
+ invert ? 1 : 0);
+
+ if (self->propertylist[pos] == NULL) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ return cpl_error_set_message(cpl_func, cpl_error_get_code(), "Could "
+ "not load FITS header from '%s' using "
+ "regexp '%s'", filename, regexp);
+#else
+ return cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Could not load FITS header");
+#endif
+ }
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the propertylists of all frames in the framelist
+ @param self The framelist to modify
+ @param ind The index of the date set to read
+ @param regexp The regular expression of properties to load
+ @param invert Boolean to invert the sense of the pattern matching.
+ @return CPL_ERROR_NONE or the relevant CPL error code
+ @see irplib_framelist_load_propertylist()
+ @note Use a regexp of "" to load all properties. If a frame already has
+ a propertylist, it is not modified (and no propertylist is loaded
+ for that frame).
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_load_propertylist_all(irplib_framelist * self,
+ int ind,
+ const char * regexp,
+ cpl_boolean invert)
+{
+
+ int nprops = 0;
+ int nfiles = 0;
+ int i;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(regexp != NULL, CPL_ERROR_NULL_INPUT);
+
+ for (i=0; i < self->size; i++) {
+ if (self->propertylist[i] == NULL)
+ cpl_ensure_code(!irplib_framelist_load_propertylist(self, i,
+ ind,
+ regexp,
+ invert),
+ cpl_error_get_code());
+ /* Counting just for diagnostics - this actually causes
+ the whole list to be reiterated :-( */
+ nprops += cpl_propertylist_get_size(self->propertylist[i]);
+ nfiles++;
+ }
+
+ cpl_msg_info(cpl_func, "List of %d frames has %d properties", nfiles,
+ nprops);
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Set the tag of all frames in the list
+ @param self The framelist to modify
+ @param tag The new tag of the frames
+ @return CPL_ERROR_NONE or the relevant _cpl_error_code_
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_set_tag_all(irplib_framelist * self,
+ const char * tag)
+{
+
+ int i;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(tag != NULL, CPL_ERROR_NULL_INPUT);
+
+ for (i=0; i < self->size; i++)
+ cpl_ensure_code(!cpl_frame_set_tag(self->frame[i], tag),
+ cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Add a frame to a framelist
+ @param self The framelist to modify
+ @param frame The frame to insert into the framelist
+ @param pos position (0 for first).
+ @return CPL_ERROR_NONE or the relevant CPL error code
+ @note It is an error to call cpl_frame_delete() on a frame that is inserted
+ in a framelist.
+
+ It is allowed to specify the position equal to the size of the list.
+ This will increment the size of the list.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_set(irplib_framelist * self, cpl_frame * frame,
+ int pos)
+{
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(frame != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pos >= 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ if (pos == self->size) {
+
+ self->size++;
+
+ irplib_framelist_set_size(self);
+
+ } else {
+
+ cpl_ensure_code(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ cpl_frame_delete(self->frame[pos]);
+ cpl_propertylist_delete(self->propertylist[pos]);
+ }
+
+ self->frame[pos] = frame;
+ self->propertylist[pos] = NULL;
+
+ return CPL_ERROR_NONE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Erase a frame from a framelist and delete it and its propertylist
+ @param self The non-empty framelist to modify
+ @param pos position of frame to delete (0 for first).
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_erase(irplib_framelist * self, int pos)
+{
+
+ int i;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pos >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+
+ /* Delete the specified frame and its propertylist */
+ cpl_frame_delete(self->frame[pos]);
+ cpl_propertylist_delete(self->propertylist[pos]);
+
+ /* Move following frames down one position */
+ for (i = pos+1; i < self->size; i++) {
+
+ self->frame[i-1] = self->frame[i];
+
+ self->propertylist[i-1] = self->propertylist[i];
+
+ }
+
+ self->size--;
+
+ irplib_framelist_set_size(self);
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Erase a frame from a framelist and return it to the caller
+ @param self The non-empty framelist to modify
+ @param pos position of frame to delete (0 for first).
+ @param plist Pointer to a propertylist or NULL
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ The specified frame is removed from the framelist and its size is decreased
+ by one. The frame is returned to the caller. The caller may also retrieve
+ the propertylist of the frame by passing a non-NULL pointer. On success
+ this may point to NULL, if a propertylist was not created for the
+ frame. If the caller passes a NULL-pointer for the propertylist, the
+ propertylist is deallocated.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_frame * irplib_framelist_unset(irplib_framelist * self, int pos,
+ cpl_propertylist ** plist)
+
+{
+ cpl_frame * frame;
+ int i;
+
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(pos >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(pos < self->size, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL);
+
+ /* Get the specified frame and its propertylist */
+ frame = self->frame[pos];
+
+ if (plist != NULL)
+ *plist = self->propertylist[pos];
+ else
+ cpl_propertylist_delete(self->propertylist[pos]);
+
+
+ /* Move following frames down one position */
+ for (i = pos+1; i < self->size; i++) {
+
+ self->frame[i-1] = self->frame[i];
+
+ self->propertylist[i-1] = self->propertylist[i];
+
+ }
+
+ self->size--;
+
+ irplib_framelist_set_size(self);
+
+ return frame;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Erase all frames from a framelist
+ @param self The framelist to modify, or NULL
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_framelist_empty(irplib_framelist * self)
+{
+
+ if (self != NULL) {
+
+ /* Deallocate all frames and their propertylists */
+ while (self->size > 0) {
+ self->size--;
+ cpl_frame_delete(self->frame[self->size]);
+ cpl_propertylist_delete(self->propertylist[self->size]);
+
+ }
+
+ /* Deallocate the arrays */
+ irplib_framelist_set_size(self);
+
+ }
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Verify that a property is present for all frames
+ @param self The framelist to verify
+ @param key Property that must be present for all the frames
+ @param type The type the property must have, or CPL_TYPE_INVALID
+ @param is_equal If true, the value must be identical for all keys
+ @param fp_tol The non-negative tolerance for floating point comparison
+ @return CPL_ERROR_NONE or the relevant CPL error code
+ @note It is allowed for a frame to have a NULL propertylist,
+ in which case no check is performed.
+ If type is CPL_TYPE_INVALID the check for a specific type is disabled.
+ However, with is_equal true, all properties must nevertheless have the
+ same type.
+ fp_tol is used only when is_equal is true and the type is
+ (explicitly or implicitly) CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
+
+ To verify the presence of the MJD-OBS keyword:
+ @code
+ irplib_framelist_contains(myframes, "MJD-OBS", CPL_TYPE_INVALID,
+ CPL_FALSE, 0.0);
+ @endcode
+
+ To verify that the EXPTIME is identical to within 0.1 millisecond:
+ @code
+ irplib_framelist_contains(myframes, "EXPTIME", CPL_TYPE_INVALID,
+ CPL_TRUE, 0.0001);
+ @endcode
+
+ To verify that the keyword "ESO INS LAMP ST" is of type boolean and that
+ it has the same value for all frames:
+ @code
+ irplib_framelist_contains(myframes, "ESO INS LAMP ST", CPL_TYPE_BOOL,
+ CPL_TRUE, 0.0);
+ @endcode
+
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_framelist_contains(const irplib_framelist * self,
+ const char * key, cpl_type type,
+ cpl_boolean is_equal, double fp_tol)
+{
+
+ char * value_0;
+ char * value_i;
+ cpl_type type_0 = CPL_TYPE_INVALID;
+ int i, ifirst = -1; /* First non-NULL propertylist */
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(key != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(fp_tol >= 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ for (i=0; i < self->size; i++) {
+ cpl_type type_i;
+
+
+ if (self->propertylist[i] == NULL) continue;
+ if (ifirst < 0) ifirst = i;
+
+ type_i = cpl_propertylist_get_type(self->propertylist[i], key);
+
+ if (type_i == CPL_TYPE_INVALID) {
+ if (type == CPL_TYPE_INVALID)
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, cpl_error_get_code(), "FITS "
+ "key '%s' is missing from file %s", key,
+ cpl_frame_get_filename(self->frame[i]));
+ else
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "FITS key '%s' [%s] is missing from file "
+ "%s", key, cpl_type_get_name(type),
+ cpl_frame_get_filename(self->frame[i]));
+#else
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "A FITS key is missing from a file");
+ else
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "A FITS key is missing from a file");
+#endif
+ return cpl_error_get_code();
+ }
+
+ if (type != CPL_TYPE_INVALID && type_i != type) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ return cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE,
+ "FITS key '%s' has type %s instead of "
+ "%s in file %s", key,
+ cpl_type_get_name(type_i),
+ cpl_type_get_name(type),
+ cpl_frame_get_filename(self->frame[i]));
+#else
+ return cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE,
+ "A FITS key had an unexpected type");
+#endif
+
+ }
+
+ if (!is_equal) continue;
+
+ if (type_0 == CPL_TYPE_INVALID) {
+ type_0 = type_i;
+ continue;
+ }
+
+ if (type_i != type_0) {
+ assert( type == CPL_TYPE_INVALID );
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH,
+ "FITS key '%s' has different types "
+ "(%s <=> %s) in files %s and %s", key,
+ cpl_type_get_name(type_0),
+ cpl_type_get_name(type_i),
+ cpl_frame_get_filename(self->frame[0]),
+ cpl_frame_get_filename(self->frame[i]));
+#else
+ return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH,
+ "A FITS key has different types in "
+ "two files");
+#endif
+ }
+
+ if (irplib_property_equal(self->propertylist[ifirst],
+ self->propertylist[i],
+ key, type_0, fp_tol, &value_0, &value_i))
+ continue;
+
+ if ((type_0 == CPL_TYPE_FLOAT || type_0 == CPL_TYPE_DOUBLE)
+ && fp_tol > 0.0) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, "FITS"
+ " key '%s' [%s] has values that differ by "
+ "more than %g (%s <=> %s) in files %s and %s",
+ key, cpl_type_get_name(type_0), fp_tol,
+ value_0, value_i,
+ cpl_frame_get_filename(self->frame[0]),
+ cpl_frame_get_filename(self->frame[i]));
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, "A "
+ "FITS key has values that differ by more "
+ "than the allowed tolerance in two file");
+#endif
+ } else {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT,
+ "FITS key '%s' [%s] has different values "
+ "(%s <=> %s) in files %s and %s", key,
+ cpl_type_get_name(type_0),
+ value_0, value_i,
+ cpl_frame_get_filename(self->frame[0]),
+ cpl_frame_get_filename(self->frame[i]));
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, "A "
+ "FITS key has different values in two files");
+#endif
+ }
+ cpl_free(value_0);
+ cpl_free(value_i);
+
+ return cpl_error_get_code();
+ }
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load an imagelist from a framelist
+ @param self The framelist
+ @param pixeltype The required type of the pixels in the images
+ @param planenum The (non-negative ) plane number
+ @param extnum The non-negative extension (0 for primary data unit)
+ @return The loaded list of images or NULL on error.
+ @see cpl_image_load()
+ @note The returned cpl_imagelist must be deallocated using
+ cpl_imagelist_delete()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_imagelist * irplib_imagelist_load_framelist(const irplib_framelist * self,
+ cpl_type pixeltype,
+ int planenum,
+ int extnum)
+{
+
+ cpl_imagelist * list = NULL;
+ cpl_image * image = NULL;
+ int i;
+
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(extnum >= 0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL);
+ cpl_ensure(planenum >= 0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL);
+
+ list = cpl_imagelist_new();
+
+ for (i=0; i < self->size; i++, image = NULL) {
+ const char * filename = cpl_frame_get_filename(self->frame[i]);
+ cpl_error_code error;
+
+ if (filename == NULL) break;
+
+ image = cpl_image_load(filename, pixeltype, planenum, extnum);
+ if (image == NULL) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ (void)cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Could not load FITS-image from plane "
+ "%d in extension %d in file %s",
+ planenum, extnum, filename);
+#else
+ (void)cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Could not load FITS-image");
+#endif
+ break;
+ }
+
+ error = cpl_imagelist_set(list, image, i);
+ assert(error == CPL_ERROR_NONE);
+ }
+
+ cpl_image_delete(image);
+
+ if (cpl_imagelist_get_size(list) != self->size) {
+ cpl_imagelist_delete(list);
+ list = NULL;
+ assert(cpl_error_get_code() != CPL_ERROR_NONE);
+ }
+
+ return list;
+
+}
+
+
+/**@}*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Set the size of the framelist - without handling any frames
+ @param self The framelist to modify
+ @return void
+ @note This private function should be used by all morphological functions;
+ it will assert() on NULL input.
+
+ This function updates the arrays used to hold the frames and propertylists
+ to the size specified by the size member.
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_framelist_set_size(irplib_framelist * self)
+{
+
+
+ assert( self != NULL);
+
+ if (self->size == 0) {
+ /* The list has been emptied */
+ cpl_free(self->frame);
+ cpl_free(self->propertylist);
+ self->frame = NULL;
+ self->propertylist = NULL;
+ } else {
+ /* Update the size of the arrays */
+
+ self->frame = cpl_realloc(self->frame, self->size * sizeof(cpl_frame*));
+ self->propertylist =
+ cpl_realloc(self->propertylist,
+ self->size * sizeof(cpl_propertylist*));
+ }
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compare the value of two properties
+ @param self The first property
+ @param other The other property of the same type
+ @param fp_tol The non-negative tolerance for floating point comparison
+ @param sstring The string value of the first property (if they differ)
+ @param ostring The string value of the other property (if they differ)
+ @return CPL_TRUE if equal, CPL_FALSE if not.
+ @note This private function will assert() on illegal input.
+ The names of the two properties are not compared.
+
+ Iff the function returns CPL_FALSE *sstring and *ostring must be deallocated
+ with cpl_free().
+
+ The original content of *sstring and *ostring is not accessed.
+
+ FIXME: This function should really take two properties (and no key + type),
+ but the cpl_propertylist module is flawed: It does not have
+ an accessor by name... :-(
+ The penalty for this is multiple propertylist searches by key
+ (and loss of commutativity) :-(((
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_boolean irplib_property_equal(const cpl_propertylist * self,
+ const cpl_propertylist * other,
+ const char * key, cpl_type type,
+ double fp_tol,
+ char ** sstring, char ** ostring)
+{
+
+ cpl_boolean equal;
+
+
+ assert(self != NULL);
+ assert(other != NULL);
+ assert(key != NULL);
+ assert(sstring != NULL);
+ assert(ostring != NULL);
+
+ /* FIXME: disable for better performance also with debugging */
+ assert(cpl_propertylist_get_type(other, key) == type);
+ assert(fp_tol >= 0.0);
+
+ if (self == other) return CPL_TRUE;
+
+ switch (type) {
+
+ case CPL_TYPE_CHAR: {
+ const char svalue = cpl_propertylist_get_char(self, key);
+ const char ovalue = cpl_propertylist_get_char(other, key);
+
+ equal = svalue == ovalue ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_sprintf("%c", svalue);
+ *ostring = cpl_sprintf("%c", ovalue);
+ }
+ break;
+ }
+
+ case CPL_TYPE_BOOL: {
+ const int svalue = cpl_propertylist_get_bool(self, key);
+ const int ovalue = cpl_propertylist_get_bool(other, key);
+
+ equal = svalue == ovalue ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_strdup(svalue == 0 ? "F" : "T");
+ *ostring = cpl_strdup(ovalue == 0 ? "F" : "T");
+ }
+ break;
+ }
+
+ case CPL_TYPE_INT: {
+ const int svalue = cpl_propertylist_get_int(self, key);
+ const int ovalue = cpl_propertylist_get_int(other, key);
+
+ equal = svalue == ovalue ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_sprintf("%d", svalue);
+ *ostring = cpl_sprintf("%d", ovalue);
+ }
+ break;
+ }
+
+ case CPL_TYPE_LONG: {
+ const long svalue = cpl_propertylist_get_long(self, key);
+ const long ovalue = cpl_propertylist_get_long(other, key);
+
+ equal = svalue == ovalue ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_sprintf("%ld", svalue);
+ *ostring = cpl_sprintf("%ld", ovalue);
+ }
+ break;
+ }
+
+ case CPL_TYPE_FLOAT: {
+ const double svalue = (double)cpl_propertylist_get_float(self, key);
+ const double ovalue = (double)cpl_propertylist_get_float(other, key);
+
+ equal = (fabs(svalue - ovalue) <= fp_tol) ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_sprintf("%f", svalue);
+ *ostring = cpl_sprintf("%f", ovalue);
+ }
+ break;
+ }
+
+ case CPL_TYPE_DOUBLE: {
+ const double svalue = cpl_propertylist_get_double(self, key);
+ const double ovalue = cpl_propertylist_get_double(other, key);
+
+ equal = (fabs(svalue - ovalue) <= fp_tol) ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_sprintf("%g", svalue);
+ *ostring = cpl_sprintf("%g", ovalue);
+ }
+ break;
+ }
+ case CPL_TYPE_STRING: {
+ const char * svalue = cpl_propertylist_get_string(self, key);
+ const char * ovalue = cpl_propertylist_get_string(other, key);
+
+ equal = strcmp(svalue, ovalue) == 0 ? CPL_TRUE : CPL_FALSE;
+ if (!equal) {
+ *sstring = cpl_strdup(svalue);
+ *ostring = cpl_strdup(ovalue);
+ }
+ break;
+ }
+ default:
+ /* Unknown property type */
+ assert( 0 );
+
+ equal = CPL_FALSE; /* In case of -DNDEBUG */
+
+ }
+
+ if (!equal) {
+ assert( *sstring != NULL );
+ assert( *ostring != NULL );
+ }
+
+ return equal;
+
+}
diff --git a/irplib/irplib_framelist.h b/irplib/irplib_framelist.h
new file mode 100644
index 0000000..fe209cb
--- /dev/null
+++ b/irplib/irplib_framelist.h
@@ -0,0 +1,107 @@
+/* $Id: irplib_framelist.h,v 1.8 2008/11/20 10:24:47 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2008/11/20 10:24:47 $
+ * $Revision: 1.8 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_FRAMELIST_H
+#define IRPLIB_FRAMELIST_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ New type
+ -----------------------------------------------------------------------------*/
+
+typedef struct _irplib_framelist_ irplib_framelist;
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+/* Constructors and destructor */
+
+irplib_framelist * irplib_framelist_new(void);
+
+void irplib_framelist_delete(irplib_framelist *);
+
+irplib_framelist * irplib_framelist_cast(const cpl_frameset *);
+
+irplib_framelist * irplib_framelist_extract(const irplib_framelist *,
+ const char *);
+irplib_framelist * irplib_framelist_extract_regexp(const irplib_framelist *,
+ const char *, cpl_boolean);
+
+/* Accessors and element modifiers */
+
+int irplib_framelist_get_size(const irplib_framelist *);
+
+const cpl_frame * irplib_framelist_get_const(const irplib_framelist *, int);
+
+cpl_frame * irplib_framelist_get(irplib_framelist *, int);
+
+const cpl_propertylist * irplib_framelist_get_propertylist_const(
+ const irplib_framelist *,
+ int);
+
+cpl_propertylist * irplib_framelist_get_propertylist(irplib_framelist *, int);
+
+cpl_error_code irplib_framelist_set_propertylist(irplib_framelist *, int,
+ const cpl_propertylist *);
+
+cpl_error_code irplib_framelist_load_propertylist(irplib_framelist *, int,
+ int, const char *,
+ cpl_boolean);
+
+cpl_error_code irplib_framelist_load_propertylist_all(irplib_framelist *, int,
+ const char *,
+ cpl_boolean);
+
+cpl_error_code irplib_framelist_set_tag_all(irplib_framelist *, const char *);
+
+
+/* Inserting and removing elements */
+
+cpl_error_code irplib_framelist_set(irplib_framelist *, cpl_frame *, int);
+
+cpl_error_code irplib_framelist_erase(irplib_framelist *, int);
+
+cpl_frame * irplib_framelist_unset(irplib_framelist *, int, cpl_propertylist **);
+
+void irplib_framelist_empty(irplib_framelist *);
+
+/* Others */
+cpl_error_code irplib_framelist_contains(const irplib_framelist *, const char *,
+ cpl_type, cpl_boolean, double);
+
+cpl_imagelist * irplib_imagelist_load_framelist(const irplib_framelist *,
+ cpl_type, int, int);
+
+cpl_frameset * irplib_frameset_cast(const irplib_framelist *);
+
+#endif
diff --git a/irplib/irplib_hist.c b/irplib/irplib_hist.c
new file mode 100644
index 0000000..9629dcc
--- /dev/null
+++ b/irplib/irplib_hist.c
@@ -0,0 +1,350 @@
+
+
+/*
+ * This file is part of the irplib package
+ * Copyright (C) 2002, 2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: kmirny $
+ * $Id: irplib_hist.c,v 1.7 2009/10/15 14:02:18 kmirny Exp $
+ * $Date: 2009/10/15 14:02:18 $
+ * $Revision: 1.7 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <math.h>
+
+#include "irplib_hist.h"
+
+struct _irplib_hist_
+{
+ unsigned long * bins;
+ unsigned long nbins;
+ double start;
+ double range;
+};
+
+/*
+ * Create a new empty histogram
+ */
+
+irplib_hist *
+irplib_hist_new(void)
+{
+ return (irplib_hist *) cpl_calloc(1, sizeof(irplib_hist));
+}
+
+/*
+ * Delete a histogram
+ */
+
+void
+irplib_hist_delete(irplib_hist * d)
+{
+ if (d == NULL)
+ return;
+
+ if (d -> bins)
+ cpl_free(d -> bins);
+
+ cpl_free(d);
+}
+
+/*
+ * Initialise a histogram with user-defined values
+ */
+
+cpl_error_code
+irplib_hist_init(irplib_hist * hist,
+ unsigned long nbins,
+ double start,
+ double range)
+{
+ /* Test the entries */
+ cpl_ensure_code(hist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(nbins > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(range > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(hist -> bins == NULL, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Initialise the histogram structure */
+ hist -> bins = (unsigned long *) cpl_calloc(nbins, sizeof(unsigned long));
+ hist -> nbins = nbins;
+ hist -> start = start;
+ hist -> range = range;
+
+ return cpl_error_get_code();
+}
+
+/*
+ * Return the value of a histogram bin.
+ * An uninitialised histogram is considered an illegal input.
+ */
+
+unsigned long
+irplib_hist_get_value(const irplib_hist * hist,
+ const unsigned long binpos)
+{
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, 0);
+ cpl_ensure(hist -> bins != NULL, CPL_ERROR_ILLEGAL_INPUT, 0);
+ cpl_ensure(binpos < hist -> nbins, CPL_ERROR_ILLEGAL_INPUT, 0);
+
+ return hist -> bins[binpos];
+}
+
+/*
+ * Return the number of bins in the histogram.
+ */
+
+unsigned long
+irplib_hist_get_nbins(const irplib_hist * hist)
+{
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, 0);
+
+ return hist -> nbins;
+}
+
+/*
+ * Return the binwidth of the histogram.
+ */
+
+double
+irplib_hist_get_bin_size(const irplib_hist * hist)
+{
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, 0);
+ cpl_ensure(hist -> bins != NULL, CPL_ERROR_ILLEGAL_INPUT, 0);
+
+ return hist -> range / (double)(hist -> nbins - 2);
+}
+
+/*
+ * Return the range covered by the histogram.
+ */
+
+double
+irplib_hist_get_range(const irplib_hist * hist)
+{
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, 0);
+
+ return hist -> range;
+}
+
+/*
+ * Return the real value corresponding
+ * to the inferior limit of the histogram..
+ */
+
+double
+irplib_hist_get_start(const irplib_hist * hist)
+{
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, 0);
+ cpl_ensure(hist -> bins != NULL, CPL_ERROR_ILLEGAL_INPUT, 0);
+
+ return hist -> start;
+}
+
+/*
+ * Fill a histogram for an image.
+ * If the histogram is uninitialised,
+ * the function initialises it with default values.
+ */
+
+cpl_error_code
+irplib_hist_fill(irplib_hist * hist,
+ const cpl_image * image)
+{
+ double binwidth = 1.0;
+ int nsamples;
+ int i;
+ const float * data = 0;
+ const cpl_binary* bpm_data = 0;
+ const cpl_mask* bpm = 0;
+ cpl_error_code error;
+
+ /* Test the entries */
+ cpl_ensure_code(hist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(image != NULL, CPL_ERROR_NULL_INPUT);
+
+ if (hist -> bins == NULL) {
+ const double hstart = cpl_image_get_min(image);
+ const double hrange = cpl_image_get_max(image) - hstart;
+
+ /*
+ * Whichever function that computes an optimal binwidth
+ * should be introduced inside this if-statement, here.
+ */
+
+ /* 2 extra-bins for possible out-of-range values */
+ const unsigned long nbins = (unsigned long) (hrange / binwidth) + 2;
+
+ error = irplib_hist_init(hist, nbins, hstart, hrange);
+ cpl_ensure_code(!error, error);
+ } else {
+ cpl_ensure_code(hist -> range > 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* 2 bins reserved for possible out-of-range values */
+ binwidth = hist -> range / (double)(hist -> nbins - 2);
+ }
+
+ nsamples = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+ data = cpl_image_get_data_float_const(image);
+ bpm = cpl_image_get_bpm_const(image);
+ if (bpm)
+ {
+ bpm_data = cpl_mask_get_data_const(bpm); // bad pixel mask
+ }
+
+ for (i = 0; i < nsamples; i++)
+ {
+ int pos = 0;
+ if(bpm_data && bpm_data[i] == CPL_BINARY_1)
+ {
+ continue;
+ }
+ pos = (int)((data[i] - hist -> start) / binwidth);
+ if (pos < 0)
+ {
+ hist -> bins[0]++;
+ } else if ((unsigned long) pos >= (hist -> nbins - 2))
+ {
+ hist -> bins[hist -> nbins - 1]++;
+ } else
+ {
+ hist -> bins[pos + 1]++;
+ }
+ }
+
+ return cpl_error_get_code();
+}
+
+/*
+ * Compute the maximum of a histogram.
+ * Return: the maximum value.
+ * The parameter max_where is a pointer to the position
+ * of the maximum in the histogram.
+ */
+
+unsigned long
+irplib_hist_get_max(const irplib_hist * hist,
+ unsigned long * maxpos)
+{
+ unsigned long max = 0;
+ unsigned long ui;
+
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, 0);
+ cpl_ensure(maxpos != NULL, CPL_ERROR_NULL_INPUT, 0);
+ cpl_ensure(hist -> bins != NULL, CPL_ERROR_ILLEGAL_INPUT, 0);
+
+ for(ui = 0; ui < hist -> nbins; ui++) {
+ double c_value = irplib_hist_get_value(hist, ui);
+ if(c_value > max) {
+ max = c_value;
+ *maxpos = ui;
+ }
+ }
+
+ return max;
+}
+
+/*
+ * Cast a histogram into a table with a single column named "HIST"
+ */
+
+cpl_table *
+irplib_hist_cast_table(const irplib_hist * hist)
+{
+ cpl_table * table;
+ cpl_error_code error;
+
+ cpl_ensure(hist != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(hist -> bins != NULL, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ table = cpl_table_new(hist -> nbins);
+
+ error = cpl_table_new_column(table, "HIST", CPL_TYPE_INT);
+ cpl_ensure(!error, error, NULL);
+
+ error = cpl_table_copy_data_int(table, "HIST", (int *)(hist -> bins));
+ cpl_ensure(!error, error, NULL);
+
+ return table;
+}
+
+/*
+ * Collapse the histogram: add the values of all bins.
+ * Used now only for debugging purposes.
+ */
+
+cpl_error_code
+irplib_hist_collapse(irplib_hist * hist,
+ unsigned long new_nbins)
+{
+ unsigned long ui, nuj;
+ unsigned long * old_bins;
+ unsigned long old_nbins;
+ double collapse_rate;
+ cpl_error_code error;
+ unsigned long rest;
+
+ cpl_ensure_code(hist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(hist -> bins != NULL, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(new_nbins > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(new_nbins <= hist -> nbins, CPL_ERROR_ILLEGAL_INPUT);
+
+ old_bins = hist -> bins;
+ old_nbins = hist -> nbins;
+
+ hist -> bins = NULL;
+ error = irplib_hist_init(hist, new_nbins, hist -> start, hist -> range);
+ cpl_ensure_code(!error, error);
+
+ collapse_rate = (double) (old_nbins - 2) / (double) (new_nbins - 2);
+
+ /* The out-of-range values are not affected by the collapsing operation */
+ hist -> bins[0] = old_bins[0];
+ hist -> bins[new_nbins - 1] = old_bins[old_nbins - 1];
+
+ rest = 0;
+ nuj = 1;
+
+ for (ui = 1; ui < new_nbins - 1; ui++) {
+ unsigned long uj;
+ const double up = collapse_rate * ui;
+
+ hist -> bins[ui] += rest;
+
+ for (uj = nuj; uj < (unsigned long) up + 1; uj++)
+ hist -> bins[ui] += old_bins[uj];
+
+ rest = (unsigned long)(up - (unsigned long) up) * old_bins[uj];
+ hist -> bins[ui] += rest;
+
+ rest = old_bins[uj] - rest;
+ nuj = uj + 1;
+ }
+
+ cpl_free(old_bins);
+
+ return cpl_error_get_code();
+}
diff --git a/irplib/irplib_hist.h b/irplib/irplib_hist.h
new file mode 100644
index 0000000..f452bb6
--- /dev/null
+++ b/irplib/irplib_hist.h
@@ -0,0 +1,93 @@
+/* $Id: irplib_hist.h,v 1.3 2007/09/07 14:23:50 lbilbao Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002, 2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: lbilbao $
+ * $Date: 2007/09/07 14:23:50 $
+ * $Revision: 1.3 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_HIST_H
+#define IRPLIB_HIST_H
+
+#include <cpl.h>
+
+typedef struct _irplib_hist_ irplib_hist;
+
+/* Creation/Destruction functions */
+
+irplib_hist *
+irplib_hist_new(void);
+
+void
+irplib_hist_delete(irplib_hist *);
+
+/* Initialisation function */
+
+cpl_error_code
+irplib_hist_init(irplib_hist *,
+ unsigned long ,
+ double ,
+ double );
+
+/* Accessor functions */
+
+unsigned long
+irplib_hist_get_value(const irplib_hist *,
+ const unsigned long);
+
+unsigned long
+irplib_hist_get_nbins(const irplib_hist *);
+
+double
+irplib_hist_get_bin_size(const irplib_hist *);
+
+double
+irplib_hist_get_range(const irplib_hist *);
+
+double
+irplib_hist_get_start(const irplib_hist *);
+
+/* Histogram computing function */
+
+cpl_error_code
+irplib_hist_fill(irplib_hist *,
+ const cpl_image *);
+
+/* Statistics functions */
+
+unsigned long
+irplib_hist_get_max(const irplib_hist *,
+ unsigned long *);
+
+/* Casting function */
+
+cpl_table *
+irplib_hist_cast_table(const irplib_hist *);
+
+/* Functions for operations on histograms */
+
+cpl_error_code
+irplib_hist_collapse(irplib_hist *,
+ unsigned long);
+
+#endif /* IRPLIB_HIST_H */
+
diff --git a/irplib/irplib_ksigma_clip.c b/irplib/irplib_ksigma_clip.c
new file mode 100644
index 0000000..555a7f6
--- /dev/null
+++ b/irplib/irplib_ksigma_clip.c
@@ -0,0 +1,258 @@
+/* $Id: irplib_ksigma_clip.c,v 1.1 2011/11/02 13:18:28 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002, 2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2011/11/02 13:18:28 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <complex.h>
+
+/*---------------------------------------------------------------------------
+ Includes
+ ---------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <string.h>
+#include <assert.h>
+#include <float.h>
+
+#include <cpl.h>
+
+#include "irplib_ksigma_clip.h"
+
+#include "irplib_hist.h"
+#include "irplib_utils.h"
+
+/*--------------------------------------------------------------------------*/
+
+/*
+ * @defgroup ksigmaclip kappa sigma clip functions
+ */
+
+/*--------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+ Defines
+ ---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------
+ Private function prototypes
+ ---------------------------------------------------------------------------*/
+
+static cpl_error_code
+irplib_ksigma_clip_double(const double * pi,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ int nx,
+ double var_sum,
+ int npixs,
+ double kappa,
+ int nclip,
+ double tolerance,
+ double * mean,
+ double * stdev);
+
+static cpl_error_code
+irplib_ksigma_clip_float(const float * pi,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ int nx,
+ double var_sum,
+ int npixs,
+ double kappa,
+ int nclip,
+ double tolerance,
+ double * mean,
+ double * stdev);
+
+static cpl_error_code
+irplib_ksigma_clip_int(const int * pi,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ int nx,
+ double var_sum,
+ int npixs,
+ double kappa,
+ int nclip,
+ double tolerance,
+ double * mean,
+ double * stdev);
+
+
+/*---------------------------------------------------------------------------*/
+/**
+ @brief Apply kappa-sigma clipping on input image
+ @param img Input image
+ @param llx Lower left x position (FITS convention)
+ @param lly Lower left y position (FITS convention)
+ @param urx Upper right x position (FITS convention)
+ @param ury Upper right y position (FITS convention)
+ @param kappa Kappa value for the clipping
+ @param nclip Number of clipping iterations
+ @param tolerance tolerance on range between two successive clip iterations
+ @param kmean Mean after clipping (output)
+ @param kstdev Stdev after clipping (output)
+ @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error
+
+ This function applies an iterative kappa-sigma clipping on the image and
+ returns mean and stdev after the clipping.
+
+ The function takes as a starting point the "standard" values of mean and
+ stdev from cpl_stats.
+
+ On each iteration, the contribution of pixels outside the range
+ [mean - kappa * stdev, mean + kappa * stdev] is removed, the values of
+ mean and stdev are updated, and so are the limits of the range to be used
+ in the next iteration as well.
+
+ The algorithm stops after nclip iterations or when the variation of the
+ range between two consecutive iterations is smaller (absolute value) than
+ the tolerance.
+
+ The effectiveness of this function resides on the way the update of the
+ values of mean and stdev is done.
+
+ The contribution of a single pixel in variance can be removed as follows:
+
+ \sum_{i=1}^{N-1} (x_i - \overline{x}_{n-1})^2 =
+ \sum_{i=1}^ N (x_i - \overline{x}_n )^2 -
+ \frac{N}{N-1} \,( \, \overline{x}_n - x_{n} )^2
+
+ For further details on the mathematical aspects, please refer to DFS05126.
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if img or kmean is NULL
+ - CPL_ERROR_ILLEGAL_INPUT if
+ a) the window specification is illegal (llx > urx or lly > ury)
+ b) the window specification is outside the image
+ c) the tolerance is negative
+ d) kappa is <= 1.0
+ e) nclip is <= 0.
+
+ The values of kmean and kstdev is undefined on error.
+*/
+/*---------------------------------------------------------------------------*/
+cpl_error_code
+irplib_ksigma_clip(const cpl_image * img,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ double kappa,
+ int nclip,
+ double tolerance,
+ double * kmean,
+ double * kstdev)
+{
+ cpl_errorstate inistate = cpl_errorstate_get();
+
+ int nx, ny;
+
+ cpl_stats * stats;
+ double mean, stdev, var_sum;
+ int npixs;
+
+ cpl_ensure_code(img != NULL, CPL_ERROR_NULL_INPUT);
+
+ nx = cpl_image_get_size_x(img);
+ ny = cpl_image_get_size_y(img);
+
+ cpl_ensure_code(llx > 0 && urx > llx && urx <= nx &&
+ lly > 0 && ury > lly && ury <= ny,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(tolerance >= 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(kappa > 1.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(nclip > 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ stats = cpl_stats_new_from_image_window(img,
+ CPL_STATS_MEAN | CPL_STATS_STDEV,
+ llx, lly, urx, ury);
+
+ npixs = cpl_stats_get_npix(stats); /* Non-bad pixels in window */
+ mean = cpl_stats_get_mean(stats);
+ stdev = cpl_stats_get_stdev(stats);
+ var_sum = stdev * stdev * (npixs - 1);
+
+ cpl_stats_delete(stats);
+
+ /* img, llx etc. may cause errors: Check and propagate */
+ cpl_ensure_code(cpl_errorstate_is_equal(inistate), cpl_error_get_code());
+
+ switch (cpl_image_get_type(img)) {
+ case CPL_TYPE_DOUBLE:
+ skip_if(irplib_ksigma_clip_double(cpl_image_get_data_double_const(img),
+ llx, lly, urx, ury, nx, var_sum,
+ npixs, kappa, nclip, tolerance,
+ &mean, &stdev));
+ break;
+ case CPL_TYPE_FLOAT:
+ skip_if(irplib_ksigma_clip_float(cpl_image_get_data_float_const(img),
+ llx, lly, urx, ury, nx, var_sum,
+ npixs, kappa, nclip, tolerance,
+ &mean, &stdev));
+ break;
+ case CPL_TYPE_INT:
+ skip_if(irplib_ksigma_clip_int(cpl_image_get_data_int_const(img),
+ llx, lly, urx, ury, nx, var_sum,
+ npixs, kappa, nclip, tolerance,
+ &mean, &stdev));
+ break;
+ default:
+ /* It is an error in CPL to reach this point */
+ assert( 0 );
+ }
+
+ *kmean = mean;
+ if (kstdev != NULL) *kstdev = stdev; /* Optional */
+
+ end_skip;
+
+ return cpl_error_get_code();
+}
+
+#define CONCAT(a,b) a ## _ ## b
+#define CONCAT2X(a,b) CONCAT(a,b)
+
+#define CPL_TYPE double
+#include "irplib_ksigma_clip_body.h"
+#undef CPL_TYPE
+
+#define CPL_TYPE float
+#include "irplib_ksigma_clip_body.h"
+#undef CPL_TYPE
+
+#define CPL_TYPE int
+#include "irplib_ksigma_clip_body.h"
+#undef CPL_TYPE
+
diff --git a/irplib/irplib_ksigma_clip.h b/irplib/irplib_ksigma_clip.h
new file mode 100644
index 0000000..b0c1d4f
--- /dev/null
+++ b/irplib/irplib_ksigma_clip.h
@@ -0,0 +1,52 @@
+/* $Id: irplib_ksigma_clip.h,v 1.1 2011/11/02 13:18:28 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002, 2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2011/11/02 13:18:28 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_KSIGMA_CLIP_H
+#define IRPLIB_KSIGMA_CLIP_H
+
+/*----------------------------------------------------------------------------
+ Includes
+ ----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*----------------------------------------------------------------------------
+ Prototypes
+ ----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_ksigma_clip(const cpl_image *,
+ const int,
+ const int,
+ const int,
+ const int,
+ const double,
+ const int,
+ const double,
+ double *,
+ double *);
+
+#endif
diff --git a/irplib/irplib_ksigma_clip_body.h b/irplib/irplib_ksigma_clip_body.h
new file mode 100644
index 0000000..a48a6ac
--- /dev/null
+++ b/irplib/irplib_ksigma_clip_body.h
@@ -0,0 +1,107 @@
+/* $Id: irplib_ksigma_clip_body.h,v 1.1 2011/11/02 13:18:28 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2011/11/02 13:18:28 $
+ * $Revision: 1.1 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#define TYPE_ADD(a) CONCAT2X(a, CPL_TYPE)
+
+static cpl_error_code
+TYPE_ADD(irplib_ksigma_clip)(const CPL_TYPE * pi,
+ int llx,
+ int lly,
+ int urx,
+ int ury,
+ int nx,
+ double var_sum,
+ int npixs,
+ double kappa,
+ int nclip,
+ double tolerance,
+ double * mean,
+ double * stdev)
+{
+ int pos0 = (llx - 1) + (lly - 1) * nx; /* 1st pixel to process */
+ double nb = (double) npixs; /* Non-bad pixels in window */
+
+ double lo_cut = *mean - kappa * (*stdev);
+ double hi_cut = *mean + kappa * (*stdev);
+
+ double lo_cut_p = lo_cut;
+ double hi_cut_p = hi_cut;
+
+ double c_var_sum;
+ double c_mean = 0; /* Avoid false uninit warning */
+ double c_stdev = 0; /* Avoid false uninit warning */
+
+ int iclip;
+
+ for (iclip = 0; iclip < nclip; iclip++) {
+ int pos = pos0;
+ int i, j;
+
+ c_var_sum = var_sum;
+ c_mean = *mean;
+ c_stdev = *stdev;
+ nb = npixs;
+
+ for (j = lly - 1; j < ury; j++, pos += (nx - urx + llx - 1)) {
+ for (i = llx - 1; i < urx; i++, pos++) {
+ if (pi[pos] > hi_cut || pi[pos] < lo_cut) {
+ const double delta = (double)pi[pos] - c_mean;
+
+ c_var_sum -= nb * delta * delta / (nb - 1.0);
+ c_mean -= delta / (nb - 1.0);
+ nb = nb - 1.0;
+ }
+ }
+ }
+
+ if (nb == 1.0 || c_var_sum < 0.0) {
+ cpl_msg_error(cpl_func, "Iteration %d: Too many pixels were "
+ "removed. This may cause unexpected behaviour. "
+ "Please set a lower number of iterations "
+ "or increase the value of kappa\n", iclip);
+ cpl_error_set(cpl_func, CPL_ERROR_DIVISION_BY_ZERO);
+ } else {
+ c_stdev = sqrt(c_var_sum / (nb - 1.0));
+ }
+
+ lo_cut = c_mean - kappa * c_stdev;
+ hi_cut = c_mean + kappa * c_stdev;
+
+ if(fabs(lo_cut - lo_cut_p) < tolerance &&
+ fabs(hi_cut - hi_cut_p) < tolerance) {
+ break;
+ } else {
+ lo_cut_p = lo_cut;
+ hi_cut_p = hi_cut;
+ }
+ }
+
+ *mean = c_mean;
+ *stdev = c_stdev;
+
+ return cpl_error_get_code();
+}
diff --git a/irplib/irplib_match_cats.c b/irplib/irplib_match_cats.c
new file mode 100644
index 0000000..e4346c8
--- /dev/null
+++ b/irplib/irplib_match_cats.c
@@ -0,0 +1,211 @@
+/* $Id: irplib_match_cats.c,v 1.10 2009/12/18 10:44:48 cgarcia Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: cgarcia $
+ * $Date: 2009/12/18 10:44:48 $
+ * $Revision: 1.10 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+
+#include <math.h>
+#include <cpl.h>
+#include <cpl_table.h>
+
+#include "irplib_match_cats.h"
+
+#define FILENAME_SZBUF 1024
+
+
+/*----------------------------------------------------------------------------*/
+/* Private functions
+ */
+/*----------------------------------------------------------------------------*/
+
+cpl_error_code irplib_match_cats_get_all_matching_pairs
+(cpl_table ** catalogues,
+ int ncats,
+ cpl_table * matching_sets,
+ int (*binary_match_condition)
+ (cpl_table * catalogue1,
+ cpl_table * catalogue2,
+ int iobj1,
+ int iobj2) );
+
+cpl_error_code irplib_match_cats_get_all_matches_cresc
+(cpl_table ** catalogues,
+ cpl_array * cat_index_begin,
+ cpl_array * cats_idx_set,
+ int mincat_match,
+ cpl_table * matching_sets);
+
+cpl_error_code irplib_match_cats_iterate_on_cat
+(cpl_table ** catalogues,
+ cpl_array * cats_idx_set,
+ int icat_iterate,
+ cpl_array * valid_iobjs,
+ int mincat_match,
+ cpl_table * matching_sets,
+ cpl_table * less_minmatch_sets);
+
+cpl_error_code irplib_match_cats_filter_obj_to_iter
+(cpl_array * cats_idx_set,
+ int order_begin,
+ cpl_table * matches_set,
+ cpl_array * excluded_objs,
+ int itercat_nobj);
+
+int irplib_match_cats_match_condition
+(cpl_table ** catalogues,
+ int * cats_idx_set_ptr,
+ int ncats);
+
+int irplib_match_count_nonmatched
+(int * cats_idx_set_ptr,
+ int ncats);
+
+int nCombinations;
+int nFilter;
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_cat Functions for matching of catalogues
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*---------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Finds all the objects that appear at least in some of the catalogues
+ * @param catalogues
+ * All the catalogues
+ * @param ncats
+ * Number of catalogues
+ * @return
+ * The matching table if sucess, NULL otherwise.
+ *
+ *
+ * Implementation notes:
+ *
+ * cat_indexing_order tells you in which order the catalogues are being
+ * iterated. For example cat_indexing_order[2] gives the index of the
+ * catalogue that is being iterated in the 3rd postion.
+ *
+ *
+*/
+/*---------------------------------------------------------------------------*/
+cpl_table * irplib_match_cat_pairs
+(cpl_table ** catalogues,
+ int ncats,
+ int (*binary_match_condition)
+ (cpl_table * catalogue1,
+ cpl_table * catalogue2,
+ int iobj1,
+ int iobj2) )
+{
+ cpl_table * matching_sets;
+
+ //Initialize the solution
+ matching_sets = cpl_table_new(0);
+ cpl_table_new_column_array(matching_sets, "MATCHING_SETS",
+ CPL_TYPE_INT, ncats);
+
+ irplib_match_cats_get_all_matching_pairs
+ (catalogues, ncats, matching_sets, binary_match_condition);
+
+ return matching_sets;
+}
+
+cpl_error_code irplib_match_cats_get_all_matching_pairs
+(cpl_table ** catalogues,
+ int ncats,
+ cpl_table * matching_sets,
+ int (*binary_match_condition)
+ (cpl_table * catalogue1,
+ cpl_table * catalogue2,
+ int iobj1,
+ int iobj2) )
+{
+ int icat1;
+ int icat2;
+
+ nCombinations = 0;
+ nFilter = 0;
+
+ for(icat1 = 0; icat1 < ncats ; ++icat1)
+ for(icat2 = icat1 + 1 ; icat2 < ncats ; ++icat2)
+ {
+ int iobj1;
+ int iobj2;
+ int nobj1;
+ int nobj2;
+
+ nobj1 = cpl_table_get_nrow(catalogues[icat1]);
+ nobj2 = cpl_table_get_nrow(catalogues[icat2]);
+
+ for(iobj1 = 0; iobj1 < nobj1 ; ++iobj1)
+ for(iobj2 = 0 ; iobj2 < nobj2 ; ++iobj2)
+ {
+ ++nCombinations;
+ if(binary_match_condition(catalogues[icat1],
+ catalogues[icat2],
+ iobj1, iobj2))
+ {
+ cpl_array * cats_idx_set;
+ int icat;
+
+ ++nFilter;
+ cats_idx_set = cpl_array_new(ncats, CPL_TYPE_INT);
+ for(icat = 0; icat < ncats; ++icat)
+ {
+ if(icat == icat1)
+ cpl_array_set_int(cats_idx_set, icat, iobj1);
+ else if(icat == icat2)
+ cpl_array_set_int(cats_idx_set, icat, iobj2);
+ else
+ cpl_array_set_int(cats_idx_set, icat, -1);
+ }
+
+ cpl_table_set_size(matching_sets,
+ cpl_table_get_nrow(matching_sets)+1);
+ cpl_table_set_array(matching_sets,"MATCHING_SETS",
+ cpl_table_get_nrow(matching_sets)-1,
+ cats_idx_set);
+ cpl_array_delete(cats_idx_set);
+ }
+ }
+ }
+
+ return CPL_ERROR_NONE;
+}
+
+/**@}*/
+
diff --git a/irplib/irplib_match_cats.h b/irplib/irplib_match_cats.h
new file mode 100644
index 0000000..ea7c662
--- /dev/null
+++ b/irplib/irplib_match_cats.h
@@ -0,0 +1,46 @@
+/* $Id: irplib_match_cats.h,v 1.5 2009/12/18 10:44:48 cgarcia Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: cgarcia $
+ * $Date: 2009/12/18 10:44:48 $
+ * $Revision: 1.5 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_MATCH_CATS_H
+#define IRPLIB_MATCH_CATS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+cpl_table * irplib_match_cat_pairs
+(cpl_table ** catalogues,
+ int nCats,
+ int (*binary_match_condition)
+ (cpl_table * catalogue1,
+ cpl_table * catalogue2,
+ int iobj1,
+ int iobj2) );
+
+#endif
diff --git a/irplib/irplib_mkmaster.c b/irplib/irplib_mkmaster.c
new file mode 100644
index 0000000..ed1aa5f
--- /dev/null
+++ b/irplib/irplib_mkmaster.c
@@ -0,0 +1,565 @@
+/* $Id: irplib_mkmaster.c,v 1.5 2012/01/12 14:29:41 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2012/01/12 14:29:41 $
+ * $Revision: 1.5 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <string.h>
+#include "irplib_mkmaster.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_calib Functions for calibrations
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+/*---------------------------------------------------------------------------*/
+/**
+ @brief find out the character string associated to the DIT keyword
+ in a propertylist
+ @param plist propertylist
+ @return dit value
+ */
+/*---------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Computes kappa-sigma clean mean (free bad pixels) for each input image of the input imagelist.
+ @param iml input imagelist
+ @param kappa value for kappa-sigma clip
+ @param nclip Number of clipping iterations
+ @param tolerance tolerance on range between two successive clip iterations
+
+ @return vector with computed values for each image of the list
+
+ The returned vector must be deallocated.
+ */
+/*--------------------------------------------------------------------------*/
+static cpl_vector *
+irplib_imagelist_get_clean_mean_levels(const cpl_imagelist* iml,
+ const double kappa,
+ const int nclip,
+ const double tolerance)
+{
+
+ const cpl_image* img=NULL;
+ int size=0;
+ int i=0;
+ cpl_vector* levels=NULL;
+ double* pval=NULL;
+ double mean=0;
+ double stdev=0;
+
+
+ cpl_error_ensure(iml != NULL, CPL_ERROR_NULL_INPUT, return(levels),
+ "Null input image list");
+ cpl_error_ensure(kappa >= 0, CPL_ERROR_ILLEGAL_INPUT, return(levels),
+ "Must be kappa>0");
+
+ size=cpl_imagelist_get_size(iml);
+ levels=cpl_vector_new(size);
+ pval=cpl_vector_get_data(levels);
+
+ for(i=0;i<size;i++) {
+ img=cpl_imagelist_get_const(iml,i);
+ irplib_ksigma_clip(img,1,1,
+ cpl_image_get_size_x(img),
+ cpl_image_get_size_y(img),
+ nclip,kappa,tolerance,&mean,&stdev);
+ cpl_msg_info(cpl_func,"Ima %d mean level: %g",i+1,mean);
+ pval[i]=mean;
+ }
+
+
+ return levels;
+}
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Subtract from input imagelist values specified in input vector.
+ @param iml input imagelist
+ @param values value to be subtracted
+ @return corrected imagelist
+
+ */
+/*--------------------------------------------------------------------------*/
+static cpl_error_code
+irplib_imagelist_subtract_values(cpl_imagelist** iml, cpl_vector* values)
+{
+
+ cpl_image* img=NULL;
+ int size=0;
+ int i=0;
+ double* pval=NULL;
+
+ size=cpl_imagelist_get_size(*iml);
+ pval=cpl_vector_get_data(values);
+
+ for(i=0;i<size;i++) {
+ img=cpl_imagelist_get(*iml,i);
+ cpl_image_subtract_scalar(img,pval[i]);
+ cpl_imagelist_set(*iml,img,i);
+ }
+
+ return cpl_error_get_code();
+}
+
+/*---------------------------------------------------------------------------*/
+/**
+ * @brief Perform kappa-sigma clip.
+ @author C. Izzo
+ @param values values to be checked
+ @param klow kappa to clip too low level values
+ @param khigh kappa to clip too high values
+ @param kiter number of iterations
+
+ @note In first iteration a median is the reference value for robustness
+
+ * @return
+ */
+/*---------------------------------------------------------------------------*/
+static double
+irplib_vector_ksigma(cpl_vector *values,
+ const double klow, const double khigh, int kiter)
+{
+ cpl_vector *accepted;
+ double mean = 0.0;
+ double sigma = 0.0;
+ double *data = cpl_vector_get_data(values);
+ int n = cpl_vector_get_size(values);
+ int ngood = n;
+ int count = 0;
+ int i;
+
+ /*
+ * At first iteration the mean is taken as the median, and the
+ * standard deviation relative to this value is computed.
+ */
+
+ mean = cpl_vector_get_median(values);
+
+ for (i = 0; i < n; i++) {
+ sigma += (mean - data[i]) * (mean - data[i]);
+ }
+ sigma = sqrt(sigma / (n - 1));
+
+ while (kiter) {
+ count = 0;
+ for (i = 0; i < ngood; i++) {
+ if (data[i]-mean < khigh*sigma && mean-data[i] < klow*sigma) {
+ data[count] = data[i];
+ ++count;
+ }
+ }
+
+ if (count == 0) // This cannot happen at first iteration.
+ break; // So we can break: we have already computed a mean.
+
+ /*
+ * The mean must be computed even if no element was rejected
+ * (count == ngood), because at first iteration median instead
+ * of mean was computed.
+ */
+
+ accepted = cpl_vector_wrap(count, data);
+ mean = cpl_vector_get_mean(accepted);
+ if(count>1) {
+ sigma = cpl_vector_get_stdev(accepted);
+ }
+ cpl_vector_unwrap(accepted);
+
+ if (count == ngood) {
+ break;
+ }
+ ngood = count;
+ --kiter;
+ }
+
+ return mean;
+}
+
+
+/**
+ * @brief
+ * Stack images using k-sigma clipping
+ *
+ * @param imlist List of images to stack
+ * @param klow Number of sigmas for rejection of lowest values
+ * @param khigh Number of sigmas for rejection of highest values
+ * @param kiter Max number of iterations
+ *
+ * @return Stacked image.
+ *
+ * At the first iteration the value of sigma is computed relatively to
+ * the median value of all pixels at a given image position. For the
+ * next iterations the sigma is computed in the standard way. If
+ * at some iteration all points would be rejected, the mean computed
+ * at the previous iteration is returned.
+ */
+
+static cpl_image *
+irplib_imagelist_ksigma_stack(const cpl_imagelist *imlist,
+ double klow, double khigh, int kiter)
+{
+ int ni, nx, ny, npix;
+ cpl_image *out_ima=NULL;
+ cpl_imagelist *loc_iml=NULL;
+ double *pout_ima=NULL;
+ cpl_image *image=NULL;
+ const double **data=NULL;
+ double *med=NULL;
+ cpl_vector *time_line=NULL;
+
+ double *ptime_line=NULL;
+ int i, j;
+ double mean_of_medians=0;
+
+ cpl_error_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, return(out_ima),
+ "Null input image list");
+
+ ni = cpl_imagelist_get_size(imlist);
+ loc_iml = cpl_imagelist_duplicate(imlist);
+ image = cpl_imagelist_get(loc_iml, 0);
+ nx = cpl_image_get_size_x(image);
+ ny = cpl_image_get_size_y(image);
+ npix = nx * ny;
+
+ out_ima = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+ pout_ima = cpl_image_get_data_double(out_ima);
+
+ time_line = cpl_vector_new(ni);
+
+ ptime_line = cpl_vector_get_data(time_line);
+
+ data = cpl_calloc(sizeof(double *), ni);
+ med = cpl_calloc(sizeof(double), ni);
+
+ for (i = 0; i < ni; i++) {
+ image = cpl_imagelist_get(loc_iml, i);
+ med[i]=cpl_image_get_median(image);
+ cpl_image_subtract_scalar(image,med[i]);
+ data[i] = cpl_image_get_data_double(image);
+ mean_of_medians+=med[i];
+ }
+ mean_of_medians/=ni;
+
+ for (i = 0; i < npix; i++) {
+ for (j = 0; j < ni; j++) {
+ ptime_line[j] = data[j][i];
+ }
+ pout_ima[i] = irplib_vector_ksigma(time_line, klow, khigh, kiter);
+ }
+
+ cpl_image_add_scalar(out_ima,mean_of_medians);
+
+
+ cpl_free(data);
+ cpl_free(med);
+ cpl_vector_delete(time_line);
+ cpl_imagelist_delete(loc_iml);
+
+ return out_ima;
+
+}
+
+
+
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Computes master frame by clean stack mean of the input imagelist.
+ @param images input imagelist
+ @param kappa value for kappa-sigma clip
+ @param nclip Number of clipping iterations
+ @param tolerance tolerance on range between two successive clip iterations
+
+ @return master image
+
+ The returned image must be deallocated.
+ */
+/*--------------------------------------------------------------------------*/
+cpl_image*
+irplib_mkmaster_mean(cpl_imagelist* images,const double kappa, const int nclip, const double tolerance,const double klow,const double khigh,const int niter)
+{
+
+ cpl_image* master=NULL;
+ cpl_vector* levels=NULL;
+ double mean=0;
+ cpl_imagelist* iml=NULL;
+
+ cpl_msg_info(cpl_func,"method mean");
+ iml=cpl_imagelist_duplicate(images);
+ levels=irplib_imagelist_get_clean_mean_levels(iml,kappa,nclip,tolerance);
+ mean=cpl_vector_get_mean(levels);
+ cpl_msg_info(cpl_func,"Master mean level: %g",mean);
+
+ irplib_imagelist_subtract_values(&iml,levels);
+
+ master = irplib_imagelist_ksigma_stack(iml,klow,khigh,niter);
+ cpl_image_add_scalar(master,mean);
+
+ cpl_vector_delete(levels);
+ cpl_imagelist_delete(iml);
+ return master;
+
+}
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Computes master frame by clean stack median of the input imagelist.
+ @param images input imagelist
+ @param kappa value for kappa-sigma clip
+ @param nclip Number of clipping iterations
+ @param tolerance tolerance on range between two successive clip iterations
+
+ @return master image
+
+ The returned image must be deallocated.
+ */
+/*--------------------------------------------------------------------------*/
+cpl_image*
+irplib_mkmaster_median(cpl_imagelist* images,const double kappa, const int nclip, const double tolerance)
+{
+
+ cpl_image* master=NULL;
+ cpl_vector* levels=NULL;
+ double mean=0;
+ cpl_imagelist* iml=NULL;
+
+ cpl_msg_info(cpl_func,"method median");
+ iml=cpl_imagelist_duplicate(images);
+ levels=irplib_imagelist_get_clean_mean_levels(iml,kappa,nclip,tolerance);
+
+ mean=cpl_vector_get_mean(levels);
+ cpl_msg_info(cpl_func,"Master mean level: %g",mean);
+ irplib_imagelist_subtract_values(&iml,levels);
+
+ master = cpl_imagelist_collapse_median_create(iml);
+
+ cpl_image_add_scalar(master,mean);
+
+ cpl_vector_delete(levels);
+ cpl_imagelist_delete(iml);
+
+ return master;
+
+}
+
+/* Work in progress */
+static cpl_error_code
+irplib_mkmaster_dark_qc(const cpl_imagelist* raw_images,
+ cpl_imagelist* preproc_images,
+ const cpl_parameterlist* parameters,
+ const int pr_num_x, const int pr_num_y,
+ const int pr_box_sx, const int pr_box_sy, const char* recipe_id,
+ cpl_table* qclog) {
+
+ cpl_ensure_code(qclog !=NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(recipe_id !=NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(parameters !=NULL, CPL_ERROR_NULL_INPUT);
+
+ int i = 0;
+ cpl_image* current_dark = 0;
+ if (pr_num_x != 0 && pr_num_y != 0 && pr_box_sx != 0 && pr_box_sy != 0) {
+ for (i = 0; i < cpl_imagelist_get_size(raw_images); i++) {
+ current_dark = cpl_image_duplicate(
+ cpl_imagelist_get_const(preproc_images, i));
+ cpl_msg_info(cpl_func, "Calculating QC parameters on raw dark frame %d",
+ i);
+ /* Here To be defined more general way to qc-log */
+ /* UVES specific stuff: may be this function should not be put in irplib
+ irplib_mdark_region_qc(current_dark, parameters, raw_images, recipe_id,qclog);
+ */
+ }
+ }
+ return cpl_error_get_code();
+}
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Find out the exposure time in seconds
+ @param plist Header to read from
+
+ @return The requested value, or undefined on error
+
+ An error is set if the exposure time is negative. In that case this negative
+ value is returned.
+ */
+/*-------------------------------------------------------------------------*/
+static double
+irplib_head_get_exptime(const cpl_propertylist * plist) {
+ double result = 0; /* Conversion from electrons to ADUs */
+
+ result=cpl_propertylist_get_double(plist, "EXPTIME");
+ cpl_ensure_code(result >= 0, CPL_ERROR_ILLEGAL_OUTPUT);
+
+ return result;
+}
+
+/*-------------------------------------------------------------------------*/
+/**
+ @brief Write the exposure time
+ @param plist Property list to write to
+ @param exptime The value to write
+
+ @return CPL_ERROR_NONE iff okay.
+ */
+/*-------------------------------------------------------------------------*/
+static cpl_error_code
+irplib_head_set_exptime(cpl_propertylist *plist, double exptime)
+{
+ cpl_propertylist_update_double(plist, "EXPTIME", exptime);
+ cpl_propertylist_set_comment(plist, "EXPTIME", "Total integration time");
+
+ return cpl_error_get_code();
+}
+
+static cpl_imagelist*
+irplib_mkmaster_dark_fill_imagelist(const cpl_imagelist* raw_images,
+ cpl_propertylist** raw_headers, const cpl_image* master_bias,
+ double* mean_exptime) {
+ /* First process each input image and store the results in a
+ new image list */
+
+ cpl_imagelist* preproc_images = NULL;
+ int i = 0;
+ cpl_image* current_dark = NULL;
+ double min_exptime = 0;
+ double max_exptime = 0;
+
+ preproc_images = cpl_imagelist_new();
+ for (i = 0; i < cpl_imagelist_get_size(raw_images); i++) {
+ double exposure_time = 0.0;
+ const cpl_propertylist *current_header;
+
+ current_dark = cpl_image_duplicate(cpl_imagelist_get_const(raw_images, i));
+ current_header = raw_headers[i];
+
+ /* Subtract master bias */
+ if (master_bias != NULL) {
+ cpl_msg_info(cpl_func, "Subtracting master bias");
+ cpl_image_subtract(current_dark, master_bias);
+ } else {
+ cpl_msg_info(cpl_func, "Skipping bias subtraction");
+ }
+
+ exposure_time = irplib_head_get_exptime(current_header);
+
+ /* Initialize/update min/max exposure time*/
+ if (i == 0 || exposure_time < min_exptime) {
+ min_exptime = exposure_time;
+ }
+ if (i == 0 || exposure_time > max_exptime) {
+ max_exptime = exposure_time;
+ }
+
+ /* Do not normalize to unit exposure time */
+ /* If this is uncommented, then remember to also calculate the
+ correct master dark exposure time below.
+ irplib_msg("Normalizing from %f s to unit exposure time", exposure_time);
+ check( cpl_image_divide_scalar(current_dark, exposure_time),
+ "Error normalizing dark frame"); */
+
+ /* Append to imagelist */
+ cpl_imagelist_set(preproc_images, current_dark, i);
+
+ /* Don't deallocate the image. It will be deallocated when
+ the image list is deallocated */
+ current_dark = NULL;
+ }
+
+
+ /* Check exposure times */
+ cpl_msg_info(cpl_func,
+ "Exposure times range from %e s to %e s (%e %% variation)", min_exptime,
+ max_exptime, 100 * (max_exptime - min_exptime) / min_exptime);
+
+ if ((max_exptime - min_exptime) / min_exptime > .001) {
+ cpl_msg_warning(cpl_func, "Exposure times differ by %e %%",
+ 100 * (max_exptime - min_exptime) / min_exptime);
+ }
+
+ /* compute correct exposure time */
+ *mean_exptime=0.5 * (max_exptime + min_exptime);
+ return preproc_images;
+}
+
+
+cpl_image *
+irplib_mdark_process_chip(const cpl_imagelist *raw_images,
+ cpl_propertylist **raw_headers, const cpl_image *master_bias,
+ cpl_propertylist *mdark_header, const cpl_parameterlist *parameters,
+ const char* recipe_id, cpl_table* qclog, const int do_qc,
+ const char* STACK_METHOD, const double STACK_KLOW, const double STACK_KHIGH,
+ const int STACK_NITER,
+ const int pr_num_x, const int pr_num_y,
+ const int pr_box_sx, const int pr_box_sy) {
+ cpl_image *master_dark = NULL; /* Result */
+ cpl_image *current_dark = NULL;
+ cpl_imagelist *preproc_images = NULL;
+ double mean_exptime = 0;
+
+ /* First process each input image and store the results in a
+ new image list */
+ preproc_images = irplib_mkmaster_dark_fill_imagelist(raw_images, raw_headers,
+ master_bias, &mean_exptime);
+ if (do_qc) {
+ /* Here we should compute QC but a a better way to log it is TBD */
+ irplib_mkmaster_dark_qc(raw_images, preproc_images, parameters, pr_num_x,
+ pr_num_y, pr_box_sx, pr_box_sy, recipe_id, qclog);
+
+ }
+ /* Get median stack of input darks */
+ if (strcmp(STACK_METHOD, "MEDIAN") == 0) {
+ cpl_msg_info(cpl_func, "Calculating stack median");
+ master_dark = cpl_imagelist_collapse_median_create(preproc_images);
+ } else {
+ cpl_msg_info(cpl_func, "Calculating stack mean");
+ master_dark = irplib_imagelist_ksigma_stack(preproc_images, STACK_KLOW,
+ STACK_KHIGH, STACK_NITER);
+
+ }
+ irplib_head_set_exptime(mdark_header, mean_exptime );
+
+ cpl_image_delete(current_dark);
+ cpl_imagelist_delete(preproc_images);
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ cpl_image_delete(master_dark);
+ }
+
+ return master_dark;
+}
+
+/**@}*/
+
diff --git a/irplib/irplib_mkmaster.h b/irplib/irplib_mkmaster.h
new file mode 100644
index 0000000..8a48534
--- /dev/null
+++ b/irplib/irplib_mkmaster.h
@@ -0,0 +1,53 @@
+/* $Id: irplib_mkmaster.h,v 1.3 2011/11/02 13:17:25 amodigli Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2011/11/02 13:17:25 $
+ * $Revision: 1.3 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_MKMASTER_H
+#define IRPLIB_MKMASTER_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+#include <irplib_ksigma_clip.h>
+
+cpl_image*
+irplib_mkmaster_mean(cpl_imagelist* images,const double kappa, const int nclip, const double tolerance,const double klow,const double khigh,const int niter);
+
+cpl_image*
+irplib_mkmaster_median(cpl_imagelist* images,const double kappa, const int nclip, const double tolerance);
+
+cpl_image *
+irplib_mdark_process_chip(const cpl_imagelist *raw_images,
+ cpl_propertylist **raw_headers, const cpl_image *master_bias,
+ cpl_propertylist *mdark_header, const cpl_parameterlist *parameters,
+ const char* recipe_id, cpl_table* qclog, const int do_qc,
+ const char* STACK_METHOD, const double STACK_KLOW, const double STACK_KHIGH,
+ const int STACK_NITER,
+ const int pr_num_x, const int pr_num_y,
+ const int pr_box_sx, const int pr_box_sy);
+#endif
diff --git a/irplib/irplib_oddeven.c b/irplib/irplib_oddeven.c
new file mode 100644
index 0000000..14c54d8
--- /dev/null
+++ b/irplib/irplib_oddeven.c
@@ -0,0 +1,338 @@
+/* $Id: irplib_oddeven.c,v 1.9 2012/01/12 11:50:41 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2012/01/12 11:50:41 $
+ * $Revision: 1.9 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_oddeven.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static cpl_imagelist * irplib_oddeven_cube_conv_xy_rtheta(cpl_imagelist *) ;
+static cpl_imagelist * irplib_oddeven_cube_conv_rtheta_xy(cpl_imagelist *) ;
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_oddeven Odd/Even column effect correction
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Estimate the odd/even rate in an image quadrant
+ @param in the inpute image
+ @param iquad the quadrant (ll=1, lr=2, ul=3, ur=4, all=0)
+ @param r_even the median of even columns / median of all columns
+ @return 0 if ok, -1 otherwise
+*/
+/*----------------------------------------------------------------------------*/
+int irplib_oddeven_monitor(
+ const cpl_image * in,
+ int iquad,
+ double * r_even)
+{
+ cpl_image * extracted ;
+ cpl_image * labels ;
+ int * plabels ;
+ int llx, lly, urx, ury ;
+ int nx, ny ;
+ double f_even, f_tot ;
+ cpl_apertures * aperts ;
+ int i, j ;
+
+ /* Test entries */
+ if (in == NULL || r_even == NULL) return -1 ;
+ nx = cpl_image_get_size_x(in) ;
+ ny = cpl_image_get_size_y(in) ;
+
+ switch (iquad){
+ case 1:
+ llx = 1 ; lly = 1 ; urx = nx/2 ; ury = ny/2 ; break ;
+ case 2:
+ llx = (nx/2)+1 ; lly = 1 ; urx = nx ; ury = ny/2 ; break ;
+ case 3:
+ llx = 1 ; lly = (ny/2)+1 ; urx = nx/2 ; ury = ny ; break ;
+ case 4:
+ llx = (nx/2)+1 ; lly = (ny/2)+1 ; urx = nx ; ury = ny ; break ;
+ case 0:
+ llx = 1 ; lly = 1 ; urx = nx ; ury = ny ; break ;
+ default:
+ cpl_msg_error(cpl_func, "Unsupported mode") ;
+ *r_even = 0.0 ;
+ return -1 ;
+ }
+
+ /* Extract quadrant */
+ if ((extracted = cpl_image_extract(in, llx, lly, urx, ury)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot extract quadrant") ;
+ *r_even = 0.0 ;
+ return -1 ;
+ }
+ nx = cpl_image_get_size_x(extracted) ;
+ ny = cpl_image_get_size_y(extracted) ;
+
+ /* Get f_tot */
+ f_tot = cpl_image_get_median(extracted) ;
+ if (fabs(f_tot) < 1e-6) {
+ cpl_msg_warning(cpl_func, "Quadrant median is 0.0") ;
+ cpl_image_delete(extracted) ;
+ *r_even = 0.0 ;
+ return -1 ;
+ }
+
+ /* Create the label image to define the even columns */
+ labels = cpl_image_new(nx, ny, CPL_TYPE_INT) ;
+ plabels = cpl_image_get_data_int(labels) ;
+ for (i=0 ; i<nx ; i++) {
+ if (i % 2) for (j=0 ; j<ny ; j++) plabels[i+j*nx] = 0 ;
+ else for (j=0 ; j<ny ; j++) plabels[i+j*nx] = 1 ;
+ }
+
+ /* Get the median of even columns */
+ if ((aperts = cpl_apertures_new_from_image(extracted, labels)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot compute the even columns median") ;
+ cpl_image_delete(extracted) ;
+ cpl_image_delete(labels) ;
+ *r_even = 0.0 ;
+ return -1 ;
+ }
+ cpl_image_delete(extracted) ;
+ cpl_image_delete(labels) ;
+ f_even = cpl_apertures_get_median(aperts, 1) ;
+ cpl_apertures_delete(aperts) ;
+
+ /* Compute the even rate and return */
+ *r_even = f_even / f_tot ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Correct the odd/even in an image
+ @param in the inpute image
+ @return the corrected image or NULL on error case
+*/
+/*----------------------------------------------------------------------------*/
+cpl_image * irplib_oddeven_correct(const cpl_image * in)
+{
+ cpl_image * in_real ;
+ cpl_image * in_imag ;
+ cpl_imagelist * freq_i ;
+ cpl_imagelist * freq_i_amp ;
+ cpl_image * cur_im ;
+ double * pcur_im ;
+ cpl_image * cleaned ;
+ int nx ;
+ cpl_vector * hf_med ;
+
+ /* Test entries */
+ if (in==NULL) return NULL ;
+
+ nx = cpl_image_get_size_x(in) ;
+
+ /* Local copy of the input image in DOUBLE */
+ in_real = cpl_image_cast(in, CPL_TYPE_DOUBLE) ;
+ in_imag = cpl_image_duplicate(in_real) ;
+ cpl_image_multiply_scalar(in_imag, 0.0) ;
+
+ /* Apply FFT to input image */
+ cpl_image_fft(in_real, in_imag, CPL_FFT_DEFAULT) ;
+
+ /* Put the result in an image list */
+ freq_i = cpl_imagelist_new() ;
+ cpl_imagelist_set(freq_i, in_real, 0) ;
+ cpl_imagelist_set(freq_i, in_imag, 1) ;
+
+ /* Convert to amplitude/phase */
+ freq_i_amp = irplib_oddeven_cube_conv_xy_rtheta(freq_i);
+ cpl_imagelist_delete(freq_i) ;
+
+ /* Correct the odd-even frequency */
+ cur_im = cpl_imagelist_get(freq_i_amp, 0) ;
+ pcur_im = cpl_image_get_data_double(cur_im) ;
+ /* Odd-even frequency will be replaced by
+ the median of the 5 values around */
+ hf_med = cpl_vector_new(5);
+
+ cpl_vector_set(hf_med, 0, pcur_im[nx/2 + 1]);
+ cpl_vector_set(hf_med, 1, pcur_im[nx/2 + 2]);
+ cpl_vector_set(hf_med, 2, pcur_im[nx/2 + 3]);
+ cpl_vector_set(hf_med, 3, pcur_im[nx/2 ]);
+ cpl_vector_set(hf_med, 4, pcur_im[nx/2 -1]);
+
+ pcur_im[nx / 2 + 1] = cpl_vector_get_median(hf_med);
+ cpl_vector_delete(hf_med);
+
+ /* Convert to X/Y */
+ freq_i = irplib_oddeven_cube_conv_rtheta_xy(freq_i_amp) ;
+ cpl_imagelist_delete(freq_i_amp) ;
+ /* FFT back to image space */
+ cpl_image_fft(cpl_imagelist_get(freq_i, 0), cpl_imagelist_get(freq_i, 1),
+ CPL_FFT_INVERSE) ;
+ cleaned = cpl_image_cast(cpl_imagelist_get(freq_i, 0), CPL_TYPE_FLOAT) ;
+ cpl_imagelist_delete(freq_i) ;
+ return cleaned ;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert a 2-plane cube from (real,imag) to (ampl,phase).
+ @param cube_in Input cube (containing 2 planes)
+ @return 1 newly allocated cube containing 2 planes.
+
+ The input cube is expected to contain two planes: first one is the real part
+ of a complex image, second one is the imaginary part of the same image. The
+ returned cube contains two planes: first one is the complex amplitude of the
+ image, second one is the phase.
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_imagelist * irplib_oddeven_cube_conv_xy_rtheta(
+ cpl_imagelist * cube_in)
+{
+ cpl_imagelist * cube_out ;
+ double re, im ;
+ double mod, phase ;
+ int nx, ny, np ;
+ cpl_image * tmp_im ;
+ double * pim1 ;
+ double * pim2 ;
+ double * pim3 ;
+ double * pim4 ;
+ int i, j ;
+
+ /* Error handling : test entries */
+ if (cube_in == NULL) return NULL ;
+ np = cpl_imagelist_get_size(cube_in) ;
+ if (np != 2) return NULL ;
+
+ /* Initialise */
+ tmp_im = cpl_imagelist_get(cube_in, 0) ;
+ pim1 = cpl_image_get_data_double(tmp_im) ;
+ nx = cpl_image_get_size_x(tmp_im) ;
+ ny = cpl_image_get_size_y(tmp_im) ;
+ tmp_im = cpl_imagelist_get(cube_in, 1) ;
+ pim2 = cpl_image_get_data_double(tmp_im) ;
+
+ /* Allocate cube_out */
+ cube_out = cpl_imagelist_duplicate(cube_in) ;
+
+ tmp_im = cpl_imagelist_get(cube_out, 0) ;
+ pim3 = cpl_image_get_data_double(tmp_im) ;
+ tmp_im = cpl_imagelist_get(cube_out, 1) ;
+ pim4 = cpl_image_get_data_double(tmp_im) ;
+ /* Convert */
+ for (j=0 ; j<ny ; j++) {
+ for (i=0 ; i<nx ; i++) {
+ re = (double)pim1[i+j*nx] ;
+ im = (double)pim2[i+j*nx] ;
+ mod = (double)(sqrt(re*re + im*im)) ;
+ if (re != 0.0)
+ phase = (double)atan2(im, re) ;
+ else
+ phase = 0.0 ;
+ pim3[i+j*nx] = mod ;
+ pim4[i+j*nx] = phase ;
+ }
+ }
+ return cube_out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert a 2-plane cube from (ampl,phase) to (real,imag).
+ @param cube_in Input cube (containing 2 planes)
+ @return 1 newly allocated cube containing 2 planes.
+
+ The input cube is expected to contain two planes: first one is the
+ amplitude of a complex image, second one is the phase. The returned cube
+ contains two planes: first one is the real part of the image, second one
+ is the imaginary part.
+
+ The returned cube must be deallocated using cube_del().
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_imagelist * irplib_oddeven_cube_conv_rtheta_xy(
+ cpl_imagelist * cube_in)
+{
+ cpl_imagelist * cube_out ;
+ double re, im ;
+ double mod, phase ;
+ int nx, ny, np ;
+ cpl_image * tmp_im ;
+ double * pim1 ;
+ double * pim2 ;
+ double * pim3 ;
+ double * pim4 ;
+ int i, j ;
+
+ /* Error handling : test entries */
+ if (cube_in == NULL) return NULL ;
+ np = cpl_imagelist_get_size(cube_in) ;
+ if (np != 2) return NULL ;
+
+ /* Initialise */
+ tmp_im = cpl_imagelist_get(cube_in, 0) ;
+ pim1 = cpl_image_get_data_double(tmp_im) ;
+ nx = cpl_image_get_size_x(tmp_im) ;
+ ny = cpl_image_get_size_y(tmp_im) ;
+ tmp_im = cpl_imagelist_get(cube_in, 1) ;
+ pim2 = cpl_image_get_data_double(tmp_im) ;
+
+ /* Allocate cube_out */
+ cube_out = cpl_imagelist_duplicate(cube_in) ;
+
+ tmp_im = cpl_imagelist_get(cube_out, 0) ;
+ pim3 = cpl_image_get_data_double(tmp_im) ;
+ tmp_im = cpl_imagelist_get(cube_out, 1) ;
+ pim4 = cpl_image_get_data_double(tmp_im) ;
+ /* Convert */
+ for (j=0 ; j<ny ; j++) {
+ for (i=0 ; i<nx ; i++) {
+ mod = (double)pim1[i+j*nx] ;
+ phase = (double)pim2[i+j*nx] ;
+ re = (double)(mod * cos(phase));
+ im = (double)(mod * sin(phase));
+ pim3[i+j*nx] = re ;
+ pim4[i+j*nx] = im ;
+ }
+ }
+ return cube_out ;
+}
diff --git a/irplib/irplib_oddeven.h b/irplib/irplib_oddeven.h
new file mode 100644
index 0000000..1f1414d
--- /dev/null
+++ b/irplib/irplib_oddeven.h
@@ -0,0 +1,40 @@
+/* $Id: irplib_oddeven.h,v 1.4 2006/10/06 20:46:04 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: yjung $
+ * $Date: 2006/10/06 20:46:04 $
+ * $Revision: 1.4 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_ODDEVEN_H
+#define IRPLIB_ODDEVEN_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+int irplib_oddeven_monitor(const cpl_image *, int, double *) ;
+cpl_image * irplib_oddeven_correct(const cpl_image *) ;
+
+#endif
diff --git a/irplib/irplib_plugin.c b/irplib/irplib_plugin.c
new file mode 100644
index 0000000..e6f2626
--- /dev/null
+++ b/irplib/irplib_plugin.c
@@ -0,0 +1,1267 @@
+/* $Id: irplib_plugin.c,v 1.39 2012/02/03 14:19:06 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2012/02/03 14:19:06 $
+ * $Revision: 1.39 $
+ * $Name: hawki-1_8_9 $
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <cpl.h>
+
+
+#include "irplib_plugin.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_plugin Irplib plugin functionality
+ *
+ * This module provides a macro and a unit test function for @em irplib_plugin.
+ *
+ * @code
+ * #include "irplib_plugin.h"
+ * @endcode
+ */
+/*----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+/* Maximum line length in SOF-file */
+#ifndef LINE_LEN_MAX
+#define LINE_LEN_MAX 1024
+#endif
+
+/* This device provides quite-random data */
+#define DEV_RANDOM "/dev/urandom"
+
+/* Copied from cpl_tools.h */
+#define recipe_assert(bool) \
+ ((bool) ? (cpl_msg_debug(cpl_func, \
+ "OK in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s",__LINE__, \
+ cpl_error_get_message(), cpl_error_get_where(), #bool), 0) \
+ : (cpl_msg_error(cpl_func, \
+ "Failure in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s", \
+ __LINE__, cpl_error_get_message(), cpl_error_get_where(), #bool), 1))
+
+
+
+/*-----------------------------------------------------------------------------
+ Private Function prototypes
+ -----------------------------------------------------------------------------*/
+
+static const cpl_parameter * irplib_parameterlist_get(const cpl_parameterlist *,
+ const char *,
+ const char *,
+ const char *);
+
+static void recipe_parameterlist_set(cpl_parameterlist *);
+static cpl_boolean irplib_plugin_has_sof_from_env(const cpl_plugin *,
+ const char *);
+
+static void recipe_frameset_load(cpl_frameset *, const char *);
+
+static void recipe_sof_test_devfile(cpl_plugin *, const char *, size_t,
+ const char *[]);
+static void recipe_sof_test_image_empty(cpl_plugin *, size_t, const char *[]);
+static void recipe_sof_test_local(cpl_plugin *);
+static void recipe_sof_test_from_env(cpl_plugin *);
+static void recipe_frameset_empty(cpl_frameset *);
+static void recipe_frameset_test_frame(const cpl_frame *);
+static void recipe_frameset_test_frameset_diff(const cpl_frameset *,
+ const cpl_frameset *);
+
+static cpl_errorstate inistate;
+
+/**@{*/
+
+/*-----------------------------------------------------------------------------
+ Function definitions
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Retrieve the value of a plugin parameter of type string
+ @param self The parameterlist to get from
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name, e.g. "stropt"
+ @return The string, or NULL on error
+
+ */
+/*----------------------------------------------------------------------------*/
+const char * irplib_parameterlist_get_string(const cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter)
+{
+
+ const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
+ recipe, parameter);
+ const char * value;
+
+ cpl_ensure(par != NULL, cpl_error_get_code(), NULL);
+
+ value = cpl_parameter_get_string(par);
+
+ if (value == NULL) (void)cpl_error_set_where(cpl_func);
+
+ return value;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Retrieve the value of a plugin parameter of type int
+ @param self The parameterlist to get from
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name, e.g. "boolopt"
+ @return The cpl_boolean (CPL_FALSE or CPL_TRUE), or undefined on error
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_boolean irplib_parameterlist_get_bool(const cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter)
+{
+
+ const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
+ recipe, parameter);
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_boolean value;
+
+
+ cpl_ensure(par != NULL, cpl_error_get_code(), CPL_FALSE);
+
+ value = cpl_parameter_get_bool(par);
+
+ if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func);
+
+ return value;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Retrieve the value of a plugin parameter of type int
+ @param self The parameterlist to get from
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name
+ @return The int, or undefined on error
+
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_parameterlist_get_int(const cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter)
+{
+
+ const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
+ recipe, parameter);
+ cpl_errorstate prestate = cpl_errorstate_get();
+ int value;
+
+
+ cpl_ensure(par != NULL, cpl_error_get_code(), 0);
+
+ value = cpl_parameter_get_int(par);
+
+ if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func);
+
+ return value;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Retrieve the value of a plugin parameter of type double
+ @param self The parameterlist to get from
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name
+ @return The double, or undefined on error
+
+ */
+/*----------------------------------------------------------------------------*/
+double irplib_parameterlist_get_double(const cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter)
+{
+
+ const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
+ recipe, parameter);
+ cpl_errorstate prestate = cpl_errorstate_get();
+ double value;
+
+
+ cpl_ensure(par != NULL, cpl_error_get_code(), 0.0);
+
+ value = cpl_parameter_get_double(par);
+
+ if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func);
+
+ return value;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Add a parameter of type string to a plugin parameterlist
+ @param self The parameterlist to set
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name
+ @param defvalue The default value of the parameter
+ @param alias The alias of the parameter or NULL to alias to parameter
+ @param context The parameter context
+ @param man The man-page of the parameter
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_parameterlist_set_string(cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter,
+ const char * defvalue,
+ const char * alias,
+ const char * context,
+ const char * man)
+{
+
+ cpl_error_code error;
+ cpl_parameter * par;
+ char * paramname = cpl_sprintf("%s.%s.%s", instrume, recipe,
+ parameter);
+
+ cpl_ensure_code(paramname != NULL, cpl_error_get_code());
+
+ par = cpl_parameter_new_value(paramname, CPL_TYPE_STRING, man, context,
+ defvalue);
+ cpl_free(paramname);
+
+ cpl_ensure_code(par != NULL, cpl_error_get_code());
+
+ error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
+ alias ? alias : parameter);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameterlist_append(self, par);
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Add a parameter of type cpl_boolean to a plugin parameterlist
+ @param self The parameterlist to set
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name
+ @param defvalue The default value of the parameter
+ @param alias The alias of the parameter or NULL to alias to parameter
+ @param context The parameter context
+ @param man The man-page of the parameter
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_parameterlist_set_bool(cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter,
+ cpl_boolean defvalue,
+ const char * alias,
+ const char * context,
+ const char * man)
+{
+
+ cpl_error_code error;
+ cpl_parameter * par;
+ char * paramname = cpl_sprintf("%s.%s.%s", instrume, recipe,
+ parameter);
+
+ cpl_ensure_code(paramname != NULL, cpl_error_get_code());
+
+ par = cpl_parameter_new_value(paramname, CPL_TYPE_BOOL, man, context,
+ defvalue);
+ cpl_free(paramname);
+
+ cpl_ensure_code(par != NULL, cpl_error_get_code());
+
+ error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
+ alias ? alias : parameter);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameterlist_append(self, par);
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Add a parameter of type int to a plugin parameterlist
+ @param self The parameterlist to set
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name
+ @param defvalue The default value of the parameter
+ @param alias The alias of the parameter or NULL to alias to parameter
+ @param context The parameter context
+ @param man The man-page of the parameter
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_parameterlist_set_int(cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter,
+ int defvalue,
+ const char * alias,
+ const char * context,
+ const char * man)
+{
+
+ cpl_error_code error;
+ cpl_parameter * par;
+ char * paramname = cpl_sprintf("%s.%s.%s", instrume, recipe,
+ parameter);
+
+ cpl_ensure_code(paramname != NULL, cpl_error_get_code());
+
+ par = cpl_parameter_new_value(paramname, CPL_TYPE_INT, man, context,
+ defvalue);
+ cpl_free(paramname);
+
+ cpl_ensure_code(par != NULL, cpl_error_get_code());
+
+ error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
+ alias ? alias : parameter);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameterlist_append(self, par);
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Add a parameter of type double to a plugin parameterlist
+ @param self The parameterlist to set
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name
+ @param defvalue The default value of the parameter
+ @param alias The alias of the parameter or NULL to alias to parameter
+ @param context The parameter context
+ @param man The man-page of the parameter
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_parameterlist_set_double(cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter,
+ double defvalue,
+ const char * alias,
+ const char * context,
+ const char * man)
+{
+
+ cpl_error_code error;
+ cpl_parameter * par;
+ char * paramname = cpl_sprintf("%s.%s.%s", instrume, recipe,
+ parameter);
+
+ cpl_ensure_code(paramname != NULL, cpl_error_get_code());
+
+ par = cpl_parameter_new_value(paramname, CPL_TYPE_DOUBLE, man, context,
+ defvalue);
+ cpl_free(paramname);
+
+ cpl_ensure_code(par != NULL, cpl_error_get_code());
+
+ error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
+ alias ? alias : parameter);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
+ cpl_ensure_code(!error, error);
+
+ error = cpl_parameterlist_append(self, par);
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find a plugin and submit it to some tests
+ @param self A non-empty pluginlist
+ @param nstr The counter of parameter strings, may be zero
+ @param astr The array of nstr parameter strings, may be NULL
+ @return 0
+ @note astr may be NULL iff nstr is zero.
+ If nstr is non-zero, the strings are used as tags in SOFs
+ created to test the plugin.
+
+ FIXME: Redeclare to void
+
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_plugin_test(cpl_pluginlist * self, size_t nstr, const char *astr[]) {
+
+ cpl_plugin * plugin;
+ cpl_recipe * recipe;
+ int (*recipe_create) (cpl_plugin *);
+ int (*recipe_exec ) (cpl_plugin *);
+ int (*recipe_deinit) (cpl_plugin *);
+ cpl_error_code error;
+ FILE * stream;
+ cpl_boolean is_debug;
+
+
+ is_debug = cpl_msg_get_level() <= CPL_MSG_DEBUG ? CPL_TRUE : CPL_FALSE;
+
+ /* Modified from CPL unit tests */
+ stream = is_debug ? stdout : fopen("/dev/null", "a");
+
+ inistate = cpl_errorstate_get();
+
+ assert( nstr == 0 || astr != NULL );
+
+ plugin = cpl_pluginlist_get_first(self);
+
+ if (plugin == NULL) {
+ cpl_msg_warning(cpl_func, "With an empty pluginlist, "
+ "no tests can be made");
+ return 0;
+ }
+
+ cpl_plugin_dump(plugin, stream);
+
+ recipe_create = cpl_plugin_get_init(plugin);
+ cpl_test( recipe_create != NULL);
+
+ recipe_exec = cpl_plugin_get_exec(plugin);
+ cpl_test( recipe_exec != NULL);
+
+ recipe_deinit = cpl_plugin_get_deinit(plugin);
+ cpl_test( recipe_deinit != NULL);
+
+ /* Only plugins of type recipe are tested (further) */
+ if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
+ cpl_msg_warning(cpl_func, "This plugin is not of type recipe, "
+ "cannot test further");
+ return 0;
+ }
+
+ if (recipe_create != NULL && recipe_exec != NULL && recipe_deinit != NULL) {
+
+ cpl_test_zero(recipe_create(plugin));
+
+ recipe = (cpl_recipe *) plugin;
+
+ cpl_test_nonnull( recipe->parameters );
+
+ recipe_parameterlist_set(recipe->parameters);
+
+ cpl_parameterlist_dump(recipe->parameters, stream);
+
+ recipe->frames = cpl_frameset_new();
+
+ if (irplib_plugin_has_sof_from_env(plugin, "RECIPE_SOF_PATH")) {
+
+ recipe_sof_test_from_env(plugin);
+
+ } else {
+
+ const cpl_msg_severity msg_level = cpl_msg_get_level();
+
+ /* Unless the CPL_MSG_LEVEL has been explicitly set, turn off
+ terminal messaging completely while inside this function */
+ if (getenv("CPL_MSG_LEVEL") == NULL) cpl_msg_set_level(CPL_MSG_OFF);
+
+ cpl_msg_info(cpl_func,"Checking handling of pre-existing CPL error "
+ "state - may produce warning(s)/error(s):");
+ cpl_error_set(cpl_func, CPL_ERROR_EOL);
+ /* Call recipe and expect non-zero return code */
+ cpl_test( recipe_exec(plugin) );
+ /* Expect also the CPL error code to be preserved */
+ cpl_test_error( CPL_ERROR_EOL );
+
+ cpl_msg_info(cpl_func,"Checking handling of empty frameset - "
+ "may produce warning(s)/error(s):");
+ /* Call recipe and expect non-zero return code */
+ cpl_test( recipe_exec(plugin) );
+ error = cpl_error_get_code();
+ /* Expect also the CPL error code to be set */
+ cpl_test_error( error );
+ cpl_test( error );
+
+ cpl_msg_info(cpl_func,"Checking handling of dummy frameset - "
+ "may produce warning(s)/error(s):");
+ do {
+ cpl_frame * f = cpl_frame_new();
+ error = cpl_frame_set_filename(f, "/dev/null");
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_frame_set_tag(f, "RECIPE_DUMMY_TAG");
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_frameset_insert(recipe->frames, f);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ /* Call recipe and expect non-zero return code */
+ cpl_test( recipe_exec(plugin) );
+ error = cpl_error_get_code();
+ /* Expect also the CPL error code to be set */
+ cpl_test_error( error );
+ cpl_test( error );
+
+ error = cpl_frameset_erase_frame(recipe->frames, f);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ } while (0);
+
+#ifdef IRPLIB_TEST_RANDOM_SOF
+ recipe_sof_test_devfile(plugin, DEV_RANDOM, nstr, astr);
+#endif
+
+ recipe_sof_test_devfile(plugin, "/dev/null", nstr, astr);
+
+ recipe_sof_test_devfile(plugin, ".", nstr, astr);
+
+ recipe_sof_test_image_empty(plugin, nstr, astr);
+
+ recipe_sof_test_local(plugin);
+
+ cpl_msg_set_level(msg_level);
+
+ }
+
+ cpl_frameset_delete(recipe->frames);
+
+ error = recipe_deinit(plugin);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ }
+
+ if (stream != stdout) fclose(stream);
+
+ return 0;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Set unset parameters to default value or via the env
+ @param self The parameter list
+ @return void
+ @note This is a modification of params_parse_config_postprocess() from esorex
+
+ The function initializes the provided parameter list by setting the current
+ parameter values to the default parameter values.
+ */
+/*----------------------------------------------------------------------------*/
+static void recipe_parameterlist_set(cpl_parameterlist * self)
+{
+
+ cpl_parameter * p = cpl_parameterlist_get_first(self);
+
+ for (; p != NULL; p = cpl_parameterlist_get_next(self)) {
+
+ const char * envvar;
+ const char * svalue;
+
+ /* FIXME: Needed ? */
+ if (cpl_parameter_get_default_flag(p)) continue;
+
+ cpl_msg_debug(cpl_func, __FILE__ " line %u: OK", __LINE__);
+
+ envvar = cpl_parameter_get_alias(p, CPL_PARAMETER_MODE_ENV);
+ svalue = envvar ? getenv(envvar) : NULL;
+
+ switch (cpl_parameter_get_type(p)) {
+ case CPL_TYPE_BOOL: {
+ const int value
+ = svalue ? atoi(svalue) : cpl_parameter_get_default_bool(p);
+ cpl_parameter_set_bool(p, value);
+ break;
+ }
+ case CPL_TYPE_INT: {
+ const int value
+ = svalue ? atoi(svalue) : cpl_parameter_get_default_int(p);
+ cpl_parameter_set_int(p, value);
+ break;
+ }
+ case CPL_TYPE_DOUBLE: {
+ const double value
+ = svalue ? atof(svalue) : cpl_parameter_get_default_double(p);
+ cpl_parameter_set_double(p, value);
+ break;
+ }
+ case CPL_TYPE_STRING:
+ {
+ const char * s_default = cpl_parameter_get_default_string(p);
+ /* Replace NULL with "" */
+ const char * value
+ = svalue ? svalue : (s_default ? s_default : "");
+ cpl_parameter_set_string(p, value);
+ break;
+ }
+
+ default:
+ assert( 0 ); /* It is a testing error to reach this point */
+ }
+ }
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Invoke the recipe with the supplied TAGS using the supplied file
+ @param plugin The plugin
+ @param filename The filename to use
+ @param nstr The number of strings
+ @param astr The array of tags
+ @return void
+
+ */
+/*----------------------------------------------------------------------------*/
+static void recipe_sof_test_devfile(cpl_plugin * plugin, const char * filename,
+ size_t nstr, const char *astr[])
+{
+ cpl_recipe * recipe = (cpl_recipe*)plugin;
+ int (*recipe_exec) (cpl_plugin *);
+ cpl_frameset * copy;
+ cpl_error_code error;
+ size_t i;
+
+
+ if (nstr < 1) return;
+ if (filename == NULL) return;
+
+ cpl_msg_info(cpl_func, "Testing recipe with %u %s as input ",
+ (unsigned)nstr, filename);
+
+ for (i = 0; i < nstr; i++) {
+ cpl_frame * f = cpl_frame_new();
+
+ error = cpl_frame_set_filename(f, filename);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_frame_set_tag(f, astr[i]);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_frameset_insert(recipe->frames, f);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ }
+
+ copy = cpl_frameset_duplicate(recipe->frames);
+
+ recipe_exec = cpl_plugin_get_exec(plugin);
+ cpl_test( recipe_exec != NULL);
+
+ if (recipe_exec != NULL) {
+
+ /* Call recipe and expect non-zero return code */
+ cpl_test( recipe_exec(plugin) );
+ error = cpl_error_get_code();
+ /* Expect also the CPL error code to be set */
+ cpl_test_error( error );
+ cpl_test( error );
+
+ recipe_frameset_test_frameset_diff(recipe->frames, copy);
+
+ recipe_frameset_empty(recipe->frames);
+ }
+
+ cpl_frameset_delete(copy);
+
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Invoke the recipe with the supplied TAGS using empty images
+ @param plugin The plugin
+ @return void
+
+ */
+/*----------------------------------------------------------------------------*/
+static void recipe_sof_test_image_empty(cpl_plugin * plugin, size_t nstr,
+ const char *astr[])
+{
+ cpl_recipe * recipe = (cpl_recipe*)plugin;
+ int (*recipe_exec) (cpl_plugin *);
+ cpl_frameset * copy;
+ cpl_error_code error;
+ size_t i;
+ cpl_frame * frame;
+ cpl_image * iempty;
+ int retstat;
+
+
+ if (nstr < 1) return;
+
+ cpl_msg_info(cpl_func, "Testing recipe with %u empty images as input ",
+ (unsigned)nstr);
+
+ iempty = cpl_image_new(13, 17, CPL_TYPE_FLOAT);
+ cpl_test_nonnull(iempty);
+
+ for (i = 0; i < nstr; i++) {
+ cpl_frame * f = cpl_frame_new();
+ char * rawname = cpl_sprintf("raw%05u.fits", (unsigned)(i+1));
+
+ error = cpl_image_save(iempty, rawname,CPL_BPP_IEEE_FLOAT, NULL,
+ CPL_IO_DEFAULT);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_frame_set_filename(f, rawname);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_frame_set_tag(f, astr[i]);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_frameset_insert(recipe->frames, f);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_free(rawname);
+ }
+ cpl_image_delete(iempty);
+
+ copy = cpl_frameset_duplicate(recipe->frames);
+
+ recipe_exec = cpl_plugin_get_exec(plugin);
+ cpl_test(recipe_exec != NULL);
+
+ if (recipe_exec != NULL) {
+
+ /* Call recipe and expect consistency between return code and
+ CPL error */
+
+ retstat = recipe_exec(plugin);
+ error = cpl_error_get_code();
+ /* Expect also the CPL error code to be set */
+ if (error == 0) {
+ cpl_test_zero(retstat);
+ } else {
+ cpl_test(retstat);
+ }
+ cpl_test_error( error );
+
+ recipe_frameset_test_frameset_diff(recipe->frames, copy);
+
+ for (frame = cpl_frameset_get_first(recipe->frames); frame != NULL;
+ frame = cpl_frameset_get_next(recipe->frames))
+ {
+ cpl_test_zero( remove(cpl_frame_get_filename(frame)) );
+ }
+
+ recipe_frameset_empty(recipe->frames);
+ }
+
+ cpl_frameset_delete(copy);
+
+ return;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Check if the the env-variable has an SOF from the plugin
+ @param plugin The plugin
+ @param envname The environment variable with the directory to load from
+ @return True iff there is an SOF in the directory of the env
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_boolean irplib_plugin_has_sof_from_env(const cpl_plugin * plugin,
+ const char * envname)
+{
+ const char * recipename = cpl_plugin_get_name(plugin);
+ const char * sof_path = envname ? getenv(envname) : NULL;
+ cpl_frameset * frames;
+ char * sof_name;
+ const cpl_frame * ffirst;
+
+ cpl_ensure(plugin != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
+ cpl_ensure(envname != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
+ cpl_ensure(recipename != NULL, CPL_ERROR_DATA_NOT_FOUND, CPL_FALSE);
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
+
+ if (sof_path == NULL) return CPL_FALSE;
+
+ sof_name = cpl_sprintf("%s/%s.sof", sof_path, recipename);
+
+ frames = cpl_frameset_new();
+ recipe_frameset_load(frames, sof_name);
+
+ ffirst = cpl_frameset_get_first_const(frames);
+
+ cpl_free(sof_name);
+ cpl_frameset_delete(frames);
+
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
+
+ return ffirst ? CPL_TRUE : CPL_FALSE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Use getenv() to look for SOFs
+ @param plugin The plugin
+ @return void
+
+ */
+/*----------------------------------------------------------------------------*/
+static void recipe_sof_test_from_env(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe = (cpl_recipe*)plugin;
+ const char * recipename = cpl_plugin_get_name(plugin);
+ const char * var_name = "RECIPE_SOF_PATH";
+ const char * sof_path = getenv(var_name);
+ cpl_error_code error;
+
+ char * sof_name;
+
+ if (sof_path == NULL) {
+ cpl_msg_warning(cpl_func, "Environment variable %s is unset: "
+ "No SOFs to check", var_name);
+ return;
+ }
+
+ cpl_msg_debug(cpl_func, "Checking for SOFs in %s", sof_path);
+
+ cpl_test_nonnull( recipename );
+ if (recipename == NULL) return;
+
+ sof_name = cpl_sprintf("%s/%s.sof", sof_path, recipename);
+
+ cpl_msg_debug(cpl_func, "Checking for SOF %s", sof_name);
+
+ recipe_frameset_load(recipe->frames, sof_name);
+
+ if (!cpl_frameset_is_empty(recipe->frames)) {
+
+ int (*recipe_exec ) (cpl_plugin *);
+ cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
+
+ recipe_exec = cpl_plugin_get_exec(plugin);
+ cpl_test(recipe_exec != NULL);
+
+ if (recipe_exec != NULL) {
+ cpl_msg_info(cpl_func,"Checking handling of SOF: %s", sof_name);
+
+ /* Call recipe and expect zero return code */
+ cpl_test_zero( recipe_exec(plugin) );
+ /* Expect also the CPL error code to be clear */
+ cpl_test_error(CPL_ERROR_NONE);
+
+ error = cpl_dfs_update_product_header(recipe->frames);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ recipe_frameset_test_frameset_diff(recipe->frames, copy);
+
+ recipe_frameset_empty(recipe->frames);
+ }
+
+ cpl_frameset_delete(copy);
+
+ }
+
+ cpl_free(sof_name);
+
+ return;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Look for SOF an SOF in ./<recipename>.sof
+ @param plugin The plugin
+ @return void
+
+ */
+/*----------------------------------------------------------------------------*/
+static void recipe_sof_test_local(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe = (cpl_recipe*)plugin;
+ const char * recipename = cpl_plugin_get_name(plugin);
+ cpl_error_code error;
+ char * sof_name = cpl_sprintf("%s.sof", recipename);
+
+ cpl_msg_debug(cpl_func, "Checking for SOF %s", sof_name);
+
+ recipe_frameset_load(recipe->frames, sof_name);
+
+ if (!cpl_frameset_is_empty(recipe->frames)) {
+
+ int (*recipe_exec ) (cpl_plugin *);
+ cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
+
+ recipe_exec = cpl_plugin_get_exec(plugin);
+ cpl_test(recipe_exec != NULL);
+
+ if (recipe_exec != NULL) {
+
+ cpl_msg_info(cpl_func,"Checking handling of SOF: %s", sof_name);
+
+ /* Call recipe and expect zero return code */
+ cpl_test_zero( recipe_exec(plugin) );
+ /* Expect also the CPL error code to be clear */
+ cpl_test_error(CPL_ERROR_NONE);
+
+ error = cpl_dfs_update_product_header(recipe->frames);
+ cpl_test_eq_error( error, CPL_ERROR_NONE );
+
+ recipe_frameset_test_frameset_diff(recipe->frames, copy);
+
+ recipe_frameset_empty(recipe->frames);
+ }
+
+ cpl_frameset_delete(copy);
+ }
+
+ cpl_free(sof_name);
+
+ return;
+}
+
+
+
+
+/**********************************************************************/
+/**
+ * @brief
+ * Create a new frame set from a @em set @em of @em frames file.
+ *
+ * @param set Frame set to be updated with the contents of @em name.
+ * @param name Input file path.
+ *
+ * @return Pointer to the newly created frame set if @em set was @c NULL,
+ * or the updated set @em set. In case an error occurred the return value
+ * is @c NULL.
+ *
+ * @note This is a simplification of er_frameset_load() from esorex
+ */
+/**********************************************************************/
+
+static void recipe_frameset_load(cpl_frameset * set, const char *name)
+{
+
+ FILE *fp;
+ char line[LINE_LEN_MAX];
+ char path[LINE_LEN_MAX], group[LINE_LEN_MAX], tag[LINE_LEN_MAX];
+ int line_number;
+
+ assert( set != NULL );
+ assert( name != NULL );
+
+ fp = fopen(name, "r");
+ if (fp == NULL) {
+ cpl_msg_debug(cpl_func, "Unable to open SOF file '%s'", name);
+ return;
+ }
+
+ /* Loop over all the lines in the set-of-frames file */
+ for (line_number = 0; fgets(line, LINE_LEN_MAX - 1, fp); line_number++) {
+
+ cpl_frame_group grp;
+ cpl_frame * frame;
+ int n;
+
+ if (line[0] == '#') continue;
+
+ n = sscanf(line, "%s %s %s", path, tag, group);
+
+ if (n < 1) {
+ cpl_msg_warning(cpl_func, "Spurious line no. %d in %s: %s",
+ line_number, name, line);
+ break;
+ }
+
+ /* Allocate a new frame */
+ frame = cpl_frame_new();
+
+ /* Set the filename component of the frame */
+ cpl_frame_set_filename(frame, path);
+
+ /* Set the tag component of the frame (or set a default) */
+ cpl_frame_set_tag(frame, n == 1 ? "" : tag);
+
+ cpl_frameset_insert(set, frame);
+
+ /* Set the group component of the frame (or set a default) */
+ if (n < 3) continue;
+
+ if (!strcmp(group, CPL_FRAME_GROUP_RAW_ID))
+ grp = CPL_FRAME_GROUP_RAW;
+ else if (!strcmp(group, CPL_FRAME_GROUP_CALIB_ID))
+ grp = CPL_FRAME_GROUP_CALIB;
+ else if (!strcmp(group, CPL_FRAME_GROUP_PRODUCT_ID))
+ grp = CPL_FRAME_GROUP_PRODUCT;
+ else
+ grp = CPL_FRAME_GROUP_NONE;
+
+ cpl_frame_set_group(frame, grp);
+ }
+
+ fclose(fp);
+
+ return;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Retrieve a parameter from a plugin parameterlist
+ @param self The parameterlist to get from
+ @param instrume The recipe name, e.g. PACKAGE from config.h
+ @param recipe The recipe name, e.g. "rrrecipe"
+ @param parameter The parameter name, e.g. "stropt"
+ @return The parameter, or NULL on error
+
+ */
+/*----------------------------------------------------------------------------*/
+static
+const cpl_parameter * irplib_parameterlist_get(const cpl_parameterlist * self,
+ const char * instrume,
+ const char * recipe,
+ const char * parameter)
+{
+
+ char * paramname;
+ const cpl_parameter * par;
+
+
+ cpl_ensure(instrume != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(recipe != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(parameter != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ paramname = cpl_sprintf("%s.%s.%s", instrume, recipe, parameter);
+
+ par = cpl_parameterlist_find_const(self, paramname);
+
+ if (par == NULL) (void)cpl_error_set_message(cpl_func,
+ cpl_error_get_code()
+ ? cpl_error_get_code()
+ : CPL_ERROR_DATA_NOT_FOUND,
+ "%s", paramname);
+
+ cpl_free(paramname);
+
+ return par;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Remove all frames from a frameset
+ *
+ * @param self A frameset.
+ *
+ * @return Nothing.
+ *
+ * @note FIXME: Move to CPL
+ *
+ * @error
+ * <table class="ec" align="center">
+ * <tr>
+ * <td class="ecl">CPL_ERROR_NULL_INPUT</td>
+ * <td class="ecr">
+ * The parameter <i>self</i> is a <tt>NULL</tt> pointer.
+ * </td>
+ * </tr>
+ * </table>
+ * @enderror
+ *
+ * The function removes all frames from @em self. Each frame
+ * is properly deallocated. After calling this function @em self is
+ * empty.
+*/
+/*----------------------------------------------------------------------------*/
+static void recipe_frameset_empty(cpl_frameset * self)
+{
+ cpl_frame * f;
+
+ if (self == NULL) {
+ cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
+ return;
+ }
+
+ for (f = cpl_frameset_get_first(self); f != NULL;
+ f = cpl_frameset_get_first(self))
+ {
+ cpl_frameset_erase_frame(self, f);
+ }
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Test a frame for product conformance
+ * @param self A frame.
+ * @return Nothing.
+ * @note FIXME: Move to CPL test module
+ *
+ * @error
+ * <table class="ec" align="center">
+ * <tr>
+ * <td class="ecl">CPL_ERROR_NULL_INPUT</td>
+ * <td class="ecr">
+ * The parameter <i>self</i> is a <tt>NULL</tt> pointer.
+ * </td>
+ * </tr>
+ * </table>
+ * @enderror
+ *
+*/
+/*----------------------------------------------------------------------------*/
+static void recipe_frameset_test_frame(const cpl_frame * self)
+{
+
+ cpl_msg_info(cpl_func, "Validating new frame: %s",
+ cpl_frame_get_filename(self));
+
+ cpl_test_nonnull(self);
+
+ /* Frame must be tagged */
+ cpl_test_nonnull(cpl_frame_get_tag(self));
+
+ /* New frames must be products */
+ cpl_test_eq(cpl_frame_get_group(self), CPL_FRAME_GROUP_PRODUCT);
+
+ if (cpl_frame_get_type(self) != CPL_FRAME_TYPE_PAF) {
+ /* All but PAF (?) must be FITS */
+ cpl_test_fits(cpl_frame_get_filename(self));
+ } else {
+ /* Frame must at least have a filename */
+ cpl_test_nonnull(cpl_frame_get_filename(self));
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Test the new frames for product conformance
+ * @param self The frameset in which to test
+ * @param other The reference frameset (with recipe input frames)
+ * @return Nothing.
+ * @note FIXME: Move to CPL test module ?
+ *
+ * @error
+ * <table class="ec" align="center">
+ * <tr>
+ * <td class="ecl">CPL_ERROR_NULL_INPUT</td>
+ * <td class="ecr">
+ * The parameter <i>self</i> is a <tt>NULL</tt> pointer.
+ * </td>
+ * </tr>
+ * </table>
+ * @enderror
+ *
+*/
+/*----------------------------------------------------------------------------*/
+static void recipe_frameset_test_frameset_diff(const cpl_frameset * self,
+ const cpl_frameset * other)
+{
+
+ const cpl_frame * frame = cpl_frameset_get_first_const(other);
+
+ /* First verify that filenames in other are non-NULL */
+ for (;frame != NULL; frame = cpl_frameset_get_next_const(other)) {
+ const char * file = cpl_frame_get_filename(frame);
+
+ if (file == NULL) {
+ cpl_test_nonnull(cpl_frame_get_filename(frame));
+ break;
+ }
+ }
+ if (frame != NULL) return;
+
+ frame = cpl_frameset_get_first_const(self);
+
+ for (;frame != NULL; frame = cpl_frameset_get_next_const(self)) {
+ const cpl_frame * cmp = cpl_frameset_get_first_const(other);
+ const char * file = cpl_frame_get_filename(frame);
+
+ if (file == NULL) {
+ cpl_test_nonnull(cpl_frame_get_filename(frame));
+ continue;
+ }
+
+ for (;cmp != NULL; cmp = cpl_frameset_get_next_const(other)) {
+ const char * cfile = cpl_frame_get_filename(cmp);
+
+ if (!strcmp(file, cfile)) break;
+
+ }
+ if (cmp == NULL) {
+ /* frame is new */
+
+ cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_PRODUCT);
+ recipe_frameset_test_frame(frame);
+ }
+ }
+}
diff --git a/irplib/irplib_plugin.h b/irplib/irplib_plugin.h
new file mode 100644
index 0000000..481ed05
--- /dev/null
+++ b/irplib/irplib_plugin.h
@@ -0,0 +1,93 @@
+/* $Id: irplib_plugin.h,v 1.23 2012/01/11 08:03:37 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2012/01/11 08:03:37 $
+ * $Revision: 1.23 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_PLUGIN_H
+#define IRPLIB_PLUGIN_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <irplib_utils.h> /* irplib_reset() */
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+/* Needed (by uves) to concatenate two macro arguments */
+#define IRPLIB_CONCAT(a,b) a ## _ ## b
+#define IRPLIB_CONCAT2X(a,b) IRPLIB_CONCAT(a,b)
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+int irplib_plugin_test(cpl_pluginlist *, size_t, const char *[]);
+
+cpl_error_code irplib_parameterlist_set_string(cpl_parameterlist *,
+ const char *, const char *,
+ const char *, const char *,
+ const char *, const char *,
+ const char *);
+
+cpl_error_code irplib_parameterlist_set_bool(cpl_parameterlist *,
+ const char *, const char *,
+ const char *, cpl_boolean,
+ const char *, const char *,
+ const char *);
+
+cpl_error_code irplib_parameterlist_set_int(cpl_parameterlist *,
+ const char *, const char *,
+ const char *, int,
+ const char *, const char *,
+ const char *);
+
+cpl_error_code irplib_parameterlist_set_double(cpl_parameterlist *,
+ const char *, const char *,
+ const char *, double,
+ const char *, const char *,
+ const char *);
+
+const char * irplib_parameterlist_get_string(const cpl_parameterlist *,
+ const char *, const char *,
+ const char *);
+
+cpl_boolean irplib_parameterlist_get_bool(const cpl_parameterlist *,
+ const char *, const char *,
+ const char *);
+
+int irplib_parameterlist_get_int(const cpl_parameterlist *,
+ const char *, const char *,
+ const char *);
+
+double irplib_parameterlist_get_double(const cpl_parameterlist *,
+ const char *, const char *,
+ const char *);
+
+#endif
diff --git a/irplib/irplib_polynomial.c b/irplib/irplib_polynomial.c
new file mode 100644
index 0000000..58d129f
--- /dev/null
+++ b/irplib/irplib_polynomial.c
@@ -0,0 +1,1486 @@
+/* $Id: irplib_polynomial.c,v 1.34 2012/02/03 14:54:06 llundin Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2001-2004 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: llundin $
+ * $Date: 2012/02/03 14:54:06 $
+ * $Revision: 1.34 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include "irplib_polynomial.h"
+#include <assert.h>
+#include <math.h>
+/* DBL_MAX: */
+#include <float.h>
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_polynomial 1D-Polynomial roots
+ *
+ *
+ */
+/*----------------------------------------------------------------------------*/
+/**@{*/
+
+/*-----------------------------------------------------------------------------
+ Macro definitions
+ -----------------------------------------------------------------------------*/
+
+#define IRPLIB_SWAP(a,b) { const double t=(a);(a)=(b);(b)=t; }
+
+#if 0
+#define irplib_trace() cpl_msg_info(cpl_func, "%d: Trace", __LINE__)
+#else
+#define irplib_trace() /* Trace */
+#endif
+
+/*-----------------------------------------------------------------------------
+ Static functions
+ -----------------------------------------------------------------------------*/
+
+static double irplib_polynomial_eval_2_max(double, double, double, cpl_boolean,
+ double, double);
+
+static double irplib_polynomial_eval_3_max(double, double, double, double,
+ cpl_boolean, double, double, double);
+
+
+static cpl_boolean irplib_polynomial_solve_1d_2(double, double, double,
+ double *, double *);
+static cpl_boolean irplib_polynomial_solve_1d_3(double, double, double, double,
+ double *, double *, double *,
+ cpl_boolean *,
+ cpl_boolean *);
+
+static void irplib_polynomial_solve_1d_31(double, double, double *, double *,
+ double *, cpl_boolean *);
+
+static void irplib_polynomial_solve_1d_32(double, double, double, double *,
+ double *, double *, cpl_boolean *);
+
+static void irplib_polynomial_solve_1d_3r(double, double, double, double,
+ double *, double *, double *);
+
+static void irplib_polynomial_solve_1d_3c(double, double, double,
+ double, double, double,
+ double *, double *, double *,
+ cpl_boolean *, cpl_boolean *);
+
+static cpl_error_code irplib_polynomial_solve_1d_4(double, double, double,
+ double, double, cpl_size *,
+ double *, double *,
+ double *, double *);
+
+static cpl_error_code irplib_polynomial_solve_1d_nonzero(cpl_polynomial *,
+ cpl_vector *,
+ cpl_size *);
+
+static cpl_error_code irplib_polynomial_divide_1d_root(cpl_polynomial *, double,
+ double *);
+
+#ifdef IPRLIB_POLYNOMIAL_USE_MONOMIAL_ROOT
+static double irplib_polynomial_depress_1d(cpl_polynomial *);
+#endif
+
+/*-----------------------------------------------------------------------------
+ Function codes
+ -----------------------------------------------------------------------------*/
+
+#if defined CPL_VERSION_CODE && CPL_VERSION_CODE > CPL_VERSION(5, 92, 0)
+#else
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Add two polynomials of the same dimension
+ @param self The polynomial to hold the result
+ @param first The 1st polynomial to add
+ @param second The 2nd polynomial to add
+ @return CPL_ERROR_NONE or the relevant CPL error code
+ @note self may be passed also as first and/or second
+
+ Possible CPL error code set in this function:
+ - CPL_ERROR_NULL_INPUT if an input pointer is NULL
+ - CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical
+ dimensions
+ - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_polynomial_add(cpl_polynomial * self,
+ const cpl_polynomial * first,
+ const cpl_polynomial * second)
+{
+ cpl_size degree0 = cpl_polynomial_get_degree(self);
+ const cpl_size degree1 = cpl_polynomial_get_degree(first);
+ const cpl_size degree2 = cpl_polynomial_get_degree(second);
+ const cpl_size maxdeg = degree1 > degree2 ? degree1 : degree2;
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(first != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
+ cpl_polynomial_get_dimension(first),
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
+ cpl_polynomial_get_dimension(second),
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+
+ /* FIXME: */
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_UNSUPPORTED_MODE);
+
+ if (degree0 < maxdeg) {
+ degree0 = maxdeg;
+ } else {
+ /* Reset coefficients in self as needed */
+ for (; degree0 > maxdeg; degree0--) {
+ cpl_polynomial_set_coeff(self, °ree0, 0.0);
+ }
+ }
+
+ /* assert( degree0 == maxdeg ); */
+
+ for (; degree0 >= 0; degree0--) {
+ const double val1 = cpl_polynomial_get_coeff(first, °ree0);
+ const double val2 = cpl_polynomial_get_coeff(second, °ree0);
+ cpl_polynomial_set_coeff(self, °ree0, val1 + val2);
+ }
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Subtract two polynomials of the same dimension
+ @param self The polynomial to hold the result
+ @param first The polynomial to subtract from
+ @param second The polynomial to subtract
+ @return CPL_ERROR_NONE or the relevant CPL error code
+ @note self may be passed also as first and/or second
+
+ Possible CPL error code set in this function:
+ - CPL_ERROR_NULL_INPUT if an input pointer is NULL
+ - CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical
+ dimensions
+ - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_polynomial_subtract(cpl_polynomial * self,
+ const cpl_polynomial * first,
+ const cpl_polynomial * second)
+{
+ cpl_size degree0 = cpl_polynomial_get_degree(self);
+ const cpl_size degree1 = cpl_polynomial_get_degree(first);
+ const cpl_size degree2 = cpl_polynomial_get_degree(second);
+ const cpl_size maxdeg = degree1 > degree2 ? degree1 : degree2;
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(first != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
+ cpl_polynomial_get_dimension(first),
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
+ cpl_polynomial_get_dimension(second),
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+
+ /* FIXME: */
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_UNSUPPORTED_MODE);
+
+ if (degree0 < maxdeg) {
+ degree0 = maxdeg;
+ } else {
+ /* Reset coefficients in self as needed */
+ for (; degree0 > maxdeg; degree0--) {
+ cpl_polynomial_set_coeff(self, °ree0, 0.0);
+ }
+ }
+
+ /* assert( degree0 == maxdeg ); */
+
+ for (; degree0 >= 0; degree0--) {
+ const double val1 = cpl_polynomial_get_coeff(first, °ree0);
+ const double val2 = cpl_polynomial_get_coeff(second, °ree0);
+ cpl_polynomial_set_coeff(self, °ree0, val1 - val2);
+ }
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Multiply a polynomial with a scalar
+ @param self The polynomial to hold the result
+ @param other The polynomial to scale, may equal self
+ @param factor The factor to multiply with
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ Possible CPL error code set in this function:
+ - CPL_ERROR_NULL_INPUT if an input pointer is NULL
+ - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_polynomial_multiply_scalar(cpl_polynomial * self,
+ const cpl_polynomial * other,
+ double factor)
+{
+
+ const cpl_size maxdeg = cpl_polynomial_get_degree(other);
+ const cpl_size zerodeg = cpl_polynomial_get_degree(self);
+ cpl_size degree;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_UNSUPPORTED_MODE);
+ cpl_ensure_code(cpl_polynomial_get_dimension(other) == 1,
+ CPL_ERROR_UNSUPPORTED_MODE);
+
+ for (degree = 0; degree <= maxdeg; degree++) {
+ const double val = factor * cpl_polynomial_get_coeff(other, °ree);
+ cpl_polynomial_set_coeff(self, °ree, val);
+ }
+
+ /* Reset coefficients in self as needed */
+ for (; degree <= zerodeg; degree++) {
+ cpl_polynomial_set_coeff(self, &zerodeg, 0.0);
+ }
+
+ return CPL_ERROR_NONE;
+}
+#endif
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute all n roots of p(x) = 0, where p(x) is of degree n, n > 0.
+ @param self The 1D-polynomial
+ @param roots A pre-allocated vector of length n to hold the roots
+ @param preal The number of real roots found, or undefined on error
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ The *preal real roots are stored first in ascending order, then follows for
+ each pair of complex conjugate roots, the real and imaginary parts of the
+ root in the positive imaginary half-plane, for example for a 3rd degree
+ polynomial with 1 real root, the roots are represented as:
+ x0 = v0
+ x1 = v1 + i v2
+ x2 = v1 - i v2,
+ where v0, v1, v2 are the elements of the roots vector.
+
+ Possible CPL error code set in this function:
+ - CPL_ERROR_NULL_INPUT if an input pointer is NULL
+ - CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension
+ - CPL_ERROR_DATA_NOT_FOUND if the polynomial does not have a degree of at
+ least 1.
+ - CPL_ERROR_INCOMPATIBLE_INPUT if the roots vector does not have length n
+ - CPL_ERROR_DIVISION_BY_ZERO if a division by zero occurs (n > 4)
+ - CPL_ERROR_CONTINUE if the algorithm does not converge (n > 4)
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_polynomial_solve_1d_all(const cpl_polynomial * self,
+ cpl_vector * roots,
+ cpl_size * preal)
+{
+
+ cpl_error_code error = CPL_ERROR_NONE;
+ cpl_polynomial * p;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(roots != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(preal != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_INVALID_TYPE);
+ cpl_ensure_code(cpl_polynomial_get_degree(self) > 0,
+ CPL_ERROR_DATA_NOT_FOUND);
+ cpl_ensure_code(cpl_polynomial_get_degree(self) ==
+ cpl_vector_get_size(roots), CPL_ERROR_INCOMPATIBLE_INPUT);
+
+ *preal = 0;
+
+ p = cpl_polynomial_duplicate(self);
+
+ error = irplib_polynomial_solve_1d_nonzero(p, roots, preal);
+
+ cpl_polynomial_delete(p);
+
+ return error;
+
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Compute all n roots of p(x) = 0, where p(x) is of degree n, n > 0.
+ @param self The 1D-polynomial
+ @param roots A pre-allocated vector of length n to hold the roots
+ @param preal The number of real roots found, or undefined on error
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ The *preal real roots are stored first in ascending order, then follows for
+ each pair of complex conjugate roots, the real and imaginary parts of the
+ root in the positive imaginary half-plane, for example for a 3rd degree
+ polynomial with 1 real root, the roots are represented as:
+ x0 = v0
+ x1 = v1 + i v2
+ x2 = v1 - i v2,
+ where v0, v1, v2 are the elements of the roots vector.
+
+ Possible CPL error code set in this function:
+ - CPL_ERROR_NULL_INPUT if an input pointer is NULL
+ - CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension
+ - CPL_ERROR_DATA_NOT_FOUND if the polynomial has the degree 0.
+ - CPL_ERROR_INCOMPATIBLE_INPUT if the roots vector does not have length n
+ - CPL_ERROR_DIVISION_BY_ZERO if a division by zero occurs (n > 4)
+ - CPL_ERROR_CONTINUE if the algorithm does not converge (n > 4)
+*/
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_polynomial_solve_1d_nonzero(cpl_polynomial * self,
+ cpl_vector * roots,
+ cpl_size * preal)
+{
+ cpl_error_code error = CPL_ERROR_NONE;
+ const cpl_size ncoeffs = 1 + cpl_polynomial_get_degree(self);
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(roots != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(preal != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_INVALID_TYPE);
+ cpl_ensure_code(ncoeffs > 1, CPL_ERROR_DATA_NOT_FOUND);
+ cpl_ensure_code(*preal >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(ncoeffs + *preal == 1+cpl_vector_get_size(roots),
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+
+ switch (ncoeffs) {
+
+ case 2 : {
+ const cpl_size i1 = 1;
+ const cpl_size i0 = 0;
+ const double p1 = cpl_polynomial_get_coeff(self, &i1);
+ const double p0 = cpl_polynomial_get_coeff(self, &i0);
+
+ cpl_vector_set(roots, (*preal)++, -p0/p1);
+ break;
+ }
+ case 3 : {
+ const cpl_size i2 = 2;
+ const cpl_size i1 = 1;
+ const cpl_size i0 = 0;
+ const double p2 = cpl_polynomial_get_coeff(self, &i2);
+ const double p1 = cpl_polynomial_get_coeff(self, &i1);
+ const double p0 = cpl_polynomial_get_coeff(self, &i0);
+ double x1, x2;
+
+ if (irplib_polynomial_solve_1d_2(p2, p1, p0, &x1, &x2)) {
+ /* This is the complex root in the upper imaginary half-plane */
+ cpl_vector_set(roots, (*preal) , x1);
+ cpl_vector_set(roots, (*preal)+1, x2);
+ } else {
+ cpl_vector_set(roots, (*preal)++, x1);
+ cpl_vector_set(roots, (*preal)++, x2);
+ }
+ break;
+ }
+ case 4 : {
+ const cpl_size i3 = 3;
+ const cpl_size i2 = 2;
+ const cpl_size i1 = 1;
+ const cpl_size i0 = 0;
+ const double p3 = cpl_polynomial_get_coeff(self, &i3);
+ const double p2 = cpl_polynomial_get_coeff(self, &i2);
+ const double p1 = cpl_polynomial_get_coeff(self, &i1);
+ const double p0 = cpl_polynomial_get_coeff(self, &i0);
+ double x1, x2, x3;
+
+ if (irplib_polynomial_solve_1d_3(p3, p2, p1, p0, &x1, &x2, &x3,
+ NULL, NULL)) {
+ cpl_vector_set(roots, (*preal)++, x1);
+ /* This is the complex root in the upper imaginary half-plane */
+ cpl_vector_set(roots, (*preal) , x2);
+ cpl_vector_set(roots, (*preal)+1, x3);
+ } else {
+ cpl_vector_set(roots, (*preal)++, x1);
+ cpl_vector_set(roots, (*preal)++, x2);
+ cpl_vector_set(roots, (*preal)++, x3);
+ }
+ break;
+ }
+ case 5 : {
+ const cpl_size i4 = 4;
+ const cpl_size i3 = 3;
+ const cpl_size i2 = 2;
+ const cpl_size i1 = 1;
+ const cpl_size i0 = 0;
+ const double p4 = cpl_polynomial_get_coeff(self, &i4);
+ const double p3 = cpl_polynomial_get_coeff(self, &i3);
+ const double p2 = cpl_polynomial_get_coeff(self, &i2);
+ const double p1 = cpl_polynomial_get_coeff(self, &i1);
+ const double p0 = cpl_polynomial_get_coeff(self, &i0);
+ double x1, x2, x3, x4;
+ cpl_size nreal;
+
+ error = irplib_polynomial_solve_1d_4(p4, p3, p2, p1, p0, &nreal,
+ &x1, &x2, &x3, &x4);
+ if (!error) {
+ cpl_vector_set(roots, (*preal) , x1);
+ cpl_vector_set(roots, (*preal)+1, x2);
+ cpl_vector_set(roots, (*preal)+2, x3);
+ cpl_vector_set(roots, (*preal)+3, x4);
+
+ *preal += nreal;
+ }
+ break;
+ }
+
+ default: {
+
+ /* Try to reduce the problem by finding a single root */
+#ifndef IPRLIB_POLYNOMIAL_USE_MONOMIAL_ROOT
+ const cpl_size n0 = ncoeffs-1;
+ const double pn0 = cpl_polynomial_get_coeff(self, &n0);
+ const cpl_size n1 = ncoeffs-2;
+ const double pn1 = cpl_polynomial_get_coeff(self, &n1);
+ /* First guess of root is the root average.
+ FIXME: May need refinement, e.g. via bisection */
+ const double rmean = -pn1 / (pn0 * n0);
+ double root = rmean;
+#else
+ /* Try an analytical solution to a (shifted) monomial */
+ cpl_polynomial * copy = cpl_polynomial_duplicate(self);
+ const cpl_size i0 = 0;
+ const double rmean = irplib_polynomial_depress_1d(copy);
+ const double c0 = cpl_polynomial_get_coeff(copy, &i0);
+ double root = rmean + ((n0&1) && c0 < 0.0 ? -1.0 : 1.0)
+ * pow(fabs(c0), 1.0/n0);
+
+ cpl_polynomial_delete(copy);
+#endif
+
+ error = cpl_polynomial_solve_1d(self, root, &root, 1);
+
+ if (!error) {
+
+ cpl_vector_set(roots, (*preal)++, root);
+
+ irplib_polynomial_divide_1d_root(self, root, NULL);
+
+ error = irplib_polynomial_solve_1d_nonzero(self, roots, preal);
+
+ if (!error && *preal > 1) {
+ /* Sort the real roots */
+
+ /* FIXME: Assumes that all roots found so far are real */
+
+ cpl_vector * reals = cpl_vector_wrap(*preal,
+ cpl_vector_get_data(roots));
+ cpl_vector_sort(reals, 1);
+ (void)cpl_vector_unwrap(reals);
+ }
+ }
+ break;
+ }
+ }
+
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the quadratic equation p2 * x^2 + p1 * x + p0 = 0, p2 != 0
+ @param p2 The non-zero coefficient to x^2
+ @param p1 The coefficient to x
+ @param p0 The constant term
+ @param px1 The 1st root or the real part of the complex roots
+ @param px2 The 2nd root or the imaginary part of the complex roots
+ @return CPL_TRUE iff the roots are complex
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_boolean irplib_polynomial_solve_1d_2(double p2, double p1, double p0,
+ double * px1,
+ double * px2) {
+
+ const double sqrtD = sqrt(fabs(p1 * p1 - 4.0 * p2 * p0));
+ cpl_boolean is_complex = CPL_FALSE;
+ double x1 = -0.5 * p1 / p2; /* Double root */
+ double x2;
+
+ /* Compute residual, assuming D == 0 */
+ double res0 = irplib_polynomial_eval_2_max(p2, p1, p0, CPL_FALSE, x1, x1);
+ double res;
+
+ assert(px1 != NULL );
+ assert(px2 != NULL );
+
+ *px2 = *px1 = x1;
+
+ /* Compute residual, assuming D > 0 */
+
+ /* x1 is the root with largest absolute value */
+ if (p1 > 0.0) {
+ x1 = -0.5 * (p1 + sqrtD);
+ irplib_trace(); /* OK */
+ } else {
+ x1 = -0.5 * (p1 - sqrtD);
+ irplib_trace(); /* OK */
+ }
+ /* Compute smaller root via division to avoid
+ loss of precision due to cancellation */
+ x2 = p0 / x1;
+ x1 /= p2; /* Scale x1 with leading coefficient */
+
+ res = irplib_polynomial_eval_2_max(p2, p1, p0, CPL_FALSE, x1, x2);
+
+ if (res < res0) {
+ res0 = res;
+ if (x2 > x1) {
+ *px1 = x1;
+ *px2 = x2;
+ irplib_trace(); /* OK */
+ } else {
+ *px1 = x2;
+ *px2 = x1;
+ irplib_trace(); /* OK */
+ }
+ }
+
+ /* Compute residual, assuming D < 0 */
+
+ x1 = -0.5 * p1 / p2; /* Real part of complex root */
+ x2 = 0.5 * sqrtD / fabs(p2); /* Positive, imaginary part of root */
+
+ res = irplib_polynomial_eval_2_max(p2, p1, p0, CPL_TRUE, x1, x2);
+
+ if (res < res0) {
+ *px1 = x1;
+ *px2 = x2;
+ is_complex = CPL_TRUE;
+ irplib_trace(); /* OK */
+ }
+
+ return is_complex;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the max residual on a 2nd degree 1D-polynomial on the roots
+ @param p2 p2
+ @param p1 p1
+ @param p0 p0
+ @param is_c CPL_TRUE iff the two roots are complex
+ @param x1 The 1st point of evaluation (or real part on complex)
+ @param x2 The 2nd point of evaluation (or imaginary part on complex)
+ @return The result
+
+
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_polynomial_eval_2_max(double p2, double p1, double p0,
+ cpl_boolean is_c,
+ double x1, double x2)
+{
+ double res;
+
+ if (is_c) {
+ res = fabs(p0 + x1 * (p1 + x1 * p2) - p2 * x2 * x2);
+ irplib_trace(); /* OK */
+ } else {
+ const double r1 = fabs(p0 + x1 * (p1 + x1 * p2));
+ const double r2 = fabs(p0 + x2 * (p1 + x2 * p2));
+
+ res = r1 > r2 ? r1 : r2;
+ irplib_trace(); /* OK */
+ }
+
+ return res;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the max residual on a 3rd degree 1D-polynomial on the roots
+ @param p3 p3
+ @param p2 p2
+ @param p1 p1
+ @param p0 p0
+ @param is_c CPL_TRUE iff two roots are complex
+ @param x1 The 1st point of evaluation (real)
+ @param x2 The 2nd point of evaluation (or real part on complex)
+ @param x3 The 3rd point of evaluation (or imaginary part on complex)
+ @return The result
+
+
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_polynomial_eval_3_max(double p3, double p2,
+ double p1, double p0,
+ cpl_boolean is_c,
+ double x1, double x2, double x3)
+{
+ const double r1 = fabs(p0 + x1 * (p1 + x1 * (p2 + x1 * p3)));
+ double res;
+
+ if (is_c) {
+ const double r2 = fabs(p0 + x2 * (p1 + x2 * (p2 + x2 * p3))
+ - x3 * x3 * ( 3.0 * p3 * x2 + p2));
+
+ res = r1 > r2 ? r1 : r2;
+ irplib_trace(); /* OK */
+ } else {
+ const double r2 = fabs(p0 + x2 * (p1 + x2 * (p2 + x2 * p3)));
+ const double r3 = fabs(p0 + x3 * (p1 + x3 * (p2 + x3 * p3)));
+ res = r1 > r2 ? (r1 > r3 ? r1 : r3) : (r2 > r3 ? r2 : r3);
+ irplib_trace(); /* OK */
+ }
+
+ /* cpl_msg_info(cpl_func, "%d: %g (%g)", __LINE__, res, r1); */
+
+ return res;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the cubic equation p3 * x^3 + p2 * x^2 + p1 * x + p0 = 0
+ @param p3 The non-zero coefficient to x^3
+ @param p2 The coefficient to x^2
+ @param p1 The coefficient to x
+ @param p0 The constant term
+ @param px1 The 1st root (real)
+ @param px2 The 2nd root or the real part of the complex roots
+ @param px3 The 3rd root or the imaginary part of the complex roots
+ @param pdbl1 CPL_TRUE iff *px1 == *px2 (only for all real)
+ @param pdbl2 CPL_TRUE iff *px2 == *px3 (only for all real)
+ @return CPL_TRUE iff two of the roots are complex
+ @see gsl_poly_complex_solve_cubic() of GSL v. 1.9
+ @note px2 and px3 may be NULL, if in this case all three roots are real *px1
+ will be set to the largest root.
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_boolean irplib_polynomial_solve_1d_3(double p3, double p2, double p1,
+ double p0,
+ double * px1,
+ double * px2,
+ double * px3,
+ cpl_boolean * pdbl1,
+ cpl_boolean * pdbl2) {
+ cpl_boolean is_complex = CPL_FALSE;
+ const double a = p2/p3;
+ const double b = p1/p3;
+ const double c = p0/p3;
+
+ const double q = (a * a - 3.0 * b);
+ const double r = (a * (2.0 * a * a - 9.0 * b) + 27.0 * c);
+
+ const double Q = q / 9.0;
+ const double R = r / 54.0;
+
+ const double Q3 = Q * Q * Q;
+ const double R2 = R * R;
+
+ double x1 = DBL_MAX; /* Fix (false) uninit warning */
+ double x2 = DBL_MAX; /* Fix (false) uninit warning */
+ double x3 = DBL_MAX; /* Fix (false) uninit warning */
+ double xx1 = DBL_MAX; /* Fix (false) uninit warning */
+ double xx2 = DBL_MAX; /* Fix (false) uninit warning */
+ double xx3 = DBL_MAX; /* Fix (false) uninit warning */
+
+ double resx = DBL_MAX;
+ double res = DBL_MAX;
+ cpl_boolean is_first = CPL_TRUE;
+
+ cpl_boolean dbl2;
+
+
+ assert(px1 != NULL );
+
+ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE;
+ if (pdbl2 != NULL) *pdbl2 = CPL_FALSE;
+
+ dbl2 = CPL_FALSE;
+
+ /*
+ All branches (for which the roots are defined) are evaluated, and
+ the branch with the smallest maximum-residual is chosen.
+ When two maximum-residual are identical, preference is given to
+ the purely real solution and if necessary to the solution with a
+ double root.
+ */
+
+ if ((R2 >= Q3 && R != 0.0) || R2 > Q3) {
+
+ cpl_boolean is_c = CPL_FALSE;
+
+ irplib_polynomial_solve_1d_3c(a, c, Q, Q3, R, R2, &x1, &x2, &x3,
+ &is_c, &dbl2);
+
+
+ res = resx = irplib_polynomial_eval_3_max(p3, p2, p1, p0, is_c,
+ x1, x2, x3);
+
+ is_first = CPL_FALSE;
+
+ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE;
+ if (!is_c && pdbl2 != NULL) *pdbl2 = dbl2;
+ is_complex = is_c;
+ irplib_trace(); /* OK */
+
+ }
+
+ if (Q > 0.0 && fabs(R / (Q * sqrt(Q))) <= 1.0) {
+
+ /* this test is actually R2 < Q3, written in a form suitable
+ for exact computation with integers */
+
+ /* assert( Q > 0.0 ); */
+
+ irplib_polynomial_solve_1d_3r(a, c, Q, R, &xx1, &xx2, &xx3);
+
+ resx = irplib_polynomial_eval_3_max(p3, p2, p1, p0, CPL_FALSE,
+ xx1, xx2, xx3);
+
+ if (is_first || (dbl2 ? resx < res : resx <= res)) {
+ is_first = CPL_FALSE;
+ res = resx;
+ x1 = xx1;
+ x2 = xx2;
+ x3 = xx3;
+ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE;
+ if (pdbl2 != NULL) *pdbl2 = CPL_FALSE;
+ is_complex = CPL_FALSE;
+ irplib_trace(); /* OK */
+ }
+ }
+
+ if (Q >= 0) {
+ cpl_boolean dbl1 = CPL_FALSE;
+
+
+ irplib_polynomial_solve_1d_32(a, c, Q, &xx1, &xx2, &xx3, &dbl2);
+
+ resx = irplib_polynomial_eval_3_max(p3, p2, p1, p0, CPL_FALSE,
+ xx1, xx2, xx3);
+ /*
+ cpl_msg_info(cpl_func, "%d: %g = %g - %g (%u)", __LINE__,
+ res - resx, res, resx, is_complex);
+ */
+
+ if (is_first || resx <= res) {
+ is_first = CPL_FALSE;
+ res = resx;
+ x1 = xx1;
+ x2 = xx2;
+ x3 = xx3;
+ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE;
+ if (pdbl2 != NULL) *pdbl2 = dbl2;
+ is_complex = CPL_FALSE;
+ irplib_trace(); /* OK */
+ }
+
+
+ /* This branch also covers the case where the depressed cubic
+ polynomial has zero as triple root (i.e. Q == R == 0) */
+
+ irplib_polynomial_solve_1d_31(a, Q, &xx1, &xx2, &xx3, &dbl1);
+
+ resx = irplib_polynomial_eval_3_max(p3, p2, p1, p0, CPL_FALSE,
+ xx1, xx2, xx3);
+
+ if (resx <= res) {
+ is_first = CPL_FALSE;
+ res = resx;
+ x1 = xx1;
+ x2 = xx2;
+ x3 = xx3;
+ if (pdbl1 != NULL) *pdbl1 = dbl1;
+ if (pdbl2 != NULL) *pdbl2 = CPL_FALSE;
+ is_complex = CPL_FALSE;
+ irplib_trace(); /* OK */
+ }
+
+ }
+
+ if (px2 != NULL && px3 != NULL) {
+ *px1 = x1;
+ *px2 = x2;
+ *px3 = x3;
+ irplib_trace(); /* OK */
+ } else if (is_complex) {
+ *px1 = x1;
+ irplib_trace(); /* OK */
+ } else {
+ *px1 = x3;
+ irplib_trace(); /* OK */
+ }
+
+ return is_complex;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the monic, depressed cubic with 1st and 2nd root as double
+ @param a p2/p3 for back-transform
+ @param Q The linear term, must be positive
+ @param px1 The 1st root
+ @param px2 The 2nd root
+ @param px3 The 3rd root
+ @param pdbl1 CPL_TRUE iff *px1 == *px2
+ @return void
+ @see irplib_polynomial_solve_1d_3()
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_polynomial_solve_1d_31(double a, double Q,
+ double * px1, double * px2,
+ double * px3, cpl_boolean * pdbl1)
+{
+
+ const double sqrtQ = sqrt (Q);
+
+ double x1, x2, x3;
+
+ x2 = x1 = -sqrtQ - a / 3.0;
+ x3 = 2.0 * sqrtQ - a / 3.0;
+ if (pdbl1 != NULL) *pdbl1 = CPL_TRUE;
+
+ *px1 = x1;
+ *px2 = x2;
+ *px3 = x3;
+
+ irplib_trace(); /* OK */
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the monic, depressed cubic with 2nd and 3rd root as double
+ @param a p2/p3 for back-transform
+ @param c p0/p3 for finding root via division of constant term
+ @param Q The linear term, must be positive
+ @param px1 The 1st root
+ @param px2 The 2nd root
+ @param px3 The 3rd root
+ @param pdbl2 CPL_TRUE iff *px2 == *px3
+ @return void
+ @see irplib_polynomial_solve_1d_3()
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_polynomial_solve_1d_32(double a, double c, double Q,
+ double * px1, double * px2,
+ double * px3, cpl_boolean * pdbl2)
+{
+
+ const double sqrtQ = sqrt (Q);
+
+ double x1 = DBL_MAX;
+ double x2 = DBL_MAX;
+ double x3 = DBL_MAX;
+
+ if (a > 0.0) {
+ /* a and sqrt(Q) have same sign - or Q is zero */
+ x1 = -2.0 * sqrtQ - a / 3.0;
+ /* FIXME: Two small roots with opposite signs may
+ end up here, with the sign lost for one of them */
+ x3 = x2 = -a < x1 ? -sqrt(fabs(c / x1)) : sqrt(fabs(c / x1));
+ if (pdbl2 != NULL) *pdbl2 = CPL_TRUE;
+ irplib_trace(); /* OK */
+ } else if (a < 0.0) {
+ /* a and sqrt(Q) have opposite signs - or Q is zero */
+ x3 = x2 = sqrtQ - a / 3.0;
+ x1 = -c / (x2 * x2);
+ if (pdbl2 != NULL) *pdbl2 = CPL_TRUE;
+ irplib_trace(); /* OK */
+ } else {
+ x1 = -2.0 * sqrtQ;
+ x3 = x2 = sqrtQ;
+ if (pdbl2 != NULL) *pdbl2 = CPL_TRUE;
+ irplib_trace(); /* OK */
+ }
+
+ *px1 = x1;
+ *px2 = x2;
+ *px3 = x3;
+
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the monic, depressed cubic with complex roots
+ @param a p2/p3 for back-transform
+ @param c p0/p3 for finding root via division of constant term
+ @param Q The linear term
+ @param Q3 Q^3
+ @param R The constant term
+ @param R2 R^2
+ @param px1 The 1st root (real)
+ @param px2 The 2nd root or the real part of the complex roots
+ @param px3 The 3rd root or the imaginary part of the complex roots
+ @param pis_c CPL_TRUE iff complex
+ @param pdbl2 CPL_TRUE iff *px2 == *px3 (only for all real)
+ @return void
+ @see irplib_polynomial_solve_1d_3()
+ @note If all roots are real, then two of them are a double root.
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_polynomial_solve_1d_3c(double a, double c,
+ double Q, double Q3,
+ double R, double R2,
+ double * px1,
+ double * px2, double * px3,
+ cpl_boolean * pis_c,
+ cpl_boolean * pdbl2)
+{
+
+ /* Due to finite precision some double roots may be missed, and
+ will be considered to be a pair of complex roots z = x +/-
+ epsilon i close to the real axis. */
+
+ /* Another case: A double root, which is small relative to the
+ last root, may cause this branch to be taken - with the
+ imaginary part eventually being truncated to zero. */
+
+ const double sgnR = (R >= 0 ? 1.0 : -1.0);
+ const double A = -sgnR * pow (fabs (R) + sqrt (R2 - Q3), 1.0 / 3.0);
+ const double B = Q / A;
+
+ double x1 = DBL_MAX;
+ double x2 = DBL_MAX;
+ double x3 = DBL_MAX;
+ cpl_boolean is_complex = CPL_FALSE;
+
+ if (( A > -B && a > 0.0) || (A < -B && a < 0.0)) {
+ /* A+B has same sign as a */
+
+ /* Real part of complex conjugate */
+ x2 = -0.5 * (A + B) - a / 3.0; /* No cancellation */
+ /* Positive, imaginary part of complex conjugate */
+ x3 = 0.5 * CPL_MATH_SQRT3 * fabs(A - B);
+
+ x1 = -c / (x2 * x2 + x3 * x3);
+ irplib_trace(); /* OK */
+ } else {
+ /* A+B and a have opposite signs - or exactly one is zero */
+ x1 = A + B - a / 3.0;
+ /* Positive, imaginary part of complex conjugate */
+ x3 = 0.5 * CPL_MATH_SQRT3 * fabs(A - B);
+
+ if (x3 > 0.0) {
+ /* Real part of complex conjugate */
+ x2 = -0.5 * (A + B) - a / 3.0; /* FIXME: Cancellation */
+ irplib_trace(); /* OK */
+ } else {
+
+ x2 = -a < x1 ? -sqrt(fabs(c / x1)) : sqrt(fabs(c / x1));
+ x3 = 0.0;
+ irplib_trace(); /* OK */
+ }
+ }
+
+ if (x3 > 0.0) {
+ is_complex = CPL_TRUE;
+ irplib_trace(); /* OK */
+ } else {
+ /* Whoaa, the imaginary part was truncated to zero
+ - return a real, double root */
+ x3 = x2;
+ if (pdbl2 != NULL) *pdbl2 = CPL_TRUE;
+ irplib_trace(); /* OK */
+ }
+
+ *px1 = x1;
+ *px2 = x2;
+ *px3 = x3;
+ *pis_c = is_complex;
+
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the monic, depressed cubic with 3 distinct, real roots
+ @param a p2/p3 for back-transform
+ @param c p0/p3 for finding root via division of constant term
+ @param Q The linear term, must be positive
+ @param R The constant term
+ @param px1 The 1st root
+ @param px2 The 2nd root
+ @param px3 The 3rd root
+ @return void
+ @see irplib_polynomial_solve_1d_3()
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_polynomial_solve_1d_3r(double a, double c,
+ double Q, double R,
+ double * px1,
+ double * px2, double * px3)
+{
+
+ const double sqrtQ = sqrt(Q);
+ const double theta = acos (R / (Q * sqrtQ)); /* theta in range [0; pi] */
+
+ /* -1.0 <= cos((theta + CPL_MATH_2PI) / 3.0) <= -0.5
+ -0.5 <= cos((theta - CPL_MATH_2PI) / 3.0) <= 0.5
+ 0.5 <= cos((theta ) / 3.0) <= 1.0 */
+
+#define TR1 (-2.0 * sqrtQ * cos( theta / 3.0))
+#define TR2 (-2.0 * sqrtQ * cos((theta - CPL_MATH_2PI) / 3.0))
+#define TR3 (-2.0 * sqrtQ * cos((theta + CPL_MATH_2PI) / 3.0))
+
+ /* TR1 < TR2 < TR3, except when theta == 0, then TR2 == TR3 */
+
+ /* The three roots must be transformed back via subtraction with a/3.
+ To prevent loss of precision due to cancellation, the root which
+ is closest to a/3 is computed using the relation
+ p3 * x1 * x2 * x3 = -p0 */
+
+ double x1 = DBL_MAX;
+ double x2 = DBL_MAX;
+ double x3 = DBL_MAX;
+
+ if (a > 0.0) {
+ x1 = TR1 - a / 3.0;
+ if (TR2 > 0.0 && (TR2 + TR3) > 2.0 * a) {
+ /* FIXME: Cancellation may still effect x3 ? */
+ x3 = TR3 - a / 3.0;
+ x2 = -c / ( x1 * x3 );
+ irplib_trace(); /* OK */
+ } else {
+ /* FIXME: Cancellation may still effect x2, especially
+ if x2, x3 is (almost) a double root, i.e.
+ if theta is close to zero. */
+ x2 = TR2 - a / 3.0;
+
+ x3 = -c / ( x1 * x2 );
+ irplib_trace(); /* OK */
+ }
+ } else if (a < 0.0) {
+ x3 = TR3 - a / 3.0;
+ if (TR2 < 0.0 && (TR1 + TR2) > 2.0 * a) {
+ x1 = TR1 - a / 3.0;
+ x2 = -c / ( x1 * x3 );
+ irplib_trace(); /* OK */
+ } else {
+ x2 = TR2 - a / 3.0;
+ x1 = -c / ( x2 * x3 );
+ irplib_trace(); /* OK */
+ }
+ } else {
+ x1 = TR1;
+ x2 = TR2;
+ x3 = TR3;
+ irplib_trace(); /* OK */
+ }
+
+ assert(x1 < x3);
+
+ if (x1 > x2) {
+ /* In absence of round-off:
+ theta == PI: x1 == x2,
+ theta < PI: x1 < x2,
+
+ The only way x1 could exceed x2 would be due to round-off when
+ theta is close to PI */
+
+ x1 = x2 = 0.5 * ( x1 + x2 );
+ irplib_trace(); /* OK, tested only for x1 == x2 */
+ } else if (x2 > x3) {
+ /* In absence of round-off:
+ theta == 0: x2 == x3,
+ theta > 0: x2 < x3,
+
+ For small theta:
+ Round-off can cause x2 to become greater than x3 */
+
+ x3 = x2 = 0.5 * ( x2 + x3 );
+ irplib_trace(); /* OK */
+ }
+
+ *px1 = x1;
+ *px2 = x2;
+ *px3 = x3;
+
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Solve the quartic equation
+ p4 * x^4 + p3 * x^3 + p2 * x^2 + p1 * x + p0 = 0
+ @param p4 The non-zero coefficient to x^4
+ @param p3 The coefficient to x^3
+ @param p2 The coefficient to x^2
+ @param p1 The coefficient to x
+ @param p0 The constant term
+ @param preal *preal is the number of real roots, or undefined on error
+ @param px1 The 1st root or the real part of the 1st complex roots-pair
+ @param px2 The 2nd root or the imaginary part of the 1st complex roots
+ @param px3 The 3rd root or the real part of the 2nd complex roots-pair
+ @param px4 The 4th root or the imaginary part of the 2nd complex roots
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_polynomial_solve_1d_4(double p4, double p3,
+ double p2, double p1,
+ double p0, cpl_size * preal,
+ double * px1, double * px2,
+ double * px3, double * px4)
+{
+
+ /* Construct the monic, depressed quartic using Horners scheme on 1 / p4 */
+ const double a = (p2 - 0.375 * p3 * p3 / p4) / p4;
+ const double b = (p1 - 0.5 * (p2 - 0.25 * p3 * p3 / p4 ) * p3 / p4 ) / p4;
+ const double c =
+ (p0 - 0.25 * (p1 - 0.25 * (p2 - 0.1875 * p3 * p3 / p4 ) * p3 / p4
+ ) * p3 / p4 ) / p4;
+
+ double x1 = DBL_MAX; /* Fix (false) uninit warning */
+ double x2 = DBL_MAX; /* Fix (false) uninit warning */
+ double x3 = DBL_MAX; /* Fix (false) uninit warning */
+ double x4 = DBL_MAX; /* Fix (false) uninit warning */
+
+ assert(preal != NULL );
+ assert(px1 != NULL );
+ assert(px2 != NULL );
+ assert(px3 != NULL );
+ assert(px4 != NULL );
+
+ *preal = 4;
+
+ if (c == 0.0) {
+ /* The depressed quartic has zero as root */
+ /* Since the sum of the roots is zero, at least one is negative
+ and at least one is positive - unless they are all zero */
+ cpl_boolean dbl1, dbl2;
+ const cpl_boolean is_real =
+ !irplib_polynomial_solve_1d_3(1.0, 0.0, a, b, &x1, &x3, &x4,
+ &dbl1, &dbl2);
+
+ x1 -= 0.25 * p3 / p4;
+ x2 = -0.25 * p3 / p4;
+ x3 -= 0.25 * p3 / p4;
+ if (is_real) {
+
+ if (dbl2) {
+ x4 = x3;
+ assert( x1 <= x2);
+ assert( x2 <= x3);
+ } else {
+ x4 -= 0.25 * p3 / p4;
+ /* Need (only) a guarded swap of x2, x3 */
+ if (x2 > x3) {
+ IRPLIB_SWAP(x2, x3);
+ }
+ if (dbl1) {
+ assert( x1 <= x2); /* The cubic may have 0 as triple root */
+ assert( x2 <= x3);
+ assert( x2 <= x4);
+ } else {
+ assert( x1 < x2);
+ assert( x2 < x4);
+ }
+ }
+ } else {
+ *preal = 2;
+
+ if (x1 > x2) {
+ assert( x3 <= x2 ); /* Don't swap a complex root */
+
+ IRPLIB_SWAP(x1, x2);
+ } else {
+ assert( x3 >= x2 );
+ }
+ }
+
+ } else if (b == 0.0) {
+ /* The monic, depressed quartic is a monic, biquadratic equation */
+ double u1, u2;
+ const cpl_boolean is_complex = irplib_polynomial_solve_1d_2(1.0, a, c,
+ &u1, &u2);
+
+ if (is_complex) {
+ /* All four roots are conjugate, complex */
+ const double norm = sqrt(u1*u1 + u2*u2);
+ const double v1 = sqrt(0.5*(norm+u1));
+ const double v2 = u2 / sqrt(2.0*(norm+u1));
+
+
+ x1 = -0.25 * p3 / p4 - v1;
+ x3 = -0.25 * p3 / p4 + v1;
+
+ x4 = x2 = v2;
+
+ *preal = 0;
+
+ } else if (u1 >= 0.0) {
+ /* All four roots are real */
+ const double sv1 = sqrt(u1);
+ const double sv2 = sqrt(u2);
+
+
+ *preal = 4;
+
+ x1 = -0.25 * p3 / p4 - sv2;
+ x2 = -0.25 * p3 / p4 - sv1;
+ x3 = -0.25 * p3 / p4 + sv1;
+ x4 = -0.25 * p3 / p4 + sv2;
+ } else if (u2 < 0.0) {
+ /* All four roots are conjugate, complex */
+ const double sv1 = sqrt(-u2);
+ const double sv2 = sqrt(-u1);
+
+
+ *preal = 0;
+
+ x1 = x3 = -0.25 * p3 / p4;
+
+ x2 = sv1;
+ x4 = sv2;
+ } else {
+ /* Two roots are real, two roots are conjugate, complex */
+ const double sv1 = sqrt(-u1);
+ const double sv2 = sqrt(u2);
+
+
+ *preal = 2;
+
+ x1 = -0.25 * p3 / p4 - sv2;
+ x2 = -0.25 * p3 / p4 + sv2;
+
+ x3 = -0.25 * p3 / p4;
+ x4 = sv1;
+ }
+ } else {
+ /* Need a root from the nested, monic cubic */
+ const double q2 = -a;
+ const double q1 = -4.0 * c;
+ const double q0 = 4.0 * a * c - b * b;
+ double u1, sqrtd, sqrtrd;
+ double z1, z2, z3, z4;
+
+ cpl_boolean is_complex1, is_complex2;
+
+ /* Largest cubic root ensures real square roots when solving the
+ quartic equation */
+ (void)irplib_polynomial_solve_1d_3(1.0, q2, q1, q0, &u1, NULL, NULL,
+ NULL, NULL);
+
+
+ assert( u1 > a );
+
+ sqrtd = sqrt(u1 - a);
+
+ sqrtrd = 0.5 * b/sqrtd;
+
+ is_complex1 = irplib_polynomial_solve_1d_2(1.0, sqrtd, 0.5*u1 - sqrtrd,
+ &z1, &z2);
+
+ is_complex2 = irplib_polynomial_solve_1d_2(1.0, -sqrtd, 0.5*u1 + sqrtrd,
+ &z3, &z4);
+
+ z1 -= 0.25 * p3 / p4;
+ z3 -= 0.25 * p3 / p4;
+ if (!is_complex1) z2 -= 0.25 * p3 / p4;
+ if (!is_complex2) z4 -= 0.25 * p3 / p4;
+
+ if (!is_complex1 && is_complex2) {
+ *preal = 2;
+ x1 = z1;
+ x2 = z2;
+ x3 = z3;
+ x4 = z4;
+ } else if (is_complex1 && !is_complex2) {
+ *preal = 2;
+ x1 = z3;
+ x2 = z4;
+ x3 = z1;
+ x4 = z2;
+ } else if (is_complex1 && is_complex2) {
+ *preal = 0;
+
+ if (z1 < z3 || (z1 == z3 && z2 <= z4)) {
+ x1 = z1;
+ x2 = z2;
+ x3 = z3;
+ x4 = z4;
+ } else {
+ x1 = z3;
+ x2 = z4;
+ x3 = z1;
+ x4 = z2;
+ }
+ } else {
+ *preal = 4;
+
+ if (z3 >= z2) {
+ x1 = z1;
+ x2 = z2;
+ x3 = z3;
+ x4 = z4;
+ } else if (z4 <= z1) {
+ x1 = z3;
+ x2 = z4;
+ x3 = z1;
+ x4 = z2;
+ } else if (z2 > z4) {
+ x1 = z3;
+ x2 = z1;
+ x3 = z4;
+ x4 = z2;
+ } else {
+ x1 = z1;
+ x2 = z3;
+ x3 = z2;
+ x4 = z4;
+ }
+ }
+ }
+
+ *px1 = x1;
+ *px2 = x2;
+ *px3 = x3;
+ *px4 = x4;
+
+ return CPL_ERROR_NONE;
+}
+
+#ifdef IPRLIB_POLYNOMIAL_USE_MONOMIAL_ROOT
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Depress a 1D-polynomial of degree at least 2.
+ @param self The 1D-polynomial to modify
+ @return The mean of the roots of the input polynomial
+
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_polynomial_depress_1d(cpl_polynomial * self)
+{
+
+ const cpl_size degree = cpl_polynomial_get_degree(self);
+ const cpl_size nc1 = degree - 1;
+ const double an = cpl_polynomial_get_coeff(self, °ree);
+ const double an1 = cpl_polynomial_get_coeff(self, &nc1);
+ double rmean;
+ cpl_size i;
+
+
+ cpl_ensure(degree > 0, CPL_ERROR_DATA_NOT_FOUND, 0.0);
+
+ assert( an != 0.0 );
+
+ rmean = -an1/(an * (double)degree);
+
+ if (rmean != 0.0) {
+
+ cpl_polynomial_shift_1d(self, 0, rmean);
+
+ cpl_polynomial_set_coeff(self, &nc1, 0.0); /* Round-off... */
+
+ }
+
+ /* Set leading coefficient to one. */
+ for (i = 0; i < degree-1; i++) {
+ const double ai = cpl_polynomial_get_coeff(self, &i) / an;
+ cpl_polynomial_set_coeff(self, &i, ai);
+ }
+
+ cpl_polynomial_set_coeff(self, °ree, 1.0); /* Round-off... */
+
+ return rmean;
+}
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Modify p, p(x) := p(x)/(x-r), where p(r) = 0.
+ @param p The polynomial to be modified in place
+ @param r The root
+ @param pres If non-NULL, *pres is the residual of the original p, p(r).
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if an input pointer is NULL
+ - CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension
+ - CPL_ERROR_DATA_NOT_FOUND if the polynomial does not have a degree of at
+ least 1.
+ */
+/*----------------------------------------------------------------------------*/
+static
+cpl_error_code irplib_polynomial_divide_1d_root(cpl_polynomial * p, double r,
+ double * pres)
+{
+
+ const cpl_size n = cpl_polynomial_get_degree(p);
+ double sum;
+ cpl_size i;
+
+
+ cpl_ensure_code(p != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(p) == 1,
+ CPL_ERROR_INVALID_TYPE);
+ cpl_ensure_code(n > 0, CPL_ERROR_DATA_NOT_FOUND);
+
+ sum = cpl_polynomial_get_coeff(p, &n);
+ cpl_polynomial_set_coeff(p, &n, 0.0);
+
+ for (i = n-1; i >= 0; i--) {
+ const double coeff = cpl_polynomial_get_coeff(p, &i);
+
+ cpl_polynomial_set_coeff(p, &i, sum);
+
+ sum = coeff + r * sum;
+
+ }
+
+ if (pres != NULL) *pres = sum;
+
+ return CPL_ERROR_NONE;
+}
diff --git a/irplib/irplib_polynomial.h b/irplib/irplib_polynomial.h
new file mode 100644
index 0000000..64d3f4d
--- /dev/null
+++ b/irplib/irplib_polynomial.h
@@ -0,0 +1,70 @@
+/* $Id: irplib_polynomial.h,v 1.9 2012/01/12 10:40:21 llundin Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2007 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: llundin $
+ * $Date: 2012/01/12 10:40:21 $
+ * $Revision: 1.9 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_POLYNOMIAL_H
+#define IRPLIB_POLYNOMIAL_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+
+#if defined CPL_VERSION_CODE && CPL_VERSION_CODE > CPL_VERSION(5, 92, 0)
+#define irplib_polynomial_add cpl_polynomial_add
+#define irplib_polynomial_subtract cpl_polynomial_subtract
+#define irplib_polynomial_multiply_scalar cpl_polynomial_multiply_scalar
+#else
+cpl_error_code irplib_polynomial_add(cpl_polynomial *,
+ const cpl_polynomial *,
+ const cpl_polynomial *);
+
+cpl_error_code irplib_polynomial_subtract(cpl_polynomial *,
+ const cpl_polynomial *,
+ const cpl_polynomial *);
+
+cpl_error_code irplib_polynomial_multiply_scalar(cpl_polynomial *,
+ const cpl_polynomial *,
+ double);
+#endif
+
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+cpl_error_code irplib_polynomial_solve_1d_all(const cpl_polynomial *,
+ cpl_vector *, cpl_size *);
+
+#endif
diff --git a/irplib/irplib_ppm.c b/irplib/irplib_ppm.c
new file mode 100644
index 0000000..24d6288
--- /dev/null
+++ b/irplib/irplib_ppm.c
@@ -0,0 +1,494 @@
+/* $Id: irplib_ppm.c,v 1.30 2011/11/23 13:58:45 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: yjung $
+ * $Date: 2011/11/23 13:58:45 $
+ * $Revision: 1.30 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_ppm.h"
+#include "irplib_wlxcorr.h"
+#include "irplib_spectrum.h"
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+/*-----------------------------------------------------------------------------
+ Private functions
+ -----------------------------------------------------------------------------*/
+#ifdef IRPLIB_PPM_USE_METHOD2
+static cpl_vector * irplib_ppm_convolve_line(const cpl_vector *, double,double);
+static cpl_vector * irplib_ppm_detect_lines(const cpl_vector *, double) ;
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_ppm Point pattern matching
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The Wavelength Calibration using PPM
+ @param spectrum The spectrum vector
+ @param lines_catalog The lines catalog
+ @param poly_init Polynomial with the initial guess
+ @param slitw The slit width
+ @param fwhm The spectral FWHM [pixel]
+ @param thresh The threshold for lines detection
+ @param degree The polynomial degree
+ @param doplot Plotting level (zero for none)
+ @param tab_infos The computed solution table or NULL (computed)
+ @return the polynomial solution or NULL in error case
+
+ The returned table must be deallocated with cpl_table_delete().
+ The returned polynomial must be deallocated with cpl_polynomial_delete().
+ */
+/*----------------------------------------------------------------------------*/
+cpl_polynomial * irplib_ppm_engine(
+ const cpl_vector * spectrum,
+ const cpl_bivector * lines_catalog,
+ const cpl_polynomial * poly_init,
+ double slitw,
+ double fwhm,
+ double thresh,
+ int degree,
+ int doplot,
+ cpl_table ** tab_infos)
+{
+#ifdef IRPLIB_PPM_USE_METHOD2
+ cpl_vector * spec_conv ;
+#endif
+ int spec_sz ;
+ cpl_vector * det_lines ;
+ double * pdet_lines ;
+ cpl_vector * cat_lines ;
+ double * pcat_lines ;
+ double wmin, wmax ;
+ double disp_min, disp_max, disp ;
+ int nlines_cat, nlines ;
+ const double * plines_catalog_x ;
+ const double * plines_catalog_y ;
+ cpl_bivector * matched ;
+ cpl_matrix * matchedx;
+ int match_sz;
+ cpl_polynomial * fitted ;
+ cpl_table * spc_table ;
+ const cpl_vector* vectors_plot[3];
+ cpl_vector * plot_y ;
+ int wl_ind, start_ind, stop_ind ;
+ double fill_val ;
+ cpl_size deg_loc ;
+ int i ;
+ cpl_error_code error;
+
+ /* Check entries */
+ if (spectrum == NULL) return NULL ;
+ if (lines_catalog == NULL) return NULL ;
+ if (poly_init == NULL) return NULL ;
+
+ /* Initialise */
+ spec_sz = cpl_vector_get_size(spectrum) ;
+ deg_loc = (cpl_size)degree ;
+
+#ifdef IRPLIB_PPM_USE_METHOD2
+ /* METHOD 2 */
+ /* Correlate the spectrum with the line profile */
+ if ((spec_conv = irplib_ppm_convolve_line(spectrum, slitw, fwhm)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot convolve the signal") ;
+ return NULL ;
+ }
+
+ /* Apply the lines detection */
+ if ((det_lines = irplib_ppm_detect_lines(spec_conv, 0.9)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot detect lines") ;
+ cpl_vector_delete(spec_conv) ;
+ return NULL ;
+ }
+ cpl_vector_delete(spec_conv) ;
+#else
+ /* METHOD 1 */
+ if ((det_lines = irplib_spectrum_detect_peaks(spectrum, fwhm,
+ thresh, 0, NULL, NULL)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot convolve the signal") ;
+ return NULL ;
+ }
+#endif
+ cpl_msg_info(cpl_func, "Detected %"CPL_SIZE_FORMAT" lines",
+ cpl_vector_get_size(det_lines));
+
+ /* Get the catalog lines */
+ wmin = cpl_polynomial_eval_1d(poly_init, 1.0, NULL) ;
+ wmax = cpl_polynomial_eval_1d(poly_init, spec_sz, NULL) ;
+ plines_catalog_x = cpl_bivector_get_x_data_const(lines_catalog) ;
+ plines_catalog_y = cpl_bivector_get_y_data_const(lines_catalog) ;
+ nlines = cpl_bivector_get_size(lines_catalog) ;
+ nlines_cat = 0 ;
+ start_ind = stop_ind = -1 ;
+ for (i=0 ; i<nlines ; i++) {
+ if (plines_catalog_x[i] > wmin && plines_catalog_x[i] < wmax &&
+ plines_catalog_y[i] > 0.0) {
+ nlines_cat++ ;
+ if (start_ind<0) start_ind = i ;
+ stop_ind = i ;
+ }
+ }
+ if (nlines_cat == 0) {
+ cpl_msg_error(cpl_func, "No lines in catalog") ;
+ cpl_vector_delete(det_lines) ;
+ return NULL ;
+ }
+ cat_lines = cpl_vector_new(nlines_cat) ;
+ pcat_lines = cpl_vector_get_data(cat_lines) ;
+ nlines_cat = 0 ;
+ for (i=0 ; i<nlines ; i++) {
+ if (plines_catalog_x[i] > wmin && plines_catalog_x[i] < wmax &&
+ plines_catalog_y[i] > 0.0) {
+ pcat_lines[nlines_cat] = plines_catalog_x[i] ;
+ nlines_cat++ ;
+ }
+ }
+
+ /* Plot inputs */
+ if (doplot) {
+ /* Catalog */
+ irplib_wlxcorr_catalog_plot(lines_catalog, wmin, wmax) ;
+
+ /* Spectrum with detected lines */
+ fill_val = cpl_vector_get_max(spectrum) ;
+ plot_y = cpl_vector_new(spec_sz);
+ cpl_vector_fill(plot_y, 0.0) ;
+ pdet_lines = cpl_vector_get_data(det_lines) ;
+ for (i=0 ; i<cpl_vector_get_size(det_lines) ; i++) {
+ cpl_vector_set(plot_y, (int)pdet_lines[i], fill_val) ;
+ }
+ vectors_plot[0] = NULL ;
+ vectors_plot[1] = spectrum ;
+ vectors_plot[2] = plot_y ;
+
+ cpl_plot_vectors("set grid;set xlabel 'Position (Pixel)';set ylabel "
+ "'Intensity (ADU/sec)';",
+ "t 'Spectrum with detected lines' w lines", "",
+ vectors_plot, 3);
+ cpl_vector_delete(plot_y) ;
+ }
+
+ /* Apply the point pattern matching */
+ disp = (wmax-wmin) / spec_sz ;
+ disp_min = disp - (disp/10) ;
+ disp_max = disp + (disp/10) ;
+ matched = cpl_ppm_match_positions(det_lines, cat_lines, disp_min,
+ disp_max, 0.05, NULL, NULL);
+ cpl_vector_delete(det_lines) ;
+ cpl_vector_delete(cat_lines) ;
+
+ if (matched == NULL) {
+ cpl_msg_error(cpl_func, "Cannot apply the point pattern matching") ;
+ return NULL ;
+ }
+
+ match_sz = cpl_bivector_get_size(matched);
+
+ cpl_msg_info(cpl_func, "Matched %d lines", match_sz) ;
+
+ if (match_sz <= deg_loc) {
+ cpl_msg_error(cpl_func, "Not enough match for the fit") ;
+ cpl_bivector_delete(matched) ;
+ return NULL ;
+ }
+
+ /* Plot if requested */
+ if (doplot) {
+ const double * pmatched ;
+ cpl_bivector * biplot ;
+ cpl_vector * plot_cat_x ;
+ cpl_vector * plot_cat_y ;
+ /* Spectrum with matched lines */
+ fill_val = cpl_vector_get_max(spectrum) ;
+ plot_y = cpl_vector_new(spec_sz);
+ cpl_vector_fill(plot_y, 0.0) ;
+ pmatched = cpl_bivector_get_x_data_const(matched) ;
+ for (i=0 ; i < match_sz; i++) {
+ cpl_vector_set(plot_y, (int)pmatched[i], fill_val) ;
+ }
+ vectors_plot[0] = NULL ;
+ vectors_plot[1] = spectrum ;
+ vectors_plot[2] = plot_y ;
+
+ cpl_plot_vectors("set grid;set xlabel 'Position (Pixel)';set ylabel "
+ "'Intensity (ADU/sec)';",
+ "t 'Spectrum with matched lines' w lines", "",
+ vectors_plot, 3);
+ cpl_vector_delete(plot_y) ;
+
+ /* Catalog with matched lines */
+ plot_cat_x=cpl_vector_extract(cpl_bivector_get_x_const(lines_catalog),
+ start_ind, stop_ind, 1) ;
+ plot_cat_y=cpl_vector_extract(cpl_bivector_get_y_const(lines_catalog),
+ start_ind, stop_ind, 1) ;
+ biplot = cpl_bivector_wrap_vectors(plot_cat_x, plot_cat_y) ;
+ cpl_plot_bivector("set grid;set xlabel 'Wavelength';set ylabel "
+ "'Emission';", "t 'Catalog' w impulses", "",
+ biplot);
+ cpl_bivector_unwrap_vectors(biplot) ;
+
+ plot_y = cpl_vector_duplicate(plot_cat_y) ;
+ cpl_vector_fill(plot_y, 0.0) ;
+ pmatched = cpl_bivector_get_y_data_const(matched) ;
+ fill_val=cpl_vector_get_mean(plot_cat_y) ;
+ for (i=0 ; i < match_sz; i++) {
+ wl_ind = 0 ;
+ while (pmatched[i] > cpl_vector_get(plot_cat_x, wl_ind)
+ && wl_ind < spec_sz) wl_ind++ ;
+ if (wl_ind < spec_sz) cpl_vector_set(plot_y, wl_ind, fill_val) ;
+ }
+ biplot = cpl_bivector_wrap_vectors(plot_cat_x, plot_y) ;
+ cpl_plot_bivector("set grid;set xlabel 'Wavelength';set ylabel "
+ "'Emission';", "t 'Catalog (matched lines)' w "
+ "impulses", "", biplot) ;
+ cpl_bivector_unwrap_vectors(biplot) ;
+ cpl_vector_delete(plot_cat_x) ;
+ cpl_vector_delete(plot_cat_y) ;
+ cpl_vector_delete(plot_y) ;
+ }
+
+ /* Apply the fit */
+ matchedx = cpl_matrix_wrap(1, match_sz, cpl_bivector_get_x_data(matched));
+ fitted = cpl_polynomial_new(1);
+ error = cpl_polynomial_fit(fitted, matchedx, NULL,
+ cpl_bivector_get_y_const(matched), NULL,
+ CPL_FALSE, NULL, °_loc);
+ cpl_bivector_delete(matched);
+ (void)cpl_matrix_unwrap(matchedx);
+ if (error) {
+ cpl_msg_error(cpl_func, "Cannot fit the polynomial") ;
+ cpl_polynomial_delete(fitted);
+ return NULL ;
+ }
+
+ /* Create the infos table */
+ if ((spc_table = irplib_wlxcorr_gen_spc_table(spectrum,
+ lines_catalog, slitw, fwhm, poly_init, fitted)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot generate the infos table") ;
+ cpl_polynomial_delete(fitted) ;
+ return NULL ;
+ }
+ if (tab_infos != NULL) *tab_infos = spc_table ;
+ else cpl_table_delete(spc_table) ;
+ return fitted ;
+}
+
+/**@}*/
+
+#ifdef IRPLIB_PPM_USE_METHOD2
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Spectrum convolution with a line profile
+ @param spectrum The spectrum vector
+ @param slitw The slit width
+ @param fwhm The spectral FWHM [pixel]
+ @param doplot Plotting level (zero for none)
+ @return the convolved spectrum
+
+ The returned vector must be deallocated with cpl_vector_delete().
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_vector * irplib_ppm_convolve_line(
+ const cpl_vector * spectrum,
+ double slitw,
+ double fwhm)
+{
+ cpl_vector * conv_kernel ;
+ cpl_vector * line_profile ;
+ cpl_vector * xcorrs ;
+ cpl_vector * spec_ext ;
+ cpl_vector * xc_single ;
+ int hs, line_sz, sp_sz ;
+ int i ;
+
+ /* Test entries */
+ if (spectrum == NULL) return NULL ;
+
+ /* Create the convolution kernel */
+ if ((conv_kernel = irplib_wlxcorr_convolve_create_kernel(slitw,
+ fwhm)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot create kernel") ;
+ return NULL ;
+ }
+ hs = cpl_vector_get_size(conv_kernel) ;
+ line_sz = 2 * hs + 1 ;
+
+ /* Create the line profile */
+ line_profile = cpl_vector_new(line_sz) ;
+ cpl_vector_fill(line_profile, 0.0) ;
+ cpl_vector_set(line_profile, hs, 1.0) ;
+ if (irplib_wlxcorr_convolve(line_profile, conv_kernel) != 0) {
+ cpl_msg_error(cpl_func, "Cannot create line profile") ;
+ cpl_vector_delete(line_profile) ;
+ cpl_vector_delete(conv_kernel) ;
+ return NULL ;
+ }
+ cpl_vector_delete(conv_kernel) ;
+
+ /* Create the correlations values vector */
+ sp_sz = cpl_vector_get_size(spectrum) ;
+ xcorrs = cpl_vector_new(sp_sz) ;
+ cpl_vector_fill(xcorrs, 0.0) ;
+ xc_single = cpl_vector_new(1) ;
+
+ /* Loop on the pixels of the spectrum */
+ for (i=hs ; i<sp_sz-hs ; i++) {
+ /* Extract the current spectrum part */
+ if ((spec_ext = cpl_vector_extract(spectrum, i-hs, i+hs, 1)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot extract spectrum") ;
+ cpl_vector_delete(xc_single) ;
+ cpl_vector_delete(line_profile) ;
+ return NULL ;
+ }
+ if (cpl_vector_correlate(xc_single, spec_ext, line_profile) < 0) {
+ cpl_msg_error(cpl_func, "Cannot correlate") ;
+ cpl_vector_delete(xc_single) ;
+ cpl_vector_delete(line_profile) ;
+ cpl_vector_delete(spec_ext) ;
+ return NULL ;
+ }
+ cpl_vector_set(xcorrs, i, cpl_vector_get(xc_single, 0)) ;
+ cpl_vector_delete(spec_ext) ;
+ }
+ cpl_vector_delete(xc_single) ;
+ cpl_vector_delete(line_profile) ;
+
+ return xcorrs ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Detect lines in a vector
+ @param spectrum The spectrum vector
+ @param threshold The threshold for line detection
+ @return the detected lines or NULL on error
+
+ The returned vector must be deallocated with cpl_vector_delete().
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_vector * irplib_ppm_detect_lines(
+ const cpl_vector * spec,
+ double threshold)
+{
+ cpl_vector * spec_loc ;
+ double * pspec_loc ;
+ cpl_vector * lines ;
+ double * plines ;
+ int spec_loc_sz, max_ind, nlines ;
+ double max ;
+ int i ;
+
+ /* Test inputs */
+ if (spec == NULL) return NULL ;
+
+ /* Local spectrum */
+ spec_loc = cpl_vector_duplicate(spec) ;
+ pspec_loc = cpl_vector_get_data(spec_loc) ;
+ spec_loc_sz = cpl_vector_get_size(spec_loc) ;
+
+ /* Threshold the local spectrum */
+ for (i=0 ; i<spec_loc_sz ; i++)
+ if (pspec_loc[i] < threshold) pspec_loc[i] = 0.0 ;
+
+ /* Allocate lines container */
+ lines = cpl_vector_new(spec_loc_sz) ;
+ plines = cpl_vector_get_data(lines) ;
+ nlines = 0 ;
+
+ /* Loop as long as there are lines */
+ while ((max = cpl_vector_get_max(spec_loc)) > threshold) {
+ /* Find the max position */
+ max_ind = 0 ;
+ while (pspec_loc[max_ind]<max && max_ind<spec_loc_sz) max_ind++ ;
+ if (max_ind == spec_loc_sz) {
+ cpl_msg_error(cpl_func, "Cannot find maximum") ;
+ cpl_vector_delete(spec_loc) ;
+ cpl_vector_delete(lines) ;
+ return NULL ;
+ }
+ if (max_ind == 0 || max_ind == spec_loc_sz-1) {
+ pspec_loc[max_ind] = 0 ;
+ continue ;
+ }
+
+ /* Get the precise position from the neighbours values */
+ plines[nlines] = pspec_loc[max_ind] * max_ind +
+ pspec_loc[max_ind-1] * (max_ind-1) +
+ pspec_loc[max_ind+1] * (max_ind+1) ;
+ plines[nlines] /= pspec_loc[max_ind] + pspec_loc[max_ind+1] +
+ pspec_loc[max_ind-1] ;
+ plines[nlines] ++ ;
+ nlines ++ ;
+
+ /* Clean the line */
+ i = max_ind ;
+ while (i>=0 && pspec_loc[i] > threshold) {
+ pspec_loc[i] = 0.0 ;
+ i-- ;
+ }
+ i = max_ind+1 ;
+ while (i<spec_loc_sz && pspec_loc[i] > threshold) {
+ pspec_loc[i] = 0.0 ;
+ i++ ;
+ }
+ }
+ cpl_vector_delete(spec_loc) ;
+
+ /* Check if there are lines */
+ if (nlines == 0) {
+ cpl_msg_error(cpl_func, "Cannot detect any line") ;
+ cpl_vector_delete(lines) ;
+ return NULL ;
+ }
+
+ /* Resize the vector */
+ cpl_vector_set_size(lines, nlines) ;
+
+ /* Sort the lines */
+ cpl_vector_sort(lines, 1) ;
+
+ return lines ;
+}
+
+#endif
diff --git a/irplib/irplib_ppm.h b/irplib/irplib_ppm.h
new file mode 100644
index 0000000..1b59754
--- /dev/null
+++ b/irplib/irplib_ppm.h
@@ -0,0 +1,40 @@
+/* $Id: irplib_ppm.h,v 1.5 2007/07/23 09:27:07 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: yjung $
+ * $Date: 2007/07/23 09:27:07 $
+ * $Revision: 1.5 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_PPM_H
+#define IRPLIB_PPM_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+cpl_polynomial * irplib_ppm_engine(const cpl_vector *, const cpl_bivector *,
+ const cpl_polynomial *, double, double, double, int, int, cpl_table **);
+
+#endif
diff --git a/irplib/irplib_slitpos.c b/irplib/irplib_slitpos.c
new file mode 100644
index 0000000..916d58c
--- /dev/null
+++ b/irplib/irplib_slitpos.c
@@ -0,0 +1,568 @@
+/* $Id: irplib_slitpos.c,v 1.30 2011/11/23 13:58:45 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: yjung $
+ * $Date: 2011/11/23 13:58:45 $
+ * $Revision: 1.30 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* The IRPLIB-based application may have checked for the availability of
+ memrchr() in which case the macro HAVE_DECL_MEMRCHR is defined as either
+ 0 or 1. Without checks it is assumed that the function is not available.
+ With a suitable version of autoconf the macro can be defined with this
+ entry in configure.ac:
+ AC_CHECK_DECLS([memrchr])
+*/
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+#include <cpl.h>
+
+#include "irplib_slitpos.h"
+#include "irplib_flat.h"
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+#ifndef IRPLIB_SLITPOS_KERNEL_SIZE_Y
+#define IRPLIB_SLITPOS_KERNEL_SIZE_Y 5
+#endif
+
+#ifndef IRPLIB_SLITPOS_MAX_EROSION
+#define IRPLIB_SLITPOS_MAX_EROSION 1024
+#endif
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static cpl_error_code irplib_slitpos_find_edges_one_line(const cpl_image *,
+ int, int *, int *);
+static cpl_error_code irplib_slitpos_find_vert_slit_ends(const cpl_image *,
+ int, int *, int *);
+static cpl_error_code irplib_slitpos_find_vert_pos(const cpl_image *, int,
+ cpl_size *);
+static cpl_error_code irplib_image_filter_background_line(cpl_image *,
+ const cpl_image *,
+ int, cpl_boolean) ;
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_slitpos Functions for slit position
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Detect the slit position, detect its ends, extract a thin image
+ containing only the slit and find its edges
+ @param imslit Input image with a vertical slit
+ @param slit_max_width Maximum slit width
+ @param slit_flux Some of the pixels values of the slit
+ @return the table with the slit position or NULL on error
+
+ On success the created table contains rows of four columns labeled:
+ "SLIT_Y" (int)
+ "SLIT_LEFT" (double)
+ "SLIT_CENTER" (double)
+ "SLIT_RIGHT" (double)
+
+ This function returns a table with 3 columns:
+
+ - Left or Lower edge of the slit
+ - Center of the slit
+ - Right or Upper edge of the slit
+
+ Additionally, the slit flux is computed. The passed slit_flux pointer
+ parameter can be NULL. In error case, its value is undefined.
+
+ NB: Coordinates use FITS convention.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_table * irplib_slitpos_analysis(const cpl_image * imslit,
+ int slit_max_width,
+ double * slit_flux)
+{
+ const int size_x = cpl_image_get_size_x(imslit);
+ const int size_y = cpl_image_get_size_y(imslit);
+ int slit_length;
+ cpl_size slit_pos;
+ cpl_image * filtered;
+ cpl_mask * mask;
+ cpl_image * thin_im;
+ int slit_top_y = 0; /* Avoid (false) uninit warning */
+ int slit_bot_y = 0; /* Avoid (false) uninit warning */
+ cpl_table * self;
+ double * slit_y,
+ * slit_x_l,
+ * slit_x_r;
+ double * coeff_r;
+ double * coeff_l;
+ int i;
+ cpl_error_code error = CPL_ERROR_NONE;
+
+ /* Initialize */
+ if (slit_flux != NULL) *slit_flux = 0.0 ;
+
+ /* Median vertical filtering 3x3 */
+ mask = cpl_mask_new(3, 3) ;
+ cpl_mask_not(mask) ;
+ filtered = cpl_image_new(size_x, size_y, cpl_image_get_type(imslit));
+ error = cpl_image_filter_mask(filtered, imslit, mask,
+ CPL_FILTER_MEDIAN, CPL_BORDER_FILTER);
+ cpl_mask_delete(mask);
+
+ if (error) {
+ cpl_image_delete(filtered);
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ /* The background may vary strongly along the vertical line. */
+ /* Detect and remove background with a 1+2*Slit_max x 1 median filter */
+ error = irplib_image_filter_background_line(filtered, NULL, slit_max_width,
+ CPL_TRUE);
+
+ if (error) {
+ cpl_image_delete(filtered) ;
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ /* Find the position of the slit */
+ if (irplib_slitpos_find_vert_pos(filtered, slit_max_width/2, &slit_pos)) {
+ cpl_image_delete(filtered);
+ cpl_msg_error(cpl_func, "Could not find the slit position");
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ /* Extract a thin image containing the slit */
+ thin_im = cpl_image_extract(filtered, slit_pos-slit_max_width/2, 1,
+ slit_pos+slit_max_width/2, size_y);
+ if (thin_im == NULL) {
+ cpl_msg_error(cpl_func, "Could not extract the %d pixel thin image "
+ "around position %"CPL_SIZE_FORMAT,
+ slit_max_width, slit_pos);
+ cpl_image_delete(filtered);
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ /* Find the ends of the slit */
+ error = irplib_slitpos_find_vert_slit_ends(thin_im,
+ IRPLIB_SLITPOS_KERNEL_SIZE_Y,
+ &slit_bot_y,
+ &slit_top_y);
+ cpl_image_delete(thin_im);
+ if (error) {
+ cpl_image_delete(filtered);
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ /* Extract an image with exactly the slit */
+ thin_im = cpl_image_extract(filtered,
+ slit_pos-slit_max_width/2,
+ slit_bot_y,
+ slit_pos+slit_max_width/2,
+ slit_top_y);
+ cpl_image_delete(filtered);
+
+ cpl_ensure(thin_im != NULL, cpl_error_get_code(), NULL);
+
+ slit_length = 1 + slit_top_y - slit_bot_y;
+
+ /* Allocate some arrays */
+ slit_y = cpl_malloc(slit_length * sizeof(double));
+ slit_x_l = cpl_malloc(slit_length * sizeof(double));
+ slit_x_r = cpl_malloc(slit_length * sizeof(double));
+
+ /* Find the edges of the slit */
+ for (i=0 ; i<slit_length ; i++) {
+ int right_pos = 0; /* Avoid (false) uninit warning */
+ int left_pos = 0; /* Avoid (false) uninit warning */
+
+ if (irplib_slitpos_find_edges_one_line(thin_im,
+ i,
+ &left_pos,
+ &right_pos)) {
+ cpl_msg_error(cpl_func, "cannot find the edges of the [%d]th line",
+ i+1);
+ cpl_image_delete(thin_im);
+ return NULL;
+ }
+
+ /* Update the slit_flux */
+ if (slit_flux != NULL) {
+ *slit_flux += cpl_image_get_flux_window(thin_im, left_pos+1,
+ i+1, right_pos+1, i+1) ;
+ }
+
+ /* Store the edges for the fit */
+ slit_x_l[i] = (double)left_pos;
+ slit_x_r[i] = (double)right_pos;
+ slit_y[i] = (double)(i+slit_bot_y-1);
+ }
+ cpl_image_delete(thin_im);
+
+ /* Linear regression to find the edges */
+ coeff_l = irplib_flat_fit_slope_robust(slit_y, slit_x_l, slit_length);
+ coeff_r = irplib_flat_fit_slope_robust(slit_y, slit_x_r, slit_length);
+ cpl_free(slit_y);
+ cpl_free(slit_x_l);
+ cpl_free(slit_x_r);
+
+ /* Allocate the table containing the results */
+ self = cpl_table_new(slit_length);
+ error |= cpl_table_new_column(self, "SLIT_Y", CPL_TYPE_INT);
+ error |= cpl_table_new_column(self, "SLIT_LEFT", CPL_TYPE_DOUBLE);
+ error |= cpl_table_new_column(self, "SLIT_CENTER", CPL_TYPE_DOUBLE);
+ error |= cpl_table_new_column(self, "SLIT_RIGHT", CPL_TYPE_DOUBLE);
+
+ error |= cpl_table_set_column_unit(self, "SLIT_Y", "pixel");
+ error |= cpl_table_set_column_unit(self, "SLIT_LEFT", "pixel");
+ error |= cpl_table_set_column_unit(self, "SLIT_CENTER", "pixel");
+ error |= cpl_table_set_column_unit(self, "SLIT_RIGHT", "pixel");
+
+ cpl_ensure(!error, cpl_error_get_code(), NULL);
+
+ /* Rewrite the edges in the out table, and write the center */
+ for (i=0 ; i < slit_length ; i++) {
+ const int islity = i + slit_bot_y;
+ const double dslit = slit_pos - slit_max_width / 2.0;
+ const double dleft = coeff_l[0] + coeff_l[1] * (double)islity + dslit;
+ const double dright = coeff_r[0] + coeff_r[1] * (double)islity + dslit;
+ const double dcent = 0.5 * (dleft + dright);
+
+ if (cpl_table_set_int(self, "SLIT_Y", i, islity)) break;
+ if (cpl_table_set_double(self, "SLIT_LEFT", i, dleft)) break;
+ if (cpl_table_set_double(self, "SLIT_RIGHT", i, dright)) break;
+ if (cpl_table_set_double(self, "SLIT_CENTER", i, dcent)) break;
+ }
+
+ cpl_free(coeff_r);
+ cpl_free(coeff_l);
+
+ if (i != slit_length) {
+ cpl_table_delete(self);
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ return self;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Return the first pixel higher than avg starting from the
+ left and from the right of the line
+ @param self input image
+ @param line_pos line position
+ @param left_pos pointer to left position
+ @param right_pos pointer to right position
+ @return 0 iff successful
+
+ Positions in C coordinates (first pixel position is 0)
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_slitpos_find_edges_one_line(const cpl_image * self,
+ int line_pos,
+ int * left_pos,
+ int * right_pos)
+{
+ const int size_x = cpl_image_get_size_x(self);
+ const float * pself;
+ double threshold;
+ int i;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_image_get_type(self) == CPL_TYPE_FLOAT,
+ CPL_ERROR_INVALID_TYPE);
+
+ pself = cpl_image_get_data_float_const(self);
+
+ /* Find the threshold */
+ threshold = cpl_image_get_mean_window(self, 1, line_pos+1, size_x,
+ line_pos+1);
+
+ /* Detect the left edge */
+ i = 0;
+ while (i < size_x && pself[line_pos*size_x+i] < threshold) i++;
+ *left_pos = i;
+
+ /* Detect the right edge */
+ i = size_x - 1;
+ while (i >= 0 && pself[line_pos*size_x+i] < threshold) i--;
+ *right_pos = i;
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the ends of a vertical slit (y coordinates in FITS convention)
+ @param in input image
+ @param kernel_size vertical kernel size
+ @param bot_slit_y bottom slit y position
+ @param top_slit_y top slit y position
+ @return 0 iff successful
+
+ The input image has to be as thin as possible to contain only the slit
+ */
+/*----------------------------------------------------------------------------*/
+static
+cpl_error_code irplib_slitpos_find_vert_slit_ends(const cpl_image * self,
+ int kernel_size,
+ int * bot_slit_y,
+ int * top_slit_y)
+{
+ cpl_mask * binary;
+ cpl_mask * copy = NULL;
+ cpl_mask * kernel;
+ cpl_image * label_image;
+ int erosions_nb;
+ cpl_size nobj ;
+ const int size_x = cpl_image_get_size_x(self);
+ const int size_y = cpl_image_get_size_y(self);
+ const int npix = size_x * size_y;
+ const cpl_binary * pbinary;
+ const cpl_binary * pfind;
+ int i, itop, ibot;
+
+
+ cpl_ensure_code(size_x > 0, cpl_error_get_code());
+ cpl_ensure_code(kernel_size > 0, cpl_error_get_code());
+
+ /* Threshold to have a binary image */
+ binary = cpl_mask_threshold_image_create(self, cpl_image_get_mean(self),
+ cpl_image_get_max(self));
+ cpl_ensure_code(binary != NULL, cpl_error_get_code());
+
+ /* Erode until there is 1 object left in the image */
+ label_image = cpl_image_labelise_mask_create(binary, &nobj);
+ cpl_image_delete(label_image);
+
+ if (label_image == NULL) {
+ cpl_mask_delete(binary);
+ cpl_ensure_code(0, cpl_error_get_code());
+ }
+
+ /* Define the kernel for morpho operations */
+ kernel = cpl_mask_new(kernel_size, 1);
+ cpl_mask_not(kernel);
+ copy = cpl_mask_wrap(size_x, size_y, cpl_malloc(size_x * size_y *
+ sizeof(cpl_binary)));
+ for (erosions_nb = 0; erosions_nb < IRPLIB_SLITPOS_MAX_EROSION && nobj > 1;
+ erosions_nb++) {
+ /* Should not be possible to break from this loop */
+ cpl_mask_copy(copy, binary, 1, 1);
+ if (cpl_mask_filter(binary, copy, kernel, CPL_FILTER_EROSION,
+ CPL_BORDER_ZERO)) break;
+
+ label_image = cpl_image_labelise_mask_create(binary, &nobj);
+ if (label_image == NULL) break; /* Assuming nobj was not set to 1 */
+ cpl_image_delete(label_image);
+ }
+
+ if (nobj > 1) {
+ cpl_mask_delete(binary);
+ cpl_mask_delete(copy);
+ cpl_mask_delete(kernel);
+ if (erosions_nb >= IRPLIB_SLITPOS_MAX_EROSION) {
+ cpl_msg_error(cpl_func, "Number of erosions reached a limit of %d "
+ "with %"CPL_SIZE_FORMAT" possible slits left",
+ IRPLIB_SLITPOS_MAX_EROSION, nobj);
+ cpl_ensure_code(0, CPL_ERROR_CONTINUE);
+ }
+ cpl_ensure_code(0, cpl_error_get_code());
+ } else if (nobj < 1) {
+ cpl_mask_delete(binary);
+ cpl_mask_delete(copy);
+ cpl_mask_delete(kernel);
+ if (erosions_nb == 0)
+ cpl_msg_error(cpl_func, "No slit could be detected across %d "
+ "pixels", size_x);
+ else
+ cpl_msg_error(cpl_func, "The last of %d erosions removed all the "
+ "possible slits", erosions_nb);
+ cpl_ensure_code(0, CPL_ERROR_DATA_NOT_FOUND);
+ }
+
+ /* Reconstruct the slit with dilations */
+ for (i=0 ; i < erosions_nb ; i++) {
+ cpl_mask_copy(copy, binary, 1, 1);
+ if (cpl_mask_filter(binary, copy, kernel, CPL_FILTER_DILATION,
+ CPL_BORDER_ZERO)) break;
+ }
+ cpl_mask_delete(copy);
+ cpl_mask_delete(kernel);
+
+ if (i != erosions_nb) {
+ cpl_msg_error(cpl_func, "Dilation number %d out of %d failed",
+ i, erosions_nb);
+ cpl_mask_delete(binary);
+ cpl_ensure_code(0, cpl_error_get_code());
+ }
+
+ /* Find the ends of the slit */
+ pbinary = cpl_mask_get_data(binary);
+ assert( pbinary != NULL );
+
+ pfind = memchr(pbinary, CPL_BINARY_1, (size_t)npix);
+ assert( pfind != NULL );
+
+ ibot = (int)(pfind - pbinary);
+
+#if defined HAVE_DECL_MEMRCHR && HAVE_DECL_MEMRCHR == 1
+ /* FIXME: Not tested */
+ pfind = memrchr(pfind, CPL_BINARY_1, (size_t)(npix - ibot));
+ assert( pfind != NULL );
+
+ itop = (int)(pfind - pbinary);
+#else
+
+ itop = npix - 1;
+ while (itop > ibot && pbinary[itop] != CPL_BINARY_1) itop--;
+
+#endif
+
+ *bot_slit_y = 1 + ibot / size_x;
+ *top_slit_y = 1 + itop / size_x;
+
+ cpl_msg_info(cpl_func,
+ "Detected %"CPL_SIZE_FORMAT"-pixel slit from pixel %d to %d "
+ "using %d erosions/dilations", cpl_mask_count(binary),
+ *bot_slit_y, *top_slit_y, erosions_nb);
+
+ cpl_mask_delete(binary);
+
+ /* Should really be an assert() */
+ cpl_ensure_code(ibot <= itop, CPL_ERROR_DATA_NOT_FOUND);
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find a vertical slit position (x coordinate of the slit)
+ @param self Filtered input image
+ @param xwidth Width of the boundary to not search (in x)
+ @param slit_pos Pointer to the searched position
+ @return 0 iff successful
+
+ Coordinate given in FITS convention (ll is (1,1))
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_slitpos_find_vert_pos(const cpl_image * self,
+ int xwidth,
+ cpl_size * slit_pos)
+{
+ const int size_x = cpl_image_get_size_x(self);
+ cpl_image * image1D;
+ cpl_size yone;
+ cpl_error_code error;
+
+
+ /* Collapse the image to a horizontal 1D image */
+ image1D = cpl_image_collapse_create(self, 0);
+
+ cpl_ensure_code(image1D != NULL, cpl_error_get_code());
+
+ /* Search the max of the 1D image to identify the slit position */
+ error = cpl_image_get_maxpos_window(image1D, 1+xwidth, 1, size_x-xwidth,
+ 1, slit_pos, &yone);
+
+ cpl_image_delete(image1D);
+
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Filter the background of an image with horizontal or vertical lines
+ @param self Filtered image
+ @param other Image to filter, use NULL for in-place filtering
+ @param hsize Filtering half-size, total size is 1 + 2 * hsize
+ @param vertical True iff the lines are vertical
+ @return CPL_ERROR_NONE or the relevant CPL error code
+
+ If the background varies strongly along the line, it can be detected
+ and removed with a unit width 1+2*hsize median filter, where hsize is an
+ upper bound on the line width.
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_image_filter_background_line(cpl_image * self,
+ const cpl_image * other,
+ int hsize,
+ cpl_boolean vertical)
+{
+ const int nx = cpl_image_get_size_x(self);
+ const int ny = cpl_image_get_size_y(self);
+ const int msize = 1 + 2 * hsize;
+ cpl_mask * mask;
+ cpl_image * background;
+ cpl_error_code error = CPL_ERROR_NONE;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ if (other == NULL) other = self;
+
+ mask = vertical ? cpl_mask_new(msize, 1) : cpl_mask_new(1, msize);
+
+ error |= cpl_mask_not(mask);
+
+ background = cpl_image_new(nx, ny, cpl_image_get_type(other));
+
+ error |= cpl_image_filter_mask(background, other, mask, CPL_FILTER_MEDIAN,
+ CPL_BORDER_FILTER);
+ cpl_mask_delete(mask);
+
+ if (self != other) {
+ error |= cpl_image_copy(self, other, 1, 1);
+ }
+
+ error |= cpl_image_subtract(self, background);
+ cpl_image_delete(background);
+
+ return error ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
+}
+
+
diff --git a/irplib/irplib_slitpos.h b/irplib/irplib_slitpos.h
new file mode 100644
index 0000000..b4a1f1c
--- /dev/null
+++ b/irplib/irplib_slitpos.h
@@ -0,0 +1,39 @@
+/* $Id: irplib_slitpos.h,v 1.6 2006/11/29 13:22:59 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: yjung $
+ * $Date: 2006/11/29 13:22:59 $
+ * $Revision: 1.6 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_SLITPOS_H
+#define IRPLIB_SLITPOS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+cpl_table * irplib_slitpos_analysis(const cpl_image *, int, double *);
+
+#endif
diff --git a/irplib/irplib_spectrum.c b/irplib/irplib_spectrum.c
new file mode 100644
index 0000000..e71163c
--- /dev/null
+++ b/irplib/irplib_spectrum.c
@@ -0,0 +1,606 @@
+/* $Id: irplib_spectrum.c,v 1.29 2012/01/12 11:50:41 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2012/01/12 11:50:41 $
+ * $Revision: 1.29 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <float.h>
+#include <cpl.h>
+
+#include "irplib_wlxcorr.h"
+#include "irplib_spectrum.h"
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+#define SPECTRUM_HW 16
+#define MIN_THRESH_FACT 0.9
+#define MAX_THRESH_FACT 1.1
+#define SPEC_SHADOW_FACT 30.0 /* Negative spectrum intensity*/
+#define SPEC_MAXWIDTH 48
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int select_valid_spectra(cpl_image *, cpl_apertures *, int,
+ spec_shadows, int, int *, int **) ;
+static int valid_spectrum(cpl_image *, cpl_apertures *, int, spec_shadows, int,
+ int) ;
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_spectrum Functions for LSS spectra
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Finds the brightest spectrum in an image
+ @param in spectral image with spectra
+ @param offset the diff. between pos. and neg. spectra
+ @param shadows the spectral shadows
+ @param min_bright min. bright. required for a spectrum
+ @param orient 1 for vertical spec. 0 for horizontal ones
+ @param pos the computed spectrum position (1->npix)
+ @return int 0 if ok, -1 in error case
+
+ Finds the brightest spectrum in an image by collapsing the image orthogonally
+ to the spectrum orientation.
+ Spectra are assumed to be horizontal for orient==0, vertical for 1
+*/
+/*----------------------------------------------------------------------------*/
+int irplib_spectrum_find_brightest(
+ const cpl_image * in,
+ int offset,
+ spec_shadows shadows,
+ double min_bright,
+ int orient,
+ double * pos)
+{
+ cpl_image * loc_ima ;
+ cpl_image * filt_image ;
+ cpl_image * collapsed ;
+ float * pcollapsed ;
+ cpl_vector * line ;
+ double * pline ;
+ cpl_vector * line_filt ;
+ double threshold ;
+ double median, stdev, max, mean ;
+ cpl_mask * mask ;
+ cpl_image * labels ;
+ cpl_size nlabels ;
+ cpl_apertures * aperts ;
+ int n_valid_specs ;
+ int * valid_specs ;
+ double brightness ;
+ int i ;
+
+ /* Test entries */
+ if (in == NULL) return -1 ;
+ if (orient!=0 && orient!=1) return -1 ;
+
+ /* Flip the image if necessary */
+ if (orient == 1) {
+ loc_ima = cpl_image_duplicate(in) ;
+ cpl_image_flip(loc_ima, 1) ;
+ } else {
+ loc_ima = cpl_image_duplicate(in) ;
+ }
+
+ /* Median vertical filtering 3x3 */
+ mask = cpl_mask_new(3, 3) ;
+ cpl_mask_not(mask) ;
+ filt_image = cpl_image_new(
+ cpl_image_get_size_x(loc_ima),
+ cpl_image_get_size_y(loc_ima),
+ cpl_image_get_type(loc_ima)) ;
+ if (cpl_image_filter_mask(filt_image, loc_ima, mask,
+ CPL_FILTER_MEDIAN, CPL_BORDER_FILTER) != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot filter the image") ;
+ cpl_mask_delete(mask) ;
+ cpl_image_delete(filt_image) ;
+ return -1 ;
+ }
+ cpl_mask_delete(mask) ;
+ cpl_image_delete(loc_ima) ;
+
+ /* Collapse the image */
+ if ((collapsed = cpl_image_collapse_median_create(filt_image, 1, 0,
+ 0)) == NULL) {
+ cpl_msg_error(cpl_func, "collapsing image: aborting spectrum detection");
+ cpl_image_delete(filt_image) ;
+ return -1 ;
+ }
+ cpl_image_delete(filt_image) ;
+
+ /* Subtract low frequency signal */
+ line = cpl_vector_new_from_image_column(collapsed, 1) ;
+ cpl_image_delete(collapsed) ;
+ line_filt = cpl_vector_filter_median_create(line, SPECTRUM_HW) ;
+ cpl_vector_subtract(line, line_filt) ;
+ cpl_vector_delete(line_filt) ;
+
+ /* Get relevant stats for thresholding */
+ median = cpl_vector_get_median_const(line) ;
+ stdev = cpl_vector_get_stdev(line) ;
+ max = cpl_vector_get_max(line) ;
+ mean = cpl_vector_get_mean(line) ;
+
+ /* Set the threshold */
+ threshold = median + stdev ;
+ if (threshold > MIN_THRESH_FACT * max) threshold = MIN_THRESH_FACT * max ;
+ if (threshold < MAX_THRESH_FACT * mean) threshold = MAX_THRESH_FACT * mean;
+
+ /* Recreate the image */
+ collapsed = cpl_image_new(1, cpl_vector_get_size(line), CPL_TYPE_FLOAT) ;
+ pcollapsed = cpl_image_get_data_float(collapsed) ;
+ pline = cpl_vector_get_data(line) ;
+ for (i=0 ; i<cpl_vector_get_size(line) ; i++)
+ pcollapsed[i] = (float)pline[i] ;
+ cpl_vector_delete(line) ;
+
+ /* Binarise the image */
+ if ((mask = cpl_mask_threshold_image_create(collapsed, threshold,
+ DBL_MAX)) == NULL) {
+ cpl_msg_error(cpl_func, "cannot binarise") ;
+ cpl_image_delete(collapsed) ;
+ return -1 ;
+ }
+ if (cpl_mask_count(mask) < 1) {
+ cpl_msg_error(cpl_func, "not enough signal to detect spectra") ;
+ cpl_image_delete(collapsed) ;
+ cpl_mask_delete(mask) ;
+ return -1 ;
+ }
+ /* Labelise the different detected apertures */
+ if ((labels = cpl_image_labelise_mask_create(mask, &nlabels))==NULL) {
+ cpl_msg_error(cpl_func, "cannot labelise") ;
+ cpl_image_delete(collapsed) ;
+ cpl_mask_delete(mask) ;
+ return -1 ;
+ }
+ cpl_mask_delete(mask) ;
+
+ /* Create the detected apertures list */
+ if ((aperts = cpl_apertures_new_from_image(collapsed, labels)) == NULL) {
+ cpl_msg_error(cpl_func, "cannot compute apertures") ;
+ cpl_image_delete(collapsed) ;
+ cpl_image_delete(labels) ;
+ return -1 ;
+ }
+ cpl_image_delete(labels) ;
+
+ /* Select only relevant specs, create corresponding LUT's */
+ if (select_valid_spectra(collapsed, aperts, offset, shadows, SPEC_MAXWIDTH,
+ &n_valid_specs, &valid_specs) == -1) {
+ cpl_msg_debug(cpl_func,
+ "Could not select valid spectra from the %"CPL_SIZE_FORMAT
+ " apertures in %"CPL_SIZE_FORMAT"-col 1D-image, offset=%d"
+ ", min_bright=%d",
+ cpl_apertures_get_size(aperts),
+ cpl_image_get_size_y(collapsed), offset, SPEC_MAXWIDTH);
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG)
+ cpl_apertures_dump(aperts, stderr);
+ cpl_image_delete(collapsed);
+ cpl_apertures_delete(aperts);
+ return -1;
+ }
+ cpl_image_delete(collapsed) ;
+ if (n_valid_specs < 1) {
+ cpl_msg_error(cpl_func, "no valid spectrum detected") ;
+ cpl_free(valid_specs) ;
+ cpl_apertures_delete(aperts) ;
+ return -1 ;
+ }
+
+ /* Look for the brightest, among the detected spectra */
+ *pos = cpl_apertures_get_centroid_y(aperts, valid_specs[0]+1) ;
+ brightness = cpl_apertures_get_flux(aperts, valid_specs[0]+1) ;
+ for (i=0 ; i<n_valid_specs ; i++) {
+ if (cpl_apertures_get_flux(aperts, valid_specs[i]+1) > brightness) {
+ *pos = cpl_apertures_get_centroid_y(aperts, valid_specs[i]+1) ;
+ brightness = cpl_apertures_get_flux(aperts, valid_specs[i]+1) ;
+ }
+ }
+ cpl_apertures_delete(aperts) ;
+ cpl_free(valid_specs) ;
+
+ /* Minimum brightness required */
+ if (brightness < min_bright) {
+ cpl_msg_error(cpl_func, "brightness %f too low <%f", brightness,
+ min_bright) ;
+ return -1 ;
+ }
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Detect the brightest features in a spectrum
+ @param in the spectrum
+ @param fwhm the FWHM used for the lines convolution
+ @param display the flag to display
+ @param fwhms the fwhms of the detected lines
+ @param areas the areas under the detected lines
+ @return The bright lines positions or NULL in error case
+
+ The lines positions are in pixels (first pixel is 1)
+ */
+/*----------------------------------------------------------------------------*/
+cpl_vector * irplib_spectrum_detect_peaks(
+ const cpl_vector * in,
+ int fwhm,
+ double sigma,
+ int display,
+ cpl_vector ** fwhms_out,
+ cpl_vector ** areas_out)
+{
+ cpl_vector * filtered ;
+ cpl_vector * spec_clean ;
+ cpl_vector * spec_convolved ;
+ double * pspec_convolved ;
+ int filt_size ;
+ cpl_vector * conv_kernel ;
+ cpl_vector * extract ;
+ cpl_vector * extract_x ;
+ cpl_vector * big_detected ;
+ cpl_vector * big_fwhms ;
+ cpl_vector * big_area ;
+ double * pbig_detected ;
+ double * pbig_fwhms ;
+ double * pbig_area ;
+ cpl_vector * detected ;
+ double * pdetected ;
+ cpl_vector * fwhms ;
+ double * pfwhms ;
+ cpl_vector * area ;
+ double * parea ;
+ double max, med, stdev, cur_val ;
+ double x0, sig, norm, offset ;
+ int nb_det, nb_samples, hwidth, start, stop ;
+ int i, j ;
+
+ /* Test entries */
+ if (in == NULL) return NULL ;
+
+ /* Initialise */
+ nb_samples = cpl_vector_get_size(in) ;
+ filt_size = 5 ;
+ hwidth = 5 ;
+
+ /* Subtract the low frequency part */
+ cpl_msg_info(__func__, "Low Frequency signal removal") ;
+ if ((filtered=cpl_vector_filter_median_create(in, filt_size))==NULL){
+ cpl_msg_error(__func__, "Cannot filter the spectrum") ;
+ return NULL ;
+ }
+ spec_clean = cpl_vector_duplicate(in) ;
+ cpl_vector_subtract(spec_clean, filtered) ;
+ cpl_vector_delete(filtered) ;
+
+ /* Display if requested */
+ if (display) {
+ cpl_plot_vector(
+ "set grid;set xlabel 'Position (pixels)';set ylabel 'Intensity (ADU)';",
+ "t 'Filtered extracted spectrum' w lines", "", spec_clean);
+ }
+
+ /* Convolve */
+ spec_convolved = cpl_vector_duplicate(spec_clean) ;
+ if (fwhm > 0) {
+ cpl_msg_info(__func__, "Spectrum convolution") ;
+ /* Create convolution kernel */
+ if ((conv_kernel = irplib_wlxcorr_convolve_create_kernel(fwhm,
+ fwhm)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot create convolution kernel") ;
+ cpl_vector_delete(spec_clean) ;
+ cpl_vector_delete(spec_convolved) ;
+ return NULL ;
+ }
+
+ /* Smooth the instrument resolution */
+ if (irplib_wlxcorr_convolve(spec_convolved, conv_kernel)) {
+ cpl_msg_error(cpl_func, "Cannot smoothe the signal");
+ cpl_vector_delete(spec_clean) ;
+ cpl_vector_delete(spec_convolved) ;
+ cpl_vector_delete(conv_kernel) ;
+ return NULL ;
+ }
+ cpl_vector_delete(conv_kernel) ;
+
+ /* Display if requested */
+ if (display) {
+ cpl_plot_vector(
+ "set grid;set xlabel 'Position (pixels)';set ylabel 'Intensity (ADU)';",
+ "t 'Convolved extracted spectrum' w lines", "", spec_convolved);
+ }
+ }
+
+ /* Apply the detection */
+ big_detected = cpl_vector_duplicate(spec_convolved) ;
+ big_fwhms = cpl_vector_duplicate(spec_convolved) ;
+ big_area = cpl_vector_duplicate(spec_convolved) ;
+ pbig_detected = cpl_vector_get_data(big_detected) ;
+ pbig_fwhms = cpl_vector_get_data(big_fwhms) ;
+ pbig_area = cpl_vector_get_data(big_area) ;
+
+ pspec_convolved = cpl_vector_get_data(spec_convolved) ;
+
+ /* To avoid detection on the side */
+ pspec_convolved[0] = pspec_convolved[nb_samples-1] = 0.0 ;
+
+ /* Compute stats */
+ max = cpl_vector_get_max(spec_convolved) ;
+ stdev = cpl_vector_get_stdev(spec_convolved) ;
+ med = cpl_vector_get_median_const(spec_convolved) ;
+
+ /* Loop on the detected lines */
+ nb_det = 0 ;
+ while (max > med + stdev * sigma) {
+ /* Compute the position */
+ i=0 ;
+ while (pspec_convolved[i] < max) i++ ;
+ if (i<=0 || i>=nb_samples-1) break ;
+
+ /* Extract the line */
+ if (i - hwidth >= 0) start = i - hwidth ;
+ else start = 0 ;
+ if (i + hwidth <= nb_samples-1) stop = i + hwidth ;
+ else stop = nb_samples-1 ;
+ extract = cpl_vector_extract(spec_clean, start, stop, 1) ;
+ extract_x = cpl_vector_duplicate(extract) ;
+ for (j=0 ; j<cpl_vector_get_size(extract_x) ; j++) {
+ cpl_vector_set(extract_x, j, (double)j+1) ;
+ }
+ /* Fit the gaussian */
+ if (cpl_vector_fit_gaussian(extract_x, NULL, extract, NULL,
+ CPL_FIT_ALL, &x0, &sig, &norm, &offset, NULL, NULL,
+ NULL) != CPL_ERROR_NONE) {
+ cpl_msg_warning(__func__,
+ "Cannot fit a gaussian at [%d, %d]",
+ start, stop) ;
+ cpl_error_reset() ;
+ } else {
+ pbig_detected[nb_det] = x0+start ;
+ pbig_area[nb_det] = norm ;
+ pbig_fwhms[nb_det] = 2*sig*sqrt(2*log(2)) ;
+ cpl_msg_debug(__func__, "Line nb %d at position %g",
+ nb_det+1, pbig_detected[nb_det]) ;
+ nb_det ++ ;
+ }
+ cpl_vector_delete(extract) ;
+ cpl_vector_delete(extract_x) ;
+
+ /* Cancel out the line on the left */
+ j = i-1 ;
+ cur_val = pspec_convolved[i] ;
+ while (j>=0 && pspec_convolved[j] < cur_val) {
+ cur_val = pspec_convolved[j] ;
+ pspec_convolved[j] = 0.0 ;
+ j-- ;
+ }
+ /* Cancel out the line on the right */
+ j = i+1 ;
+ cur_val = pspec_convolved[i] ;
+ while (j<=nb_samples-1 && pspec_convolved[j] < cur_val) {
+ cur_val = pspec_convolved[j] ;
+ pspec_convolved[j] = 0.0 ;
+ j++ ;
+ }
+ /* Cancel out the line on center */
+ pspec_convolved[i] = 0.0 ;
+
+ /* Recompute the stats */
+ max = cpl_vector_get_max(spec_convolved) ;
+ stdev = cpl_vector_get_stdev(spec_convolved) ;
+ med = cpl_vector_get_median_const(spec_convolved) ;
+ }
+ cpl_vector_delete(spec_convolved) ;
+ cpl_vector_delete(spec_clean) ;
+
+ /* Create the output vector */
+ if (nb_det == 0) {
+ detected = NULL ;
+ area = NULL ;
+ fwhms = NULL ;
+ } else {
+ detected = cpl_vector_new(nb_det) ;
+ area = cpl_vector_new(nb_det) ;
+ fwhms = cpl_vector_new(nb_det) ;
+ pdetected = cpl_vector_get_data(detected) ;
+ parea = cpl_vector_get_data(area) ;
+ pfwhms = cpl_vector_get_data(fwhms) ;
+ for (i=0 ; i<nb_det ; i++) {
+ pdetected[i] = pbig_detected[i] ;
+ parea[i] = pbig_area[i] ;
+ pfwhms[i] = pbig_fwhms[i] ;
+ }
+ }
+ cpl_vector_delete(big_detected) ;
+ cpl_vector_delete(big_area) ;
+ cpl_vector_delete(big_fwhms) ;
+
+ /* Return */
+ if (fwhms_out == NULL) cpl_vector_delete(fwhms) ;
+ else *fwhms_out = fwhms ;
+ if (areas_out == NULL) cpl_vector_delete(area) ;
+ else *areas_out = area ;
+ return detected ;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Selects the valid spectra in a spectral image
+ @param in the 1d image
+ @param aperts detected objects
+ @param offset the distance to the two shadows of the bright spectrum
+ @param shadows shadows mode
+ @param max_spec_width maximal spectrum width
+ @param n_valid_specs number of valid spectra
+ @param valid_specs lut giving the object number of a found spectrum
+ @return 0 if ok, -1 in error case
+*/
+/*----------------------------------------------------------------------------*/
+static int select_valid_spectra(
+ cpl_image * in,
+ cpl_apertures * aperts,
+ int offset,
+ spec_shadows shadows,
+ int max_spec_width,
+ int * n_valid_specs,
+ int ** valid_specs)
+{
+ int nb_aperts ;
+ int i, j ;
+
+ /* Initialise */
+ *valid_specs = NULL ;
+ nb_aperts = cpl_apertures_get_size(aperts) ;
+ *n_valid_specs = 0 ;
+
+ /* Test entries */
+ if (nb_aperts < 1) return -1 ;
+
+ /* Count nb of valid specs */
+ j = 0 ;
+ for (i=0 ; i<nb_aperts ; i++)
+ if (valid_spectrum(in, aperts, offset, shadows, max_spec_width,
+ i+1)) (*n_valid_specs)++ ;
+
+ /* Associate to each spectrum, its object number */
+ if (*n_valid_specs) {
+ *valid_specs = cpl_calloc(*n_valid_specs, sizeof(int)) ;
+ j = 0 ;
+ for (i=0 ; i<nb_aperts ; i++)
+ if (valid_spectrum(in, aperts, offset, shadows, max_spec_width,
+ i+1)) {
+ (*valid_specs)[j] = i ;
+ j++ ;
+ }
+ } else return -1 ;
+
+ return 0 ;
+}
+
+/*---------------------------------------------------------------------------*/
+/**
+ @brief Helper function to select_valid_spectra
+ @param in the 1d image
+ @param aperts detected objects
+ @param offset the distance to the two shadows of the bright spectrum
+ @param shadows shadows mode
+ @param max_spec_width maximal spectrum width
+ @param objnum index of the object to test (1 for the first)
+ @return 1 if valid 0 if not
+*/
+/*----------------------------------------------------------------------------*/
+static int valid_spectrum(
+ cpl_image * in,
+ cpl_apertures * aperts,
+ int offset,
+ spec_shadows shadows,
+ int max_spec_width,
+ int objnum)
+{
+ int objwidth ;
+ double valover, valunder, valcenter ;
+
+ /* Find objwidth */
+ objwidth = cpl_apertures_get_top(aperts, objnum) -
+ cpl_apertures_get_bottom(aperts, objnum) + 1 ;
+ if (objwidth > max_spec_width) {
+ cpl_msg_error(cpl_func, "object is too wide") ;
+ return 0 ;
+ }
+
+ /* Object is too small */
+ if (cpl_apertures_get_npix(aperts, objnum) < 2) return 0 ;
+
+ /* no shadow required */
+ if (shadows == NO_SHADOW) return 1 ;
+
+ /* Get the median of the object (valcenter) */
+ valcenter = cpl_apertures_get_median(aperts, objnum) ;
+
+ /* Get the black shadows medians (valunder and valover) */
+ if (cpl_apertures_get_bottom(aperts, objnum) - offset < 1) valunder = 0.0 ;
+ else valunder = cpl_image_get_median_window(in, 1,
+ cpl_apertures_get_bottom(aperts, objnum) - offset, 1,
+ cpl_apertures_get_top(aperts, objnum) - offset) ;
+
+ if (cpl_apertures_get_top(aperts, objnum) + offset > 1024) valover = 0.0 ;
+ else valover = cpl_image_get_median_window(in, 1,
+ cpl_apertures_get_bottom(aperts, objnum) + offset, 1,
+ cpl_apertures_get_top(aperts, objnum) + offset) ;
+
+ switch (shadows) {
+ case TWO_SHADOWS:
+ if ((valunder < -fabs(valcenter/SPEC_SHADOW_FACT)) &&
+ (valover < -fabs(valcenter/SPEC_SHADOW_FACT)) &&
+ (valunder/valover > 0.5) &&
+ (valunder/valover < 2.0)) return 1 ;
+ break;
+
+ case ONE_SHADOW:
+ if ((valunder < -fabs(valcenter/SPEC_SHADOW_FACT)) ||
+ (valover < -fabs(valcenter/SPEC_SHADOW_FACT))) return 1 ;
+ break;
+
+ case NO_SHADOW:
+ return 1 ;
+
+ default:
+ cpl_msg_error(cpl_func, "unknown spec_detect_mode") ;
+ break ;
+ }
+
+ cpl_msg_debug(cpl_func, "No spectrum(%d): under=%g, center=%g, over=%g",
+ shadows, valunder, valcenter, valover);
+
+ return 0 ;
+}
diff --git a/irplib/irplib_spectrum.h b/irplib/irplib_spectrum.h
new file mode 100644
index 0000000..83c275f
--- /dev/null
+++ b/irplib/irplib_spectrum.h
@@ -0,0 +1,59 @@
+/* $Id: irplib_spectrum.h,v 1.7 2009/07/30 12:38:37 yjung Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: yjung $
+ * $Date: 2009/07/30 12:38:37 $
+ * $Revision: 1.7 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_SPECTRUM_H
+#define IRPLIB_SPECTRUM_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ New types
+ -----------------------------------------------------------------------------*/
+
+typedef enum SPEC_SHADOWS {
+ /* 2 shadows above and below true spectrum */
+ TWO_SHADOWS,
+ /* 1 shadow at specified distance from spectrum */
+ ONE_SHADOW,
+ /* Do not search for shadow */
+ NO_SHADOW
+} spec_shadows ;
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+int irplib_spectrum_find_brightest(const cpl_image *, int, spec_shadows,
+ double, int, double *) ;
+cpl_vector * irplib_spectrum_detect_peaks(const cpl_vector *, int,
+ double, int, cpl_vector **, cpl_vector **) ;
+
+#endif
diff --git a/irplib/irplib_stdstar.c b/irplib/irplib_stdstar.c
new file mode 100644
index 0000000..d91b477
--- /dev/null
+++ b/irplib/irplib_stdstar.c
@@ -0,0 +1,823 @@
+/* $Id: irplib_stdstar.c,v 1.41 2012/05/04 13:58:12 cgarcia Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: cgarcia $
+ * $Date: 2012/05/04 13:58:12 $
+ * $Revision: 1.41 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <float.h>
+
+#include <cpl.h>
+
+#include "irplib_stdstar.h"
+#include "irplib_utils.h"
+#include "irplib_wcs.h"
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_stdstar Functions for standard stars
+ */
+/*----------------------------------------------------------------------------*/
+/**@{*/
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Write the ASCII catalogs as FITS files
+ @param set_in Input frameset wher the product is registered
+ @param set_raw Set of ASCII catalogs
+ @param recipe_name Recipe name
+ @param pro_cat PRO.CATG
+ @param pro_type PRO.TYPE
+ @param package_name Usually PACKAGE "/" PACKAGE_VERSION
+ @param ins_name Instrument name
+ @param convert_ascii_table Conversion function
+ @return 0 if ok, -1 in error case
+
+ Every catalog will be written in a different extension, where EXTNAME
+ is the name of the catalog ASCII file name.
+
+ The conversion ascii -> cpl_table is done by convert_ascii_table() and
+ should be defined in each instrument
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_stdstar_write_catalogs(
+ cpl_frameset * set_in,
+ const cpl_frameset * set_raw,
+ const char * recipe_name,
+ const char * pro_cat,
+ const char * pro_type,
+ const char * package_name,
+ const char * ins_name,
+ cpl_table * (*convert_ascii_table)(const char *))
+{
+ cpl_table * out ;
+ cpl_propertylist * plist ;
+ cpl_propertylist * plist_ext ;
+ cpl_parameterlist * parlist ;
+ const char * cat_name ;
+ char * out_name ;
+ int nb_catalogs ;
+ const cpl_frame * cur_frame ;
+ int i ;
+
+ /* Check entries */
+ if (set_in == NULL) return CPL_ERROR_NULL_INPUT;
+ if (set_raw == NULL) return CPL_ERROR_NULL_INPUT;
+ if (recipe_name == NULL) return CPL_ERROR_NULL_INPUT;
+ if (pro_cat == NULL) return CPL_ERROR_NULL_INPUT;
+ if (ins_name == NULL) return CPL_ERROR_NULL_INPUT;
+
+ /* Define the file name */
+ out_name = cpl_sprintf("%s.fits", recipe_name) ;
+
+ /* Number of catalogs */
+ nb_catalogs = cpl_frameset_get_size(set_raw) ;
+
+ /* Get the catalog name */
+ cur_frame = cpl_frameset_get_frame_const(set_raw, 0) ;
+ cat_name = cpl_frame_get_filename(cur_frame) ;
+
+ /* Create the output table */
+ if ((out = convert_ascii_table(cat_name)) == NULL) {
+ cpl_free(out_name) ;
+ return CPL_ERROR_UNSPECIFIED;
+ }
+
+ /* Some keywords */
+ plist = cpl_propertylist_new() ;
+ cpl_propertylist_append_string(plist, "INSTRUME", ins_name) ;
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG, pro_cat) ;
+ if (pro_type != NULL) {
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE, pro_type) ;
+ }
+ plist_ext = cpl_propertylist_new() ;
+ cpl_propertylist_append_string(plist_ext, "EXTNAME", cat_name) ;
+
+ /* Write the table */
+ parlist = cpl_parameterlist_new() ;
+ cpl_dfs_save_table(set_in,
+ NULL,
+ parlist,
+ set_raw,
+ NULL,
+ out,
+ plist_ext,
+ recipe_name,
+ plist,
+ NULL,
+ package_name,
+ out_name) ;
+ cpl_parameterlist_delete(parlist) ;
+ cpl_propertylist_delete(plist) ;
+ cpl_propertylist_delete(plist_ext) ;
+ cpl_table_delete(out) ;
+
+ /* Append the next catalogs */
+ for (i=1 ; i<nb_catalogs ; i++) {
+ /* Get the catalog name */
+ cur_frame = cpl_frameset_get_frame_const(set_raw, i) ;
+ cat_name = cpl_frame_get_filename(cur_frame) ;
+
+ /* Create the output table */
+ if ((out = convert_ascii_table(cat_name)) == NULL) {
+ cpl_free(out_name) ;
+ return CPL_ERROR_UNSPECIFIED;
+ }
+
+ plist_ext = cpl_propertylist_new() ;
+ cpl_propertylist_append_string(plist_ext, "EXTNAME", cat_name) ;
+ cpl_table_save(out, NULL, plist_ext, out_name, CPL_IO_EXTEND) ;
+ cpl_table_delete(out) ;
+ cpl_propertylist_delete(plist_ext) ;
+ }
+ cpl_free(out_name) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Load the FITS catalog in a table
+ @param filename Name of the FITS catalog
+ @param ext_name Name of the catalog or "all"
+ @return The newly allocated table orNULL in error case.
+
+ The table is loaded from the specified extension.
+ If "all" is specified, all extension with the same columns as the
+ first one are loaded and put together in the returned table.
+
+ The returned table must be de allocated with cpl_table_delete().
+ */
+/*----------------------------------------------------------------------------*/
+cpl_table * irplib_stdstar_load_catalog(
+ const char * filename,
+ const char * ext_name)
+{
+ int next ;
+ cpl_propertylist * plist ;
+ const char * cur_name ;
+ cpl_table * out ;
+ cpl_table * out_cur ;
+ cpl_frame * cur_frame ;
+ int i ;
+
+ /* Check entries */
+ if (filename == NULL) return NULL ;
+ if (ext_name == NULL) return NULL ;
+
+ /* Initialise */
+ out = NULL ;
+
+ /* Get the number of extensions in the catalog */
+ cur_frame = cpl_frame_new() ;
+ cpl_frame_set_filename(cur_frame, filename) ;
+ next = cpl_frame_get_nextensions(cur_frame) ;
+ cpl_frame_delete(cur_frame) ;
+
+ /* Loop on the extentions */
+ for (i=0 ; i<next ; i++) {
+ /* Check the name of the current extension */
+ if ((plist = cpl_propertylist_load_regexp(filename, i+1, "EXTNAME",
+ 0)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load header of %d th extension",
+ i+1);
+ return NULL ;
+ }
+ cur_name = cpl_propertylist_get_string(plist, "EXTNAME") ;
+
+ /* Check the current extension */
+ if (!strcmp(cur_name, ext_name)) {
+ /* Load the table */
+ if (out == NULL) {
+ out = cpl_table_load(filename, i+1, 1) ;
+ cpl_table_new_column(out, IRPLIB_STDSTAR_CAT_COL, CPL_TYPE_STRING);
+ cpl_table_fill_column_window_string(out, IRPLIB_STDSTAR_CAT_COL,
+ 0, cpl_table_get_nrow(out),
+ cur_name);
+ if (out == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load extension %d", i+1) ;
+ cpl_propertylist_delete(plist) ;
+ return NULL ;
+ }
+ }
+ } else if (!strcmp(ext_name, "all")) {
+ /* Load the table and append it */
+ if (i==0) {
+ /* Load the first table */
+ out = cpl_table_load(filename, i+1, 1) ;
+ cpl_table_new_column(out, IRPLIB_STDSTAR_CAT_COL, CPL_TYPE_STRING);
+ cpl_table_fill_column_window_string(out, IRPLIB_STDSTAR_CAT_COL,
+ 0, cpl_table_get_nrow(out),
+ cur_name);
+ if (out == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load extension %d", i+1) ;
+ cpl_propertylist_delete(plist) ;
+ return NULL ;
+ }
+ } else {
+ /* Load the current table */
+ out_cur = cpl_table_load(filename, i+1, 1) ;
+ if (out_cur == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load extension %d", i+1) ;
+ cpl_table_delete(out) ;
+ cpl_propertylist_delete(plist) ;
+ return NULL ;
+ }
+ cpl_table_new_column(out_cur, IRPLIB_STDSTAR_CAT_COL, CPL_TYPE_STRING);
+ cpl_table_fill_column_window_string(out_cur, IRPLIB_STDSTAR_CAT_COL,
+ 0, cpl_table_get_nrow(out_cur),
+ cur_name);
+ /* Append the table */
+ if (cpl_table_insert(out, out_cur,
+ cpl_table_get_nrow(out)) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot merge table %d", i+1) ;
+ cpl_table_delete(out) ;
+ cpl_table_delete(out_cur) ;
+ cpl_propertylist_delete(plist) ;
+ return NULL ;
+ }
+ cpl_table_delete(out_cur) ;
+ }
+ }
+ cpl_propertylist_delete(plist) ;
+ }
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Check that the table has the relevant columns of a stdstar table
+ @param catal Table with the catalogue
+ @return CPL_ERROR_NONE if the table has all the mandatory columns,
+ a proper error code otherwise
+
+ The table is checked for the presence of the mandatory keywords
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_stdstar_check_columns_exist(
+ const cpl_table * catal)
+{
+ /* Check for all the mandatory columns */
+ if (!cpl_table_has_column(catal, IRPLIB_STDSTAR_STAR_COL)) {
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Missing column: %s",
+ IRPLIB_STDSTAR_STAR_COL);
+ }
+ if (!cpl_table_has_column(catal, IRPLIB_STDSTAR_TYPE_COL)) {
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Missing column: %s",
+ IRPLIB_STDSTAR_TYPE_COL);
+ }
+ if (!cpl_table_has_column(catal, IRPLIB_STDSTAR_CAT_COL)) {
+ return cpl_error_set_message(cpl_func,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Missing column: %s",
+ IRPLIB_STDSTAR_CAT_COL);
+ }
+ if (!cpl_table_has_column(catal, IRPLIB_STDSTAR_RA_COL)) {
+ return cpl_error_set_message(cpl_func,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Missing column: %s",
+ IRPLIB_STDSTAR_RA_COL);
+ }
+ if (!cpl_table_has_column(catal, IRPLIB_STDSTAR_DEC_COL)) {
+ return cpl_error_set_message(cpl_func,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Missing column: %s",
+ IRPLIB_STDSTAR_DEC_COL);
+ }
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Select the stars that are within a given distance
+ @param cat the catalog
+ @param ra RA pos
+ @param dec DEC pos
+ @param dist the distancw
+ @return 0 if ok, -1 in error case
+
+ The stars that are within not further than dist from ra,dec are
+ selected in the table.
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_stdstar_select_stars_dist(
+ cpl_table * cat,
+ double ra,
+ double dec,
+ double dist)
+{
+ double distance ;
+ int nrows ;
+ int i ;
+
+ /* Check entries */
+ if (cat == NULL) return -1;
+
+ /* Get the number of selected rows */
+ nrows = cpl_table_get_nrow(cat) ;
+
+ /* Check if the columns are there */
+ if (!cpl_table_has_column(cat, IRPLIB_STDSTAR_RA_COL)) {
+ cpl_msg_error(cpl_func, "Missing %s column", IRPLIB_STDSTAR_RA_COL) ;
+ return -1 ;
+ }
+ if (!cpl_table_has_column(cat, IRPLIB_STDSTAR_DEC_COL)) {
+ cpl_msg_error(cpl_func, "Missing %s column", IRPLIB_STDSTAR_DEC_COL) ;
+ return -1 ;
+ }
+
+ /* Compute distances of the selected rows */
+ for (i=0 ; i<nrows ; i++) {
+ if (cpl_table_is_selected(cat, i)) {
+ /* The row is selected - compute the distance */
+ distance = irplib_wcs_great_circle_dist(ra, dec,
+ cpl_table_get_double(cat, IRPLIB_STDSTAR_RA_COL, i, NULL),
+ cpl_table_get_double(cat, IRPLIB_STDSTAR_DEC_COL, i, NULL));
+ if (distance > dist) cpl_table_unselect_row(cat, i) ;
+ }
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Select the stars that have a known magnitude
+ @param cat the catalog
+ @param mag_colname the column name with the searched magnitude
+ @return 0 if ok, -1 in error case
+
+ The stars whose magnitude in the mag band is known are selected in the table.
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_stdstar_select_stars_mag(
+ cpl_table * cat,
+ const char * mag_colname)
+{
+ /* Check entries */
+ if (cat == NULL) return -1 ;
+ if (mag_colname == NULL) return -1 ;
+
+ /* Check that the table has the mag column */
+ if (!cpl_table_has_column(cat, mag_colname)) {
+ cpl_msg_error(cpl_func, "Column %s does not exist in the catalog",
+ mag_colname) ;
+ return -1 ;
+ }
+
+ /* Apply the selection */
+ if (cpl_table_and_selected_double(cat, mag_colname, CPL_NOT_GREATER_THAN,
+ 98.0) <= 0) {
+ cpl_msg_error(cpl_func, "Column %s does not exist in the catalog",
+ mag_colname) ;
+ return -1 ;
+ }
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the closest star
+ @param cat the catalog
+ @param ra RA pos
+ @param dec DEC pos
+ @return the index of the star in the table or -1 in error case
+
+ Returns the index of the star that is closest to (ra,dec)
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_stdstar_find_closest(
+ const cpl_table * cat,
+ double ra,
+ double dec)
+{
+ double min_dist, distance ;
+ int nrows ;
+ int ind ;
+ int i ;
+
+ /* Check entries */
+ if (cat == NULL) return -1 ;
+
+ /* Initialize */
+ min_dist = 1000.0 ;
+ ind = -1 ;
+
+ /* Get the number of selected rows */
+ nrows = cpl_table_get_nrow(cat) ;
+
+ /* Check if the columns are there */
+ if (!cpl_table_has_column(cat, IRPLIB_STDSTAR_RA_COL)) {
+ cpl_msg_error(cpl_func, "Missing %s column", IRPLIB_STDSTAR_RA_COL) ;
+ return -1 ;
+ }
+ if (!cpl_table_has_column(cat, IRPLIB_STDSTAR_DEC_COL)) {
+ cpl_msg_error(cpl_func, "Missing %s column", IRPLIB_STDSTAR_DEC_COL) ;
+ return -1 ;
+ }
+
+ /* Compute distances of the selected rows */
+ for (i=0 ; i<nrows ; i++) {
+ if (cpl_table_is_selected(cat, i)) {
+ /* The row is selected - compute the distance */
+ distance = irplib_wcs_great_circle_dist(ra, dec,
+ cpl_table_get_double(cat, IRPLIB_STDSTAR_RA_COL, i, NULL),
+ cpl_table_get_double(cat, IRPLIB_STDSTAR_DEC_COL, i, NULL));
+ if (distance <= min_dist) {
+ min_dist = distance ;
+ ind = i ;
+ }
+ }
+ }
+ return ind ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the closest star to ra, dec in the catalog
+ @param catfile the catalog file name
+ @param ra RA pos where to search
+ @param dec DEC pos where to search
+ @param band the band name
+ @param catname the searched catalog name
+ @param mag the computed magnitude (output)
+ @param name the star name (output)
+ @param type the star type (output)
+ @param star_ra the star RA from the catalog (output)
+ @param star_dec the star DEC from the catalog (output)
+ @param dist_am the distance in arc minutes
+ @return CPL_ERROR_NONE if ok, or an appropiate error case otherwise
+
+ The closest star to ra, dec with defined magnitude is search in all the
+ catalogues included in catfile.
+ If catname is "all", all the catalogs are searched at once.
+ The output pointers can be NULL if one is not interested in them.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_stdstar_find_star(
+ const char * catfile,
+ double ra,
+ double dec,
+ const char * band,
+ const char * catname,
+ double * mag,
+ char ** name,
+ char ** type,
+ char ** usedcatname,
+ double * star_ra,
+ double * star_dec,
+ double dist_am)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_table * catal ;
+ const double dist = dist_am / 60.0 ;
+ int ind ;
+
+ /* Check entries */
+ if (catfile == NULL) return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
+ if (band == NULL) return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
+ if (catname == NULL) return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
+
+ /* Load the catalog */
+ if ((catal = irplib_stdstar_load_catalog(catfile, catname)) == NULL) {
+ return cpl_error_set_message(cpl_func, CPL_ERROR_FILE_NOT_FOUND,
+ "Cannot load the catalog %s from %s",
+ catname, catfile);
+ }
+
+ /* Check the columns are present */
+ if (irplib_stdstar_check_columns_exist(catal) != CPL_ERROR_NONE) {
+ cpl_table_delete(catal);
+ return cpl_error_set_where(cpl_func);
+ }
+
+ /* Select stars with known magnitude */
+ if (irplib_stdstar_select_stars_mag(catal, band) == -1) {
+ cpl_table_delete(catal) ;
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Cannot select stars in that band");
+ }
+
+ /* Select stars within a given distance */
+ if (irplib_stdstar_select_stars_dist(catal, ra, dec, dist) == -1) {
+ cpl_table_delete(catal) ;
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Cannot select close stars");
+ }
+
+ /* Take the closest */
+ if ((ind=irplib_stdstar_find_closest(catal, ra, dec)) < 0) {
+ cpl_table_delete(catal) ;
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ "Cannot get the closest star with "
+ "known %s magnitude",band);
+ }
+
+ if(mag != NULL)
+ *mag = cpl_table_get_double(catal, band, ind, NULL) ;
+
+ if(name != NULL)
+ {
+ *name = cpl_strdup(cpl_table_get_string(catal,
+ IRPLIB_STDSTAR_STAR_COL, ind));
+
+ }
+ if(type != NULL)
+ {
+ *type = cpl_strdup(cpl_table_get_string(catal, IRPLIB_STDSTAR_TYPE_COL,
+ ind));
+ }
+ if(usedcatname != NULL)
+ {
+ if(strcmp(catname, "all"))
+ *usedcatname = cpl_strdup(catname);
+ else
+ {
+ *usedcatname = cpl_strdup(cpl_table_get_string
+ (catal, IRPLIB_STDSTAR_CAT_COL, ind));
+ }
+ }
+ if(star_ra != NULL)
+ *star_ra = cpl_table_get_double(catal, IRPLIB_STDSTAR_RA_COL, ind, NULL);
+ if(star_dec != NULL)
+ *star_dec = cpl_table_get_double(catal, IRPLIB_STDSTAR_DEC_COL, ind, NULL);
+
+ /* Free and return */
+ cpl_table_delete(catal);
+ return cpl_errorstate_is_equal(prestate) ? CPL_ERROR_NONE
+ : cpl_error_set_where(cpl_func);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the conversion
+ @param spec the extracted spectrum
+ @param dit the DIT (in sec)
+ @param surface the surface of the miror (in sq cm)
+ @param gain the gain of the instrument (ISAAC=4.5, SINFONI=2.42)
+ @param mag the star magnitude
+ @return the newly allocated conversion or NULL in error case
+
+ conversion(wave) = (spec * gain * 10^(mag/2.5) * h * c) /
+ (dit * surface * dispersion * wave)
+ */
+/*----------------------------------------------------------------------------*/
+cpl_vector * irplib_stdstar_get_conversion(
+ const cpl_bivector * spec,
+ double dit,
+ double surface,
+ double gain,
+ double mag)
+{
+ double h = 6.62e-27 ;
+ double c = 3e18 ;
+ const cpl_vector * wave ;
+ const cpl_vector * extr ;
+ cpl_vector * out ;
+ double factor ;
+
+ /* Test entries */
+ if (spec == NULL) return NULL ;
+ if (dit <= 0.0) return NULL ;
+
+ /* Get the extracted spectrum */
+ wave = cpl_bivector_get_x_const(spec) ;
+ extr = cpl_bivector_get_y_const(spec) ;
+
+ /* Get the spectrum */
+ out = cpl_vector_duplicate(extr) ;
+
+ /* Divide by DIT */
+ cpl_vector_divide_scalar(out, dit) ;
+
+ /* Divide by the surface */
+ cpl_vector_divide_scalar(out, surface) ;
+
+ /* Multiply by the gain */
+ cpl_vector_multiply_scalar(out, gain) ;
+
+ /* Multiply by the difference magnitude */
+ factor = pow(10, mag/2.5) ;
+ cpl_vector_multiply_scalar(out, factor) ;
+
+ /* Divide by the dispersion */
+ factor = (cpl_vector_get(wave, cpl_vector_get_size(wave)-1) -
+ cpl_vector_get(wave, 0)) / cpl_vector_get_size(wave) ;
+ cpl_vector_divide_scalar(out, factor) ;
+
+ /* Multiply by the energy of the photon */
+ cpl_vector_multiply_scalar(out, h*c) ;
+ cpl_vector_divide(out, wave) ;
+
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the 0 magnitude spectrum
+ @param sed the SED in angstroms / ergs/s/cm^2/Angstrom
+ @param waves the wavelengths in angstroms
+ @param cent_wl the central wavelength in microns
+ @return the newly allocated spectrum or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+cpl_vector * irplib_stdstar_get_mag_zero(
+ const cpl_bivector * sed,
+ const cpl_vector * waves,
+ double cent_wl)
+{
+ double wmin, wmax, wstep ;
+ int nb_sed ;
+ const double * sed_x ;
+ const double * sed_y ;
+ cpl_bivector * sed_loc ;
+ double * sed_loc_x ;
+ double * sed_loc_y ;
+ cpl_vector * out ;
+ cpl_bivector * out_biv ;
+ double f0_jan, f0_erg, cent_val ;
+ int i ;
+
+ /* Test entries */
+ if (sed == NULL) return NULL ;
+ if (waves == NULL) return NULL ;
+
+ /* Initialise */
+ nb_sed = cpl_bivector_get_size(sed) ;
+ sed_x = cpl_bivector_get_x_data_const(sed) ;
+ sed_y = cpl_bivector_get_y_data_const(sed) ;
+ wstep = sed_x[1] - sed_x[0] ;
+ wmin = cpl_vector_get(waves, 0) ;
+ wmax = cpl_vector_get(waves, cpl_vector_get_size(waves)-1) ;
+
+ /* Expand sed with 0 to have it bigger than the required wavelengths */
+ sed_loc = cpl_bivector_new(nb_sed + 4) ;
+ sed_loc_x = cpl_bivector_get_x_data(sed_loc) ;
+ sed_loc_y = cpl_bivector_get_y_data(sed_loc) ;
+ for (i=0 ; i<nb_sed ; i++) {
+ sed_loc_x[i+2] = sed_x[i] ;
+ sed_loc_y[i+2] = sed_y[i] ;
+ }
+
+ /* Low bound */
+ sed_loc_x[1] = sed_loc_x[2] - wstep ;
+ if (sed_loc_x[2] < wmin) {
+ sed_loc_x[0] = sed_loc_x[1] - wstep ;
+ } else {
+ sed_loc_x[0] = wmin - wstep ;
+ }
+ sed_loc_y[0] = 1e-20 ;
+ sed_loc_y[1] = 1e-20 ;
+
+ /* High bound */
+ sed_loc_x[nb_sed+2] = sed_loc_x[nb_sed+1] + wstep ;
+ if (sed_loc_x[nb_sed+1] > wmax) {
+ sed_loc_x[nb_sed+3] = sed_loc_x[nb_sed+2] + wstep ;
+ } else {
+ sed_loc_x[nb_sed+3] = wmax + wstep ;
+ }
+ sed_loc_y[nb_sed+2] = 1e-20 ;
+ sed_loc_y[nb_sed+3] = 1e-20 ;
+
+ /* Create the output bivector */
+ out = cpl_vector_duplicate(waves) ;
+ out_biv = cpl_bivector_wrap_vectors((cpl_vector*)waves, out) ;
+
+ /* Interpolate */
+ if (cpl_bivector_interpolate_linear(out_biv, sed_loc) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot interpolate the wavelength") ;
+ cpl_bivector_unwrap_vectors(out_biv) ;
+ cpl_vector_delete(out) ;
+ cpl_bivector_delete(sed_loc) ;
+ return NULL ;
+ }
+ cpl_bivector_unwrap_vectors(out_biv) ;
+ cpl_bivector_delete(sed_loc) ;
+
+ /* Compute f0_jan */
+ f0_jan = 5513.15 / ( pow(cent_wl,3) * (exp(1.2848/cent_wl)-1) ) ;
+
+ /* Convert f0 Jansky -> ergs/s/cm^2/Angstrom */
+ f0_erg = f0_jan * 1e-26 * 1e7 * 3e18 / (1e4 * cent_wl*cent_wl*1e4*1e4) ;
+
+ /* Scale out so that the central value is f0 */
+ cent_val = cpl_vector_get(out, cpl_vector_get_size(out)/2) ;
+ if (cent_val <= 0.0) {
+ cpl_msg_error(cpl_func, "Negative or 0 central value") ;
+ cpl_vector_delete(out) ;
+ return NULL ;
+ }
+ cpl_vector_multiply_scalar(out, f0_erg/cent_val) ;
+
+ /* Return */
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the SED
+ @param seds_file the table file name
+ @param sptype the requested spectral type
+ @return the newly allocated SED or NULL in error case
+
+ wavelength in Angstroms
+ SED in
+ */
+/*----------------------------------------------------------------------------*/
+cpl_bivector * irplib_stdstar_get_sed(
+ const char * seds_file,
+ const char * sptype)
+{
+ cpl_table * seds ;
+ cpl_bivector * out ;
+ cpl_vector * wave ;
+ cpl_vector * sed ;
+ cpl_bivector * tmp ;
+ int nlines ;
+
+ /* Test entries */
+ if (seds_file == NULL) return NULL ;
+ if (sptype == NULL) return NULL ;
+
+ /* Load the table */
+ if ((seds = cpl_table_load(seds_file, 1, 0)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load the table") ;
+ return NULL ;
+ }
+
+ /* Check if the column is there */
+ if (!cpl_table_has_column(seds, sptype)) {
+ cpl_msg_error(cpl_func, "SED of the requested star not available") ;
+ cpl_table_delete(seds) ;
+ return NULL ;
+ }
+
+ /* Get the nb lines */
+ nlines = cpl_table_get_nrow(seds) ;
+
+ /* Get the wavelength as a vector */
+ if ((wave = cpl_vector_wrap(nlines,
+ cpl_table_get_data_double(seds, "Wavelength"))) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot get the Wavelength column") ;
+ cpl_table_delete(seds) ;
+ return NULL ;
+ }
+
+ /* Get the SED as a vector */
+ if ((sed = cpl_vector_wrap(nlines,
+ cpl_table_get_data_double(seds, sptype))) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot get the SED column") ;
+ cpl_table_delete(seds) ;
+ cpl_vector_unwrap(wave) ;
+ return NULL ;
+ }
+ tmp = cpl_bivector_wrap_vectors(wave, sed) ;
+
+ /* Create the output bivector */
+ out = cpl_bivector_duplicate(tmp) ;
+
+ /* Free */
+ cpl_bivector_unwrap_vectors(tmp) ;
+ cpl_vector_unwrap(wave) ;
+ cpl_vector_unwrap(sed) ;
+ cpl_table_delete(seds) ;
+
+ /* Return */
+ return out ;
+}
+/**@}*/
diff --git a/irplib/irplib_stdstar.h b/irplib/irplib_stdstar.h
new file mode 100644
index 0000000..4f51f5a
--- /dev/null
+++ b/irplib/irplib_stdstar.h
@@ -0,0 +1,78 @@
+/* $Id: irplib_stdstar.h,v 1.15 2011/12/14 08:53:04 cgarcia Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: cgarcia $
+ * $Date: 2011/12/14 08:53:04 $
+ * $Revision: 1.15 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_STDSTAR_H
+#define IRPLIB_STDSTAR_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+#define IRPLIB_STDSTAR_STAR_COL "STARS"
+#define IRPLIB_STDSTAR_TYPE_COL "SP_TYPE"
+#define IRPLIB_STDSTAR_RA_COL "RA"
+#define IRPLIB_STDSTAR_DEC_COL "DEC"
+#define IRPLIB_STDSTAR_CAT_COL "CATALOG"
+
+/* Maximum allowed distance [arc minutes] between observation and
+ catalogue coordinates */
+#define IRPLIB_STDSTAR_MAXDIST 2.0
+
+/* Magical value to indicate an invalid magnitude */
+#define IRPLIB_STDSTAR_NOMAG 99.0
+
+/* Use this limit in comparisons regarding an invalid magnitude */
+#define IRPLIB_STDSTAR_LIMIT (IRPLIB_STDSTAR_NOMAG-1.0)
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+int irplib_stdstar_write_catalogs(cpl_frameset *, const cpl_frameset *,
+ const char *, const char *, const char *, const char *,
+ const char *, cpl_table * (*convert_ascii_table)(const char *)) ;
+cpl_table * irplib_stdstar_load_catalog(const char *, const char *) ;
+cpl_error_code irplib_stdstar_check_columns_exist(const cpl_table *);
+int irplib_stdstar_select_stars_dist(cpl_table *, double, double, double) ;
+int irplib_stdstar_select_stars_mag(cpl_table *, const char *) ;
+int irplib_stdstar_find_closest(const cpl_table *, double, double) ;
+cpl_error_code irplib_stdstar_find_star(const char *, double, double, const char *,
+ const char *, double *, char **, char **, char **,
+ double *, double * , double);
+cpl_vector * irplib_stdstar_get_conversion(const cpl_bivector *, double, double,
+ double, double);
+cpl_vector * irplib_stdstar_get_mag_zero(const cpl_bivector *,
+ const cpl_vector *, double);
+cpl_bivector * irplib_stdstar_get_sed(const char *, const char *);
+
+#endif
diff --git a/irplib/irplib_strehl.c b/irplib/irplib_strehl.c
new file mode 100644
index 0000000..f1e6a24
--- /dev/null
+++ b/irplib/irplib_strehl.c
@@ -0,0 +1,806 @@
+/* $Id: irplib_strehl.c,v 1.43 2009/11/18 21:37:48 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2009/11/18 21:37:48 $
+ * $Revision: 1.43 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+
+#include <cpl.h>
+
+#include "irplib_utils.h"
+#include "irplib_strehl.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_strehl Functions to compute the Strehl
+ */
+/*----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#ifndef IRPLIB_STREHL_RAD_CENTRAL
+#define IRPLIB_STREHL_RAD_CENTRAL 5
+#endif
+
+#define IRPLIB_DISK_BG_MIN_PIX_NB 30
+#define IRPLIB_DISK_BG_REJ_LOW 0.1
+#define IRPLIB_DISK_BG_REJ_HIGH 0.1
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static cpl_image * irplib_strehl_generate_otf(double, double, double, double,
+ int, double);
+static double PSF_H1(double, double, double);
+static double PSF_H2(double, double);
+static double PSF_G(double, double);
+static double PSF_sinc(double);
+static double PSF_TelOTF(double, double);
+static cpl_error_code update_bad_pixel_map(cpl_image* im);
+
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+/**@{*/
+
+/**
+ @brief Update the bad pixel map for the image - mark all pixels with NaN value as a bad
+ @param im Image with pixel-type float or double
+ @return 0 iff ok
+ */
+cpl_error_code update_bad_pixel_map(cpl_image* im)
+{
+ int szx = cpl_image_get_size_x(im);
+ int szy = cpl_image_get_size_y(im);
+ int x = 0;
+ cpl_mask* bpm = cpl_image_get_bpm(im);
+
+ for (x = 1; x <=szx; x++)
+ {
+ int y = 0;
+ for(y = 1; y <= szy; y++)
+ {
+ int isnull = 0;
+ double value = cpl_image_get(im, x, y, &isnull);
+ if (isnan(value))
+ {
+ cpl_mask_set(bpm, x, y, CPL_BINARY_1);
+ }
+ }
+ }
+ return cpl_error_get_code();
+}
+/**
+ @brief Compute the strehl ratio in an image.
+ at param im Image with pixel-type float
+ @param m1 Diameter of the M1 mirror [m]
+ @param m2 Diameter of the M2 mirror [m]
+ @param lam Central wavelength [micron]
+ @param dlam Filter bandwidth [micron]
+ @param pscale Positive pixel scale
+ @param size Size of image to be used for internal PSF
+ @param xpos The x position of the ring center
+ @param ypos The y position of the ring center
+ @param r1 The Star Radius, r1 > 0
+ @param r2 The Internal Radius, r2 > 0
+ @param r3 The External Radius, r3 > r2
+ @param noise_box_sz Pass -1 for default values
+ @param noise_nsamples Pass -1 for default values
+ @param strehl Pointer to the Strehl Error (positive on success)
+ @param strehl_err Pointer to the Strehl Error (non-negative on success)
+ @param star_bg Pointer to the Star Background
+ @param star_peak Pointer to the Star Peak (positive on success)
+ @param star_flux Pointer to the Star Flux (positive on success)
+ @param psf_peak Pointer to the PSF Peak (positive on success)
+ @param psf_flux Pointer to the PSF Flux (1 on success)
+ @param bg_noise Pointer to the Background Noise
+ @return 0 iff ok
+ @note The output is undefined on error. On success the Strehl Ratio may
+ exceed 1. Before computation, all NaN values in the image would be marked in the
+ bad pixel map. That means, parameter im would changed (bad pixel map would be updated / created).
+ */
+
+cpl_error_code irplib_strehl_mark_bad_and_compute(cpl_image * im,
+ double m1,
+ double m2,
+ double lam,
+ double dlam,
+ double pscale,
+ int size,
+ double xpos,
+ double ypos,
+ double r1,
+ double r2,
+ double r3,
+ int noise_box_sz,
+ int noise_nsamples,
+ double * strehl,
+ double * strehl_err,
+ double * star_bg,
+ double * star_peak,
+ double * star_flux,
+ double * psf_peak,
+ double * psf_flux,
+ double * bg_noise)
+{
+ cpl_ensure_code(!update_bad_pixel_map(im), cpl_error_get_code());
+ return irplib_strehl_compute(im, m1, m2, lam, dlam, pscale, size, xpos, ypos,
+ r1,
+ r2,
+ r3,
+ noise_box_sz,
+ noise_nsamples,
+ strehl,
+ strehl_err,
+ star_bg,
+ star_peak,
+ star_flux,
+ psf_peak,
+ psf_flux,
+ bg_noise);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the strehl ratio in an image
+ @param im Image with pixel-type float
+ @param m1 Diameter of the M1 mirror [m]
+ @param m2 Diameter of the M2 mirror [m]
+ @param lam Central wavelength [micron]
+ @param dlam Filter bandwidth [micron]
+ @param pscale Positive pixel scale [Arcsecond/pixel]
+ @param size Size of image to be used for internal PSF [pixel]
+ @param xpos The x position of the ring center [pixel]
+ @param ypos The y position of the ring center [pixel]
+ @param r1 The Star Radius, r1 > 0 [Arcsecond]
+ @param r2 The Internal Radius, r2 > 0 [Arcsecond]
+ @param r3 The External Radius, r3 > r2 [Arcsecond]
+ @param noise_box_sz Pass -1 for default values
+ @param noise_nsamples Pass -1 for default values
+ @param strehl Pointer to the Strehl Error (positive on success)
+ @param strehl_err Pointer to the Strehl Error (non-negative on success)
+ @param star_bg Pointer to the Star Background
+ @param star_peak Pointer to the Star Peak (positive on success)
+ @param star_flux Pointer to the Star Flux (positive on success)
+ @param psf_peak Pointer to the PSF Peak (positive on success)
+ @param psf_flux Pointer to the PSF Flux (1 on success)
+ @param bg_noise Pointer to the Background Noise
+ @return 0 iff ok
+ @note The output is undefined on error. On success the Strehl Ratio may
+ exceed 1. Strehl computation could fail if the image contains NaN values
+ and those values are not marked in the bad pixel map. In that case the function
+ rplib_strehl_mark_bad_and_compute could be used instead.
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_strehl_compute(const cpl_image * im,
+ double m1,
+ double m2,
+ double lam,
+ double dlam,
+ double pscale,
+ int size,
+ double xpos,
+ double ypos,
+ double r1,
+ double r2,
+ double r3,
+ int noise_box_sz,
+ int noise_nsamples,
+ double * strehl,
+ double * strehl_err,
+ double * star_bg,
+ double * star_peak,
+ double * star_flux,
+ double * psf_peak,
+ double * psf_flux,
+ double * bg_noise)
+{
+ cpl_image * psf;
+ double star_radius, max_radius;
+
+ /* FIXME: Arbitrary choice of image border */
+ const double window_size = (double)(IRPLIB_STREHL_RAD_CENTRAL);
+
+ /* Determined empirically by C. Lidman for Strehl error computation */
+ const double strehl_error_coefficient = CPL_MATH_PI * 0.007 / 0.0271;
+ double ring[4];
+ /* cpl_flux_get_noise_ring() must succeed with this many tries */
+ int ring_tries = 3;
+ cpl_errorstate prestate;
+
+ /* Check compile-time constant */
+ cpl_ensure_code(window_size > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Test inputs */
+ cpl_ensure_code(im != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(strehl != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(strehl_err != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(star_bg != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(star_peak != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(star_flux != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(psf_peak != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(psf_flux != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(pscale > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(r1 > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(r2 > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(r3 > r2, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Computing a Strehl ratio is a story between an ideal PSF */
+ /* and a candidate image supposed to approximate this ideal PSF. */
+
+ /* Generate first appropriate PSF to find max peak */
+ psf = irplib_strehl_generate_psf(m1, m2, lam, dlam, pscale, size);
+ cpl_ensure_code(psf != NULL, CPL_ERROR_ILLEGAL_OUTPUT);
+
+ /* Compute flux in PSF and find max peak */
+ *psf_peak = cpl_image_get_max(psf);
+ cpl_image_delete(psf);
+
+ assert( *psf_peak > 0.0); /* The ideal PSF has a positive maximum */
+ *psf_flux = 1.0; /* The psf flux, cpl_image_get_flux(psf), is always 1 */
+
+ /* Measure the background in the candidate image */
+ *star_bg = irplib_strehl_ring_background(im, xpos, ypos, r2/pscale, r3/pscale,
+ IRPLIB_BG_METHOD_AVER_REJ);
+
+ /* Compute star_radius in pixels */
+ star_radius = r1/pscale;
+
+ /* Measure the flux on the candidate image */
+ *star_flux = irplib_strehl_disk_flux(im, xpos, ypos, star_radius, *star_bg);
+
+ cpl_ensure_code(*star_flux > 0.0, CPL_ERROR_ILLEGAL_OUTPUT);
+
+ /* Find the peak value on the central part of the candidate image */
+ max_radius = window_size < star_radius ? window_size : star_radius;
+ cpl_ensure_code(!irplib_strehl_disk_max(im, xpos, ypos, max_radius,
+ star_peak), cpl_error_get_code());
+ *star_peak -= *star_bg;
+
+ cpl_ensure_code(*star_peak > 0.0, CPL_ERROR_ILLEGAL_OUTPUT);
+
+ /* Compute Strehl */
+ /* (StarPeak / StarFlux) / (PsfPeak / PsfFlux) */
+ *strehl = (*star_peak * *psf_flux ) / ( *star_flux * *psf_peak);
+
+ if (*strehl > 1)
+ cpl_msg_warning(cpl_func, "Extreme Strehl-ratio=%g, star_peak=%g, "
+ "star_flux=%g, psf_peak=%g, psf_flux=%g", *strehl,
+ *star_peak, *star_flux, *psf_peak, *psf_flux);
+
+ /* Compute Strehl error */
+ /* computation could fail if the image contains pixels with NaN value*/
+ ring[0] = xpos;
+ ring[1] = ypos;
+ ring[2] = r2/pscale;
+ ring[3] = r3/pscale;
+
+ /* FIXME: With CPL 5.1 the recoverable error
+ will be CPL_ERROR_DATA_NOT_FOUND */
+ prestate = cpl_errorstate_get();
+ while (cpl_flux_get_noise_ring(im, ring, noise_box_sz, noise_nsamples,
+ bg_noise, NULL) && --ring_tries > 0);
+ if (ring_tries > 0) {
+ cpl_errorstate_set(prestate); /* Recover, if an error happened */
+ } else {
+ return cpl_error_set_where(cpl_func);
+ }
+
+ *strehl_err = strehl_error_coefficient * (*bg_noise) * pscale *
+ star_radius * star_radius / *star_flux;
+
+ /* This check should not be able to fail, but just to be sure */
+ cpl_ensure_code(*strehl_err >= 0.0, CPL_ERROR_ILLEGAL_OUTPUT);
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the flux from a disk
+ @param im Image with pixel-type float
+ @param xpos the x position of the disk center
+ @param ypos the y position of the disk center
+ @param rad the radius
+ @param bg the star background
+ @return The computed flux or 0.0 on error
+ @note (xpos, ypos) and may be outside the image, if so then a sufficiently
+ small rad will cause no pixels to be encircled, in which case the
+ returned flux is zero.
+
+ The nan values check has been added for SINFONI. The input image in
+ input should not contain nan values, but it does in some cases...
+ */
+/*----------------------------------------------------------------------------*/
+double irplib_strehl_disk_flux(const cpl_image * im,
+ double xpos,
+ double ypos,
+ double rad,
+ double bg)
+{
+ const double sqr = rad * rad;
+ double sqrest;
+ const float * pim;
+ double flux = 0.0;
+ double yj, xi;
+ int nx, ny;
+ int lx, ly, ux, uy;
+ int i, j;
+
+
+ /* Check entries */
+ cpl_ensure(im != NULL, CPL_ERROR_NULL_INPUT, 0.0);
+ cpl_ensure(cpl_image_get_type(im) == CPL_TYPE_FLOAT,
+ CPL_ERROR_UNSUPPORTED_MODE, 0.0);
+ cpl_ensure(rad > 0.0, CPL_ERROR_ILLEGAL_INPUT, 0.0);
+
+ nx = cpl_image_get_size_x(im);
+ ny = cpl_image_get_size_y(im);
+
+ /* Round down */
+ lx = (int)(xpos - rad);
+ ly = (int)(ypos - rad);
+ if (lx < 0) lx = 0;
+ if (ly < 0) ly = 0;
+
+ /* Round up */
+ ux = (int)(xpos + rad) + 1;
+ uy = (int)(ypos + rad) + 1;
+ if (ux > (nx-1)) ux = nx-1;
+ if (uy > (ny-1)) uy = ny-1;
+
+ pim = cpl_image_get_data_float_const(im);
+ for (j=ly ; j<uy ; j++) {
+ yj = (double)j - ypos;
+ sqrest = sqr - yj * yj;
+ for (i=lx; i<ux ; i++) {
+ xi = (double)i - xpos;
+ if (sqrest >= xi * xi && irplib_isnan(pim[i+j*nx]) == 0) {
+ flux += (double)pim[i+j*nx] - bg;
+ }
+ }
+ }
+ return flux;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the background in the image from a specified disk
+ @param im Image with pixel-type float
+ @param xpos the x position of the ring center
+ @param ypos the y position of the ring center
+ @param rad_int the internal radius
+ @param rad_ext the external radius
+ @param mode IRPLIB_BG_METHOD_AVER_REJ or IRPLIB_BG_METHOD_MEDIAN
+ @return The computed background or 0.0 on error.
+
+ The nan values check has been added for SINFONI. The input image in
+ input should not contain nan values, but it does in some cases...
+ */
+/*----------------------------------------------------------------------------*/
+double irplib_strehl_ring_background(const cpl_image * im,
+ double xpos,
+ double ypos,
+ double rad_int,
+ double rad_ext,
+ irplib_strehl_bg_method mode)
+{
+ int npix;
+ const double sqr_int = rad_int * rad_int;
+ const double sqr_ext = rad_ext * rad_ext;
+ double dist;
+ cpl_vector * pix_arr;
+ const float * pim;
+ double flux = 0.0;
+ double yj, xi;
+ int lx, ly, ux, uy;
+ int nx, ny;
+ int i, j;
+
+ /* Check entries */
+ cpl_ensure(im != NULL, CPL_ERROR_NULL_INPUT, 0.0);
+ cpl_ensure(cpl_image_get_type(im) == CPL_TYPE_FLOAT,
+ CPL_ERROR_UNSUPPORTED_MODE, 0.0);
+ cpl_ensure(rad_int > 0.0, CPL_ERROR_ILLEGAL_INPUT, 0.0);
+ cpl_ensure(rad_ext > rad_int, CPL_ERROR_ILLEGAL_INPUT, 0.0);
+
+ cpl_ensure(mode == IRPLIB_BG_METHOD_AVER_REJ ||
+ mode == IRPLIB_BG_METHOD_MEDIAN,
+ CPL_ERROR_UNSUPPORTED_MODE, 0.0);
+
+ nx = cpl_image_get_size_x(im);
+ ny = cpl_image_get_size_y(im);
+
+ /* Round down */
+ lx = (int)(xpos - rad_ext);
+ ly = (int)(ypos - rad_ext);
+ if (lx < 0) lx = 0;
+ if (ly < 0) ly = 0;
+
+ /* Round up */
+ ux = (int)(xpos + rad_ext) + 1;
+ uy = (int)(ypos + rad_ext) + 1;
+ if (ux > (nx-1)) ux = nx-1;
+ if (uy > (ny-1)) uy = ny-1;
+
+ npix = (ux - lx + 1) * (uy - ly + 1);
+ cpl_ensure(npix >= IRPLIB_DISK_BG_MIN_PIX_NB, CPL_ERROR_DATA_NOT_FOUND, 0.0);
+
+ /* Allocate pixel array to hold values in the ring */
+ pix_arr = cpl_vector_new(npix);
+
+ /* Count number of pixels in the ring */
+ /* Retrieve all pixels which belong to the ring */
+ pim = cpl_image_get_data_float_const(im);
+ npix = 0;
+ for (j=ly ; j<uy ; j++) {
+ yj = (double)j - ypos;
+ for (i=lx ; i<ux; i++) {
+ xi = (double)i - xpos;
+ dist = yj * yj + xi * xi;
+ if (sqr_int <= dist && dist <= sqr_ext &&
+ irplib_isnan(pim[i+j*nx]) == 0) {
+ cpl_vector_set(pix_arr, npix, (double)pim[i+j*nx]);
+ npix++;
+ }
+ }
+ }
+
+ if (npix < IRPLIB_DISK_BG_MIN_PIX_NB) {
+ cpl_vector_delete(pix_arr);
+ cpl_ensure(0, CPL_ERROR_DATA_NOT_FOUND, 0.0);
+ }
+
+ /* Should not be able to fail now */
+
+ /* Resize pixel array to actual number of values within the ring */
+ cpl_vector_set_size(pix_arr, npix);
+
+ if (mode == IRPLIB_BG_METHOD_AVER_REJ) {
+ const int low_ind = (int)((double)npix * IRPLIB_DISK_BG_REJ_LOW);
+ const int high_ind = (int)((double)npix
+ * (1.0 - IRPLIB_DISK_BG_REJ_HIGH));
+
+ /* Sort the array */
+ cpl_vector_sort(pix_arr, 1);
+
+ for (i=low_ind ; i<high_ind ; i++) {
+ flux += cpl_vector_get(pix_arr, i);
+ }
+ if (high_ind - low_ind > 1) flux /= (double)(high_ind - low_ind);
+ } else /* if (mode == IRPLIB_BG_METHOD_MEDIAN) */ {
+ flux = cpl_vector_get_median(pix_arr);
+ }
+
+ cpl_vector_delete(pix_arr);
+
+ return flux;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the ideal PSF for a given telescope+instrument.
+ @param m1 Diameter of the M1 mirror [meter]
+ @param m2 Diameter of the M2 mirror [meter]
+ @param lam Central wavelength [micron]
+ @param dlam Filter bandwidth [micron]
+ @param size Generated image size (image will be square) [pixel]
+ @param pscale Pixel scale on the sky [Arcsecond/pixel]
+ @return 1 newly generated image.
+
+ This function computes the ideal PSF for a given telescope and instrument.
+ The PSF is computed by first generated the ideal OTF for the provided
+ conditions, and applying a Fourier transform to it to bring it back to real
+ space. The returned PSF is normalized to unity flux, to help Strehl ratio
+ computations.
+
+ The image halves of the returned PSF are swapped in both directions.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_image * irplib_strehl_generate_psf(
+ double m1,
+ double m2,
+ double lam,
+ double dlam,
+ double pscale,
+ int size)
+{
+ cpl_image * otf_image = irplib_strehl_generate_otf(m1, m2, lam, dlam,
+ size, pscale);
+
+ if (otf_image == NULL) return NULL;
+
+ /* Transform back to real space
+ - Normalization is unnecessary, due to the subsequent normalisation.
+ - An OTF is point symmetric about its center, i.e. it is even,
+ i.e. the real space image is real.
+ - Because of this a forward FFT works as well.
+ - If the PSF ever needs to have its images halves swapped add
+ CPL_FFT_SWAP_HALVES to the FFT call.
+ */
+
+ if (cpl_image_fft(otf_image, NULL, CPL_FFT_UNNORMALIZED) ||
+
+ /* Compute absolute values of PSF */
+ cpl_image_abs(otf_image) ||
+
+ /* Normalize PSF to get flux=1 */
+ cpl_image_normalise(otf_image, CPL_NORM_FLUX)) {
+
+ cpl_image_delete(otf_image);
+ return NULL;
+ }
+
+ return otf_image;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate an image of an ideal Optical Transfer Function.
+ @param m1 Diameter of the M1 mirror [m]
+ @param m2 Diameter of the M2 mirror [m], m2 < m1
+ @param lam Central wavelength [micron]
+ @param dlam Filter bandwidth [micron]
+ @param size Generated image size (image will be square).
+ @param pscale Pixel scale on the sky [Arcsecond/pixel]
+ @return 1 newly generated cpl_image
+
+ Based on the paper "Amplitude estimation from speckle interferometry" by
+ Christian Perrier in "Diffraction-limited imaging with very large telescopes",
+ NATO ASI Series C, Vol. 274, edited by D. Alloin and J.-M. Mariotti, 1989
+ (p. 99).
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_image * irplib_strehl_generate_otf(
+ double m1,
+ double m2,
+ double lam,
+ double dlam,
+ int size,
+ double pscale)
+{
+ cpl_image * otf_image;
+ double * otf_data;
+ double obs_ratio ; /* m1 / m2 */
+ double f_max ; /* cut-off frequency */
+ int pix0 ; /* Pixel corresponding to the zero frequency */
+ double a, x, y;
+ double f, rsq, fc, invfc, lambda;
+ double sincy;
+ double invsize;
+ register int pos;
+ int i, j, k;
+
+
+ cpl_ensure(m2 > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(m1 > m2, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(lam > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(dlam > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(size > 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(pscale > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ /* Convert pixel scale from sec to radians, microns in meters */
+ pscale /= (double)206265;
+ lam /= (double)1.0e6;
+ dlam /= (double)1.0e6;
+
+ /* Obscuration ratio */
+ obs_ratio = m2 / m1;
+
+ /* Pixel corresponding to the zero frequency */
+ pix0 = size/2;
+ invsize = (double)1.0 / (double)size;
+
+ /* Cut-off frequency in pixels */
+ f_max = m1 * pscale * (double)size / lam;
+
+ /* Allocate for output image */
+ otf_image = cpl_image_new(size, size, CPL_TYPE_DOUBLE);
+ if (otf_image==NULL) return NULL;
+ otf_data = cpl_image_get_data_double(otf_image);
+
+ /* Now compute the OTF */
+ /* OPTIMIZED CODE !!! LIMITED READABILITY !!! */
+
+ for (k=1 ; k<=9 ; k++) { /* iteration on the wavelength */
+ /* Compute intermediate cut-off frequency */
+ lambda = (double)(lam - dlam*(double)(k-5)/8.0);
+ fc = (double)f_max * (double)lam / lambda;
+ invfc = 1.0 / fc;
+
+ /* Convolution with the detector pixels */
+ pos = 0;
+ for (j=0 ; j<size ; j++) {
+ y = (double)(j-pix0);
+ sincy = PSF_sinc(CPL_MATH_PI * y * invsize);
+ for (i=0 ; i<size ; i++) {
+ x = (double)(i-pix0);
+ rsq = x*x + y*y;
+ if (rsq < fc*fc) {
+ if (rsq < 0.01)
+ a = 1.0;
+ else {
+ f = sqrt(rsq) * invfc;
+ a = PSF_TelOTF(f,obs_ratio) *
+ PSF_sinc(CPL_MATH_PI * x * invsize) * sincy;
+ }
+ } else {
+ a = 0.0;
+ }
+ otf_data[pos++] += a / 9.0;
+ }
+ }
+ }
+ return otf_image;
+}
+
+/*----------------------------------------------------------------------------*
+ * H1 function
+ *----------------------------------------------------------------------------*/
+static double PSF_H1(
+ double f,
+ double u,
+ double v)
+{
+ const double e = fabs(1.0-v) > 0.0 ? -1.0 : 1.0; /* e = 1.0 iff v = 1.0 */
+
+ return((v*v/CPL_MATH_PI)*acos((f/v)*(1.0+e*(1.0-u*u)/(4.0*f*f))));
+}
+
+/*----------------------------------------------------------------------------*
+ * H2 function
+ *----------------------------------------------------------------------------*/
+static double PSF_H2(double f,
+ double u)
+{
+ const double tmp1 = (2.0 * f) / (1.0 + u);
+ const double tmp2 = (1.0 - u) / (2.0 * f);
+
+ return -1.0 * (f/CPL_MATH_PI) * (1.0+u)
+ * sqrt((1.0-tmp1*tmp1)*(1.0-tmp2*tmp2));
+}
+
+/*----------------------------------------------------------------------------*
+ * G function
+ *----------------------------------------------------------------------------*/
+static double PSF_G(double f,
+ double u)
+{
+ if (f <= (1.0-u)/2.0) return(u*u);
+ if (f >= (1.0+u)/2.0) return(0.0);
+ else return(PSF_H1(f,u,1.0) + PSF_H1(f,u,u) + PSF_H2(f,u));
+}
+
+/*----------------------------------------------------------------------------*
+ * sinc function
+ *----------------------------------------------------------------------------*/
+static double PSF_sinc(double x)
+{
+ return fabs(x) > fabs(sin(x)) ? sin(x)/x : 1.0;
+}
+
+/*----------------------------------------------------------------------------*
+ * Telescope OTF function
+ *----------------------------------------------------------------------------*/
+static double PSF_TelOTF(double f,
+ double u)
+{
+ return((PSF_G(f,1.0)+u*u*PSF_G(f/u,1.0)-2.0*PSF_G(f,u))/(1.0-u*u));
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the peak flux inside a disk
+ @param self Image with pixel-type float
+ @param xpos The x position of the disk center
+ @param ypos The y position of the disk center
+ @param radius The positive radius
+ @param ppeak Pointer to the Star Peak
+ @return 0 iff successful
+ @note *ppeak is undefined on error
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_strehl_disk_max(const cpl_image * self,
+ double xpos,
+ double ypos,
+ double radius,
+ double * ppeak)
+{
+
+ const double sqr = radius * radius;
+ double sqrest;
+ const float * pself;
+ float peak = FLT_MAX; /* Avoid (false) uninit warning */
+ double yj, xi;
+ int nx, ny;
+ int lx, ly, ux, uy;
+ int i, j;
+ cpl_boolean first = CPL_TRUE;
+
+
+ /* Check entries */
+ cpl_ensure_code(ppeak != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_image_get_type(self) == CPL_TYPE_FLOAT,
+ CPL_ERROR_UNSUPPORTED_MODE);
+ cpl_ensure_code(radius > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ nx = cpl_image_get_size_x(self);
+ ny = cpl_image_get_size_y(self);
+
+ /* Round down */
+ lx = (int)(xpos - radius);
+ ly = (int)(ypos - radius);
+ if (lx < 0) lx = 0;
+ if (ly < 0) ly = 0;
+
+ /* Round up */
+ ux = (int)(xpos + radius) + 1;
+ uy = (int)(ypos + radius) + 1;
+ if (ux > (nx-1)) ux = nx-1;
+ if (uy > (ny-1)) uy = ny-1;
+
+ pself = cpl_image_get_data_float_const(self);
+ for (j=ly ; j<uy ; j++) {
+ yj = (double)j - ypos;
+ sqrest = sqr - yj * yj;
+ for (i=lx; i<ux ; i++) {
+ xi = (double)i - xpos;
+ if (sqrest >= xi * xi && irplib_isnan(pself[i+j*nx]) == 0) {
+ if (first || pself[i+j*nx] > peak) {
+ first = CPL_FALSE;
+ peak = pself[i+j*nx];
+ }
+ }
+ }
+ }
+
+ cpl_ensure_code(!first, CPL_ERROR_DATA_NOT_FOUND);
+
+ *ppeak = (double)peak;
+
+ return CPL_ERROR_NONE;
+}
diff --git a/irplib/irplib_strehl.h b/irplib/irplib_strehl.h
new file mode 100644
index 0000000..c8da3fe
--- /dev/null
+++ b/irplib/irplib_strehl.h
@@ -0,0 +1,75 @@
+/* $Id: irplib_strehl.h,v 1.12 2009/06/29 14:32:53 kmirny Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: kmirny $
+ * $Date: 2009/06/29 14:32:53 $
+ * $Revision: 1.12 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_STREHL_H
+#define IRPLIB_STREHL_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#ifndef IRPLIB_STREHL_BORDER
+#define IRPLIB_STREHL_BORDER 5
+#endif
+
+typedef enum {
+ IRPLIB_BG_METHOD_AVER_REJ,
+ IRPLIB_BG_METHOD_MEDIAN
+} irplib_strehl_bg_method;
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_error_code irplib_strehl_compute(const cpl_image *, double, double, double,
+ double, double, int, double, double,
+ double, double, double, int, int,
+ double *, double *, double *, double *,
+ double *, double *, double *, double *);
+cpl_error_code irplib_strehl_mark_bad_and_compute(
+ cpl_image *, double, double, double,
+ double, double, int, double, double,
+ double, double, double, int, int,
+ double *, double *, double *, double *,
+ double *, double *, double *, double *);
+double irplib_strehl_disk_flux(const cpl_image *, double, double, double,
+ double);
+
+double irplib_strehl_ring_background(const cpl_image *, double, double, double,
+ double, irplib_strehl_bg_method);
+
+cpl_image * irplib_strehl_generate_psf(double, double, double, double, double,
+ int);
+cpl_error_code irplib_strehl_disk_max(const cpl_image *, double, double,
+ double, double *);
+#endif
diff --git a/irplib/irplib_utils.c b/irplib/irplib_utils.c
new file mode 100644
index 0000000..0f40913
--- /dev/null
+++ b/irplib/irplib_utils.c
@@ -0,0 +1,1659 @@
+/* $Id: irplib_utils.c,v 1.78 2012/05/08 13:56:09 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2012/05/08 13:56:09 $
+ * $Revision: 1.78 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+
+#include <string.h>
+#include <assert.h>
+
+#include <cpl.h>
+
+#include "irplib_utils.h"
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+#ifndef inline
+#define inline /* inline */
+#endif
+
+/*-----------------------------------------------------------------------------
+ Missing Function Prototypes
+ -----------------------------------------------------------------------------*/
+
+#if defined HAVE_ISNAN && HAVE_ISNAN != 0
+#if !defined isnan && defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 0
+/* HP-UX and Solaris may have isnan() available at link-time
+ without the prototype */
+int isnan(double);
+#endif
+#endif
+
+/*-----------------------------------------------------------------------------
+ Private Function Prototypes
+ -----------------------------------------------------------------------------*/
+
+inline static double irplib_data_get_double(const void *, cpl_type, int)
+#ifdef CPL_HAVE_GNUC_NONNULL
+ __attribute__((nonnull))
+#endif
+ ;
+
+inline static void irplib_data_set_double(void *, cpl_type, int, double)
+#ifdef CPL_HAVE_GNUC_NONNULL
+ __attribute__((nonnull))
+#endif
+ ;
+
+
+static
+void irplib_errorstate_dump_one_level(void (*)(const char *,
+ const char *, ...)
+ #ifdef __GNUC__
+ __attribute__((format (printf, 2, 3)))
+ #endif
+ , unsigned, unsigned, unsigned);
+static double frame_get_exptime(const cpl_frame * pframe);
+static void quicksort(int* index, double* exptime, int left, int right);
+
+static cpl_error_code irplib_dfs_product_save(cpl_frameset *,
+ cpl_propertylist *,
+ const cpl_parameterlist *,
+ const cpl_frameset *,
+ const cpl_frame *,
+ const cpl_imagelist *,
+ const cpl_image *,
+ cpl_type,
+ const cpl_table *,
+ const cpl_propertylist *,
+ const char *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const char *);
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_utils Miscellaneous Utilities
+ */
+/*----------------------------------------------------------------------------*/
+/**@{*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Dump a single CPL error at the CPL warning level
+ @param self The number of the current error to be dumped
+ @param first The number of the first error to be dumped
+ @param last The number of the last error to be dumped
+ @return void
+ @see cpl_errorstate_dump_one
+
+ FIXME: Move this function to the CPL errorstate module.
+
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_errorstate_dump_warning(unsigned self, unsigned first,
+ unsigned last)
+{
+
+ irplib_errorstate_dump_one_level(&cpl_msg_warning, self, first, last);
+
+}
+
+static cpl_polynomial * irplib_polynomial_fit_1d_create_common(
+ const cpl_vector * x_pos,
+ const cpl_vector * values,
+ int degree,
+ double * mse,
+ double * rechisq
+ );
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Dump a single CPL error at the CPL info level
+ @param self The number of the current error to be dumped
+ @param first The number of the first error to be dumped
+ @param last The number of the last error to be dumped
+ @return void
+ @see cpl_errorstate_dump_one
+
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_errorstate_dump_info(unsigned self, unsigned first,
+ unsigned last)
+{
+
+ irplib_errorstate_dump_one_level(&cpl_msg_info, self, first, last);
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Dump a single CPL error at the CPL debug level
+ @param self The number of the current error to be dumped
+ @param first The number of the first error to be dumped
+ @param last The number of the last error to be dumped
+ @return void
+ @see cpl_errorstate_dump_one
+
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_errorstate_dump_debug(unsigned self, unsigned first,
+ unsigned last)
+{
+
+ irplib_errorstate_dump_one_level(&cpl_msg_debug, self, first, last);
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save an image as a DFS-compliant pipeline product
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param image The image to be saved
+ @param bpp Bits per pixel
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param remregexp Optional regexp of properties not to put in main header
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename of created product
+ @note The image may be NULL in which case only the header information is saved
+ but passing a NULL image is deprecated, use cpl_dfs_save_propertylist().
+ @note remregexp may be NULL
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see cpl_dfs_save_image().
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_dfs_save_image(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_image * image,
+ cpl_type_bpp bpp,
+ const char * recipe,
+ const char * procat,
+ const cpl_propertylist * applist,
+ const char * remregexp,
+ const char * pipe_id,
+ const char * filename)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_propertylist * prolist = applist ? cpl_propertylist_duplicate(applist)
+ : cpl_propertylist_new();
+
+ cpl_propertylist_update_string(prolist, CPL_DFS_PRO_CATG, procat);
+
+ irplib_dfs_save_image_(allframes, NULL, parlist, usedframes, NULL, image,
+ bpp, recipe, prolist, remregexp, pipe_id, filename);
+
+ cpl_propertylist_delete(prolist);
+
+ cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a propertylist as a DFS-compliant pipeline product
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param remregexp Optional regexp of properties not to put in main header
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename of created product
+ @note remregexp may be NULL
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see cpl_dfs_save_propertylist().
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_dfs_save_propertylist(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const char * recipe,
+ const char * procat,
+ const cpl_propertylist * applist,
+ const char * remregexp,
+ const char * pipe_id,
+ const char * filename)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_propertylist * prolist = applist ? cpl_propertylist_duplicate(applist)
+ : cpl_propertylist_new();
+
+ cpl_propertylist_update_string(prolist, CPL_DFS_PRO_CATG, procat);
+
+ cpl_dfs_save_propertylist(allframes, NULL, parlist, usedframes, NULL,
+ recipe, prolist, remregexp, pipe_id, filename);
+
+ cpl_propertylist_delete(prolist);
+
+ cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save an imagelist as a DFS-compliant pipeline product
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param imagelist The imagelist to be saved
+ @param bpp Bits per pixel
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param remregexp Optional regexp of properties not to put in main header
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename of created product
+ @note remregexp may be NULL
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see cpl_dfs_save_imagelist().
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_dfs_save_imagelist(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_imagelist * imagelist,
+ cpl_type_bpp bpp,
+ const char * recipe,
+ const char * procat,
+ const cpl_propertylist * applist,
+ const char * remregexp,
+ const char * pipe_id,
+ const char * filename)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_propertylist * prolist = applist ? cpl_propertylist_duplicate(applist)
+ : cpl_propertylist_new();
+
+ cpl_propertylist_update_string(prolist, CPL_DFS_PRO_CATG, procat);
+
+ cpl_dfs_save_imagelist(allframes, NULL, parlist, usedframes, NULL,
+ imagelist, bpp, recipe, prolist, remregexp, pipe_id,
+ filename);
+
+ cpl_propertylist_delete(prolist);
+
+ cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save a table as a DFS-compliant pipeline product
+ @param allframes The list of input frames for the recipe
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param table The table to be saved
+ @param tablelist Optional propertylist to use in table extension or NULL
+ @param recipe The recipe name
+ @param procat The product category tag
+ @param applist Optional propertylist to append to primary header or NULL
+ @param remregexp Optional regexp of properties not to put in main header
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename of created product
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see cpl_dfs_save_table().
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_dfs_save_table(cpl_frameset * allframes,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_table * table,
+ const cpl_propertylist * tablelist,
+ const char * recipe,
+ const char * procat,
+ const cpl_propertylist * applist,
+ const char * remregexp,
+ const char * pipe_id,
+ const char * filename)
+{
+
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_propertylist * prolist = applist ? cpl_propertylist_duplicate(applist)
+ : cpl_propertylist_new();
+
+ cpl_propertylist_update_string(prolist, CPL_DFS_PRO_CATG, procat);
+
+ cpl_dfs_save_table(allframes, NULL, parlist, usedframes, NULL,
+ table, tablelist, recipe, prolist, remregexp,
+ pipe_id, filename);
+
+ cpl_propertylist_delete(prolist);
+
+ cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save an image as a DFS-compliant pipeline product
+ @param allframes The list of input frames for the recipe
+ @param header NULL, or filled with properties written to product header
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param inherit NULL or product frames inherit their header from this frame
+ @param image The image to be saved
+ @param type The type used to represent the data in the file
+ @param recipe The recipe name
+ @param applist Propertylist to append to primary header, w. PRO.CATG
+ @param remregexp Optional regexp of properties not to put in main header
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename of created product
+ @note The image may be NULL in which case only the header information is saved
+ but passing a NULL image is deprecated, use cpl_dfs_save_propertylist().
+ @note remregexp may be NULL
+ @note applist must contain a string-property with key CPL_DFS_PRO_CATG
+ @note On success and iff header is non-NULL, it will be emptied and then
+ filled with the properties written to the primary header of the product
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see cpl_dfs_save_image()
+ @note applist is copied with cpl_propertylist_copy_property_regexp() instead
+ pf cpl_propertylist_append()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_dfs_save_image_(cpl_frameset * allframes,
+ cpl_propertylist * header,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_frame * inherit,
+ const cpl_image * image,
+ cpl_type type,
+ const char * recipe,
+ const cpl_propertylist * applist,
+ const char * remregexp,
+ const char * pipe_id,
+ const char * filename)
+{
+ return
+ irplib_dfs_product_save(allframes, header, parlist, usedframes, inherit,
+ NULL, image, type, NULL, NULL, recipe,
+ applist, remregexp, pipe_id, filename)
+ ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save either an image or table as a pipeline product
+ @param allframes The list of input frames for the recipe
+ @param header NULL, or filled with properties written to product header
+ @param parlist The list of input parameters
+ @param usedframes The list of raw/calibration frames used for this product
+ @param inherit NULL, or frame from which header information is inherited
+ @param imagelist The imagelist to be saved or NULL
+ @param image The image to be saved or NULL
+ @param type The type used to represent the data in the file
+ @param table The table to be saved or NULL
+ @param tablelist Optional propertylist to use in table extension or NULL
+ @param recipe The recipe name
+ @param applist Optional propertylist to append to main header or NULL
+ @param remregexp Optional regexp of properties not to put in main header
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param filename Filename of created product
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see cpl_dfs_product_save()
+ @note applist is copied with cpl_propertylist_copy_property_regexp() instead
+ pf cpl_propertylist_append()
+
+ */
+/*----------------------------------------------------------------------------*/
+
+static
+cpl_error_code irplib_dfs_product_save(cpl_frameset * allframes,
+ cpl_propertylist * header,
+ const cpl_parameterlist * parlist,
+ const cpl_frameset * usedframes,
+ const cpl_frame * inherit,
+ const cpl_imagelist * imagelist,
+ const cpl_image * image,
+ cpl_type type,
+ const cpl_table * table,
+ const cpl_propertylist * tablelist,
+ const char * recipe,
+ const cpl_propertylist * applist,
+ const char * remregexp,
+ const char * pipe_id,
+ const char * filename) {
+
+ const char * procat;
+ cpl_propertylist * plist;
+ cpl_frame * product_frame;
+ /* Inside this function the product-types are numbered:
+ 0: imagelist
+ 1: table
+ 2: image
+ 3: propertylist only
+ */
+ const unsigned pronum
+ = imagelist != NULL ? 0 : table != NULL ? 1 : (image != NULL ? 2 : 3);
+ const char * proname[] = {"imagelist", "table", "image",
+ "propertylist"};
+ /* FIXME: Define a frame type for an imagelist and when data-less */
+ const int protype[] = {CPL_FRAME_TYPE_ANY, CPL_FRAME_TYPE_TABLE,
+ CPL_FRAME_TYPE_IMAGE, CPL_FRAME_TYPE_ANY};
+ cpl_error_code error = CPL_ERROR_NONE;
+
+
+ /* No more than one of imagelist, table and image may be non-NULL */
+ /* tablelist may only be non-NULL when table is non-NULL */
+ if (imagelist != NULL) {
+ assert(pronum == 0);
+ assert(image == NULL);
+ assert(table == NULL);
+ assert(tablelist == NULL);
+ } else if (table != NULL) {
+ assert(pronum == 1);
+ assert(imagelist == NULL);
+ assert(image == NULL);
+ } else if (image != NULL) {
+ assert(pronum == 2);
+ assert(imagelist == NULL);
+ assert(table == NULL);
+ assert(tablelist == NULL);
+ } else {
+ assert(pronum == 3);
+ assert(imagelist == NULL);
+ assert(table == NULL);
+ assert(tablelist == NULL);
+ assert(image == NULL);
+ }
+
+ cpl_ensure_code(allframes != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(usedframes != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(recipe != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(applist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pipe_id != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT);
+
+ procat = cpl_propertylist_get_string(applist, CPL_DFS_PRO_CATG);
+
+ cpl_ensure_code(procat != NULL, cpl_error_get_code());
+
+ cpl_msg_info(cpl_func, "Writing FITS %s product(%s): %s", proname[pronum],
+ procat, filename);
+
+ product_frame = cpl_frame_new();
+
+ /* Create product frame */
+ error |= cpl_frame_set_filename(product_frame, filename);
+ error |= cpl_frame_set_tag(product_frame, procat);
+ error |= cpl_frame_set_type(product_frame, protype[pronum]);
+ error |= cpl_frame_set_group(product_frame, CPL_FRAME_GROUP_PRODUCT);
+ error |= cpl_frame_set_level(product_frame, CPL_FRAME_LEVEL_FINAL);
+
+ if (error) {
+ cpl_frame_delete(product_frame);
+ return cpl_error_set_where(cpl_func);
+ }
+
+ if (header != NULL) {
+ cpl_propertylist_empty(header);
+ plist = header;
+ } else {
+ plist = cpl_propertylist_new();
+ }
+
+ /* Add any QC parameters here */
+ if (applist != NULL) error = cpl_propertylist_copy_property_regexp(plist,
+ applist,
+ ".", 0);
+
+ /* Add DataFlow keywords */
+ if (!error)
+ error = cpl_dfs_setup_product_header(plist, product_frame, usedframes,
+ parlist, recipe, pipe_id,
+ "PRO-1.15", inherit);
+
+ if (remregexp != NULL && !error) {
+ cpl_errorstate prestate = cpl_errorstate_get();
+ (void)cpl_propertylist_erase_regexp(plist, remregexp, 0);
+ if (!cpl_errorstate_is_equal(prestate)) error = cpl_error_get_code();
+ }
+
+ if (!error) {
+ switch (pronum) {
+ case 0:
+ error = cpl_imagelist_save(imagelist, filename, type, plist,
+ CPL_IO_CREATE);
+ break;
+ case 1:
+ error = cpl_table_save(table, plist, tablelist, filename,
+ CPL_IO_CREATE);
+ break;
+ case 2:
+ error = cpl_image_save(image, filename, type, plist,
+ CPL_IO_CREATE);
+ break;
+ default:
+ /* case 3: */
+ error = cpl_propertylist_save(plist, filename, CPL_IO_CREATE);
+ }
+ }
+
+ if (!error) {
+ /* Insert the frame of the saved file in the input frameset */
+ error = cpl_frameset_insert(allframes, product_frame);
+
+ } else {
+ cpl_frame_delete(product_frame);
+ }
+
+ if (plist != header) cpl_propertylist_delete(plist);
+
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Split the values in an image in three according to two thresholds
+ @param self The image to split
+ @param im_low If non-NULL low-valued pixels are assigned to this image
+ @param im_mid If non-NULL middle-valued pixels are assigned to this image
+ @param im_high If non-NULL high-valued pixels are assigned to this image
+ @param th_low The lower threshold
+ @param isleq_low Ift true use less than or equal
+ @param th_high The upper threshold, must be at least th_low
+ @param isgeq_high Iff true use greater than or equal
+ @param alt_low Assign this value when the pixel value is not low
+ @param alt_high Assign this value, when the pixel value is not high
+ @param isbad_low Flag non-low pixels as bad
+ @param isbad_mid Flag non-mid pixels as bad
+ @param isbad_high Flag non-high pixels as bad
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @note At least one output image must be non-NULL; all non-NULL images must
+ be of identical size, but may be of any pixel-type.
+ self may be passed as one of the output images for an in-place split.
+
+
+ FIXME: This function is way too slow and perhaps over-engineered...
+
+ A split in two is achieved with th_low equal th_high (in this case there
+ is little reason for im_mid to be non-NULL).
+
+ All pixel values in the output images are reset,
+ as well as their bad pixels maps.
+
+ If an input pixel-value is flagged as bad, then the receiving pixel in the
+ output image is flagged as well.
+
+ @par The same image may be passed more than once which allows a split
+ into one image with the mid-valued pixels and another with both the
+ low and high-valued pixels, i.e.
+ @code
+ irplib_image_split(source, dest, im_mid, dest,
+ th_low, isleq_low, th_high, isgeq_high,
+ alt_low, alt_high,
+ isbad_low, isbad_mid, isbad_high);
+ @endcode
+
+ @par These two calls are equivalent:
+ @code
+ cpl_image_threshold(img, th_low, th_high, alt_low, alt_high);
+ @endcode
+
+ @code
+ irplib_image_split(img, NULL, img, NULL,
+ th_low, CPL_TRUE, th_high, CPL_TRUE,
+ alt_low, alt_high, dontcare, CPL_FALSE, dontcare);
+ @endcode
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_image_split(const cpl_image * self,
+ cpl_image * im_low,
+ cpl_image * im_mid,
+ cpl_image * im_high,
+ double th_low,
+ cpl_boolean isleq_low,
+ double th_high,
+ cpl_boolean isgeq_high,
+ double alt_low,
+ double alt_high,
+ cpl_boolean isbad_low,
+ cpl_boolean isbad_mid,
+ cpl_boolean isbad_high)
+{
+
+ const void * selfdata = cpl_image_get_data_const(self);
+ /* hasbpm reduces check-overhead if self does not have a bpm, and if
+ self is also passed as an output image, that ends up with bad pixels */
+ /* FIXME: Need a proper way to know if a bpm has been allocated :-((((((( */
+ const cpl_boolean hasbpm
+ = cpl_image_count_rejected(self) ? CPL_TRUE : CPL_FALSE;
+ const cpl_binary * selfbpm = hasbpm
+ ? cpl_mask_get_data_const(cpl_image_get_bpm_const(self)) : NULL;
+ const cpl_type selftype = cpl_image_get_type(self);
+ const int nx = cpl_image_get_size_x(self);
+ const int ny = cpl_image_get_size_y(self);
+ const int npix = nx * ny;
+ const cpl_boolean do_low = im_low != NULL;
+ const cpl_boolean do_mid = im_mid != NULL;
+ const cpl_boolean do_high = im_high != NULL;
+ void * lowdata = NULL;
+ void * middata = NULL;
+ void * highdata = NULL;
+ cpl_binary * lowbpm = NULL;
+ cpl_binary * midbpm = NULL;
+ cpl_binary * highbpm = NULL;
+ const cpl_type lowtype
+ = do_low ? cpl_image_get_type(im_low) : CPL_TYPE_INVALID;
+ const cpl_type midtype
+ = do_mid ? cpl_image_get_type(im_mid) : CPL_TYPE_INVALID;
+ const cpl_type hightype
+ = do_high ? cpl_image_get_type(im_high) : CPL_TYPE_INVALID;
+ int i;
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(do_low || do_mid || do_high, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(th_low <= th_high, CPL_ERROR_ILLEGAL_INPUT);
+
+ if (do_low) {
+ cpl_ensure_code(cpl_image_get_size_x(im_low) == nx,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ cpl_ensure_code(cpl_image_get_size_y(im_low) == ny,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ lowdata = cpl_image_get_data(im_low);
+ }
+
+ if (do_mid) {
+ cpl_ensure_code(cpl_image_get_size_x(im_mid) == nx,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ cpl_ensure_code(cpl_image_get_size_y(im_mid) == ny,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ middata = cpl_image_get_data(im_mid);
+ }
+
+ if (do_high) {
+ cpl_ensure_code(cpl_image_get_size_x(im_high) == nx,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ cpl_ensure_code(cpl_image_get_size_y(im_high) == ny,
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ highdata = cpl_image_get_data(im_high);
+ }
+
+ /* From this point a failure would indicate a serious bug in CPL */
+
+ for (i = 0; i < npix; i++) {
+ const double value = irplib_data_get_double(selfdata, selftype, i);
+ cpl_boolean isalt_low = do_low;
+ cpl_boolean isalt_mid = do_mid;
+ cpl_boolean isalt_high = do_high;
+ cpl_boolean setbad_low = do_low;
+ cpl_boolean setbad_mid = do_mid;
+ cpl_boolean setbad_high = do_high;
+ const void * setdata = NULL;
+ double alt_mid = 0.0; /* Avoid (false) uninit warning */
+
+ if (isleq_low ? value <= th_low : value < th_low) {
+ if (do_low) {
+ isalt_low = CPL_FALSE;
+ irplib_data_set_double(lowdata, lowtype, i, value);
+ setbad_low = hasbpm && selfbpm[i];
+ setdata = lowdata;
+ }
+ alt_mid = alt_low;
+ } else if (isgeq_high ? value >= th_high : value > th_high) {
+ if (do_high) {
+ isalt_high = CPL_FALSE;
+ irplib_data_set_double(highdata, hightype, i, value);
+ setbad_high = hasbpm && selfbpm[i];
+ setdata = highdata;
+ }
+ alt_mid = alt_high;
+ } else if (do_mid) {
+ isalt_mid = CPL_FALSE;
+ irplib_data_set_double(middata, midtype, i, value);
+ setbad_mid = hasbpm && selfbpm[i];
+ setdata = middata;
+ }
+
+ if (isalt_low && lowdata != setdata) {
+ irplib_data_set_double(lowdata, lowtype, i, alt_low);
+ setbad_low = isbad_low;
+ }
+ if (isalt_mid && middata != setdata) {
+ irplib_data_set_double(middata, midtype, i, alt_mid);
+ setbad_mid = isbad_mid;
+ }
+ if (isalt_high && highdata != setdata) {
+ irplib_data_set_double(highdata, hightype, i, alt_high);
+ setbad_high = isbad_high;
+ }
+
+ if (setbad_low) {
+ if (lowbpm == NULL) lowbpm
+ = cpl_mask_get_data(cpl_image_get_bpm(im_low));
+ lowbpm[i] = CPL_BINARY_1;
+ }
+ if (setbad_mid) {
+ if (midbpm == NULL) midbpm
+ = cpl_mask_get_data(cpl_image_get_bpm(im_mid));
+ midbpm[i] = CPL_BINARY_1;
+ }
+ if (setbad_high) {
+ if (highbpm == NULL) highbpm
+ = cpl_mask_get_data(cpl_image_get_bpm(im_high));
+ highbpm[i] = CPL_BINARY_1;
+ }
+ }
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create a DFS product with one table from one or more (ASCII) file(s)
+ @param self Table with labels (and units) but no row data
+ @param allframes The list of input frames for the recipe
+ @param useframes The frames to process for the product
+ @param maxlinelen The maximum line length in the input file(s)
+ @param commentchar Skip lines that start with this character, e.g. '#'
+ @param product_name The name of the created FITS table product or NULL
+ @param procatg The PROCATG of the created FITS table product
+ @param parlist The list of input parameters
+ @param recipe_name The name of the calling recipe
+ @param mainlist Optional propertylist to append to main header or NULL
+ @param extlist Optional propertylist to append to ext. header or NULL
+ @param remregexp Optional regexp of properties not to put in main header
+ @param instrume The value to use for the INSTRUME key, uppercase PACKAGE
+ @param pipe_id PACKAGE "/" PACKAGE_VERSION
+ @param table_set_row Caller-defined function to insert one row in the table
+ @param table_check Optional caller-defined function to check table or NULL
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see irplib_table_read_from_frameset(), cpl_dfs_save_table()
+ @note If product_name is NULL, the product will be named <recipe_name>.fits.
+
+ @par Example (error handling omitted for brevity):
+ @code
+ extern cpl_boolean my_table_set_row(cpl_table *, const char *, int,
+ const cpl_frame *,
+ const cpl_parameterlist *);
+ extern cpl_error_code my_table_check(cpl_table *,
+ const cpl_frameset *,
+ const cpl_parameterlist *);
+ const int expected_rows = 42;
+ cpl_table * self = cpl_table_new(expected_rows);
+
+ cpl_table_new_column(self, "MYLABEL1", CPL_TYPE_STRING);
+ cpl_table_new_column(self, "MYLABEL2", CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(self, "MYLABEL2", "Some_SI_Unit");
+
+ irplib_dfs_table_convert(self, allframes, useframes, 1024, '#', NULL,
+ "MYPROCATG", parlist, "myrecipe", NULL, NULL,
+ NULL, "MYINSTRUME", PACKAGE "/" PACKAGE_VERSION,
+ my_table_set_row, my_table_check);
+
+ cpl_table_delete(self);
+
+ @endcode
+
+ */
+/*----------------------------------------------------------------------------*/
+
+cpl_error_code
+irplib_dfs_table_convert(cpl_table * self,
+ cpl_frameset * allframes,
+ const cpl_frameset * useframes,
+ int maxlinelen,
+ char commentchar,
+ const char * product_name,
+ const char * procatg,
+ const cpl_parameterlist * parlist,
+ const char * recipe_name,
+ const cpl_propertylist * mainlist,
+ const cpl_propertylist * extlist,
+ const char * remregexp,
+ const char * instrume,
+ const char * pipe_id,
+ cpl_boolean (*table_set_row)
+ (cpl_table *, const char *, int,
+ const cpl_frame *,
+ const cpl_parameterlist *),
+ cpl_error_code (*table_check)
+ (cpl_table *,
+ const cpl_frameset *,
+ const cpl_parameterlist *))
+{
+
+ const char * filename;
+ cpl_propertylist * applist = NULL;
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_error_code error;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(allframes != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(useframes != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(procatg != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(recipe_name != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(instrume != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pipe_id != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(!irplib_table_read_from_frameset(self, useframes,
+ maxlinelen,
+ commentchar,
+ parlist,
+ table_set_row),
+ cpl_error_get_code());
+
+ if (table_check != NULL && (table_check(self, useframes, parlist) ||
+ !cpl_errorstate_is_equal(prestate))) {
+ return cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Consistency check of table failed");
+ }
+
+ filename = product_name != NULL
+ ? product_name : cpl_sprintf("%s" CPL_DFS_FITS, recipe_name);
+
+ applist = mainlist == NULL
+ ? cpl_propertylist_new() : cpl_propertylist_duplicate(mainlist);
+
+ error = cpl_propertylist_update_string(applist, "INSTRUME", instrume);
+
+ if (!error)
+ error = irplib_dfs_save_table(allframes, parlist, useframes, self,
+ extlist, recipe_name, procatg, applist,
+ remregexp, pipe_id, filename);
+
+ cpl_propertylist_delete(applist);
+ if (filename != product_name) cpl_free((char*)filename);
+
+ /* Propagate the error, if any */
+ cpl_ensure_code(!error, error);
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Set the rows of a table with data from one or more (ASCII) files
+ @param self Table with labels (and units) but no row data
+ @param useframes The frames to process for the table
+ @param maxlinelen The maximum line length in the input file(s)
+ @param commentchar Skip lines that start with this character, e.g. '#'
+ @param parlist The list of input parameters
+ @param table_set_row Caller-defined function to insert one row in the table
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+
+ table_set_row() is a function that sets the specified row in a table
+ - it may optionally include a check of the line for consistency.
+ An integer is passed to table_set_row() to indicate which row
+ to set. Instead of setting the row table_set_row() may decide to discard
+ the data. Iff the row was set, table_set_row() should return CPL_TRUE.
+
+ It needs to know:
+ 1) How to parse the lines - each line is read with fgets().
+ 2) For each column: type/format (%lg/%s/%d) + label
+
+ During a succesful call self will have rows added or removed to exactly
+ match the number of lines converted. Any a priori knowledge about the
+ expected number of converted rows can be used in the creation of the
+ table (to reduce memory reallocation overhead).
+ On error the number of rows in self is undefined.
+
+ @par Example (error handling omitted for brevity):
+ @code
+ extern cpl_boolean my_table_set_row(cpl_table *, const char *, int,
+ const cpl_frame *,
+ const cpl_parameterlist *);
+ const int expected_rows = 42;
+ cpl_table * self = cpl_table_new(expected_rows);
+
+ cpl_table_new_column(self, "MYLABEL1", CPL_TYPE_STRING);
+ cpl_table_new_column(self, "MYLABEL2", CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(self, "MYLABEL2", "Some_SI_Unit");
+
+ irplib_table_read_from_frameset(self, useframes, 1024, '#', parlist,
+ my_table_set_row);
+
+ // Use self...
+
+ cpl_table_delete(self);
+
+ @endcode
+
+ */
+/*----------------------------------------------------------------------------*/
+
+cpl_error_code
+irplib_table_read_from_frameset(cpl_table * self,
+ const cpl_frameset * useframes,
+ int maxlinelen,
+ char commentchar,
+ const cpl_parameterlist * parlist,
+ cpl_boolean (*table_set_row)
+ (cpl_table *, const char *, int,
+ const cpl_frame *,
+ const cpl_parameterlist *))
+{
+
+ const cpl_frame * rawframe;
+ char * linebuffer = NULL;
+ FILE * stream = NULL;
+ int nfiles = 0;
+ int nrow = cpl_table_get_nrow(self);
+ int irow = 0;
+ cpl_errorstate prestate = cpl_errorstate_get();
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(useframes != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(maxlinelen > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(table_set_row != NULL, CPL_ERROR_NULL_INPUT);
+
+ linebuffer = cpl_malloc(maxlinelen);
+
+ for (rawframe = cpl_frameset_get_first_const(useframes);
+ rawframe != NULL;
+ rawframe = cpl_frameset_get_next_const(useframes), nfiles++) {
+
+ const char * rawfile = cpl_frame_get_filename(rawframe);
+ const char * done; /* Indicate when the reading is done */
+ const int irowpre = irow;
+ int iirow = 0;
+ int ierror;
+
+ if (rawfile == NULL) break; /* Should not happen... */
+
+ stream = fopen(rawfile, "r");
+
+ if (stream == NULL) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, "Could not "
+ "open %s for reading", rawfile);
+#else
+ cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, "Could not "
+ "open file for reading");
+#endif
+ break;
+ }
+
+ for (;(done = fgets(linebuffer, maxlinelen, stream)) != NULL; iirow++) {
+
+ if (linebuffer[0] != commentchar) {
+ cpl_boolean didset;
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ const int prerow = irow;
+#endif
+
+ if (irow == nrow) {
+ nrow += nrow ? nrow : 1;
+ if (cpl_table_set_size(self, nrow)) break;
+ }
+
+ didset = table_set_row(self, linebuffer, irow, rawframe,
+ parlist);
+ if (didset) irow++;
+
+ if (!cpl_errorstate_is_equal(prestate)) {
+ if (didset)
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Failed to set table row %d "
+ "using line %d from %d. file %s",
+ 1+prerow, iirow+1,
+ nfiles+1, rawfile);
+ else
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Failure with line %d from %d. "
+ "file %s", iirow+1,
+ nfiles+1, rawfile);
+#else
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Failed to set table row"
+ "using catalogue line");
+ else
+ cpl_error_set_message(cpl_func, cpl_error_get_code(),
+ "Failure with catalogue line");
+#endif
+
+ break;
+ }
+ }
+ }
+ if (done != NULL) break;
+
+ ierror = fclose(stream);
+ stream = NULL;
+ if (ierror) break;
+
+
+ if (irow == irowpre)
+ cpl_msg_warning(cpl_func, "No usable lines in the %d. file: %s",
+ 1+nfiles, rawfile);
+ }
+
+ cpl_free(linebuffer);
+ if (stream != NULL) fclose(stream);
+
+ /* Check for premature end */
+ cpl_ensure_code(rawframe == NULL, cpl_error_get_code());
+
+ if (irow == 0) {
+#if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0
+ return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "No usable lines in the %d input "
+ "frame(s)", nfiles);
+#else
+ return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "No usable lines in the input frame(s)");
+#endif
+ }
+
+ /* Resize the table to the actual number of rows set */
+ cpl_ensure_code(!cpl_table_set_size(self, irow), cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Reset IRPLIB state
+
+ This function resets all static memory used by IRPLIB to a well-defined,
+ initial state.
+
+ The function should be called (during initialization) by any application
+ using static memory facilities in IRPLIB.
+
+ Currently, this function does nothing.
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_reset(void)
+{
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Comparison function to identify different input frames
+ @param frame1 first frame
+ @param frame2 second frame
+ @return 0 if frame1!=frame2, 1 if frame1==frame2, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_compare_tags(
+ cpl_frame * frame1,
+ cpl_frame * frame2)
+{
+ char * v1 ;
+ char * v2 ;
+
+ /* Test entries */
+ if (frame1==NULL || frame2==NULL) return -1 ;
+
+ /* Get the tags */
+ if ((v1 = (char*)cpl_frame_get_tag(frame1)) == NULL) return -1 ;
+ if ((v2 = (char*)cpl_frame_get_tag(frame2)) == NULL) return -1 ;
+
+ /* Compare the tags */
+ if (strcmp(v1, v2)) return 0 ;
+ else return 1 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the filename with the given tag in a frame set.
+ @param self A frame set.
+ @param tag The frame tag to search for.
+ @return The filename or NULL if none found and on error.
+ @see cpl_frameset_find
+ @note If called with a CPL error code, the location will be updated and NULL
+ returned.
+
+ NULL is returned and no error code set if the tag is not found.
+
+ If the file is not unique, the name of the first one is returned and with
+ a warning.
+
+ */
+/*----------------------------------------------------------------------------*/
+const char * irplib_frameset_find_file(const cpl_frameset * self,
+ const char * tag)
+{
+ const cpl_frame * frame = cpl_frameset_find_const(self, tag);
+
+
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), NULL);
+
+ if (frame == NULL) return NULL;
+
+ if (cpl_frameset_find_const(self, NULL))
+ cpl_msg_warning(cpl_func,
+ "Frameset has more than one file with tag: %s",
+ tag);
+
+ return cpl_frame_get_filename(frame);
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the first frame belonging to the given group
+ @param self The frameset
+ @param group The group attribute
+ @return The first frame belonging to the given group, or @c NULL if no
+ such frame was found. The function returns @c NULL if an error
+ occurs and sets the appropriate error code.
+
+ */
+/*----------------------------------------------------------------------------*/
+const
+cpl_frame * irplib_frameset_get_first_from_group(const cpl_frameset * self,
+ cpl_frame_group group)
+{
+ const cpl_frame * frame;
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ for (frame = cpl_frameset_get_first_const(self); frame != NULL ;
+ frame = cpl_frameset_get_next_const(self)) {
+ if (cpl_frame_get_group(frame) == group) break;
+ }
+ return frame;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the aperture(s) with the greatest flux
+ @param self The aperture object
+ @param ind The aperture-indices in order of decreasing flux
+ @param nfind Number of indices to find
+ @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
+
+ nfind must be at least 1 and at most the size of the aperture object.
+
+ The ind array must be able to hold (at least) nfind integers.
+ On success the first nfind elements of ind point to indices of the
+ aperture object.
+
+ To find the single ind of the aperture with the maximum flux use simply:
+ int ind;
+ irplib_apertures_find_max_flux(self, &ind, 1);
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_apertures_find_max_flux(const cpl_apertures * self,
+ int * ind, int nfind)
+{
+ const int nsize = cpl_apertures_get_size(self);
+ int ifind;
+
+
+ cpl_ensure_code(nsize > 0, cpl_error_get_code());
+ cpl_ensure_code(ind, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(nfind > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(nfind <= nsize, CPL_ERROR_ILLEGAL_INPUT);
+
+ for (ifind=0; ifind < nfind; ifind++) {
+ double maxflux = -1;
+ int maxind = -1;
+ int i;
+ for (i=1; i <= nsize; i++) {
+ int k;
+
+ /* The flux has to be the highest among those not already found */
+ for (k=0; k < ifind; k++) if (ind[k] == i) break;
+
+ if (k == ifind) {
+ /* i has not been inserted into ind */
+ const double flux = cpl_apertures_get_flux(self, i);
+
+ if (maxind < 0 || flux > maxflux) {
+ maxind = i;
+ maxflux = flux;
+ }
+ }
+ }
+ ind[ifind] = maxind;
+ }
+
+ return CPL_ERROR_NONE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief portable isinf
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_isinf(double value)
+{
+#if defined HAVE_ISINF && HAVE_ISINF
+ return isinf(value);
+#else
+ return value != 0 && value == 2 * value;
+#endif
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief portable isnan
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_isnan(double value)
+{
+#if defined HAVE_ISNAN && HAVE_ISNAN
+ return isnan(value);
+#else
+ return value != value;
+#endif
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Dump a single CPL error
+ @param self The number of the current error to be dumped
+ @param first The number of the first error to be dumped
+ @param last The number of the last error to be dumped
+ @return void
+ @note This function differs from cpl_errorstate_dump_one only in message level
+ @see cpl_errorstate_dump_one
+
+ */
+/*----------------------------------------------------------------------------*/
+void irplib_errorstate_warning(unsigned self, unsigned first, unsigned last)
+{
+
+ const cpl_boolean is_reverse = first > last ? CPL_TRUE : CPL_FALSE;
+ const unsigned newest = is_reverse ? first : last;
+ const unsigned oldest = is_reverse ? last : first;
+ const char * revmsg = is_reverse ? " in reverse order" : "";
+
+
+ assert( oldest <= self );
+ assert( newest >= self );
+
+ if (newest == 0) {
+ cpl_msg_info(cpl_func, "No error(s) to dump");
+ assert( oldest == 0);
+ } else {
+ assert( oldest > 0);
+ assert( newest >= oldest);
+ if (self == first) {
+ if (oldest == 1) {
+ cpl_msg_warning(cpl_func, "Dumping all %u error(s)%s:", newest,
+ revmsg);
+ } else {
+ cpl_msg_warning(cpl_func, "Dumping the %u most recent error(s) "
+ "out of a total of %u errors%s:",
+ newest - oldest + 1, newest, revmsg);
+ }
+ cpl_msg_indent_more();
+ }
+
+ cpl_msg_warning(cpl_func, "[%u/%u] '%s' (%u) at %s", self, newest,
+ cpl_error_get_message(), cpl_error_get_code(),
+ cpl_error_get_where());
+
+ if (self == last) cpl_msg_indent_less();
+ }
+}
+
+
+/**@}*/
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Optimized version of cpl_image_get()
+ @param self A void pointer, e.g. from cpl_image_get_data_const()
+ @param type The data type, e.g. from cpl_image_get_type()
+ @param i The index into the buffer after it has been cast to type
+ @return The value cast to double
+ @note This function has no error checking for speed
+ @see cpl_image_get()
+
+ */
+/*----------------------------------------------------------------------------*/
+inline static
+double irplib_data_get_double(const void * self, cpl_type type, int i)
+{
+
+ double value;
+
+
+ switch (type) {
+ case CPL_TYPE_FLOAT:
+ {
+ const float * pself = (const float*)self;
+ value = (double)pself[i];
+ break;
+ }
+ case CPL_TYPE_INT:
+ {
+ const int * pself = (const int*)self;
+ value = (double)pself[i];
+ break;
+ }
+ default: /* case CPL_TYPE_DOUBLE */
+ {
+ const double * pself = (const double*)self;
+ value = pself[i];
+ break;
+ }
+ }
+
+ return value;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Optimized version of cpl_image_set()
+ @param self A void pointer, e.g. from cpl_image_get_data_const()
+ @param type The data type, e.g. from cpl_image_get_type()
+ @param i The index into the buffer after it has been cast to type
+ @param value The value to write
+ @note This function has no error checking for speed
+ @see cpl_image_set()
+
+ */
+/*----------------------------------------------------------------------------*/
+inline static
+void irplib_data_set_double(void * self, cpl_type type, int i, double value)
+{
+
+ switch (type) {
+ case CPL_TYPE_FLOAT:
+ {
+ float * pself = (float*)self;
+ pself[i] = (float)value;
+ break;
+ }
+ case CPL_TYPE_INT:
+ {
+ int * pself = (int*)self;
+ pself[i] = (int)value;
+ break;
+ }
+ default: /* case CPL_TYPE_DOUBLE */
+ {
+ double * pself = (double*)self;
+ pself[i] = value;
+ break;
+ }
+ }
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Dump a single CPL error
+ @param Pointer to one of cpl_msg_info(), cpl_msg_warning(), ...
+ @param self The number of the current error to be dumped
+ @param first The number of the first error to be dumped
+ @param last The number of the last error to be dumped
+ @return void
+ @see irplib_errorstate_dump_one
+
+ */
+/*----------------------------------------------------------------------------*/
+static
+void irplib_errorstate_dump_one_level(void (*messenger)(const char *,
+ const char *, ...),
+ unsigned self, unsigned first,
+ unsigned last)
+{
+
+ const cpl_boolean is_reverse = first > last ? CPL_TRUE : CPL_FALSE;
+ const unsigned newest = is_reverse ? first : last;
+ const unsigned oldest = is_reverse ? last : first;
+ const char * revmsg = is_reverse ? " in reverse order" : "";
+
+
+ /*
+ cx_assert( messenger != NULL );
+ cx_assert( oldest <= self );
+ cx_assert( newest >= self );
+ */
+
+ if (newest == 0) {
+ messenger(cpl_func, "No error(s) to dump");
+ /* cx_assert( oldest == 0); */
+ } else {
+ /*
+ cx_assert( oldest > 0);
+ cx_assert( newest >= oldest);
+ */
+ if (self == first) {
+ if (oldest == 1) {
+ messenger(cpl_func, "Dumping all %u error(s)%s:", newest,
+ revmsg);
+ } else {
+ messenger(cpl_func, "Dumping the %u most recent error(s) "
+ "out of a total of %u errors%s:",
+ newest - oldest + 1, newest, revmsg);
+ }
+ cpl_msg_indent_more();
+ }
+
+ messenger(cpl_func, "[%u/%u] '%s' (%u) at %s", self, newest,
+ cpl_error_get_message(), cpl_error_get_code(),
+ cpl_error_get_where());
+
+ if (self == last) cpl_msg_indent_less();
+ }
+}
+
+cpl_polynomial * irplib_polynomial_fit_1d_create_chiq(
+ const cpl_vector * x_pos,
+ const cpl_vector * values,
+ int degree,
+ double * rechisq
+ )
+ {
+ return irplib_polynomial_fit_1d_create_common(x_pos, values, degree, NULL, rechisq);
+ }
+cpl_polynomial * irplib_polynomial_fit_1d_create(
+ const cpl_vector * x_pos,
+ const cpl_vector * values,
+ int degree,
+ double * mse
+ )
+{
+
+ return irplib_polynomial_fit_1d_create_common(x_pos, values, degree, mse, NULL);
+}
+static cpl_polynomial * irplib_polynomial_fit_1d_create_common(
+ const cpl_vector * x_pos,
+ const cpl_vector * values,
+ int degree,
+ double * mse,
+ double * rechisq
+ )
+{
+ cpl_polynomial * fit1d = NULL;
+ cpl_size loc_degree = (cpl_size)degree ;
+ int x_size = 0;
+ fit1d = cpl_polynomial_new(1);
+ x_size = cpl_vector_get_size(x_pos);
+ if(fit1d != NULL && x_size > 1)
+ {
+ cpl_matrix * samppos = NULL;
+ cpl_vector * fitresidual = NULL;
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), NULL);
+ samppos = cpl_matrix_wrap(1, x_size,
+ (double*)cpl_vector_get_data_const(x_pos));
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), NULL);
+ fitresidual = cpl_vector_new(x_size);
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), NULL);
+ cpl_polynomial_fit(fit1d, samppos, NULL, values, NULL,
+ CPL_FALSE, NULL, &loc_degree);
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), NULL);
+ cpl_vector_fill_polynomial_fit_residual(fitresidual, values, NULL, fit1d,
+ samppos, rechisq);
+ cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), NULL);
+ if (mse)
+ {
+ *mse = cpl_vector_product(fitresidual, fitresidual)
+ / cpl_vector_get_size(fitresidual);
+ }
+ cpl_matrix_unwrap(samppos);
+ cpl_vector_delete(fitresidual);
+ }
+ return fit1d;
+}
+
+static void quicksort(int* iindex, double* exptime, int left, int right)
+{
+ int i = left;
+ int j = right;
+ int pivot = (i + j) / 2;
+ double index_value = exptime[pivot];
+ do
+ {
+ while(exptime[i] < index_value) i++;
+ while(exptime[j] > index_value) j--;
+ if (i <= j)
+ {
+ if(i < j)
+ {
+ int tmp = iindex[i];
+ double dtmp = exptime[i];
+ iindex[i]=iindex[j];
+ iindex[j]=tmp;
+ exptime[i] = exptime[j];
+ exptime[j] = dtmp;
+ }
+ i++;
+ j--;
+ }
+ } while (i <= j);
+
+ if (i < right)
+ {
+ quicksort(iindex, exptime, i, right);
+ }
+ if (left < j)
+ {
+ quicksort(iindex, exptime,left, j);
+ }
+}
+cpl_error_code irplib_frameset_sort(const cpl_frameset * self, int* iindex, double* exptime)
+{
+ int sz = 0;
+ int i = 0;
+ const cpl_frame* tmp_frame = 0;
+ cpl_error_code error = CPL_ERROR_NONE;
+ sz = cpl_frameset_get_size(self);
+
+ /* 1. get an array of frames */
+ tmp_frame = cpl_frameset_get_first_const(self);
+ while(tmp_frame)
+ {
+ exptime[i] = frame_get_exptime(tmp_frame);
+ iindex[i] = i;
+ tmp_frame = cpl_frameset_get_next_const(self);
+ i++;
+ }
+ /* 2.sort */
+ quicksort(iindex, exptime, 0, sz - 1);
+
+ return error;
+}
+
+static double frame_get_exptime(const cpl_frame * pframe)
+{
+ cpl_propertylist *plist = 0;
+ double dval = 0;
+
+ plist = cpl_propertylist_load(cpl_frame_get_filename(pframe),0);
+ if(plist)
+ {
+ cpl_error_code err = CPL_ERROR_NONE;
+ dval = cpl_propertylist_get_double(plist, "EXPTIME");
+ err = cpl_error_get_code();
+ if (err != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func, "error during reading EXPTIME key from the frame [%s]", cpl_frame_get_filename(pframe));
+ }
+ }
+ /* Free and return */
+ cpl_propertylist_delete(plist);
+ return dval;
+}
diff --git a/irplib/irplib_utils.h b/irplib/irplib_utils.h
new file mode 100644
index 0000000..9fd58b7
--- /dev/null
+++ b/irplib/irplib_utils.h
@@ -0,0 +1,464 @@
+/* $Id: irplib_utils.h,v 1.55 2011/06/01 06:47:56 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2011/06/01 06:47:56 $
+ * $Revision: 1.55 $
+ * $Name: hawki-1_8_9 $
+ * $Log: irplib_utils.h,v $
+ * Revision 1.55 2011/06/01 06:47:56 llundin
+ * skip_if_lt(): Fix previous edits switch of A and B in error message
+ *
+ * Revision 1.54 2011/05/26 08:08:56 llundin
+ * skip_if_lt(): Support printf-style error message, name-space protect temporary variables
+ *
+ * Revision 1.53 2011/05/09 07:51:18 llundin
+ * irplib_dfs_save_image_(): Modified from cpl_dfs_save_image(). irplib_dfs_save_image(): Use irplib_dfs_save_image_()
+ *
+ * Revision 1.52 2010/03/23 07:57:59 kmirny
+ * DFS08552, Documentation for irplib_frameset_sort
+ *
+ * Revision 1.51 2009/12/16 14:59:30 cgarcia
+ * Avoid name clash with index function
+ *
+ * Revision 1.50 2009/08/17 15:10:16 kmirny
+ *
+ * DFS07454 DFS07437
+ *
+ */
+
+#ifndef IRPLIB_UTILS_H
+#define IRPLIB_UTILS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <stdarg.h>
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define IRPLIB_XSTRINGIFY(TOSTRING) #TOSTRING
+#define IRPLIB_STRINGIFY(TOSTRING) IRPLIB_XSTRINGIFY(TOSTRING)
+
+/* FIXME: Remove when no longer used by any irplib-based pipelines */
+/* Useful for debugging */
+#define irplib_trace() do if (cpl_error_get_code()) { \
+ cpl_msg_debug(cpl_func, __FILE__ " at line %d: ERROR '%s' at %s", \
+ __LINE__, cpl_error_get_message(), cpl_error_get_where()); \
+ } else { \
+ cpl_msg_debug(cpl_func, __FILE__ " at line %d: OK", __LINE__); \
+ } while (0)
+
+#define irplib_error_recover(ESTATE, ...) \
+ do if (!cpl_errorstate_is_equal(ESTATE)) { \
+ cpl_msg_warning(cpl_func, __VA_ARGS__); \
+ cpl_msg_indent_more(); \
+ cpl_errorstate_dump(ESTATE, CPL_FALSE, irplib_errorstate_warning); \
+ cpl_msg_indent_less(); \
+ cpl_errorstate_set(ESTATE); \
+ } while (0)
+
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Declare a function suitable for use with irplib_dfs_table_convert()
+ @param table_set_row The name of the function to declare
+ @see irplib_dfs_table_convert(), irplib_table_read_from_frameset()
+
+*/
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_UTIL_SET_ROW(table_set_row) \
+ cpl_boolean table_set_row(cpl_table *, \
+ const char *, \
+ int, \
+ const cpl_frame *, \
+ const cpl_parameterlist *)
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Declare a function suitable for use with irplib_dfs_table_convert()
+ @param table_check The name of the function to declare
+ @see irplib_dfs_table_convert()
+
+*/
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_UTIL_CHECK(table_check) \
+ cpl_error_code table_check(cpl_table *, \
+ const cpl_frameset *, \
+ const cpl_parameterlist *)
+
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Conditional skip to the (unqiue) return point of the function
+ @param CONDITION The condition to check
+ @see cpl_error_ensure()
+
+ skip_if() takes one argument, which is a logical expression.
+ If the logical expression is false skip_if() takes no action and
+ program execution continues.
+ If the logical expression is true this indicates an error. In this case
+ skip_if() will set the location of the error to the point where it
+ was invoked in the recipe code (unless the error location is already in the
+ recipe code). If no error code had been set, then skip_if() will set one.
+ Finally, skip_if() causes program execution to skip to the macro 'end_skip'.
+ The macro end_skip is located towards the end of the function, after
+ which all resource deallocation and the function return is located.
+
+ The use of skip_if() assumes the following coding practice:
+ 1) Pointers used for dynamically allocated memory that they "own" shall always
+ point to either NULL or to allocated memory (including CPL-objects).
+ 2) Such pointers may not be reused to point to memory whose deallocation
+ requires calls to different functions.
+ 3) Pointers of type FILE should be set NULL when not pointing to an open
+ stream and their closing calls (fclose(), freopen(), etc.) following the
+ 'end_skip' should be guarded against such NULL pointers.
+
+ Error checking with skip_if() is encouraged due to the following advantages:
+ 1) It ensures that a CPL-error code is set.
+ 2) It ensures that the location of the error in the _recipe_ code is noted.
+ 3) The error checking may be confined to a single concise line.
+ 4) It is not necessary to replicate memory deallocation for every error
+ condition.
+ 5) If more extensive error reporting/handling is required it is not precluded
+ by the use of skip_if().
+ 6) It allows for a single point of function return.
+ 7) It allows for optional, uniformly formatted debugging/tracing information
+ at each macro invocation.
+
+ The implementation of skip_if() uses a goto/label construction.
+ According to Kerningham & Ritchie, The C Programming Language, 2nd edition,
+ Section 3.8:
+ "This organization is handy if the error-handling code is non-trivial,
+ and if errors can occur in several places."
+
+ The use of goto for any other purpose should be avoided.
+
+*/
+/*----------------------------------------------------------------------------*/
+#define skip_if(CONDITION) \
+ do { \
+ cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), \
+ goto cleanup, "Propagating a pre-existing error"); \
+ cpl_error_ensure(!(CONDITION), cpl_error_get_code(), \
+ goto cleanup, "Propagating error");\
+ } while (0)
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Skip if A < B
+ @param A The 1st double to compare
+ @param B The 2nd double to compare
+ @param MSG A printf-style error message, 1st arg should be a string literal
+ @see skip_if()
+ @note A and B are evaluated exactly once
+
+ If no CPL error is set, sets CPL_ERROR_DATA_NOT_FOUND on failure
+*/
+/*----------------------------------------------------------------------------*/
+#define skip_if_lt(A, B, ...) \
+ do { \
+ /* Name-space protected one-time only evaluation */ \
+ const double irplib_utils_a = (double)(A); \
+ const double irplib_utils_b = (double)(B); \
+ \
+ cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), \
+ goto cleanup, "Propagating a pre-existing error"); \
+ if (irplib_utils_a < irplib_utils_b) { \
+ char * irplib_utils_msg = cpl_sprintf(__VA_ARGS__); \
+ (void)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, \
+ "Need at least %g (not %g) %s", \
+ irplib_utils_b, irplib_utils_a, \
+ irplib_utils_msg); \
+ cpl_free(irplib_utils_msg); \
+ goto cleanup; \
+ } \
+ } while (0)
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Conditional skip on coding bug
+ @param CONDITION The condition to check
+ @see skip_if()
+ @note unlike assert() this check cannot be disabled
+ */
+/*----------------------------------------------------------------------------*/
+#define bug_if(CONDITION) \
+ do { \
+ cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), \
+ goto cleanup, "Propagating an unexpected error, " \
+ "please report to " PACKAGE_BUGREPORT); \
+ cpl_error_ensure(!(CONDITION), CPL_ERROR_UNSPECIFIED, \
+ goto cleanup, "Internal error, please report to " \
+ PACKAGE_BUGREPORT); \
+ } while (0)
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Conditional skip with error creation
+ @param CONDITION The condition to check
+ @param ERROR The error code to set
+ @param MSG A printf-style error message. As a matter of
+ user-friendliness the message should mention any
+ value that caused the @em CONDITION to fail.
+ @see skip_if()
+ @note unlike assert() this check cannot be disabled
+ */
+/*----------------------------------------------------------------------------*/
+#define error_if(CONDITION, ERROR, ...) \
+ cpl_error_ensure(cpl_error_get_code() == CPL_ERROR_NONE && \
+ !(CONDITION), ERROR, goto cleanup, __VA_ARGS__)
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Propagate a preexisting error, if any
+ @param MSG A printf-style error message.
+ @see skip_if()
+ */
+/*----------------------------------------------------------------------------*/
+#define any_if(...) \
+ cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), \
+ goto cleanup, __VA_ARGS__)
+
+/*----------------------------------------------------------------------------*/
+/*
+ @brief Define the single point of resource deallocation and return
+ @see skip_if()
+ @note end_skip should be used exactly once in functions that use skip_if() etc
+*/
+/*----------------------------------------------------------------------------*/
+#define end_skip \
+ do { \
+ cleanup: \
+ if (cpl_error_get_code()) \
+ cpl_msg_debug(cpl_func, "Cleanup in " __FILE__ " line %u with " \
+ "error '%s' at %s", __LINE__, \
+ cpl_error_get_message(), cpl_error_get_where()); \
+ else \
+ cpl_msg_debug(cpl_func, "Cleanup in " __FILE__ " line %u", \
+ __LINE__); \
+ } while (0)
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Conditional skip to the (unqiue) return point of the function
+ @param CONDITION An error is set if this test condition
+ evaluates to false
+ @param ec The CPL error code
+ @param msg A printf-style error
+ message. As a matter of user-friendliness
+ the message should mention any value
+ that caused the @em CONDITION to fail.
+ @see skip_if()
+*/
+/*----------------------------------------------------------------------------*/
+#define irplib_ensure(CONDITION, ec, ...) \
+ cpl_error_ensure(CONDITION, ec, goto cleanup, __VA_ARGS__)
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Catch an error
+ @param COMMAND Command to execute and check. This command is
+ expected to set the cpl_error_code in case of
+ failure
+ @param msg A printf-style error message.
+ @see skip_if()
+
+ This macro is used to catch an error from a function that sets the
+ @c cpl_error_code in case of error.
+
+ Example:
+ @code
+ irplib_check( cpl_object_do_something(object), ("Could not do something"));
+ @endcode
+
+ If the @c cpl_error_code is set before or after calling the function,
+ execution jumps to the @em cleanup label.
+
+ The macro can also be used to check a sequence of commands:
+ @code
+ irplib_check(
+ x = cpl_table_get_int(table, "x", 0, NULL);
+ y = cpl_table_get_int(table, "y", 0, NULL);
+ z = cpl_table_get_int(table, "z", 0, NULL), / * Comma here! * /
+ ("Error reading wavelength catalogue"));
+ @endcode
+
+*/
+/*----------------------------------------------------------------------------*/
+
+#define irplib_check(COMMAND, ...) \
+ do { \
+ cpl_errorstate irplib_check_prestate = cpl_errorstate_get(); \
+ skip_if(0); \
+ COMMAND; \
+ irplib_trace(); \
+ irplib_ensure(cpl_errorstate_is_equal(irplib_check_prestate), \
+ cpl_error_get_code(), __VA_ARGS__); \
+ irplib_trace(); \
+ } while (0)
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_error_code irplib_dfs_save_image(cpl_frameset *,
+ const cpl_parameterlist *,
+ const cpl_frameset *,
+ const cpl_image *,
+ cpl_type_bpp ,
+ const char *,
+ const char *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const char *);
+
+
+cpl_error_code irplib_dfs_save_propertylist(cpl_frameset *,
+ const cpl_parameterlist *,
+ const cpl_frameset *,
+ const char *,
+ const char *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const char *);
+
+cpl_error_code irplib_dfs_save_imagelist(cpl_frameset *,
+ const cpl_parameterlist *,
+ const cpl_frameset *,
+ const cpl_imagelist *,
+ cpl_type_bpp ,
+ const char *,
+ const char *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const char *);
+
+cpl_error_code irplib_dfs_save_table(cpl_frameset *,
+ const cpl_parameterlist *,
+ const cpl_frameset *,
+ const cpl_table *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const char *);
+
+cpl_error_code irplib_dfs_save_image_(cpl_frameset *,
+ cpl_propertylist *,
+ const cpl_parameterlist *,
+ const cpl_frameset *,
+ const cpl_frame *,
+ const cpl_image *,
+ cpl_type ,
+ const char *,
+ const cpl_propertylist *,
+ const char *,
+ const char *,
+ const char *);
+
+void irplib_reset(void);
+int irplib_compare_tags(cpl_frame *, cpl_frame *);
+const char * irplib_frameset_find_file(const cpl_frameset *, const char *);
+const cpl_frame * irplib_frameset_get_first_from_group(const cpl_frameset *,
+ cpl_frame_group);
+
+cpl_error_code irplib_apertures_find_max_flux(const cpl_apertures *, int *,
+ int);
+
+int irplib_isinf(double value);
+int irplib_isnan(double value);
+
+void irplib_errorstate_warning(unsigned, unsigned, unsigned);
+
+cpl_error_code
+irplib_dfs_table_convert(cpl_table *, cpl_frameset *, const cpl_frameset *,
+ int, char, const char *, const char *,
+ const cpl_parameterlist *, const char *,
+ const cpl_propertylist *, const cpl_propertylist *,
+ const char *, const char *, const char *,
+ cpl_boolean (*)(cpl_table *, const char *, int,
+ const cpl_frame *,
+ const cpl_parameterlist *),
+ cpl_error_code (*)(cpl_table *,
+ const cpl_frameset *,
+ const cpl_parameterlist *));
+
+cpl_error_code irplib_table_read_from_frameset(cpl_table *,
+ const cpl_frameset *,
+ int,
+ char,
+ const cpl_parameterlist *,
+ cpl_boolean (*)
+ (cpl_table *, const char *,
+ int, const cpl_frame *,
+ const cpl_parameterlist *));
+
+cpl_error_code irplib_image_split(const cpl_image *,
+ cpl_image *, cpl_image *, cpl_image *,
+ double, cpl_boolean,
+ double, cpl_boolean,
+ double, double,
+ cpl_boolean, cpl_boolean, cpl_boolean);
+
+void irplib_errorstate_dump_warning(unsigned, unsigned, unsigned);
+void irplib_errorstate_dump_info(unsigned, unsigned, unsigned);
+void irplib_errorstate_dump_debug(unsigned, unsigned, unsigned);
+/* wrapper for replace deprecated function cpl_polynomial_fit_1d_create*/
+cpl_polynomial * irplib_polynomial_fit_1d_create(
+ const cpl_vector * x_pos,
+ const cpl_vector * values,
+ int degree,
+ double * mse
+ );
+cpl_polynomial * irplib_polynomial_fit_1d_create_chiq(
+ const cpl_vector * x_pos,
+ const cpl_vector * values,
+ int degree,
+ double * rechiq
+ );
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Sort a frameset based on the exposure time
+ @param self Frameset to sort (input)
+ @param iindex Index array with sort results (output), each element is
+ a frame number
+ @param exptime Array with exposure time for each frame (output)
+*/
+cpl_error_code irplib_frameset_sort(
+ const cpl_frameset * self,
+ int* iindex,
+ double* exptime);
+
+#endif
diff --git a/irplib/irplib_wavecal.c b/irplib/irplib_wavecal.c
new file mode 100644
index 0000000..f7b38b0
--- /dev/null
+++ b/irplib/irplib_wavecal.c
@@ -0,0 +1,1646 @@
+/* $Id: irplib_wavecal.c,v 1.46 2012/03/02 09:01:04 amodigli Exp $
+ *
+ * This file is part of the IRPLIB Pipeline
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: amodigli $
+ * $Date: 2012/03/02 09:01:04 $
+ * $Revision: 1.46 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#include <cpl.h>
+
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+#include "irplib_wavecal_impl.h"
+
+/* Needed for irplib_errorstate_dump_debug() */
+#include "irplib_utils.h"
+
+#include <string.h>
+#include <math.h>
+
+#ifdef HAVE_GSL
+#include <gsl/gsl_multimin.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Private types
+ -----------------------------------------------------------------------------*/
+
+typedef struct {
+
+ const cpl_vector * observed;
+ cpl_polynomial * disp1d;
+ cpl_vector * spectrum;
+ irplib_base_spectrum_model * param;
+ cpl_error_code (* filler)(cpl_vector *, const cpl_polynomial *,
+ irplib_base_spectrum_model *, int);
+ cpl_vector * vxc;
+ double xc;
+ int maxxc;
+ double mxc;
+ cpl_polynomial * mdisp;
+ int ishift;
+
+} irplib_multimin;
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+#ifndef inline
+#define inline /* inline */
+#endif
+
+#define IRPLIB_MAX(A,B) ((A) > (B) ? (A) : (B))
+#define IRPLIB_MIN(A,B) ((A) < (B) ? (A) : (B))
+
+/*-----------------------------------------------------------------------------
+ Private functions
+ -----------------------------------------------------------------------------*/
+
+#ifdef HAVE_GSL
+static double irplib_gsl_correlation(const gsl_vector *, void *);
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_wavecal Spectro functionality
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Count the positive Y-entries in a given X-range
+ @param self Bivector with increasing X-entries
+ @param x_min minimum X-entry
+ @param x_max maximum X-entry
+ @return the number of matching entries, or negative on error
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_bivector_count_positive(const cpl_bivector * self,
+ double x_min,
+ double x_max)
+{
+
+ const int nself = cpl_bivector_get_size(self);
+ const double * px = cpl_bivector_get_x_data_const(self);
+ const double * py = cpl_bivector_get_y_data_const(self);
+ int npos = 0;
+ int i = 0;
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1);
+ cpl_ensure(x_min <= x_max, CPL_ERROR_ILLEGAL_INPUT, -2);
+
+ /* FIXME: Use cpl_vector_find() */
+ while (i < nself && px[i] < x_min) i++;
+ while (i < nself && px[i] < x_max)
+ if (py[i++] > 0) npos++;
+
+ return npos;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Fit a 2D-dispersion from an image of wavelengths
+ @param self 2D-polynomial to hold fit
+ @param imgwave Image map of wavelengths, any pixeltype
+ @param fitdeg Degree of fit
+ @param presid On success, points to fitting residual
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_polynomial_fit_2d_dispersion(cpl_polynomial * self,
+ const cpl_image * imgwave,
+ int fitdeg, double * presid)
+{
+
+ const int nx = cpl_image_get_size_x(imgwave);
+ const int ny = cpl_image_get_size_y(imgwave);
+ const int nbad = cpl_image_count_rejected(imgwave);
+ const int nsamp = nx * ny - nbad;
+ cpl_matrix * xy_pos;
+ double * xdata;
+ double * ydata;
+ cpl_vector * wlen;
+ double * dwlen;
+ const cpl_size nfitdeg = (cpl_size)fitdeg;
+ int i, j;
+ int k = 0;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(imgwave != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(presid != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(fitdeg > 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 2,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ xy_pos = cpl_matrix_new(2, nsamp);
+ xdata = cpl_matrix_get_data(xy_pos);
+ ydata = xdata + nsamp;
+
+ dwlen = (double*)cpl_malloc(nsamp * sizeof(double));
+ wlen = cpl_vector_wrap(nsamp, dwlen);
+
+ for (i=1; i <= nx; i++) {
+ for (j=1; j <= ny; j++) {
+ int is_bad;
+ const double value = cpl_image_get(imgwave, i, j, &is_bad);
+ if (!is_bad) {
+ xdata[k] = i;
+ ydata[k] = j;
+ dwlen[k] = value;
+ k++;
+ }
+ }
+ }
+
+ cpl_msg_info(cpl_func, "Fitting 2D polynomial to %d X %d image, ignoring "
+ "%d poorly calibrated pixels", nx, ny, nbad);
+
+ if (cpl_polynomial_fit(self, xy_pos, NULL, wlen, NULL, CPL_FALSE, NULL,
+ &nfitdeg) == CPL_ERROR_NONE && presid != NULL) {
+ cpl_vector_fill_polynomial_fit_residual(wlen, wlen, NULL, self, xy_pos,
+ NULL);
+ *presid = cpl_vector_product(wlen, wlen)/nsamp;
+ }
+ cpl_matrix_delete(xy_pos);
+ cpl_vector_delete(wlen);
+
+ cpl_ensure_code(k == nsamp, CPL_ERROR_UNSPECIFIED);
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Modify self by maximizing the cross-correlation
+ @param self 1D-Dispersion relation to modify, at least of degree 1
+ @param maxdeg Maximize the cross-correlation by modifying maxdeg degree
+ @param obs The observed spectrum to correlate against
+ @param model The model of the lines/OTF etc.
+ @param filler The function to fill the model spectrum
+ @param pixtol The (positive) dispersion tolerance, e.g. 1e-6
+ @param pixstep The step length used in the maximization, e.g. 0.5 [pixel]
+ @param hsize Half the search-distance to ensure a global-maximum, hsize >= 0
+ @param maxite Maximum number of iterations, e.g. 100 * maxdeg
+ @param pxc On sucess, *pxc is the cross-correlation
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @note Fails with CPL_ERROR_UNSUPPORTED_MODE if compiled without GSL.
+ self must be increasing in the interval from 1 to the length of obs.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_polynomial_find_1d_from_correlation(cpl_polynomial * self,
+ int maxdeg,
+ const cpl_vector * obs,
+ irplib_base_spectrum_model * model,
+ cpl_error_code (* filler)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *, int),
+ double pixtol,
+ double pixstep,
+ int hsize,
+ int maxite,
+ double * pxc)
+{
+
+#ifdef HAVE_GSL
+ const gsl_multimin_fminimizer_type * T = gsl_multimin_fminimizer_nmsimplex;
+ gsl_multimin_fminimizer * minimizer;
+ gsl_multimin_function my_func;
+ irplib_multimin data;
+ gsl_vector * dispgsl;
+ gsl_vector * stepsize;
+ gsl_vector * dispprev;
+ int status = GSL_CONTINUE;
+ const int nobs = cpl_vector_get_size(obs);
+ const cpl_size nfit = maxdeg + 1;
+ cpl_errorstate prestate = cpl_errorstate_get();
+ /* Convert pixel step to wavelength step on detector center */
+ const double wlstep =
+ cpl_polynomial_eval_1d_diff(self, 0.5 * (nobs + pixstep),
+ 0.5 * (nobs - pixstep), NULL);
+ double wlstepi = wlstep;
+ double size;
+ int iter;
+ cpl_size i;
+
+#endif
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(obs != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pxc != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_degree(self) > 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(maxdeg >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pixtol > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pixstep > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(maxite >= 0, CPL_ERROR_ILLEGAL_INPUT);
+
+#ifndef HAVE_GSL
+ return cpl_error_set_message(cpl_func, CPL_ERROR_UNSUPPORTED_MODE,
+ "GSL is not available");
+#else
+
+ minimizer = gsl_multimin_fminimizer_alloc(T, (size_t)nfit);
+
+ cpl_ensure_code(minimizer != NULL, CPL_ERROR_ILLEGAL_OUTPUT);
+
+ dispgsl = gsl_vector_alloc((size_t)nfit);
+ stepsize = gsl_vector_alloc((size_t)nfit);
+ dispprev = gsl_vector_alloc((size_t)nfit);
+
+ for (i=0; i < nfit; i++) {
+ const double value = cpl_polynomial_get_coeff(self, &i);
+ gsl_vector_set(dispgsl, (size_t)i, value);
+ gsl_vector_set(stepsize, (size_t)i, wlstepi);
+ wlstepi /= (double)nobs;
+ }
+
+ my_func.n = nfit;
+ my_func.f = &irplib_gsl_correlation;
+ my_func.params = (void *)(&data);
+
+ data.observed = obs;
+ data.disp1d = self;
+ data.spectrum = cpl_vector_new(nobs + 2 * hsize);
+ data.vxc = cpl_vector_new(1 + 2 * hsize);
+ data.param = model;
+ data.filler = filler;
+ data.maxxc = 0; /* Output */
+ data.ishift = 0; /* Output */
+ data.mxc = -1.0; /* Output */
+ data.mdisp = NULL; /* Output */
+
+ gsl_multimin_fminimizer_set (minimizer, &my_func, dispgsl, stepsize);
+
+ for (iter = 0; status == GSL_CONTINUE && iter < maxite; iter++) {
+
+ const double fprev = minimizer->fval;
+
+ gsl_vector_memcpy(dispprev, minimizer->x);
+ status = gsl_multimin_fminimizer_iterate(minimizer);
+
+ if (status || !cpl_errorstate_is_equal(prestate)) break;
+
+ size = gsl_multimin_fminimizer_size (minimizer);
+ status = gsl_multimin_test_size (size, pixtol);
+
+ if (status == GSL_SUCCESS) {
+ cpl_msg_debug(cpl_func, "converged to minimum at");
+
+ if (nfit == 0) {
+ cpl_msg_debug(cpl_func, "%5d %g df() = %g size = %g",
+ iter,
+ gsl_vector_get (minimizer->x, 0)
+ - gsl_vector_get (dispprev, 0),
+ minimizer->fval - fprev, size);
+ } else if (nfit == 1) {
+ cpl_msg_debug(cpl_func, "%5d %g %g df() = %g size = %g",
+ iter,
+ gsl_vector_get (minimizer->x, 0)
+ - gsl_vector_get (dispprev, 0),
+ gsl_vector_get (minimizer->x, 1)
+ - gsl_vector_get (dispprev, 1),
+ minimizer->fval - fprev, size);
+ } else {
+ cpl_msg_debug(cpl_func, "%5d %g %g %g df() = %g size = %g",
+ iter,
+ gsl_vector_get (minimizer->x, 0)
+ - gsl_vector_get (dispprev, 0),
+ gsl_vector_get (minimizer->x, 1)
+ - gsl_vector_get (dispprev, 1),
+ gsl_vector_get (minimizer->x, 2)
+ - gsl_vector_get (dispprev, 2),
+ minimizer->fval - fprev, size);
+ }
+ }
+ }
+
+ if (status == GSL_SUCCESS && cpl_errorstate_is_equal(prestate)) {
+ if (data.mxc > -minimizer->fval) {
+ *pxc = data.mxc;
+ cpl_msg_warning(cpl_func, "Local maximum: %g(%d) > %g",
+ data.mxc, data.ishift, -minimizer->fval);
+ cpl_polynomial_shift_1d(data.mdisp, 0, (double)data.ishift);
+ cpl_polynomial_copy(self, data.mdisp);
+ status = GSL_CONTINUE;
+ } else {
+ *pxc = -minimizer->fval;
+ for (i=0; i < nfit; i++) {
+ const double value = gsl_vector_get(minimizer->x, i);
+ cpl_polynomial_set_coeff(self, &i, value);
+ }
+ }
+ }
+
+ cpl_vector_delete(data.spectrum);
+ cpl_vector_delete(data.vxc);
+ cpl_polynomial_delete(data.mdisp);
+ gsl_multimin_fminimizer_free(minimizer);
+ gsl_vector_free(dispgsl);
+ gsl_vector_free(dispprev);
+ gsl_vector_free(stepsize);
+
+ cpl_ensure_code(status != GSL_CONTINUE, CPL_ERROR_CONTINUE);
+ cpl_ensure_code(status == GSL_SUCCESS, CPL_ERROR_DATA_NOT_FOUND);
+ cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+#endif
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate a 1D spectrum from a model and a dispersion relation
+ @param self Vector to fill with spectrum
+ @param disp 1D-Dispersion relation, at least of degree 1
+ @param lsslamp Pointer to irplib_line_spectrum_model struct
+ @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+
+ The model comprises these elements:
+ @code
+ double wslit; // Slit Width
+ double wfwhm; // FWHM of transfer function
+ double xtrunc; // Truncate transfer function beyond xtrunc, xtrunc > 0
+ const cpl_bivector * lines; // Catalogue of intensities, with
+ // increasing X-vector elements
+ cpl_vector * linepix; // NULL, or temporary work-space of size
+ // equal to the lines bivector
+ // - should be uninitialized to zero
+ unsigned cost; // Will be incremented for each call
+ unsigned xcost; // Will be incremented for each OK call
+ @endcode
+
+ The units of the X-values of the lines is assumed to be the same as
+ that of disp, the units of wslit, wfwhm and xtrunc are assumed to be the same
+ as the input unit of disp(), the units of self will be that of the Y-values
+ of the lines.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_vector_fill_line_spectrum(cpl_vector * self,
+ const cpl_polynomial * disp,
+ irplib_base_spectrum_model * lsslamp,
+ int hsize)
+{
+
+ irplib_line_spectrum_model * arclamp
+ = (irplib_line_spectrum_model *)lsslamp;
+ cpl_error_code error;
+
+ cpl_ensure_code(arclamp != NULL, CPL_ERROR_NULL_INPUT);
+
+ arclamp->cost++;
+
+ error = irplib_vector_fill_line_spectrum_model(self,
+ arclamp->linepix,
+ arclamp->erftmp,
+ disp,
+ arclamp->lines,
+ arclamp->wslit,
+ arclamp->wfwhm,
+ arclamp->xtrunc,
+ hsize, CPL_FALSE, CPL_FALSE,
+ &(arclamp->ulines));
+ cpl_ensure_code(!error, error);
+
+ arclamp->xcost++;
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate a 1D spectrum from a model and a dispersion relation
+ @param self Vector to fill with spectrum
+ @param disp 1D-Dispersion relation, at least of degree 1
+ @param lsslamp Pointer to irplib_line_spectrum_model struct
+ @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @note The logarithm is taken on the intensities
+ @see irplib_vector_fill_line_spectrum
+
+ log(1+I) is used for the (positive) intensities
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_vector_fill_logline_spectrum(cpl_vector * self,
+ const cpl_polynomial * disp,
+ irplib_base_spectrum_model * lsslamp,
+ int hsize)
+{
+
+ irplib_line_spectrum_model * arclamp
+ = (irplib_line_spectrum_model *)lsslamp;
+ cpl_error_code error;
+
+ cpl_ensure_code(arclamp != NULL, CPL_ERROR_NULL_INPUT);
+
+ arclamp->cost++;
+
+ error = irplib_vector_fill_line_spectrum_model(self,
+ arclamp->linepix,
+ arclamp->erftmp,
+ disp,
+ arclamp->lines,
+ arclamp->wslit,
+ arclamp->wfwhm,
+ arclamp->xtrunc,
+ hsize, CPL_FALSE, CPL_TRUE,
+ &(arclamp->ulines));
+ cpl_ensure_code(!error, error);
+
+ arclamp->xcost++;
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate a 1D spectrum from a model and a dispersion relation
+ @param self Vector to fill with spectrum
+ @param disp 1D-Dispersion relation, at least of degree 1
+ @param lsslamp Pointer to irplib_line_spectrum_model struct
+ @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @see irplib_vector_fill_line_spectrum()
+
+ Complexity reduced from O(nw) to O(n + w), where n is number of lines and
+ truncation width [pixel] of the line.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_vector_fill_line_spectrum_fast(cpl_vector * self,
+ const cpl_polynomial * disp,
+ irplib_base_spectrum_model * lsslamp,
+ int hsize)
+{
+
+ irplib_line_spectrum_model * arclamp
+ = (irplib_line_spectrum_model *)lsslamp;
+ cpl_error_code error;
+
+ cpl_ensure_code(arclamp != NULL, CPL_ERROR_NULL_INPUT);
+
+ arclamp->cost++;
+
+ error = irplib_vector_fill_line_spectrum_model(self,
+ arclamp->linepix,
+ arclamp->erftmp,
+ disp,
+ arclamp->lines,
+ arclamp->wslit,
+ arclamp->wfwhm,
+ arclamp->xtrunc,
+ hsize, CPL_TRUE, CPL_FALSE,
+ &(arclamp->ulines));
+ cpl_ensure_code(!error, error);
+
+ arclamp->xcost++;
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate a 1D spectrum from a model and a dispersion relation
+ @param self Vector to fill with spectrum
+ @param disp 1D-Dispersion relation, at least of degree 1
+ @param lsslamp Pointer to irplib_line_spectrum_model struct
+ @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @note The logarithm is taken on the intensities
+ @see irplib_vector_fill_line_spectrum_fast()
+
+ log(1+I) is used for the (positive) intensities
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_vector_fill_logline_spectrum_fast(cpl_vector * self,
+ const cpl_polynomial * disp,
+ irplib_base_spectrum_model * lsslamp,
+ int hsize)
+{
+
+ irplib_line_spectrum_model * arclamp
+ = (irplib_line_spectrum_model *)lsslamp;
+ cpl_error_code error;
+
+ cpl_ensure_code(arclamp != NULL, CPL_ERROR_NULL_INPUT);
+
+ arclamp->cost++;
+
+ error = irplib_vector_fill_line_spectrum_model(self,
+ arclamp->linepix,
+ arclamp->erftmp,
+ disp,
+ arclamp->lines,
+ arclamp->wslit,
+ arclamp->wfwhm,
+ arclamp->xtrunc,
+ hsize, CPL_TRUE, CPL_TRUE,
+ &(arclamp->ulines));
+ cpl_ensure_code(!error, error);
+
+ arclamp->xcost++;
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Plot a 1D spectrum and one from a model
+ @param self Vector with observed spectrum
+ @param disp1d 1D-Dispersion relation, at least of degree 1
+ @param model Pointer to model parameters
+ @param filler The function to fill the model spectrum
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @see irplib_vector_fill_line_spectrum()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_plot_spectrum_and_model(const cpl_vector * self,
+ const cpl_polynomial * disp1d,
+ irplib_base_spectrum_model * model,
+ cpl_error_code (* filler)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int))
+{
+
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_vector * wl;
+ cpl_vector * spectrum;
+ cpl_vector * vxc;
+ const int len = cpl_vector_get_size(self);
+ double maxval, xc;
+ int ixc;
+ int error = 0;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(disp1d != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(disp1d) == 1,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_degree(disp1d) > 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ wl = cpl_vector_new(len);
+ spectrum = cpl_vector_new(len);
+ vxc = cpl_vector_new(1);
+
+ error |= (int)cpl_vector_fill_polynomial(wl, disp1d, 1.0, 1.0);
+ error |= filler(spectrum, disp1d, model, 0);
+
+ ixc = cpl_vector_correlate(vxc, self, spectrum);
+ xc = cpl_vector_get(vxc, ixc);
+
+ maxval = cpl_vector_get_max(spectrum);
+ if (maxval != 0.0)
+ error |= cpl_vector_multiply_scalar(spectrum,
+ cpl_vector_get_max(self)/maxval);
+ if (!error) {
+ const cpl_vector * spair[] = {wl, self, spectrum};
+ char * pre = cpl_sprintf("set grid;set xlabel 'Wavelength (%g -> %g)'; "
+ "set ylabel 'Intensity';", cpl_vector_get(wl, 0),
+ cpl_vector_get(wl, len-1));
+ char * title = cpl_sprintf("t 'Observed and modelled spectra (%d pixel "
+ "XC=%g) ' w linespoints", len, xc);
+
+ (void)cpl_plot_vectors(pre, title, "", spair, 3);
+ cpl_free(pre);
+ cpl_free(title);
+ }
+
+ cpl_vector_delete(wl);
+ cpl_vector_delete(spectrum);
+ cpl_vector_delete(vxc);
+
+ cpl_errorstate_set(prestate);
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find shift(s) that maximizes (locally) the cross-correlation
+ @param self list of shifts that maximizes the cross-correlation (locally)
+ @param disp 1D-Dispersion relation, at least of degree 1
+ @param obs The observed spectrum to correlate against
+ @param model Pointer to model parameters
+ @param filler The function to fill the model spectrum
+ @param hsize Half the search-distance, hsize > 0 [pixel]
+ @param doplot Plot the cross-correlation as a function of pixel shift
+ @param pxc Iff non-NULL, set *pxc to cross-correlation on success
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @note On success, self will be resized to fit the number of shifts.
+
+ The shifts are listed in order of decreasing cross-correlation. If pxc is
+ non-NULL, *pxc will be set to the cross-correlation at shift 0.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_bivector_find_shift_from_correlation(cpl_bivector * self,
+ const cpl_polynomial * disp,
+ const cpl_vector * obs,
+ irplib_base_spectrum_model * model,
+ cpl_error_code (*filler)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *, int),
+ int hsize,
+ cpl_boolean doplot,
+ double *pxc)
+{
+
+ const int nobs = cpl_vector_get_size(obs);
+ const int nmodel = 2 * hsize + nobs;
+ cpl_vector * xself = cpl_bivector_get_x(self);
+ cpl_vector * yself = cpl_bivector_get_y(self);
+ cpl_vector * mspec1d;
+ cpl_vector * xcorr;
+ cpl_error_code error = CPL_ERROR_NONE;
+ double xcprev, xcnext;
+ int ixc, imax = 0;
+ int i;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(disp != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(obs != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(hsize > 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ mspec1d = cpl_vector_new(nmodel);
+
+ if (filler(mspec1d, disp, model, hsize)) {
+ cpl_vector_delete(mspec1d);
+ return cpl_error_set_where(cpl_func);
+ }
+
+ /* Should not be able to fail now */
+ xcorr = cpl_vector_new(1 + 2 * hsize);
+ ixc = cpl_vector_correlate(xcorr, mspec1d, obs);
+
+#ifdef IRPLIB_SPC_DUMP
+ /* Need irplib_wavecal.c rev. 1.12 through 1.15 */
+ irplib_polynomial_dump_corr_step(disp, xcorr, "Shift");
+#endif
+
+ cpl_vector_delete(mspec1d);
+
+ /* Find local maxima. */
+ /* FIXME(?): Also include stationary points */
+ i = 0;
+ xcprev = cpl_vector_get(xcorr, i);
+ xcnext = cpl_vector_get(xcorr, i+1);
+
+ if (xcprev >= xcnext) {
+ /* 1st data point is an extreme */
+ /* FIXME: This could also be an error, recoverable by caller by
+ increasing hsize */
+ imax++;
+
+ cpl_vector_set(xself, 0, i - hsize);
+ cpl_vector_set(yself, 0, xcprev);
+
+ }
+
+ for (i = 1; i < 2 * hsize; i++) {
+ const double xc = xcnext;
+ xcnext = cpl_vector_get(xcorr, i+1);
+ if (xc >= xcprev && xc >= xcnext) {
+ /* Found (local) maximum at shift i - hsize */
+ int j;
+
+ imax++;
+
+ if (cpl_bivector_get_size(self) < imax) {
+ cpl_vector_set_size(xself, imax);
+ cpl_vector_set_size(yself, imax);
+ }
+
+ for (j = imax-1; j > 0; j--) {
+ if (xc <= cpl_vector_get(yself, j-1)) break;
+ cpl_vector_set(xself, j, cpl_vector_get(xself, j-1));
+ cpl_vector_set(yself, j, cpl_vector_get(yself, j-1));
+ }
+ cpl_vector_set(xself, j, i - hsize);
+ cpl_vector_set(yself, j, xc);
+ }
+ xcprev = xc;
+ }
+
+ /* assert( i == 2 * hsize ); */
+
+ if (xcnext >= xcprev) {
+ /* Last data point is an extreme */
+ /* FIXME: This could also be an error, recoverable by caller by
+ increasing hsize */
+ int j;
+
+ imax++;
+
+ if (cpl_bivector_get_size(self) < imax) {
+ cpl_vector_set_size(xself, imax);
+ cpl_vector_set_size(yself, imax);
+ }
+
+ for (j = imax-1; j > 0; j--) {
+ if (xcnext <= cpl_vector_get(yself, j-1)) break;
+ cpl_vector_set(xself, j, cpl_vector_get(xself, j-1));
+ cpl_vector_set(yself, j, cpl_vector_get(yself, j-1));
+ }
+ cpl_vector_set(xself, j, i - hsize);
+ cpl_vector_set(yself, j, xcnext);
+
+ }
+
+ if (doplot) {
+ cpl_vector * xvals = cpl_vector_new(1 + 2 * hsize);
+ cpl_bivector * bcorr = cpl_bivector_wrap_vectors(xvals, xcorr);
+ double x = (double)-hsize;
+ char * title = cpl_sprintf("t 'Cross-correlation of shifted %d-pixel "
+ "spectrum (XCmax=%g at %d)' w linespoints",
+ nobs, cpl_vector_get(xcorr, ixc),
+ ixc - hsize);
+
+ for (i = 0; i < 1 + 2 * hsize; i++, x += 1.0) {
+ cpl_vector_set(xvals, i, x);
+ }
+
+ cpl_plot_bivector("set grid;set xlabel 'Offset [pixel]';", title,
+ "", bcorr);
+ cpl_bivector_unwrap_vectors(bcorr);
+ cpl_vector_delete(xvals);
+ cpl_free(title);
+ }
+
+ if (pxc != NULL) *pxc = cpl_vector_get(xcorr, hsize);
+
+ cpl_vector_delete(xcorr);
+
+ if (imax < 1) {
+ error = CPL_ERROR_DATA_NOT_FOUND;
+ } else if (cpl_bivector_get_size(self) > imax) {
+ cpl_vector_set_size(xself, imax);
+ cpl_vector_set_size(yself, imax);
+ }
+
+ /* Propagate error, if any */
+ return cpl_error_set(cpl_func, error);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Shift self by the amount that maximizes the cross-correlation
+ @param self 1D-Dispersion relation to shift, at least of degree 1
+ @param obs The observed spectrum to correlate against
+ @param model Pointer to model parameters
+ @param filler The function to fill the model spectrum
+ @param hsize Half the search-distance, hsize > 0 [pixel]
+ @param doplot Plot the cross-correlation as a function of pixel shift
+ @param pxc Iff non-NULL, set *pxc to cross-correlation on success
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_polynomial_shift_1d_from_correlation(cpl_polynomial * self,
+ const cpl_vector * obs,
+ irplib_base_spectrum_model * model,
+ cpl_error_code (*filler)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *, int),
+ int hsize,
+ cpl_boolean doplot,
+ double * pxc)
+{
+
+ const int nobs = cpl_vector_get_size(obs);
+ const int nmodel = 2 * hsize + nobs;
+ cpl_vector * mspec1d;
+ cpl_vector * xcorr;
+ cpl_error_code error;
+ int ixc, xxc;
+ double xc;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(obs != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(hsize > 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ mspec1d = cpl_vector_new(nmodel);
+
+ if (filler(mspec1d, self, model, hsize)) {
+ cpl_vector_delete(mspec1d);
+ cpl_ensure_code(0, cpl_error_get_code());
+ }
+
+ /* Should not be able to fail now */
+ xcorr = cpl_vector_new(1 + 2 * hsize);
+ ixc = cpl_vector_correlate(xcorr, mspec1d, obs);
+
+#ifdef IRPLIB_SPC_DUMP
+ /* Need irplib_wavecal.c rev. 1.12 through 1.15 */
+ irplib_polynomial_dump_corr_step(self, xcorr, "Shift");
+#endif
+
+ cpl_vector_delete(mspec1d);
+
+ xxc = ixc - hsize;
+
+ error = cpl_polynomial_shift_1d(self, 0, (double)xxc);
+
+ xc = cpl_vector_get(xcorr, ixc);
+
+ cpl_msg_info(cpl_func, "Shifting %d pixels (%g < %g)", xxc,
+ cpl_vector_get(xcorr, hsize), xc);
+
+ if (doplot) {
+ cpl_vector * xvals = cpl_vector_new(1 + 2 * hsize);
+ cpl_bivector * bcorr = cpl_bivector_wrap_vectors(xvals, xcorr);
+ int i;
+ double x = (double)-hsize;
+ char * title = cpl_sprintf("t 'Cross-correlation of shifted %d-pixel "
+ "spectrum (XCmax=%g at %d)' w linespoints",
+ nobs, cpl_vector_get(xcorr, ixc), xxc);
+
+ for (i = 0; i < 1 + 2 * hsize; i++, x += 1.0) {
+ cpl_vector_set(xvals, i, x);
+ }
+
+ cpl_plot_bivector("set grid;set xlabel 'Offset [pixel]';", title,
+ "", bcorr);
+ cpl_bivector_unwrap_vectors(bcorr);
+ cpl_vector_delete(xvals);
+ cpl_free(title);
+ }
+
+ cpl_vector_delete(xcorr);
+
+ cpl_ensure_code(!error, error);
+
+ if (pxc != NULL) *pxc = xc;
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate a 1D spectrum from (arc) lines and a dispersion relation
+ @param self Vector to fill with spectrum
+ @param linepix Vector to update with best guess of line pixel position
+ @param disp 1D-Dispersion relation, at least of degree 1
+ @param lines Catalogue of lines, with increasing wavelengths
+ @param wslit Positive width of the slit
+ @param wfwhm Positive FWHM of the transfer function
+ @param xtrunc Truncate the line profile beyond distance xtrunc, xtrunc > 0
+ @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0
+ @param dofast Iff true compose profile from pairs of two integer-placed
+ @param dolog Iff true log(1+I) is used for the (positive) intensities
+ @param pulines Iff non-NULL, number of lines used, on success
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @see irplib_vector_fill_line_spectrum()
+ @note This function is supposed to be called via
+ irplib_vector_fill_line_spectrum().
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_vector_fill_line_spectrum_model(cpl_vector * self,
+ cpl_vector * linepix,
+ cpl_vector * erftmp,
+ const cpl_polynomial * disp,
+ const cpl_bivector * lines,
+ double wslit,
+ double wfwhm,
+ double xtrunc,
+ int hsize,
+ cpl_boolean dofast,
+ cpl_boolean dolog,
+ unsigned * pulines)
+{
+
+ cpl_errorstate prestate;
+ const double sigma = wfwhm * CPL_MATH_SIG_FWHM;
+ const cpl_vector * xlines = cpl_bivector_get_x_const(lines);
+ const double * dxlines = cpl_vector_get_data_const(xlines);
+ const double * dylines = cpl_bivector_get_y_data_const(lines);
+ double * plinepix
+ = linepix ? cpl_vector_get_data(linepix) : NULL;
+ const int nlines = cpl_vector_get_size(xlines);
+ const int nself = cpl_vector_get_size(self);
+ double * dself = cpl_vector_get_data(self);
+ cpl_polynomial * dispi;
+ double * profile = NULL;
+ const cpl_size i0 = 0;
+ const double p0 = cpl_polynomial_get_coeff(disp, &i0);
+ double wl;
+ double xpos = (double)(1-hsize)-xtrunc;
+ const double xmax = (double)(nself-hsize)+xtrunc;
+ double xderiv, xextreme;
+ cpl_error_code error = CPL_ERROR_NONE;
+ int iline;
+ unsigned ulines = 0;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(disp != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(lines != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(wslit > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(wfwhm > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(xtrunc > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(nself > 2 * hsize, CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(disp) == 1,
+ CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_degree(disp) > 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ /* The smallest wavelength contributing to the spectrum. */
+ wl = cpl_polynomial_eval_1d(disp, xpos, &xderiv);
+
+ if (wl <= 0.0) return
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT, __FILE__,
+ __LINE__, "Non-positive wavelength at x=%g: "
+ "P(x)=%g, P'(x)=%g", xpos, wl, xderiv);
+
+ if (xderiv <= 0.0) return
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT, __FILE__,
+ __LINE__, "Non-increasing dispersion at "
+ "x=%g: P'(x)=%g, P(x)=%g", xpos, xderiv, wl);
+
+ /* Find the 1st line */
+ iline = cpl_vector_find(xlines, wl);
+
+ /* The first line must be at least at wl */
+ if (dxlines[iline] < wl) iline++;
+
+ if (iline >= nlines) return
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_DATA_NOT_FOUND, __FILE__,
+ __LINE__, "The %d-line catalogue has only "
+ "lines below P(%g)=%g > %g", nlines, xpos,
+ wl, dxlines[nlines-1]);
+
+ memset(dself, 0, nself * sizeof(double));
+
+ dispi = cpl_polynomial_duplicate(disp);
+
+ /* Verify monotony of dispersion */
+ cpl_polynomial_derivative(dispi, 0);
+
+ prestate = cpl_errorstate_get();
+
+ if (cpl_polynomial_solve_1d(dispi, 0.5*(nlines+1), &xextreme, 1)) {
+ cpl_errorstate_set(prestate);
+ } else if (xpos < xextreme && xextreme < xmax) {
+ cpl_polynomial_delete(dispi);
+ return cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "Non-monotone "
+ "dispersion at x=%g: P'(x)=0, "
+ "P(x)=%g", xextreme,
+ cpl_polynomial_eval_1d(disp, xextreme,
+ NULL));
+ }
+
+ if (dofast) {
+ const int npix = 1+(int)xtrunc;
+
+ if (erftmp != NULL && cpl_vector_get_size(erftmp) == npix &&
+ cpl_vector_get(erftmp, 0) > 0.0) {
+ profile = cpl_vector_get_data(erftmp);
+ } else {
+
+ const double yval = 0.5 / wslit;
+ const double x0p = 0.5 * wslit + 0.5;
+ const double x0n = -0.5 * wslit + 0.5;
+ double x1diff
+ = irplib_erf_antideriv(x0p, sigma)
+ - irplib_erf_antideriv(x0n, sigma);
+ int ipix;
+
+ if (erftmp == NULL) {
+ profile = (double*)cpl_malloc(sizeof(double)*(size_t)npix);
+ } else {
+ cpl_vector_set_size(erftmp, npix);
+ profile = cpl_vector_get_data(erftmp);
+ }
+
+ profile[0] = 2.0 * yval * x1diff;
+
+ for (ipix = 1; ipix < npix; ipix++) {
+ const double x1 = (double)ipix;
+ const double x1p = x1 + 0.5 * wslit + 0.5;
+ const double x1n = x1 - 0.5 * wslit + 0.5;
+ const double x0diff = x1diff;
+
+ x1diff = irplib_erf_antideriv(x1p, sigma)
+ - irplib_erf_antideriv(x1n, sigma);
+
+ profile[ipix] = yval * (x1diff - x0diff);
+
+ }
+ }
+ }
+
+ cpl_polynomial_copy(dispi, disp);
+
+ /* FIXME: A custom version of cpl_polynomial_solve_1d() which returns
+ P'(xpos) can be used for the 1st NR-iteration. */
+ /* Further, the sign of P'(xpos) could be checked for all lines. */
+ /* Perform 1st NR-iteration in solving for P(xpos) = dxlines[iline] */
+ xpos -= (wl - dxlines[iline]) / xderiv;
+
+ /* Iterate through the lines */
+ for (; !error && iline < nlines; iline++) {
+
+ /* Lines may have a non-physical intensity (e.g. zero) to indicate some
+ property of the line, e.g. unknown intensity due to blending */
+ if (dylines[iline] <= 0.0) continue;
+
+ /* Use 1st guess, if available (Use 0.0 to flag unavailable) */
+ if (plinepix != NULL && plinepix[iline] > 0.0) xpos = plinepix[iline];
+
+ if (xpos > xmax) xpos = xmax; /* FIXME: Better to limit xpos ? */
+
+ /* Find the (sub-) pixel position of the line */
+ error = cpl_polynomial_set_coeff(dispi, &i0, p0 - dxlines[iline]) ||
+ cpl_polynomial_solve_1d(dispi, xpos, &xpos, 1);
+
+ if (xpos > xmax) {
+ if (error) {
+ error = 0;
+ cpl_msg_debug(cpl_func, "Stopping spectrum fill at line %d/%d "
+ "at xpos=%g > xmax=%g",
+ iline, nlines, xpos, xmax);
+ cpl_errorstate_dump(prestate, CPL_FALSE,
+ irplib_errorstate_dump_debug);
+ cpl_errorstate_set(prestate);
+ }
+ break;
+ } else if (error) {
+ if (linepix != NULL && ulines) (void)cpl_vector_fill(linepix, 0.0);
+ (void)cpl_error_set_message_macro(cpl_func, cpl_error_get_code(),
+ __FILE__, __LINE__,
+ "Could not find pixel-position "
+ "of line %d/%d at wavelength=%g."
+ " xpos=%g, xmax=%g",
+ iline, nlines, dxlines[iline],
+ xpos, xmax);
+ break;
+ } else if (dofast) {
+ const double frac = fabs(xpos - floor(xpos));
+#ifdef IRPLIB_WAVECAL_FAST_FAST
+ const double frac0 = 1.0 - frac; /* Weight opposite of distance */
+#else
+ /* Center intensity correctly */
+ const double ep1pw = irplib_erf_antideriv(frac + 0.5 * wslit, sigma);
+ const double en1pw = irplib_erf_antideriv(frac + 0.5 * wslit - 1.0,
+ sigma);
+ const double ep1nw = irplib_erf_antideriv(frac - 0.5 * wslit, sigma);
+ const double en1nw = irplib_erf_antideriv(frac - 0.5 * wslit - 1.0,
+ sigma);
+ const double frac0
+ = (en1nw - en1pw) / (ep1pw - en1pw - ep1nw + en1nw);
+
+#endif
+ const double frac1 = 1.0 - frac0;
+ const double yval0 = frac0 * dylines[iline];
+ const double yval1 = frac1 * dylines[iline];
+ const int npix = 1+(int)xtrunc;
+ int ipix;
+ int i0n = hsize - 1 + floor(xpos);
+ int i0p = i0n;
+ int i1n = i0n + 1;
+ int i1p = i1n;
+ cpl_boolean didline = CPL_FALSE;
+
+
+ /* Update 1st guess for next time, if available */
+ if (plinepix != NULL) plinepix[iline] = xpos;
+
+ if (frac0 < 0.0) {
+ (void)cpl_error_set_message_macro(cpl_func,
+ CPL_ERROR_UNSPECIFIED,
+ __FILE__, __LINE__,
+ "Illegal split at x=%g: %g + "
+ "%g = 1", xpos, frac0, frac1);
+#ifdef IRPLIB_WAVEVAL_DEBUG
+ } else {
+ cpl_msg_warning(cpl_func,"profile split at x=%g: %g + %g = 1",
+ xpos, frac0, frac1);
+#endif
+ }
+
+ for (ipix = 0; ipix < npix; ipix++, i0n--, i0p++, i1n--, i1p++) {
+
+ if (i0n >= 0 && i0n < nself) {
+ dself[i0n] += yval0 * profile[ipix];
+ didline = CPL_TRUE;
+ }
+ if (i1n >= 0 && i1n < nself && ipix + 1 < npix) {
+ dself[i1n] += yval1 * profile[ipix+1];
+ didline = CPL_TRUE;
+ }
+
+ if (ipix == 0) continue;
+
+ if (i0p >= 0 && i0p < nself) {
+ dself[i0p] += yval0 * profile[ipix];
+ didline = CPL_TRUE;
+ }
+ if (i1p >= 0 && i1p < nself && ipix + 1 < npix) {
+ dself[i1p] += yval1 * profile[ipix+1];
+ didline = CPL_TRUE;
+ }
+ }
+
+ if (didline) ulines++;
+
+ } else {
+ const double yval = 0.5 * dylines[iline] / wslit;
+ const int ifirst = IRPLIB_MAX((int)(xpos-xtrunc+0.5), 1-hsize);
+ const int ilast = IRPLIB_MIN((int)(xpos+xtrunc), nself-hsize);
+ int ipix;
+ const double x0 = (double)ifirst - xpos;
+ const double x0p = x0 + 0.5*wslit - 0.5;
+ const double x0n = x0 - 0.5*wslit - 0.5;
+ double x1diff
+ = irplib_erf_antideriv(x0p, sigma)
+ - irplib_erf_antideriv(x0n, sigma);
+
+ /* Update 1st guess for next time, if available */
+ if (plinepix != NULL) plinepix[iline] = xpos;
+
+ if (ilast >= ifirst) ulines++;
+
+ for (ipix = ifirst; ipix <= ilast; ipix++) {
+ const double x1 = (double)ipix - xpos;
+ const double x1p = x1 + 0.5*wslit + 0.5;
+ const double x1n = x1 - 0.5*wslit + 0.5;
+ const double x0diff = x1diff;
+
+ x1diff = irplib_erf_antideriv(x1p, sigma)
+ - irplib_erf_antideriv(x1n, sigma);
+
+ dself[ipix+hsize-1] += yval * (x1diff - x0diff);
+
+ }
+ }
+ }
+
+ cpl_polynomial_delete(dispi);
+ if (erftmp == NULL) cpl_free(profile);
+
+ cpl_ensure_code(!error, cpl_error_get_code());
+
+ if (dolog) {
+ int i;
+ for (i = 0; i < nself; i++) {
+ dself[i] = dself[i] > 0.0 ? log(1.0 + dself[i]) : 0.0;
+ }
+ }
+
+ if (!ulines) return
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ __FILE__, __LINE__, "The %d-line "
+ "catalogue has no lines in the range "
+ "%g -> P(%g)=%g", nlines, wl, xmax,
+ cpl_polynomial_eval_1d(disp, xmax, NULL));
+
+ if (pulines != NULL) *pulines = ulines;
+
+ return CPL_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The antiderivative of erx(x/sigma/sqrt(2)) with respect to x
+ @param x x
+ @param sigma sigma
+ @return The antiderivative
+ @note This function is even.
+
+ */
+/*----------------------------------------------------------------------------*/
+inline double irplib_erf_antideriv(double x, double sigma)
+{
+ return x * erf( x / (sigma * CPL_MATH_SQRT2))
+ + 2.0 * sigma/CPL_MATH_SQRT2PI * exp(-0.5 * x * x / (sigma * sigma));
+}
+
+
+#ifdef HAVE_GSL
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute minus the cross-correlation
+ @param self The 1D-dispersion relation
+ @param data Pointer to a irplib_multimin struct
+ @return Minus the cross-correlation or GSL_NAN on error
+ @note Just a stub so far
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_gsl_correlation(const gsl_vector * self, void * data)
+{
+
+ irplib_multimin * mindata = (irplib_multimin *)data;
+ cpl_errorstate prestate = cpl_errorstate_get();
+ int nobs, nmodel, ndiff;
+ cpl_size i;
+
+ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, GSL_NAN);
+ cpl_ensure(data != NULL, CPL_ERROR_NULL_INPUT, GSL_NAN);
+
+ cpl_ensure(mindata->filler != NULL, CPL_ERROR_NULL_INPUT, GSL_NAN);
+ cpl_ensure(mindata->observed != NULL, CPL_ERROR_NULL_INPUT, GSL_NAN);
+ cpl_ensure(mindata->spectrum != NULL, CPL_ERROR_NULL_INPUT, GSL_NAN);
+
+ nobs = cpl_vector_get_size(mindata->observed);
+ nmodel = cpl_vector_get_size(mindata->spectrum);
+ ndiff = nmodel - nobs;
+
+ cpl_ensure((ndiff & 1) == 0, CPL_ERROR_ILLEGAL_INPUT, GSL_NAN);
+
+ cpl_ensure(cpl_vector_get_size(mindata->vxc) == 1 + ndiff,
+ CPL_ERROR_ILLEGAL_INPUT, GSL_NAN);
+
+ ndiff /= 2;
+
+ for (i=0; i < (cpl_size)self->size; i++) {
+ const double value = gsl_vector_get(self, (size_t)i);
+ cpl_polynomial_set_coeff(mindata->disp1d, &i, value);
+ }
+
+ if (mindata->filler(mindata->spectrum, mindata->disp1d,
+ mindata->param, ndiff)
+ || !cpl_errorstate_is_equal(prestate)) {
+
+ /* The fill failed. Ensure the discarding of this candidate by
+ setting the cross-correlation to its minimum possible value. */
+
+ (void)cpl_vector_fill(mindata->vxc, -1.0);
+
+ mindata->maxxc = ndiff;
+
+ if (!cpl_errorstate_is_equal(prestate)) {
+ cpl_msg_debug(cpl_func, "Spectrum fill failed:");
+ cpl_errorstate_dump(prestate, CPL_FALSE,
+ irplib_errorstate_dump_debug);
+ cpl_errorstate_set(prestate);
+ }
+ } else {
+
+ mindata->maxxc = cpl_vector_correlate(mindata->vxc,
+ mindata->spectrum,
+ mindata->observed);
+ }
+
+#ifdef IRPLIB_SPC_DUMP
+ /* Need irplib_wavecal.c rev. 1.12 through 1.15 */
+ irplib_polynomial_dump_corr_step(mindata->disp1d, mindata->vxc,
+ "Optimize");
+#endif
+
+ mindata->xc = cpl_vector_get(mindata->vxc, ndiff);
+
+ if (mindata->maxxc != ndiff &&
+ cpl_vector_get(mindata->vxc, mindata->maxxc) > mindata->mxc) {
+ const irplib_base_spectrum_model * arclamp
+ = (const irplib_base_spectrum_model *)mindata->param;
+
+ if (mindata->mdisp == NULL) {
+ mindata->mdisp = cpl_polynomial_duplicate(mindata->disp1d);
+ } else {
+ cpl_polynomial_copy(mindata->mdisp, mindata->disp1d);
+ }
+ mindata->mxc = cpl_vector_get(mindata->vxc, mindata->maxxc);
+ mindata->ishift = mindata->maxxc - ndiff;
+ cpl_msg_debug(cpl_func, "Local maximum: %g(%d) > %g(%d) (cost=%u:%u. "
+ "lines=%u)", mindata->mxc, mindata->maxxc, mindata->xc,
+ ndiff, arclamp->cost, arclamp->xcost, arclamp->ulines);
+ }
+
+ return -mindata->xc;
+}
+
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Modify self by maximizing the cross-correlation across all maxima
+ @param self 1D-Dispersion relation to modify, at least of degree 1
+ @param maxdeg Maximize the cross-correlation by modifying maxdeg degree
+ @param obs The observed spectrum to correlate against
+ @param nmaxima Number of local maxima to try (0 for all, 1 for global only)
+ @param linelim Maximum number of lines allowed in iterative refinement
+ @param model The model of the lines/OTF etc.
+ @param filler The function to fill the model spectrum
+ @param pixtol The (positive) dispersion tolerance, e.g. 1e-6
+ @param pixstep The step length used in the maximization, e.g. 0.5 [pixel]
+ @param hsize Half the search-distance to ensure a global-maximum, hsize >= 0
+ @param maxite Maximum number of iterations, e.g. 100 * maxdeg
+ @param maxfail Number of retries on failure
+ @param maxcont Number of retries on non-convergence
+ @param doplot Plot the cross-correlation as a function of pixel shift
+ @param pxc On sucess, *pxc is the cross-correlation
+ @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code
+ @note Fails with CPL_ERROR_UNSUPPORTED_MODE if compiled without GSL.
+ self must be increasing in the interval from 1 to the length of obs.
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code
+irplib_polynomial_find_1d_from_correlation_all(cpl_polynomial * self,
+ int maxdeg,
+ const cpl_vector * obs,
+ int nmaxima,
+ int linelim,
+ irplib_base_spectrum_model* model,
+ cpl_error_code (* filler)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int),
+ double pixtol,
+ double pixstep,
+ int hsize,
+ int maxite,
+ int maxfail,
+ int maxcont,
+ cpl_boolean doplot,
+ double * pxc)
+{
+
+#ifdef HAVE_GSL
+
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_polynomial * start;
+ cpl_polynomial * cand;
+ cpl_polynomial * backup;
+ cpl_error_code error = CPL_ERROR_NONE;
+ double xc;
+ cpl_bivector * xtshift = cpl_bivector_new(nmaxima ? nmaxima : 1);
+ const cpl_vector * xtshiftx = cpl_bivector_get_x_const(xtshift);
+ const cpl_vector * xtshifty = cpl_bivector_get_y_const(xtshift);
+ int nshift;
+ int imaximum = -1;
+ int imaxima;
+
+#endif
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(obs != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pxc != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(cpl_polynomial_get_degree(self) > 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(maxdeg >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pixtol > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(pixstep > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(maxite >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(nmaxima >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(maxfail > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(maxcont > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(linelim >= 0, CPL_ERROR_ILLEGAL_INPUT);
+
+#ifndef HAVE_GSL
+ /* Avoid unused variable warning */
+ cpl_ensure_code(doplot == CPL_TRUE || doplot == CPL_FALSE,
+ CPL_ERROR_ILLEGAL_INPUT);
+ return cpl_error_set_message(cpl_func, CPL_ERROR_UNSUPPORTED_MODE,
+ "GSL is not available");
+#else
+
+ if (irplib_bivector_find_shift_from_correlation(xtshift, self, obs,
+ model, filler,
+ hsize, doplot, &xc)) {
+ cpl_bivector_delete(xtshift);
+ return cpl_error_set_where(cpl_func);
+ }
+
+ if (model->ulines > (unsigned)linelim) {
+ /* The initial, optimal (integer) shift */
+ const double xxc = cpl_vector_get(xtshiftx, 0);
+ const double xc0 = cpl_vector_get(xtshifty, 0);
+
+ cpl_msg_warning(cpl_func, "Doing only shift=%g pixels with lines=%u > "
+ "%d and XC=%g", xxc, model->ulines, linelim, xc0);
+
+ cpl_polynomial_shift_1d(self, 0, xxc);
+
+ *pxc = xc0;
+
+ cpl_bivector_delete(xtshift);
+
+ return CPL_ERROR_NONE;
+ }
+
+ start = cpl_polynomial_duplicate(self);
+ cand = cpl_polynomial_new(1);
+ backup = cpl_polynomial_new(1);
+
+ /* Number of (local) maxima to use as starting point of the optimization */
+ nshift = cpl_bivector_get_size(xtshift);
+ if (nmaxima == 0 || nmaxima > nshift) nmaxima = nshift;
+
+ cpl_msg_info(cpl_func, "Optimizing %d/%d local shift-maxima "
+ "(no-shift xc=%g. linelim=%d)", nmaxima, nshift, xc, linelim);
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG)
+ cpl_bivector_dump(xtshift, stdout);
+
+ for (imaxima = 0; imaxima < nmaxima; imaxima++) {
+ /* The initial, optimal (integer) shift */
+ const double xxc = cpl_vector_get(xtshiftx, imaxima);
+ double xtpixstep = pixstep;
+ double xtpixtol = pixtol;
+ double xtxc;
+ cpl_boolean ok = CPL_FALSE;
+ int nfail;
+
+
+ cpl_polynomial_copy(cand, start);
+ cpl_polynomial_shift_1d(cand, 0, xxc);
+ cpl_polynomial_copy(backup, cand);
+
+ /* Increase tolerance until convergence */
+ for (nfail = 0; nfail < maxfail; nfail++, xtpixtol *= 2.0,
+ xtpixstep *= 2.0) {
+ int restart = maxcont;
+ do {
+ error = irplib_polynomial_find_1d_from_correlation
+ (cand, maxdeg, obs, model,
+ filler, xtpixtol, xtpixstep, 2,
+ maxite, &xtxc);
+ } while (error == CPL_ERROR_CONTINUE && --restart);
+
+ if (!error) {
+ cpl_msg_debug(cpl_func, "XC(imax=%d/%d:xtpixtol=%g): %g "
+ "(cost=%u:%u)", 1+imaxima, nmaxima, xtpixtol,
+ xtxc, model->cost, model->xcost);
+ break;
+ }
+ cpl_msg_warning(cpl_func, "Increasing xtpixtol from %g (%g, imax="
+ "%d/%d)", xtpixtol, xtpixstep, 1+imaxima, nmaxima);
+ if (model->ulines > (unsigned)linelim) {
+ cpl_msg_warning(cpl_func, "Stopping search-refinement via "
+ "catalogue with %u lines > %u", model->ulines,
+ linelim);
+ break;
+ }
+ cpl_polynomial_copy(cand, start);
+ }
+
+ /* Decrease tolerance until inconvergence, keep previous */
+ for (; !error && xtpixtol > 0.0; xtpixtol *= 0.25, xtpixstep *= 0.5) {
+ int restart = maxcont;
+
+ cpl_polynomial_copy(backup, cand);
+ do {
+ error = irplib_polynomial_find_1d_from_correlation
+ (cand, maxdeg, obs, model, filler,
+ xtpixtol, xtpixstep, 2, maxite, &xtxc);
+ } while (error == CPL_ERROR_CONTINUE && --restart);
+ if (error) break;
+ ok = CPL_TRUE;
+ cpl_msg_debug(cpl_func, "XC(imax=%d/%d:xtpixtol=%g): %g (cost=%u:%u"
+ ". ulines=%u)", 1+imaxima, nmaxima, xtpixtol, xtxc,
+ model->cost, model->xcost, model->ulines);
+ if (model->ulines > (unsigned)linelim) {
+ cpl_msg_info(cpl_func, "Stopping search-refinement via "
+ "catalogue with %u lines > %u", model->ulines,
+ linelim);
+ break;
+ }
+ }
+
+ if (error) {
+ error = 0;
+ cpl_errorstate_dump(prestate, CPL_FALSE,
+ irplib_errorstate_dump_debug);
+ cpl_errorstate_set(prestate);
+ cpl_polynomial_copy(cand, backup);
+ }
+ if (ok && xtxc > xc) {
+ imaximum = imaxima;
+ cpl_polynomial_copy(self, cand);
+ xc = xtxc;
+
+ cpl_msg_info(cpl_func, "XC(imax=%d/%d): %g -> %g (initial-shift=%g. "
+ "cost=%u:%u. lines=%u)", 1+imaxima, nmaxima,
+ cpl_vector_get(xtshifty, imaxima), xtxc,
+ cpl_vector_get(xtshiftx, imaxima), model->cost,
+ model->xcost, model->ulines);
+ } else {
+ cpl_msg_info(cpl_func, "xc(imax=%d/%d): %g -> %g (initial-shift=%g. "
+ "cost=%u:%u. lines=%u)", 1+imaxima, nmaxima,
+ cpl_vector_get(xtshifty, imaxima), xtxc,
+ cpl_vector_get(xtshiftx, imaxima),
+ model->cost, model->xcost, model->ulines);
+ }
+ }
+
+ cpl_polynomial_delete(start);
+ cpl_polynomial_delete(backup);
+ cpl_polynomial_delete(cand);
+
+ if (imaximum < 0) {
+ error = cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+ "XC could not be optimized over %d "
+ "local shift-maxima (xc=%g)", nmaxima, xc);
+ } else {
+ cpl_msg_info(cpl_func, "Maximal XC=%g (up from %g, with initial pixel-"
+ "shift of %g) at %d/%d local shift-maximi", xc,
+ cpl_vector_get(xtshifty, imaximum),
+ cpl_vector_get(xtshiftx, imaximum),
+ 1+imaximum, nmaxima);
+
+ if (doplot) {
+ irplib_plot_spectrum_and_model(obs, self, model, filler);
+ }
+
+ *pxc = xc;
+ }
+
+ cpl_bivector_delete(xtshift);
+
+ return error;
+
+#endif
+
+}
+/**@}*/
diff --git a/irplib/irplib_wavecal.h b/irplib/irplib_wavecal.h
new file mode 100644
index 0000000..15189e5
--- /dev/null
+++ b/irplib/irplib_wavecal.h
@@ -0,0 +1,184 @@
+/* $Id: irplib_wavecal.h,v 1.16 2009/10/21 14:49:42 llundin Exp $
+ *
+ * This file is part of the IRPLIB Pipeline
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2009/10/21 14:49:42 $
+ * $Revision: 1.16 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_WAVECAL_H
+#define IRPLIB_WAVECAL_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define IRPLIB_WAVECAL_MODEL_COEFFS 4
+/* The number of columns is 5 + IRPLIB_WAVECAL_MODEL_COEFFS */
+#define IRPLIB_WAVECAL_MODEL_COLS 9
+
+#define IRPLIB_WAVECAL_LAB_MODE "SpecMode"
+#define IRPLIB_WAVECAL_LAB_RESID "Residual"
+#define IRPLIB_WAVECAL_LAB_ORDER "Fit_Order"
+#define IRPLIB_WAVECAL_LAB_XMIN "XMin"
+#define IRPLIB_WAVECAL_LAB_XMAX "XMax"
+#define IRPLIB_WAVECAL_LAB_C1 "C_1"
+#define IRPLIB_WAVECAL_LAB_C2 "C_2"
+#define IRPLIB_WAVECAL_LAB_C3 "C_3"
+#define IRPLIB_WAVECAL_LAB_C4 "C_4"
+
+#define IRPLIB_WAVECAL_LAB_WAVE "WAVELENGTH"
+#define IRPLIB_WAVECAL_LAB_INTENS "INTENSITY"
+
+
+/*-----------------------------------------------------------------------------
+ New Types
+ -----------------------------------------------------------------------------*/
+
+/* Any spectrum model must have these members first! */
+typedef struct {
+ unsigned cost; /* May be incremented for cost counting */
+ unsigned xcost; /* Ditto (can exclude failed fills) */
+ unsigned ulines; /* May be set to number of lines used */
+
+} irplib_base_spectrum_model;
+
+typedef struct {
+ unsigned cost; /* May be incremented for cost counting */
+ unsigned xcost; /* Ditto (can exclude failed fills) */
+ unsigned ulines; /* May be set to number of lines used */
+
+ double wslit; /* Slit Width */
+ double wfwhm; /* FWHM of transfer function */
+ double xtrunc; /* Truncate transfer function beyond xtrunc,
+ xtrunc > 0 */
+ const cpl_bivector * lines; /* Catalogue of intensities, with
+ increasing X-vector elements */
+ cpl_vector * linepix; /* Catalogue of line pixel positions
+ - zero for uninitialized */
+ cpl_vector * erftmp; /* Temporary storage for erf() values
+ - zero for uninitialized */
+} irplib_line_spectrum_model;
+
+/*-----------------------------------------------------------------------------
+ Function Prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_error_code
+irplib_polynomial_find_1d_from_correlation_all(cpl_polynomial *,
+ int,
+ const cpl_vector *,
+ int, int,
+ irplib_base_spectrum_model *,
+ cpl_error_code (*)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int),
+ double,
+ double,
+ int,
+ int,
+ int,
+ int,
+ cpl_boolean,
+ double *);
+
+cpl_error_code
+irplib_bivector_find_shift_from_correlation(cpl_bivector *,
+ const cpl_polynomial *,
+ const cpl_vector *,
+ irplib_base_spectrum_model *,
+ cpl_error_code (*)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *, int),
+ int,
+ cpl_boolean,
+ double *);
+
+cpl_error_code
+irplib_polynomial_shift_1d_from_correlation(cpl_polynomial *,
+ const cpl_vector *,
+ irplib_base_spectrum_model *,
+ cpl_error_code (*)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *, int),
+ int, cpl_boolean, double *);
+
+cpl_error_code
+irplib_polynomial_find_1d_from_correlation(cpl_polynomial *, int,
+ const cpl_vector *,
+ irplib_base_spectrum_model *,
+ cpl_error_code (*)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *, int),
+ double, double,
+ int, int, double *);
+
+cpl_error_code irplib_vector_fill_line_spectrum(cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int);
+
+cpl_error_code irplib_vector_fill_logline_spectrum(cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int);
+
+cpl_error_code
+irplib_vector_fill_line_spectrum_fast(cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int);
+
+cpl_error_code
+irplib_vector_fill_logline_spectrum_fast(cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int);
+
+cpl_error_code irplib_plot_spectrum_and_model(const cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ cpl_error_code (*)
+ (cpl_vector *,
+ const cpl_polynomial *,
+ irplib_base_spectrum_model *,
+ int));
+
+cpl_error_code irplib_polynomial_fit_2d_dispersion(cpl_polynomial *,
+ const cpl_image *,
+ int, double *);
+
+int irplib_bivector_count_positive(const cpl_bivector *, double, double);
+
+#endif
diff --git a/irplib/irplib_wavecal_impl.h b/irplib/irplib_wavecal_impl.h
new file mode 100644
index 0000000..d3e174a
--- /dev/null
+++ b/irplib/irplib_wavecal_impl.h
@@ -0,0 +1,56 @@
+/* $Id: irplib_wavecal_impl.h,v 1.6 2009/10/21 14:49:42 llundin Exp $
+ *
+ * This file is part of the IRPLIB Pipeline
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2009/10/21 14:49:42 $
+ * $Revision: 1.6 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_WAVECAL_IMPL_H
+#define IRPLIB_WAVECAL_IMPL_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include "irplib_wavecal.h"
+
+/*-----------------------------------------------------------------------------
+ Private Function Prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_error_code irplib_vector_fill_line_spectrum_model(cpl_vector *,
+ cpl_vector *,
+ cpl_vector *,
+ const cpl_polynomial *,
+ const cpl_bivector *,
+ double,
+ double,
+ double,
+ int,
+ cpl_boolean,
+ cpl_boolean,
+ unsigned *);
+
+double irplib_erf_antideriv(double, double);
+
+#endif
diff --git a/irplib/irplib_wcs.c b/irplib/irplib_wcs.c
new file mode 100644
index 0000000..7e1d622
--- /dev/null
+++ b/irplib/irplib_wcs.c
@@ -0,0 +1,391 @@
+/* $Id: irplib_wcs.c,v 1.8 2010/10/07 14:10:55 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2010/10/07 14:10:55 $
+ * $Revision: 1.8 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_wcs.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_wcs Functions related to WCS
+ */
+/*----------------------------------------------------------------------------*/
+
+static cpl_error_code irplib_wcs_is_iso8601(int, int, int, int, int, double);
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert x, y coordinates (physical) to RA, DEC (World)
+ @param wcs The World Coordinate System solution
+ @param x The X coordinate (Physical)
+ @param y The Y coordinate (Physical)
+ @param ra The RA coordinate (World) (returned)
+ @param dec The DEC coordinate (World) (returned)
+ @see cpl_wcs_convert()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_wcs_xytoradec(const cpl_wcs *wcs,
+ double x,
+ double y,
+ double *ra,
+ double *dec)
+{
+ cpl_matrix * xy;
+ cpl_matrix * radec = NULL;
+ cpl_array * status = NULL;
+ cpl_error_code error;
+
+ cpl_ensure_code(ra != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(dec != NULL, CPL_ERROR_NULL_INPUT);
+
+ /* Load up the information */
+ xy = cpl_matrix_new(1, 2);
+ cpl_matrix_set(xy, 0, 0, x);
+ cpl_matrix_set(xy, 0, 1, y);
+
+ /* Call the conversion routine */
+ error = cpl_wcs_convert(wcs, xy, &radec, &status, CPL_WCS_PHYS2WORLD);
+
+ cpl_matrix_delete(xy);
+
+ if (!error) {
+
+ /* Pass it back now */
+ *ra = cpl_matrix_get(radec, 0, 0);
+ *dec = cpl_matrix_get(radec, 0, 1);
+
+ }
+
+ /* Tidy and propagate error, if any */
+ cpl_matrix_delete(radec);
+ cpl_array_delete(status);
+
+ return cpl_error_set_where(cpl_func);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert RA, DEC (World) to x, y coordinates (physical)
+ @param wcs The World Coordinate System solution
+ @param ra The RA coordinate (World) (returned)
+ @param dec The DEC coordinate (World)
+ @param x The X coordinate (Physical) (returned)
+ @param y The Y coordinate (Physical) (returned)
+ @see cpl_wcs_convert()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_wcs_radectoxy(const cpl_wcs * wcs,
+ double ra,
+ double dec,
+ double * x,
+ double * y)
+{
+ cpl_matrix * radec;
+ cpl_matrix * xy = NULL;
+ cpl_array * status = NULL;
+ cpl_error_code error;
+
+ cpl_ensure_code(x != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(y != NULL, CPL_ERROR_NULL_INPUT);
+
+ /* Feed the matrix with RA, DEC */
+ radec = cpl_matrix_new(1, 2);
+ cpl_matrix_set(radec, 0, 0, ra);
+ cpl_matrix_set(radec, 0, 1, dec);
+
+ error = cpl_wcs_convert(wcs, radec, &xy, &status, CPL_WCS_WORLD2PHYS);
+
+ cpl_matrix_delete(radec);
+
+ if (!error) {
+
+ *x = cpl_matrix_get(xy, 0, 0);
+ *y = cpl_matrix_get(xy, 0, 1);
+
+ }
+
+ /* Tidy and propagate error, if any */
+ cpl_array_delete(status);
+ cpl_matrix_delete(xy);
+
+ return cpl_error_set_where(cpl_func);
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the great-circle distance between two points on a sphere
+ @param ra1 Right ascension of first point [degrees]
+ @param dec1 Declination of first point [degrees]
+ @param ra2 Right ascension of second point [degrees]
+ @param dec2 Declination of second point [degrees]
+ @return Non-negative distance [degrees].
+ @see http://en.wikipedia.org/wiki/Great-circle_distance (on 2005-10-23)
+ */
+/*----------------------------------------------------------------------------*/
+double irplib_wcs_great_circle_dist(double ra1,
+ double dec1,
+ double ra2,
+ double dec2)
+{
+
+ /* Convert all input from degrees to radian - and back for the result */
+ const double dra = sin( CPL_MATH_RAD_DEG * (ra2 - ra1 )/2.0 );
+ const double ddec = sin( CPL_MATH_RAD_DEG * (dec2 - dec1)/2.0 );
+
+ dec1 *= CPL_MATH_RAD_DEG;
+ dec2 *= CPL_MATH_RAD_DEG;
+
+ return 2.0 * asin(sqrt( ddec*ddec + cos(dec1)*cos(dec2)*dra*dra))
+ * CPL_MATH_DEG_RAD;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert a date from ISO-8601 to Modified Julian Date (MJD)
+ @param pmjd On success, the MJD
+ @param year The ISO-8601 Year
+ @param month The ISO-8601 Month (1 for first)
+ @param day The ISO-8601 Day (1 for first)
+ @param hour The ISO-8601 Hour (0 for first)
+ @param minute The ISO-8601 Minute (0 for first)
+ @param second The ISO-8601 Second (0 for first)
+ @return CPL_ERROR_NONE on success, otherwise the error
+ @see The conversion code in wcslib version 4.4.4
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_wcs_mjd_from_iso8601(double * pmjd, int year, int month,
+ int day, int hour, int minute,
+ double second)
+{
+
+ cpl_ensure_code(pmjd != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(!irplib_wcs_is_iso8601(year, month, day, hour, minute,
+ second), cpl_error_get_code());
+
+ /* Compute MJD. */
+ *pmjd = (double)((1461*(year - (12-month)/10 + 4712))/4
+ + (306*((month+9)%12) + 5)/10
+ - (3*((year - (12-month)/10 + 4900)/100))/4
+ + day - 2399904)
+ + (hour + (minute + second/60.0)/60.0)/24.0;
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extract an ISO-8601 date from a string
+ @param pyear The ISO-8601 Year
+ @param pmonth The ISO-8601 Month (1 for first)
+ @param pday The ISO-8601 Day (1 for first)
+ @param phour The ISO-8601 Hour (0 for first)
+ @param pminute The ISO-8601 Minute (0 for first)
+ @param psecond The ISO-8601 Second (0 for first)
+ @param iso8601 The ISO-8601 formatted string
+ @return CPL_ERROR_NONE on success, otherwise the error
+ @see irplib_wcs_mjd_from_iso8601()
+ @note The format must be the
+ standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]]
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_wcs_iso8601_from_string(int * pyear, int * pmonth,
+ int * pday, int * phour,
+ int * pminute, double * psecond,
+ const char * iso8601)
+{
+
+ /* Standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]] */
+ const char * iso8601format = "%4d-%2d-%2dT%2d:%2d:%lf";
+
+ cpl_ensure_code(pyear != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pmonth != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pday != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(phour != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pminute != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(psecond != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(iso8601 != NULL, CPL_ERROR_NULL_INPUT);
+
+ cpl_error_ensure(sscanf(iso8601, iso8601format, pyear, pmonth,
+ pday, phour, pminute, psecond) == 6,
+ CPL_ERROR_ILLEGAL_INPUT, return cpl_error_get_code(),
+ "%s is not formatted as %s", iso8601, iso8601format);
+
+ cpl_ensure_code(!irplib_wcs_is_iso8601(*pyear, *pmonth, *pday, *phour,
+ *pminute, *psecond),
+ cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert a date from a ISO-8601 string to Modified Julian Date (MJD)
+ @param pmjd On success, the MJD
+ @param iso8601 The ISO-8601 formatted string
+ @return CPL_ERROR_NONE on success, otherwise the error
+ @see irplib_wcs_iso8601_from_string(), irplib_wcs_mjd_from_iso8601()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_wcs_mjd_from_string(double * pmjd, const char * iso8601)
+{
+
+
+ int year, day, month, hour, minute;
+ double second;
+
+ return irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second, iso8601)
+ || irplib_wcs_mjd_from_iso8601(pmjd, year, month, day, hour, minute,
+ second)
+ ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert a date from Modified Julian Date (MJD) to ISO-8601
+ @param pyear The ISO-8601 Year
+ @param pmonth The ISO-8601 Month (1 for first)
+ @param pday The ISO-8601 Day (1 for first)
+ @param phour The ISO-8601 Hour (0 for first)
+ @param pminute The ISO-8601 Minute (0 for first)
+ @param psecond The ISO-8601 Second (0 for first)
+ @param mjd The MJD
+ @return CPL_ERROR_NONE on success, otherwise the error
+ @see irplib_wcs_mjd_from_iso8601()
+
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code irplib_wcs_iso8601_from_mjd(int * pyear, int * pmonth,
+ int * pday, int * phour,
+ int * pminute, double * psecond,
+ double mjd)
+{
+
+ int jd, n4, dd;
+ double t;
+
+ cpl_ensure_code(pyear != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pmonth != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pday != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(phour != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(pminute != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(psecond != NULL, CPL_ERROR_NULL_INPUT);
+
+ /* Copied from datfix() in wcslib (v. 4.4.4) */
+
+ jd = 2400001 + (int)mjd;
+
+ n4 = 4*(jd + ((2*((4*jd - 17918)/146097)*3)/4 + 1)/2 - 37);
+ dd = 10*(((n4-237)%1461)/4) + 5;
+
+ *pyear = n4/1461 - 4712;
+ *pmonth = (2 + dd/306)%12 + 1;
+ *pday = (dd%306)/10 + 1;
+
+ t = mjd - (int)mjd; /* t is now days */
+
+ t *= 24.0; /* t is now hours */
+ *phour = (int)t;
+ t = 60.0 * (t - *phour); /* t is now minutes */
+ *pminute = (int)t;
+ *psecond = 60.0 * (t - *pminute);
+
+ /* A failure here implies that this code has a bug */
+ cpl_ensure_code(!irplib_wcs_is_iso8601(*pyear, *pmonth, *pday, *phour,
+ *pminute, *psecond),
+ CPL_ERROR_UNSPECIFIED);
+
+ return CPL_ERROR_NONE;
+}
+
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Verify that the six numbers comprise a valid ISO-8601 date
+ @param year The Year
+ @param month The Month (1 for first)
+ @param day The Day (1 for first)
+ @param hour The Hour (0 for first)
+ @param minute The Minute (0 for first)
+ @param second The Second (0 for first)
+ @return CPL_ERROR_NONE on valid input, otherwise CPL_ERROR_ILLEGAL_INPUT
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code irplib_wcs_is_iso8601(int year, int month,
+ int day, int hour,
+ int minute, double second)
+{
+
+ const cpl_boolean is_leap = year % 4 ? CPL_FALSE : CPL_TRUE;
+ const int mlen[] = {0, 31, is_leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30,
+ 31, 30, 31};
+
+ cpl_ensure_code(month > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(month <= 12, CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(day > 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(day <= mlen[month], CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(minute < 60, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(minute >= 0, CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(second < 60.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(second >= 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(hour >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ /* 24:00:00 is valid ISO-8601 */
+ cpl_ensure_code(hour <= (minute > 0 || second > 0.0 ? 23 : 24),
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ return CPL_ERROR_NONE;
+}
diff --git a/irplib/irplib_wcs.h b/irplib/irplib_wcs.h
new file mode 100644
index 0000000..48d4482
--- /dev/null
+++ b/irplib/irplib_wcs.h
@@ -0,0 +1,66 @@
+/* $Id: irplib_wcs.h,v 1.7 2010/10/07 14:10:55 llundin Exp $
+ *
+ * This file is part of the irplib package
+ * Copyright (C) 2002,2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2010/10/07 14:10:55 $
+ * $Revision: 1.7 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_WCS_H
+#define IRPLIB_WCS_H
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+cpl_error_code irplib_wcs_xytoradec(const cpl_wcs * wcs,
+ double x,
+ double y,
+ double * ra,
+ double * dec);
+
+cpl_error_code irplib_wcs_radectoxy(const cpl_wcs * wcs,
+ double ra,
+ double dec,
+ double * x,
+ double * y);
+
+double irplib_wcs_great_circle_dist(double ra1,
+ double dec1,
+ double ra2,
+ double dec2);
+
+
+cpl_error_code irplib_wcs_iso8601_from_string(int *, int *, int *, int *, int *,
+ double *, const char *);
+
+cpl_error_code irplib_wcs_mjd_from_iso8601(double *, int, int, int, int, int,
+ double);
+
+cpl_error_code irplib_wcs_mjd_from_string(double *, const char *);
+
+cpl_error_code irplib_wcs_iso8601_from_mjd(int *, int *, int *, int *, int *,
+ double *, double);
+
+#endif
diff --git a/irplib/irplib_wlxcorr.c b/irplib/irplib_wlxcorr.c
new file mode 100644
index 0000000..3b116b8
--- /dev/null
+++ b/irplib/irplib_wlxcorr.c
@@ -0,0 +1,1261 @@
+/* $Id: irplib_wlxcorr.c,v 1.55 2012/01/12 11:50:41 llundin Exp $
+ *
+ * This file is part of the IRPLIB package
+ * Copyright (C) 2002,2003 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: llundin $
+ * $Date: 2012/01/12 11:50:41 $
+ * $Revision: 1.55 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <string.h>
+
+#include <cpl.h>
+
+#include "irplib_wavecal_impl.h"
+
+#include "irplib_wlxcorr.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_wlxcorr Wavelength Cross correlation w. plotting
+ *
+ * @par Synopsis:
+ * @code
+ * #include "irplib_wlxcorr.h"
+ * @endcode
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+#ifndef inline
+#define inline /* inline */
+#endif
+
+#define IRPLIB_MAX(A,B) ((A) > (B) ? (A) : (B))
+#define IRPLIB_MIN(A,B) ((A) < (B) ? (A) : (B))
+
+#define IRPLIB_PTR_SWAP(a,b) \
+ do { void * irplib_ptr_swap =(a);(a)=(b);(b)=irplib_ptr_swap; } while (0)
+
+/*-----------------------------------------------------------------------------
+ Private functions
+ -----------------------------------------------------------------------------*/
+
+static void irplib_wlxcorr_estimate(cpl_vector *, cpl_vector *,
+ const cpl_vector *,
+ const cpl_bivector *,
+ const cpl_vector *,
+ const cpl_polynomial *,
+ double, double);
+
+static int irplib_wlxcorr_signal_resample(cpl_vector *, const cpl_vector *,
+ const cpl_bivector *) ;
+static cpl_error_code cpl_vector_fill_lss_profile_symmetric(cpl_vector *,
+ double, double);
+static cpl_error_code irplib_wlcalib_fill_spectrum(cpl_vector *,
+ const cpl_bivector *,
+ const cpl_vector *,
+ const cpl_polynomial *, int);
+
+static cpl_boolean irplib_wlcalib_is_lines(const cpl_vector *,
+ const cpl_polynomial *,
+ int, double);
+
+/**@{*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the best polynomial in a given range
+ @param spectrum The spectrum vector
+ @param lines_catalog The lines catalog
+ @param degree The polynomial degree
+ @param guess_poly Guess Dispersion Polynomial
+ @param wl_error Search range around the anchor points
+ @param nsamples Number of samples around the anchor points
+ @param slitw The slit width
+ @param fwhm The spectral FWHM [pixel]
+ @param xc Cross-correlation factor (returned)
+ @param wlres The table with the calibration results or NULL
+ @param xcorrs The vector with the correlation values or NULL
+ @return the best polynomial or NULL in error case
+ @note *wlres may be NULL also when no error code is set by the function
+
+ wl_error must be of size degree+1.
+ The returned polynomial must be deallocated with cpl_polynomial_delete().
+
+ On success:
+ If wlres is non-NULL, *wlres points to a table which must be deallocated
+ with cpl_table_delete(), and if xcorrs is non-NULL, *xcorrs points to a
+ vector which must be deallocated with cpl_vector_delete().
+
+ The complexity in terms of model spectra creation is O(N^D), where N is
+ nsamples and D is the length of wl_error.
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
+ - CPL_ERROR_ILLEGAL_INPUT if the wl_error vector has not the proper
+ size (with respect to the degree) of if the degree is outside the
+ allowed range
+ - CPL_ERROR_ILLEGAL_OUTPUT if the spectral table cannot be generated
+ from the solution polynomial
+ */
+/*----------------------------------------------------------------------------*/
+cpl_polynomial * irplib_wlxcorr_best_poly(const cpl_vector * spectrum,
+ const cpl_bivector * lines_catalog,
+ int degree,
+ const cpl_polynomial * guess_poly,
+ const cpl_vector * wl_error,
+ int nsamples,
+ double slitw,
+ double fwhm,
+ double * xc,
+ cpl_table ** wlres,
+ cpl_vector ** xcorrs)
+{
+ const int spec_sz = cpl_vector_get_size(spectrum);
+ const int nfree = cpl_vector_get_size(wl_error);
+ int ntests = 1;
+ cpl_vector * model;
+ cpl_vector * vxc;
+ cpl_vector * init_pts_wl;
+ cpl_matrix * init_pts_x;
+ cpl_vector * pts_wl;
+ cpl_vector * vxcorrs;
+ cpl_vector * conv_kernel = NULL;
+ cpl_polynomial * poly_sol;
+ cpl_polynomial * poly_candi;
+ const double * pwl_error = cpl_vector_get_data_const(wl_error);
+ const double * dxc;
+ cpl_size degree_loc ;
+ const cpl_boolean symsamp = CPL_TRUE; /* init_pts_x is symmetric */
+ const cpl_boolean is_lines
+ = irplib_wlcalib_is_lines(cpl_bivector_get_x_const(lines_catalog),
+ guess_poly, spec_sz, 1.0);
+ int i;
+
+ /* FIXME: Need mode parameter for catalogue type (lines <=> profile) */
+
+ /* In case of failure */
+ if (wlres != NULL) *wlres = NULL;
+ if (xcorrs != NULL) *xcorrs = NULL;
+
+ /* Useful for knowing if resampling is used */
+ cpl_msg_debug(cpl_func, "Checking %d^%d dispersion polynomials (slitw=%g, "
+ "fwhm=%g) against %d-point observed spectrum with%s "
+ "catalog resampling", nsamples, nfree, slitw, fwhm, spec_sz,
+ is_lines ? "out" : "");
+
+ cpl_ensure(xc != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ *xc = -1.0;
+ cpl_ensure(spectrum != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(lines_catalog != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(guess_poly != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(wl_error != NULL, CPL_ERROR_NULL_INPUT, NULL);
+ cpl_ensure(nfree >= 2, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(nsamples > 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ /* FIXME: degree is redundant */
+ cpl_ensure(1 + degree == nfree, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ cpl_ensure(cpl_polynomial_get_dimension(guess_poly) == 1,
+ CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ if (nsamples > 1) {
+ /* Search place must consist of more than one point */
+ /* FIXME: The bounds should probably not be negative */
+ for (i = 0; i < nfree; i++) {
+ if (pwl_error[i] != 0.0) break;
+ }
+ cpl_ensure(i < nfree, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ }
+
+ if (!is_lines) {
+ /* Create the convolution kernel */
+ conv_kernel = irplib_wlxcorr_convolve_create_kernel(slitw, fwhm);
+ cpl_ensure(conv_kernel != NULL, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ }
+
+ /* Create initial test points */
+ init_pts_x = cpl_matrix_new(1, nfree);
+ init_pts_wl = cpl_vector_new(nfree);
+ pts_wl = cpl_vector_new(nfree);
+ for (i = 0; i < nfree; i++) {
+ const double xpos = spec_sz * i / (double)degree;
+ const double wlpos = cpl_polynomial_eval_1d(guess_poly, xpos, NULL)
+ - 0.5 * pwl_error[i];
+
+ cpl_matrix_set(init_pts_x, 0, i, xpos);
+ cpl_vector_set(init_pts_wl, i, wlpos);
+
+ ntests *= nsamples; /* Count number of tests */
+
+ }
+
+ vxcorrs = xcorrs != NULL ? cpl_vector_new(ntests) : NULL;
+
+ poly_sol = cpl_polynomial_new(1);
+ poly_candi = cpl_polynomial_new(1);
+ model = cpl_vector_new(spec_sz);
+ vxc = cpl_vector_new(1);
+ dxc = cpl_vector_get_data_const(vxc);
+
+ /* Create the polynomial candidates and estimate them */
+ for (i=0; i < ntests; i++) {
+ int idiv = i;
+ int deg;
+
+ /* Update wavelength at one anchor point - and reset wavelengths
+ to their default for any anchor point(s) at higher wavelengths */
+ for (deg = degree; deg >= 0; deg--, idiv /= nsamples) {
+ const int imod = idiv % nsamples;
+ const double wlpos = cpl_vector_get(init_pts_wl, deg)
+ + imod * pwl_error[deg] / nsamples;
+
+ /* FIXME: If wlpos causes pts_wl to be non-increasing, the
+ solution will be non-physical with no need for evaluation.
+ (*xc could be set to -1 in this case). */
+ cpl_vector_set(pts_wl, deg, wlpos);
+
+ if (imod > 0) break;
+ }
+
+ /* Generate */
+ degree_loc = (cpl_size)degree ;
+ cpl_polynomial_fit(poly_candi, init_pts_x, &symsamp, pts_wl,
+ NULL, CPL_FALSE, NULL, °ree_loc);
+ /* *** Estimate *** */
+ irplib_wlxcorr_estimate(vxc, model, spectrum, lines_catalog,
+ conv_kernel, poly_candi, slitw, fwhm);
+ if (vxcorrs != NULL) cpl_vector_set(vxcorrs, i, *dxc);
+ if (*dxc > *xc) {
+ /* Found a better solution */
+ *xc = *dxc;
+ IRPLIB_PTR_SWAP(poly_sol, poly_candi);
+ }
+ }
+
+ cpl_vector_delete(model);
+ cpl_vector_delete(vxc);
+ cpl_vector_delete(conv_kernel);
+ cpl_vector_delete(pts_wl);
+ cpl_matrix_delete(init_pts_x);
+ cpl_vector_delete(init_pts_wl);
+ cpl_polynomial_delete(poly_candi);
+
+#ifdef CPL_WLCALIB_FAIL_ON_CONSTANT
+ /* FIXME: */
+ if (cpl_polynomial_get_degree(poly_sol) == 0) {
+ cpl_polynomial_delete(poly_sol);
+ cpl_vector_delete(vxcorrs);
+ *xc = 0.0;
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT,
+ __FILE__, __LINE__, "Found a constant "
+ "dispersion");
+ cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
+ return NULL;
+ }
+#endif
+
+ if (wlres != NULL) {
+ /* FIXME: A failure in the table creation is not considered a failure
+ of the whole function call (although all outputs may be useless) */
+
+ cpl_errorstate prestate = cpl_errorstate_get();
+ /* Create the spc_table */
+ *wlres = irplib_wlxcorr_gen_spc_table(spectrum, lines_catalog, slitw,
+ fwhm, guess_poly, poly_sol);
+ if (*wlres == NULL) {
+ cpl_polynomial_delete(poly_sol);
+ cpl_vector_delete(vxcorrs);
+ *xc = -1.0;
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT,
+ __FILE__, __LINE__, "Cannot generate "
+ "infos table");
+ /* cpl_errorstate_dump(prestate, CPL_FALSE, NULL); */
+ cpl_errorstate_set(prestate);
+ return NULL;
+ }
+ }
+
+ if (xcorrs != NULL) {
+ *xcorrs = vxcorrs;
+ } else {
+ /* assert(vxcorrs == NULL); */
+ }
+
+ return poly_sol;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Generate the infos table
+ @param spectrum The spectrum vector
+ @param lines_catalog The lines catalog
+ @param slitw The slit width
+ @param fwhm The spectral FWHM [pixel]
+ @param guess_poly Guess Dispersion Polynomial
+ @param corr_poly Corrected Dispersion Polynomial
+ @return the table with the results of the calibration or NULL in error case
+
+ The returned table must be deallocated with cpl_table_delete().
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
+ - CPL_ERROR_ILLEGAL_INPUT if the spectrum cannot be generated from the
+ catalog or if the convolution kernel cannot be created
+ */
+/*----------------------------------------------------------------------------*/
+cpl_table * irplib_wlxcorr_gen_spc_table(
+ const cpl_vector * spectrum,
+ const cpl_bivector * lines_catalog,
+ double slitw,
+ double fwhm,
+ const cpl_polynomial * guess_poly,
+ const cpl_polynomial * corr_poly)
+{
+
+ cpl_vector * conv_kernel = NULL;
+ cpl_bivector * gen_init ;
+ cpl_bivector * gen_corr ;
+ cpl_table * spc_table ;
+ const double * pgen ;
+ const double xtrunc = 0.5 * slitw + 5.0 * fwhm * CPL_MATH_SIG_FWHM;
+ const int spec_sz = cpl_vector_get_size(spectrum);
+ const cpl_boolean guess_resamp
+ = !irplib_wlcalib_is_lines(cpl_bivector_get_x_const(lines_catalog),
+ guess_poly, spec_sz, 1.0);
+ const cpl_boolean corr_resamp
+ = !irplib_wlcalib_is_lines(cpl_bivector_get_x_const(lines_catalog),
+ corr_poly, spec_sz, 1.0);
+ cpl_error_code error;
+
+ cpl_msg_debug(cpl_func, "Tabel for guess dispersion polynomial (slitw=%g, "
+ "fwhm=%g) with %d-point observed spectrum with%s catalog re"
+ "sampling", slitw, fwhm, spec_sz, guess_resamp ? "out" : "");
+ cpl_msg_debug(cpl_func, "Tabel for corr. dispersion polynomial (slitw=%g, "
+ "fwhm=%g) with %d-point observed spectrum with%s catalog re"
+ "sampling", slitw, fwhm, spec_sz, corr_resamp ? "out" : "");
+
+ /* Test inputs */
+ cpl_ensure(spectrum, CPL_ERROR_NULL_INPUT, NULL) ;
+ cpl_ensure(lines_catalog, CPL_ERROR_NULL_INPUT, NULL) ;
+ cpl_ensure(guess_poly, CPL_ERROR_NULL_INPUT, NULL) ;
+ cpl_ensure(corr_poly, CPL_ERROR_NULL_INPUT, NULL) ;
+
+ /* Create the convolution kernel */
+ if (guess_resamp || corr_resamp) {
+ conv_kernel = irplib_wlxcorr_convolve_create_kernel(slitw, fwhm);
+
+ if (conv_kernel == NULL) {
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "Cannot create "
+ "convolution kernel") ;
+ return NULL ;
+ }
+ }
+
+ /* Get the emission at initial wavelengths */
+ gen_init = cpl_bivector_new(spec_sz);
+ if (guess_resamp) {
+ error = irplib_wlcalib_fill_spectrum(cpl_bivector_get_y(gen_init),
+ lines_catalog, conv_kernel,
+ guess_poly, 0);
+ } else {
+ error = irplib_vector_fill_line_spectrum_model
+ (cpl_bivector_get_y(gen_init), NULL, NULL,
+ guess_poly, lines_catalog,
+ slitw, fwhm, xtrunc, 0, CPL_FALSE, CPL_FALSE, NULL);
+ }
+
+ if (error || cpl_vector_fill_polynomial(cpl_bivector_get_x(gen_init),
+ guess_poly, 1, 1)) {
+ cpl_vector_delete(conv_kernel);
+ cpl_bivector_delete(gen_init);
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "Cannot get the "
+ "emission spectrum");
+ return NULL;
+ }
+
+ /* Get the emission at corrected wavelengths */
+ gen_corr = cpl_bivector_new(spec_sz);
+ if (corr_resamp) {
+ error = irplib_wlcalib_fill_spectrum(cpl_bivector_get_y(gen_corr),
+ lines_catalog, conv_kernel,
+ corr_poly, 0);
+ } else {
+ error = irplib_vector_fill_line_spectrum_model
+ (cpl_bivector_get_y(gen_corr), NULL, NULL,
+ corr_poly, lines_catalog,
+ slitw, fwhm, xtrunc, 0, CPL_FALSE, CPL_FALSE, NULL);
+ }
+
+ if (error || cpl_vector_fill_polynomial(cpl_bivector_get_x(gen_corr),
+ corr_poly, 1, 1)) {
+ cpl_vector_delete(conv_kernel);
+ cpl_bivector_delete(gen_init);
+ cpl_bivector_delete(gen_corr) ;
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "Cannot get the "
+ "emission spectrum");
+ return NULL;
+ }
+ cpl_vector_delete(conv_kernel) ;
+
+ /* Create the ouput table */
+ spc_table = cpl_table_new(spec_sz);
+ cpl_table_new_column(spc_table, IRPLIB_WLXCORR_COL_WAVELENGTH,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(spc_table, IRPLIB_WLXCORR_COL_CAT_INIT,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(spc_table, IRPLIB_WLXCORR_COL_CAT_FINAL,
+ CPL_TYPE_DOUBLE);
+ cpl_table_new_column(spc_table, IRPLIB_WLXCORR_COL_OBS, CPL_TYPE_DOUBLE);
+
+ /* Update table */
+ pgen = cpl_bivector_get_x_data_const(gen_corr) ;
+ cpl_table_copy_data_double(spc_table, IRPLIB_WLXCORR_COL_WAVELENGTH, pgen) ;
+ pgen = cpl_bivector_get_y_data_const(gen_corr) ;
+ cpl_table_copy_data_double(spc_table, IRPLIB_WLXCORR_COL_CAT_FINAL, pgen) ;
+ pgen = cpl_vector_get_data_const(spectrum) ;
+ cpl_table_copy_data_double(spc_table, IRPLIB_WLXCORR_COL_OBS, pgen) ;
+ pgen = cpl_bivector_get_y_data_const(gen_init) ;
+ cpl_table_copy_data_double(spc_table, IRPLIB_WLXCORR_COL_CAT_INIT, pgen);
+ cpl_bivector_delete(gen_init);
+ cpl_bivector_delete(gen_corr);
+
+ return spc_table ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Extract a sub catalog
+ @param lines_catalog Bivector with the lines
+ @param wave_min The wavelength min
+ @param wave_max The wavelength max
+ @return the extracted bivector or NULL in error case
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
+ - CPL_ERROR_ILLEGAL_INPUT if the specified wavelength range is invalid
+ */
+/*----------------------------------------------------------------------------*/
+cpl_bivector * irplib_wlxcorr_cat_extract(
+ const cpl_bivector * lines_catalog,
+ double wave_min,
+ double wave_max)
+{
+ const int nlines = cpl_bivector_get_size(lines_catalog);
+ int wave_min_id, wave_max_id ;
+ cpl_vector * sub_cat_wl ;
+ cpl_vector * sub_cat_int ;
+ const cpl_vector * xlines = cpl_bivector_get_x_const(lines_catalog);
+ const double * dxlines = cpl_vector_get_data_const(xlines);
+
+ cpl_ensure(lines_catalog != NULL, CPL_ERROR_NULL_INPUT, NULL);
+
+ /* Find the 1st line */
+ wave_min_id = cpl_vector_find(xlines, wave_min);
+ /* The first line must be greater than (at least?) wave_min */
+ if (dxlines[wave_min_id] <= wave_min) wave_min_id++;
+
+ /* Find the last line */
+ wave_max_id = cpl_vector_find(xlines, wave_max);
+ /* The last line must be less than wave_max */
+ if (dxlines[wave_max_id] >= wave_min) wave_max_id--;
+
+ /* Checking the wavelength range at this point via the indices also
+ verifies that they were not found using non-increasing wavelengths */
+ cpl_ensure(wave_min_id <= wave_max_id, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ if (wave_min_id < 0 || wave_max_id == nlines) {
+ cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "The %d-line catalogue "
+ "has no lines in the range %g -> %g",
+ nlines, wave_min, wave_max);
+ return NULL ;
+ }
+
+ sub_cat_wl = cpl_vector_extract(xlines, wave_min_id, wave_max_id, 1);
+ sub_cat_int = cpl_vector_extract(cpl_bivector_get_y_const(lines_catalog),
+ wave_min_id, wave_max_id, 1);
+
+ return cpl_bivector_wrap_vectors(sub_cat_wl, sub_cat_int);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create Right Half of a symmetric smoothing kernel
+ @param slitw The slit width [pixel]
+ @param fwhm The spectral FWHM [pixel]
+ @return Right Half of (symmetric) smoothing vector
+
+ The smoothing function is the right half of the convolution of a Gaussian with
+ sigma = fwhm / (2 * sqrt(2*log(2))) and a top-hat with a width equal to the
+ slit width, and area 1.
+ Since this function is symmetric only the central, maximum value and the
+ right half is returned. The length of the resulting vector is
+ 1 + 5 * sigma + slitw/2
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_ILLEGAL_INPUT if the slit width or fwhm is non-positive
+ */
+/*----------------------------------------------------------------------------*/
+cpl_vector * irplib_wlxcorr_convolve_create_kernel(double slitw,
+ double fwhm)
+{
+ const double sigma = fwhm * CPL_MATH_SIG_FWHM;
+ const int size = 1 + (int)(5.0 * sigma + 0.5*slitw);
+ cpl_vector * kernel = cpl_vector_new(size);
+
+
+ if (cpl_vector_fill_lss_profile_symmetric(kernel, slitw, fwhm)) {
+ cpl_vector_delete(kernel);
+ cpl_ensure(0, cpl_error_get_code(), NULL);
+ }
+
+ return kernel;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convolve a 1d-signal with a symmetric 1D-signal
+ @param smoothed Preallocated vector to be smoothed in place
+ @param conv_kernel Vector with symmetric convolution function
+ @return 0 or -1 in error case
+
+ The length of conv_kernel must be smaller than that of smoothed.
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
+ - CPL_ERROR_ILLEGAL_INPUT if conv_kernel is longer than smoothed
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_wlxcorr_convolve(
+ cpl_vector * smoothed,
+ const cpl_vector * conv_kernel)
+{
+ int nsamples ;
+ int ihwidth ;
+ cpl_vector * raw ;
+ double * psmoothe ;
+ double * praw ;
+ const double* psymm ;
+ int i, j ;
+
+ /* Test entries */
+ cpl_ensure(smoothed, CPL_ERROR_NULL_INPUT, -1) ;
+ cpl_ensure(conv_kernel, CPL_ERROR_NULL_INPUT, -1) ;
+
+ /* Initialise */
+ nsamples = cpl_vector_get_size(smoothed) ;
+ ihwidth = cpl_vector_get_size(conv_kernel) - 1 ;
+ cpl_ensure(ihwidth<nsamples, CPL_ERROR_ILLEGAL_INPUT, -1) ;
+ psymm = cpl_vector_get_data_const(conv_kernel) ;
+ psmoothe = cpl_vector_get_data(smoothed) ;
+
+ /* Create raw vector */
+ raw = cpl_vector_duplicate(smoothed) ;
+ praw = cpl_vector_get_data(raw) ;
+
+ /* Convolve with the symmetric function */
+ for (i=0 ; i<ihwidth ; i++) {
+ psmoothe[i] = praw[i] * psymm[0];
+ for (j=1 ; j <= ihwidth ; j++) {
+ const int k = i-j < 0 ? 0 : i-j;
+ psmoothe[i] += (praw[k]+praw[i+j]) * psymm[j];
+ }
+ }
+
+ for (i=ihwidth ; i<nsamples-ihwidth ; i++) {
+ psmoothe[i] = praw[i] * psymm[0];
+ for (j=1 ; j<=ihwidth ; j++)
+ psmoothe[i] += (praw[i-j]+praw[i+j]) * psymm[j];
+ }
+ for (i=nsamples-ihwidth ; i<nsamples ; i++) {
+ psmoothe[i] = praw[i] * psymm[0];
+ for (j=1 ; j<=ihwidth ; j++) {
+ const int k = i+j > nsamples-1 ? nsamples - 1 : i+j;
+ psmoothe[i] += (praw[k]+praw[i-j]) * psymm[j];
+ }
+ }
+ cpl_vector_delete(raw) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Plot the wavelength solution
+ @param init The initial guess
+ @param comp The computed solution
+ @param sol The real solution or NULL if not available
+ @param pix_start The first pixel
+ @param pix_stop The last pixel
+ @return 0 if ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_wlxcorr_plot_solution(
+ const cpl_polynomial * init,
+ const cpl_polynomial * comp,
+ const cpl_polynomial * sol,
+ int pix_start,
+ int pix_stop)
+{
+ int nsamples, nplots ;
+ cpl_vector ** vectors ;
+ cpl_bivector * bivector ;
+ double diff ;
+ int i ;
+
+ /* Test entries */
+ if (init == NULL || comp == NULL) return -1 ;
+
+ /* Initialise */
+ nsamples = pix_stop - pix_start + 1 ;
+ if (sol != NULL) nplots = 3 ;
+ else nplots = 2 ;
+
+ /* Create vectors */
+ vectors = cpl_malloc((nplots+1)*sizeof(cpl_vector*)) ;
+ for (i=0 ; i<nplots+1 ; i++) vectors[i] = cpl_vector_new(nsamples) ;
+
+ /* First plot with the lambda/pixel relation */
+ /* Fill vectors */
+ for (i=0 ; i<nsamples ; i++) {
+ cpl_vector_set(vectors[0], i, pix_start+i) ;
+ cpl_vector_set(vectors[1], i,
+ cpl_polynomial_eval_1d(init, (double)(pix_start+i), NULL)) ;
+ cpl_vector_set(vectors[2], i,
+ cpl_polynomial_eval_1d(comp, (double)(pix_start+i), NULL)) ;
+ if (sol != NULL)
+ cpl_vector_set(vectors[3], i,
+ cpl_polynomial_eval_1d(sol, (double)(pix_start+i), NULL)) ;
+ }
+
+ /* Plot */
+ cpl_plot_vectors("set grid;set xlabel 'Position (pixels)';",
+ "t '1-Initial / 2-Computed / 3-Solution' w lines",
+ "", (const cpl_vector **)vectors, nplots+1);
+
+ /* Free vectors */
+ for (i=0 ; i<nplots+1 ; i++) cpl_vector_delete(vectors[i]) ;
+ cpl_free(vectors) ;
+
+ /* Allocate vectors */
+ nplots -- ;
+ vectors = cpl_malloc((nplots+1)*sizeof(cpl_vector*)) ;
+ for (i=0 ; i<nplots+1 ; i++) vectors[i] = cpl_vector_new(nsamples) ;
+
+ /* Second plot with the delta-lambda/pixel relation */
+ /* Fill vectors */
+ for (i=0 ; i<nsamples ; i++) {
+ cpl_vector_set(vectors[0], i, pix_start+i) ;
+ diff = cpl_polynomial_eval_1d(comp, (double)(pix_start+i), NULL) -
+ cpl_polynomial_eval_1d(init, (double)(pix_start+i), NULL) ;
+ cpl_vector_set(vectors[1], i, diff) ;
+ if (sol != NULL) {
+ diff = cpl_polynomial_eval_1d(sol, (double)(pix_start+i), NULL) -
+ cpl_polynomial_eval_1d(init, (double)(pix_start+i), NULL) ;
+ cpl_vector_set(vectors[2], i, diff) ;
+ }
+ }
+
+ /* Plot */
+ if (sol == NULL) {
+ bivector = cpl_bivector_wrap_vectors(vectors[0], vectors[1]) ;
+ cpl_plot_bivector(
+"set grid;set xlabel 'Position (pixels)';set ylabel 'Wavelength difference';",
+ "t 'Computed-Initial wavelenth' w lines", "", bivector);
+ cpl_bivector_unwrap_vectors(bivector) ;
+ } else {
+ cpl_plot_vectors("set grid;set xlabel 'Position (pixels)';",
+ "t '1-Computed - Initial / 2--Solution - Initial' w lines",
+ "", (const cpl_vector **)vectors, nplots+1);
+ }
+
+ /* Free vectors */
+ for (i=0 ; i<nplots+1 ; i++) cpl_vector_delete(vectors[i]) ;
+ cpl_free(vectors) ;
+
+ /* Return */
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Plot the spectral table
+ @param spc_table The spectral table
+ @param title A title
+ @return 0 if ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_wlxcorr_plot_spc_table(
+ const cpl_table * spc_table,
+ const char * title)
+{
+ char title_loc[1024] ;
+ cpl_vector ** vectors ;
+ cpl_vector ** sub_vectors ;
+ cpl_vector * tmp_vec ;
+ int nsamples ;
+ double max, mean1, mean3 ;
+ int start_ind, stop_ind, nblines, hsize_pix ;
+ int i, j ;
+
+ /* Test entries */
+ if (spc_table == NULL) return -1 ;
+
+ /* Initialise */
+ nsamples = cpl_table_get_nrow(spc_table) ;
+ hsize_pix = 10 ;
+ nblines = 0 ;
+ sprintf(title_loc,
+ "t '%s - 1-Initial catalog/2-Corrected catalog/3-Observed' w lines",
+ title) ;
+ title_loc[1023] = (char)0 ;
+
+ vectors = cpl_malloc(4*sizeof(cpl_vector*)) ;
+ vectors[0] = cpl_vector_wrap(nsamples,
+ cpl_table_get_data_double((cpl_table*)spc_table,
+ IRPLIB_WLXCORR_COL_WAVELENGTH));
+ vectors[1] = cpl_vector_wrap(nsamples,
+ cpl_table_get_data_double((cpl_table*)spc_table,
+ IRPLIB_WLXCORR_COL_CAT_INIT));
+ vectors[2] = cpl_vector_wrap(nsamples,
+ cpl_table_get_data_double((cpl_table*)spc_table,
+ IRPLIB_WLXCORR_COL_CAT_FINAL));
+ vectors[3] = cpl_vector_wrap(nsamples,
+ cpl_table_get_data_double((cpl_table*)spc_table,
+ IRPLIB_WLXCORR_COL_OBS)) ;
+
+ /* Scale the signal for a bettre display */
+ mean1 = cpl_vector_get_mean(vectors[1]) ;
+ mean3 = cpl_vector_get_mean(vectors[3]) ;
+ if (fabs(mean3) > 1)
+ cpl_vector_multiply_scalar(vectors[3], fabs(mean1/mean3)) ;
+
+ cpl_plot_vectors("set grid;set xlabel 'Wavelength (nm)';", title_loc,
+ "", (const cpl_vector **)vectors, 4);
+
+ /* Unscale the signal */
+ if (fabs(mean3) > 1)
+ cpl_vector_multiply_scalar(vectors[3], mean3/mean1) ;
+
+ /* Loop on the brightest lines and zoom on them */
+ sprintf(title_loc,
+"t '%s - 1-Initial catalog/2-Corrected catalog/3-Observed (ZOOMED)' w lines",
+ title) ;
+ title_loc[1023] = (char)0 ;
+ tmp_vec = cpl_vector_duplicate(vectors[2]) ;
+ for (i=0 ; i<nblines ; i++) {
+ /* Find the brightest line */
+ if ((max = cpl_vector_get_max(tmp_vec)) <= 0.0) break ;
+ for (j=0 ; i<nsamples ; j++) {
+ if (cpl_vector_get(tmp_vec, j) == max) break ;
+ }
+ if (j-hsize_pix < 0) start_ind = 0 ;
+ else start_ind = j-hsize_pix ;
+ if (j+hsize_pix > nsamples-1) stop_ind = nsamples-1 ;
+ else stop_ind = j+hsize_pix ;
+ for (j=start_ind ; j<=stop_ind ; j++) cpl_vector_set(tmp_vec, j, 0.0) ;
+
+ sub_vectors = cpl_malloc(4*sizeof(cpl_vector*)) ;
+ sub_vectors[0]=cpl_vector_extract(vectors[0],start_ind,stop_ind,1);
+ sub_vectors[1]=cpl_vector_extract(vectors[1],start_ind,stop_ind,1);
+ sub_vectors[2]=cpl_vector_extract(vectors[2],start_ind,stop_ind,1);
+ sub_vectors[3]=cpl_vector_extract(vectors[3],start_ind,stop_ind,1);
+
+ cpl_plot_vectors("set grid;set xlabel 'Wavelength (nm)';", title_loc,
+ "", (const cpl_vector **)sub_vectors, 4);
+
+ cpl_vector_delete(sub_vectors[0]) ;
+ cpl_vector_delete(sub_vectors[1]) ;
+ cpl_vector_delete(sub_vectors[2]) ;
+ cpl_vector_delete(sub_vectors[3]) ;
+ cpl_free(sub_vectors) ;
+ }
+ cpl_vector_delete(tmp_vec) ;
+
+ cpl_vector_unwrap(vectors[0]) ;
+ cpl_vector_unwrap(vectors[1]) ;
+ cpl_vector_unwrap(vectors[2]) ;
+ cpl_vector_unwrap(vectors[3]) ;
+ cpl_free(vectors) ;
+
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Plot a part of the catalog
+ @param cat The catalog
+ @param wmin The minimum wavelength
+ @param wmax The maximum wavelength
+ @return 0 if ok, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+int irplib_wlxcorr_catalog_plot(
+ const cpl_bivector * cat,
+ double wmin,
+ double wmax)
+{
+ int start, stop ;
+ cpl_bivector * subcat ;
+ cpl_vector * subcat_x ;
+ cpl_vector * subcat_y ;
+ const double * pwave ;
+ int nvals, nvals_tot ;
+ int i ;
+
+ /* Test entries */
+ if (cat == NULL) return -1 ;
+ if (wmax <= wmin) return -1 ;
+
+ /* Initialise */
+ nvals_tot = cpl_bivector_get_size(cat) ;
+
+ /* Count the nb of values */
+ pwave = cpl_bivector_get_x_data_const(cat) ;
+ if (pwave[0] >= wmin) start = 0 ;
+ else start = -1 ;
+ if (pwave[nvals_tot-1] <= wmax) stop = nvals_tot-1 ;
+ else stop = -1 ;
+ i=0 ;
+ while ((pwave[i] < wmin) && (i<nvals_tot-1)) i++ ;
+ start = i ;
+ i= nvals_tot-1 ;
+ while ((pwave[i] > wmax) && (i>0)) i-- ;
+ stop = i ;
+
+ if (start>=stop) {
+ cpl_msg_error(cpl_func, "Cannot plot the catalog") ;
+ return -1 ;
+ }
+ nvals = start - stop + 1 ;
+
+ /* Create the bivector to plot */
+ subcat_x = cpl_vector_extract(cpl_bivector_get_x_const(cat),start,stop, 1) ;
+ subcat_y = cpl_vector_extract(cpl_bivector_get_y_const(cat),start,stop, 1) ;
+ subcat = cpl_bivector_wrap_vectors(subcat_x, subcat_y) ;
+
+ /* Plot */
+ if (nvals > 500) {
+ cpl_plot_bivector(
+ "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Emission';",
+ "t 'Catalog Spectrum' w lines", "", subcat);
+ } else {
+ cpl_plot_bivector(
+ "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Emission';",
+ "t 'Catalog Spectrum' w impulses", "", subcat);
+ }
+ cpl_bivector_unwrap_vectors(subcat) ;
+ cpl_vector_delete(subcat_x) ;
+ cpl_vector_delete(subcat_y) ;
+
+ return 0 ;
+}
+
+/**@}*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Estimate a possible solution
+ @param vxc The vector of cross-correlation(s) to be filled
+ @param model The model spectrum
+ @param spectrum The observed spectrum
+ @param lines_catalog The lines catalog
+ @param conv_kernel The convolution kernel, or NULL for line spectrum
+ @param poly_candi Candidate Polynomial
+ @param slitw The slit width [pixel]
+ @param fwhm The spectral FWHM [pixel]
+ @return void
+ @note vxc is filled with 0.0 on failure, errors are reset
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_wlxcorr_estimate(cpl_vector * vxc,
+ cpl_vector * model,
+ const cpl_vector * spectrum,
+ const cpl_bivector * lines_catalog,
+ const cpl_vector * conv_kernel,
+ const cpl_polynomial * poly_candi,
+ double slitw,
+ double fwhm)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ const int hsize = cpl_vector_get_size(vxc) / 2;
+
+ if (conv_kernel != NULL) {
+ irplib_wlcalib_fill_spectrum(model, lines_catalog, conv_kernel,
+ poly_candi, hsize);
+ } else {
+ const double xtrunc = 0.5 * slitw + 5.0 * fwhm * CPL_MATH_SIG_FWHM;
+
+ irplib_vector_fill_line_spectrum_model(model, NULL, NULL, poly_candi,
+ lines_catalog, slitw, fwhm,
+ xtrunc, 0, CPL_FALSE, CPL_FALSE,
+ NULL);
+ }
+
+ if (cpl_errorstate_is_equal(prestate))
+ cpl_vector_correlate(vxc, model, spectrum);
+
+ if (!cpl_errorstate_is_equal(prestate)) {
+ cpl_vector_fill(vxc, 0.0);
+
+ /* cpl_errorstate_dump(prestate, CPL_FALSE, NULL); */
+ cpl_errorstate_set(prestate);
+
+ }
+
+ return;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Try to guess if a catalogue is a sampled profile or (arc) lines
+ @param wavelengths Cector with the wavelengths of the catalogue
+ @param disp1d The 1D-polynomial for the wavelengths
+ @param spec_sz The spectrum size
+ @param tol The line tolerance [lines/pixel]
+ @return CPL_TRUE iff the catalogue is a line catalogue
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_boolean irplib_wlcalib_is_lines(const cpl_vector * wavelengths,
+ const cpl_polynomial * disp1d,
+ int spec_sz,
+ double tol)
+{
+ const int nlines = cpl_vector_get_size(wavelengths);
+ /* The dispersion on the detector center */
+ const double dispersion = cpl_polynomial_eval_1d_diff(disp1d,
+ 0.5 * spec_sz + 1.0,
+ 0.5 * spec_sz,
+ NULL);
+ const double range = cpl_vector_get(wavelengths, nlines-1)
+ - cpl_vector_get(wavelengths, 0);
+
+ cpl_ensure(wavelengths != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
+ cpl_ensure(disp1d != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
+ cpl_ensure(cpl_polynomial_get_dimension(disp1d) == 1,
+ CPL_ERROR_ILLEGAL_INPUT, CPL_FALSE);
+ cpl_ensure(range > 0.0, CPL_ERROR_ILLEGAL_INPUT, CPL_FALSE);
+
+ return nlines * fabs(dispersion) <= tol * fabs(range) ? CPL_TRUE
+ : CPL_FALSE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Construct the model spectrum at the given wavelengths
+ @param self Vector to fill
+ @param lines_catalog Bivector with the lines
+ @param slitw The slit width
+ @param fwhm The spectral FWHM [pixel]
+ @param poly the polynomial for the wavelengths
+ @param search_hs the half size of the searching zone
+ @return CPL_ERROR_NONE or the relevant CPL eror on failure
+
+ The expected emission is a model spectrum used to cross-correlate
+ against an actual observed spectrum.
+ Its size is nsamples + 2 * search_hs
+ */
+/*----------------------------------------------------------------------------*/
+static
+cpl_error_code irplib_wlcalib_fill_spectrum(cpl_vector * self,
+ const cpl_bivector * lines_catalog,
+ const cpl_vector * conv_kernel,
+ const cpl_polynomial * poly,
+ int search_hs)
+{
+
+
+ const int size = cpl_vector_get_size(self);
+ const int nlines = cpl_bivector_get_size(lines_catalog);
+ const cpl_vector * xlines = cpl_bivector_get_x_const(lines_catalog);
+ const double * dxlines = cpl_vector_get_data_const(xlines);
+ cpl_bivector * sub_cat ;
+ cpl_vector * sub_cat_x;
+ cpl_vector * sub_cat_y;
+ cpl_vector * wl_limits;
+ double wave_min, wave_max;
+ int wave_min_id, wave_max_id;
+ int nsub;
+ int error;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(lines_catalog != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(conv_kernel != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(poly != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(size > 0, CPL_ERROR_ILLEGAL_INPUT);
+
+
+ /* Resample the spectrum */
+ wl_limits = cpl_vector_new(size + 1);
+ cpl_vector_fill_polynomial(wl_limits, poly, 0.5 - search_hs, 1);
+
+ /* The spectrum wavelength bounds */
+ wave_min = cpl_vector_get(wl_limits, 0);
+ wave_max = cpl_vector_get(wl_limits, size);
+
+ /* Find the 1st line */
+ wave_min_id = cpl_vector_find(xlines, wave_min);
+ /* The first line must be less than or equal to wave_min */
+ if (dxlines[wave_min_id] > wave_min) wave_min_id--;
+
+ if (wave_min_id < 0) {
+ cpl_vector_delete(wl_limits);
+ return cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "The %d-line "
+ "catalogue only has lines above %g",
+ nlines, wave_min);
+ }
+
+ /* Find the last line */
+ wave_max_id = cpl_vector_find(xlines, wave_max);
+ /* The last line must be greater than or equal to wave_max */
+ if (dxlines[wave_max_id] < wave_max) wave_max_id++;
+
+ if (wave_max_id == nlines) {
+ cpl_vector_delete(wl_limits);
+ return cpl_error_set_message_macro(cpl_func, CPL_ERROR_ILLEGAL_INPUT,
+ __FILE__, __LINE__, "The %d-line "
+ "catalogue only has lines below %g",
+ nlines, wave_max);
+ }
+
+ /* Checking the wavelength range at this point via the indices also
+ verifies that they were not found using non-increasing wavelengths */
+ nsub = 1 + wave_max_id - wave_min_id;
+ cpl_ensure_code(nsub > 1, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Wrap a new bivector around the relevant part of the catalog */
+ /* The data is _not_ modified */
+ sub_cat_x = cpl_vector_wrap(nsub, wave_min_id + (double*)dxlines);
+ sub_cat_y = cpl_vector_wrap(nsub, wave_min_id + (double*)
+ cpl_bivector_get_y_data_const(lines_catalog));
+ sub_cat = cpl_bivector_wrap_vectors(sub_cat_x, sub_cat_y);
+
+ /* High resolution catalog */
+ error = irplib_wlxcorr_signal_resample(self, wl_limits, sub_cat);
+
+ cpl_vector_delete(wl_limits);
+ cpl_bivector_unwrap_vectors(sub_cat);
+ (void)cpl_vector_unwrap(sub_cat_x);
+ (void)cpl_vector_unwrap(sub_cat_y);
+
+ cpl_ensure_code(!error, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Smooth the instrument resolution */
+ cpl_ensure_code(!irplib_wlxcorr_convolve(self, conv_kernel),
+ cpl_error_get_code());
+
+ return CPL_ERROR_NONE;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Smoothe a 1d-signal by averaging it
+ @param resampled Preallocated vector to hold resampled signal
+ @param xbounds Vector with the wavelengths boundaries
+ @param hires Bivector with the high resolution signal
+ @return 0 if ok, -1 otherwise
+
+ The length of xbouns must be one higher than that of the resampled signal.
+ */
+/*----------------------------------------------------------------------------*/
+static int irplib_wlxcorr_signal_resample(
+ cpl_vector * resampled,
+ const cpl_vector * xbounds,
+ const cpl_bivector * hires)
+{
+ const int hrsize = cpl_bivector_get_size(hires);
+ const cpl_vector* xhires ;
+ const cpl_vector* yhires ;
+ const double * pxhires ;
+ const double * pyhires ;
+ const double * pxbounds ;
+ cpl_vector * ybounds ;
+ cpl_bivector * boundary ;
+ double * pybounds ;
+ double * presampled ;
+ int nsamples ;
+ int i, itt ;
+
+ /* Test entries */
+ if ((!resampled) || (!xbounds) || (!hires)) return -1 ;
+
+ /* Initialise */
+ nsamples = cpl_vector_get_size(resampled) ;
+
+ /* Initialise */
+ presampled = cpl_vector_get_data(resampled) ;
+ pxbounds = cpl_vector_get_data_const(xbounds) ;
+ xhires = cpl_bivector_get_x_const(hires) ;
+ yhires = cpl_bivector_get_y_const(hires) ;
+ pxhires = cpl_vector_get_data_const(xhires) ;
+ pyhires = cpl_vector_get_data_const(yhires) ;
+
+ /* Create a new vector */
+ ybounds = cpl_vector_new(cpl_vector_get_size(xbounds)) ;
+ boundary = cpl_bivector_wrap_vectors((cpl_vector*)xbounds,ybounds) ;
+ pybounds = cpl_vector_get_data(ybounds) ;
+
+ /* Test entries */
+ if (cpl_bivector_get_size(boundary) != nsamples + 1) {
+ cpl_bivector_unwrap_vectors(boundary) ;
+ cpl_vector_delete(ybounds) ;
+ return -1 ;
+ }
+
+ /* Get the ind */
+ itt = cpl_vector_find(xhires, pxbounds[0]);
+
+ /* Interpolate the signal */
+ if (cpl_bivector_interpolate_linear(boundary, hires)) {
+ cpl_bivector_unwrap_vectors(boundary) ;
+ cpl_vector_delete(ybounds) ;
+ return -1 ;
+ }
+
+ /* At this point itt most likely points to element just below
+ pxbounds[0] */
+ while (pxhires[itt] < pxbounds[0]) itt++;
+
+ for (i=0; i < nsamples; i++) {
+ /* The i'th signal is the weighted average of the two interpolated
+ signals at the pixel boundaries and those table signals in
+ between */
+
+ double xlow = pxbounds[i];
+ double x = pxhires[itt];
+
+ if (x > pxbounds[i+1]) x = pxbounds[i+1];
+ /* Contribution from interpolated value at wavelength at lower pixel
+ boundary */
+ presampled[i] = pybounds[i] * (x - xlow);
+
+ /* Contribution from table values in between pixel boundaries */
+ while ((pxhires[itt] < pxbounds[i+1]) && (itt < hrsize)) {
+ const double xprev = x;
+ x = pxhires[itt+1];
+ if (x > pxbounds[i+1]) x = pxbounds[i+1];
+ presampled[i] += pyhires[itt] * (x - xlow);
+ xlow = xprev;
+ itt++;
+ }
+
+ /* Contribution from interpolated value at wavelength at upper pixel
+ boundary */
+ presampled[i] += pybounds[i+1] * (pxbounds[i+1] - xlow);
+
+ /* Compute average by dividing integral by length of pixel range
+ (the factor 2 comes from the contributions) */
+ presampled[i] /= 2 * (pxbounds[i+1] - pxbounds[i]);
+ }
+ cpl_bivector_unwrap_vectors(boundary) ;
+ cpl_vector_delete(ybounds) ;
+ return 0 ;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Fill right half of a symmetric long-slit spectroscopy line profile
+ @param self The pre-allocated vector to be filled
+ @param slitw The slit width [pixel]
+ @param fwhm The spectral FWHM [pixel]
+ @return CPL_ERROR_NONE or the relevant error code on failure
+
+ The smoothing function is the right half of the convolution of a Gaussian with
+ sigma = fwhm / (2 * sqrt(2*log(2))) and a top-hat with a width equal to the
+ slit width, and area 1, and a tophat with unit width and area.
+ (the convolution with a tophat with unit width and area equals integration
+ from i-1/2 to 1+1/2).
+ Since this function is symmetric only the central, maximum value and the
+ right half is computed,
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if a pointer is NULL
+ - CPL_ERROR_ILLEGAL_INPUT if the slit width or fwhm is non-positive
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_error_code cpl_vector_fill_lss_profile_symmetric(cpl_vector * self,
+ double slitw,
+ double fwhm)
+{
+
+ const double sigma = fwhm * CPL_MATH_SIG_FWHM;
+ const int n = cpl_vector_get_size(self);
+ int i;
+
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(slitw > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(fwhm > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Cannot fail now */
+
+ /* Special case for i = 0 */
+ (void)cpl_vector_set(self, 0,
+ (irplib_erf_antideriv(0.5*slitw + 0.5, sigma) -
+ irplib_erf_antideriv(0.5*slitw - 0.5, sigma)) / slitw);
+
+ for (i = 1; i < n; i++) {
+ /* FIXME: Reuse two irplib_erf_antideriv() calls from previous value */
+ const double x1p = i + 0.5*slitw + 0.5;
+ const double x1n = i - 0.5*slitw + 0.5;
+ const double x0p = i + 0.5*slitw - 0.5;
+ const double x0n = i - 0.5*slitw - 0.5;
+ const double val = 0.5/slitw *
+ (irplib_erf_antideriv(x1p, sigma) - irplib_erf_antideriv(x1n, sigma) -
+ irplib_erf_antideriv(x0p, sigma) + irplib_erf_antideriv(x0n, sigma));
+ (void)cpl_vector_set(self, i, val);
+ }
+
+ return CPL_ERROR_NONE;
+}
diff --git a/irplib/irplib_wlxcorr.h b/irplib/irplib_wlxcorr.h
new file mode 100644
index 0000000..d19ae4e
--- /dev/null
+++ b/irplib/irplib_wlxcorr.h
@@ -0,0 +1,73 @@
+/* $Id: irplib_wlxcorr.h,v 1.20 2008/11/06 12:45:28 llundin Exp $
+ *
+ * This file is part of the IRPLIB package
+ * Copyright (C) 2002,2003 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: llundin $
+ * $Date: 2008/11/06 12:45:28 $
+ * $Revision: 1.20 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifndef IRPLIB_WLXCORR_H
+#define IRPLIB_WLXCORR_H
+
+/*-----------------------------------------------------------------------------
+ Include
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+/* The 4 columns of the table */
+#define IRPLIB_WLXCORR_COL_WAVELENGTH "Wavelength"
+#define IRPLIB_WLXCORR_COL_CAT_INIT "Catalog Initial"
+#define IRPLIB_WLXCORR_COL_CAT_FINAL "Catalog Corrected"
+#define IRPLIB_WLXCORR_COL_OBS "Observed"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+int irplib_wlxcorr_plot_spc_table(const cpl_table *, const char *) ;
+int irplib_wlxcorr_catalog_plot(const cpl_bivector *, double, double) ;
+int irplib_wlxcorr_plot_solution(const cpl_polynomial *, const cpl_polynomial *,
+ const cpl_polynomial *, int, int) ;
+
+cpl_polynomial * irplib_wlxcorr_best_poly(const cpl_vector *,
+ const cpl_bivector *, int, const cpl_polynomial *, const cpl_vector *,
+ int, double, double, double *, cpl_table **, cpl_vector **) ;
+cpl_table * irplib_wlxcorr_gen_spc_table(const cpl_vector *,
+ const cpl_bivector *, double, double, const cpl_polynomial *,
+ const cpl_polynomial *) ;
+cpl_bivector * irplib_wlxcorr_cat_extract(const cpl_bivector *, double, double);
+cpl_vector * irplib_wlxcorr_convolve_create_kernel(double, double) ;
+int irplib_wlxcorr_convolve(cpl_vector *,const cpl_vector *) ;
+
+
+cpl_error_code irplib_wlxcorr_vector_fill_line_spectrum(cpl_vector *,
+ const cpl_polynomial *,
+ const cpl_bivector *,
+ double, double, double,
+ int);
+
+#endif
diff --git a/irplib/tests/Makefile.am b/irplib/tests/Makefile.am
new file mode 100644
index 0000000..893d5b8
--- /dev/null
+++ b/irplib/tests/Makefile.am
@@ -0,0 +1,90 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the IRPLIB package
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+INCLUDES = $(all_includes)
+
+LDADD = $(LIBIRPLIB)
+
+pkginclude_HEADERS =
+
+noinst_HEADERS =
+
+check_PROGRAMS = irplib_wlxcorr-test \
+ irplib_hist-test \
+ irplib_polynomial-test \
+ irplib_plugin-test \
+ irplib_utils-test \
+ irplib_framelist-test \
+ irplib_wcs-test \
+ irplib_cat-test
+
+irplib_framelist_test_SOURCES = irplib_framelist-test.c
+irplib_framelist_test_DEPENDENCIES = $(LIBIRPLIB)
+
+irplib_utils_test_SOURCES = irplib_utils-test.c
+irplib_utils_test_DEPENDENCIES = $(LIBIRPLIB)
+
+irplib_hist_test_SOURCES = irplib_hist-test.c
+irplib_hist_test_DEPENDENCIES = $(LIBIRPLIB)
+
+irplib_polynomial_test_SOURCES = irplib_polynomial-test.c
+irplib_polynomial_test_DEPENDENCIES = $(LIBIRPLIB)
+
+irplib_plugin_test_SOURCES = irplib_plugin-test.c
+irplib_plugin_test_DEPENDENCIES = $(LIBIRPLIB)
+
+irplib_wlxcorr_test_SOURCES = irplib_wlxcorr-test.c
+irplib_wlxcorr_test_DEPENDENCIES = $(LIBIRPLIB)
+
+irplib_wcs_test_SOURCES = irplib_wcs-test.c
+irplib_wcs_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_wcs_test_LDADD = $(LIBIRPLIB) $(LIBWCSLIB)
+irplib_wcs_test_LDFLAGS = $(WCSLIB_LDFLAGS)
+
+irplib_cat_test_SOURCES = irplib_cat-test.c
+irplib_cat_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_cat_test_LDADD = $(LIBIRPLIB) $(LIBWCSLIB)
+irplib_cat_test_LDFLAGS = $(WCSLIB_LDFLAGS)
+
+TESTS = $(check_PROGRAMS)
+
+# Be sure to reexport important environment variables.
+TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
+ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
+
+# We need to remove any files that the above tests created.
+clean-local:
+ $(RM) *.log *.paf *.fits .logfile
+
+#if PURIFY
+#include $(top_builddir)/Makefile.purify
+#endif
diff --git a/irplib/tests/Makefile.in b/irplib/tests/Makefile.in
new file mode 100644
index 0000000..61c0341
--- /dev/null
+++ b/irplib/tests/Makefile.in
@@ -0,0 +1,776 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+check_PROGRAMS = irplib_wlxcorr-test$(EXEEXT) \
+ irplib_hist-test$(EXEEXT) irplib_polynomial-test$(EXEEXT) \
+ irplib_plugin-test$(EXEEXT) irplib_utils-test$(EXEEXT) \
+ irplib_framelist-test$(EXEEXT) irplib_wcs-test$(EXEEXT) \
+ irplib_cat-test$(EXEEXT)
+subdir = irplib/tests
+DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_irplib_cat_test_OBJECTS = irplib_cat-test.$(OBJEXT)
+irplib_cat_test_OBJECTS = $(am_irplib_cat_test_OBJECTS)
+am__DEPENDENCIES_1 =
+irplib_cat_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(irplib_cat_test_LDFLAGS) $(LDFLAGS) -o $@
+am_irplib_framelist_test_OBJECTS = irplib_framelist-test.$(OBJEXT)
+irplib_framelist_test_OBJECTS = $(am_irplib_framelist_test_OBJECTS)
+irplib_framelist_test_LDADD = $(LDADD)
+am_irplib_hist_test_OBJECTS = irplib_hist-test.$(OBJEXT)
+irplib_hist_test_OBJECTS = $(am_irplib_hist_test_OBJECTS)
+irplib_hist_test_LDADD = $(LDADD)
+am_irplib_plugin_test_OBJECTS = irplib_plugin-test.$(OBJEXT)
+irplib_plugin_test_OBJECTS = $(am_irplib_plugin_test_OBJECTS)
+irplib_plugin_test_LDADD = $(LDADD)
+am_irplib_polynomial_test_OBJECTS = irplib_polynomial-test.$(OBJEXT)
+irplib_polynomial_test_OBJECTS = $(am_irplib_polynomial_test_OBJECTS)
+irplib_polynomial_test_LDADD = $(LDADD)
+am_irplib_utils_test_OBJECTS = irplib_utils-test.$(OBJEXT)
+irplib_utils_test_OBJECTS = $(am_irplib_utils_test_OBJECTS)
+irplib_utils_test_LDADD = $(LDADD)
+am_irplib_wcs_test_OBJECTS = irplib_wcs-test.$(OBJEXT)
+irplib_wcs_test_OBJECTS = $(am_irplib_wcs_test_OBJECTS)
+irplib_wcs_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(irplib_wcs_test_LDFLAGS) $(LDFLAGS) -o $@
+am_irplib_wlxcorr_test_OBJECTS = irplib_wlxcorr-test.$(OBJEXT)
+irplib_wlxcorr_test_OBJECTS = $(am_irplib_wlxcorr_test_OBJECTS)
+irplib_wlxcorr_test_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(irplib_cat_test_SOURCES) $(irplib_framelist_test_SOURCES) \
+ $(irplib_hist_test_SOURCES) $(irplib_plugin_test_SOURCES) \
+ $(irplib_polynomial_test_SOURCES) $(irplib_utils_test_SOURCES) \
+ $(irplib_wcs_test_SOURCES) $(irplib_wlxcorr_test_SOURCES)
+DIST_SOURCES = $(irplib_cat_test_SOURCES) \
+ $(irplib_framelist_test_SOURCES) $(irplib_hist_test_SOURCES) \
+ $(irplib_plugin_test_SOURCES) \
+ $(irplib_polynomial_test_SOURCES) $(irplib_utils_test_SOURCES) \
+ $(irplib_wcs_test_SOURCES) $(irplib_wlxcorr_test_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(pkgincludedir)"
+HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+DISTCLEANFILES = *~
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
+INCLUDES = $(all_includes)
+LDADD = $(LIBIRPLIB)
+pkginclude_HEADERS =
+noinst_HEADERS =
+irplib_framelist_test_SOURCES = irplib_framelist-test.c
+irplib_framelist_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_utils_test_SOURCES = irplib_utils-test.c
+irplib_utils_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_hist_test_SOURCES = irplib_hist-test.c
+irplib_hist_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_polynomial_test_SOURCES = irplib_polynomial-test.c
+irplib_polynomial_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_plugin_test_SOURCES = irplib_plugin-test.c
+irplib_plugin_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_wlxcorr_test_SOURCES = irplib_wlxcorr-test.c
+irplib_wlxcorr_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_wcs_test_SOURCES = irplib_wcs-test.c
+irplib_wcs_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_wcs_test_LDADD = $(LIBIRPLIB) $(LIBWCSLIB)
+irplib_wcs_test_LDFLAGS = $(WCSLIB_LDFLAGS)
+irplib_cat_test_SOURCES = irplib_cat-test.c
+irplib_cat_test_DEPENDENCIES = $(LIBIRPLIB)
+irplib_cat_test_LDADD = $(LIBIRPLIB) $(LIBWCSLIB)
+irplib_cat_test_LDFLAGS = $(WCSLIB_LDFLAGS)
+TESTS = $(check_PROGRAMS)
+
+# Be sure to reexport important environment variables.
+TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
+ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign irplib/tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign irplib/tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+irplib_cat-test$(EXEEXT): $(irplib_cat_test_OBJECTS) $(irplib_cat_test_DEPENDENCIES)
+ @rm -f irplib_cat-test$(EXEEXT)
+ $(irplib_cat_test_LINK) $(irplib_cat_test_OBJECTS) $(irplib_cat_test_LDADD) $(LIBS)
+irplib_framelist-test$(EXEEXT): $(irplib_framelist_test_OBJECTS) $(irplib_framelist_test_DEPENDENCIES)
+ @rm -f irplib_framelist-test$(EXEEXT)
+ $(LINK) $(irplib_framelist_test_OBJECTS) $(irplib_framelist_test_LDADD) $(LIBS)
+irplib_hist-test$(EXEEXT): $(irplib_hist_test_OBJECTS) $(irplib_hist_test_DEPENDENCIES)
+ @rm -f irplib_hist-test$(EXEEXT)
+ $(LINK) $(irplib_hist_test_OBJECTS) $(irplib_hist_test_LDADD) $(LIBS)
+irplib_plugin-test$(EXEEXT): $(irplib_plugin_test_OBJECTS) $(irplib_plugin_test_DEPENDENCIES)
+ @rm -f irplib_plugin-test$(EXEEXT)
+ $(LINK) $(irplib_plugin_test_OBJECTS) $(irplib_plugin_test_LDADD) $(LIBS)
+irplib_polynomial-test$(EXEEXT): $(irplib_polynomial_test_OBJECTS) $(irplib_polynomial_test_DEPENDENCIES)
+ @rm -f irplib_polynomial-test$(EXEEXT)
+ $(LINK) $(irplib_polynomial_test_OBJECTS) $(irplib_polynomial_test_LDADD) $(LIBS)
+irplib_utils-test$(EXEEXT): $(irplib_utils_test_OBJECTS) $(irplib_utils_test_DEPENDENCIES)
+ @rm -f irplib_utils-test$(EXEEXT)
+ $(LINK) $(irplib_utils_test_OBJECTS) $(irplib_utils_test_LDADD) $(LIBS)
+irplib_wcs-test$(EXEEXT): $(irplib_wcs_test_OBJECTS) $(irplib_wcs_test_DEPENDENCIES)
+ @rm -f irplib_wcs-test$(EXEEXT)
+ $(irplib_wcs_test_LINK) $(irplib_wcs_test_OBJECTS) $(irplib_wcs_test_LDADD) $(LIBS)
+irplib_wlxcorr-test$(EXEEXT): $(irplib_wlxcorr_test_OBJECTS) $(irplib_wlxcorr_test_DEPENDENCIES)
+ @rm -f irplib_wlxcorr-test$(EXEEXT)
+ $(LINK) $(irplib_wlxcorr_test_OBJECTS) $(irplib_wlxcorr_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_cat-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_framelist-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_hist-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_plugin-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_polynomial-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_utils-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wcs-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wlxcorr-test.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes$$std"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(pkgincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkgincludeHEADERS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgincludeHEADERS install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-pkgincludeHEADERS
+
+
+# We need to remove any files that the above tests created.
+clean-local:
+ $(RM) *.log *.paf *.fits .logfile
+
+#if PURIFY
+#include $(top_builddir)/Makefile.purify
+#endif
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/irplib/tests/irplib_cat-test.c b/irplib/tests/irplib_cat-test.c
new file mode 100644
index 0000000..efe51d6
--- /dev/null
+++ b/irplib/tests/irplib_cat-test.c
@@ -0,0 +1,98 @@
+/* $Id: irplib_cat-test.c,v 1.9 2009/08/12 14:26:44 cgarcia Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2001-2008 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: cgarcia $
+ * $Date: 2009/08/12 14:26:44 $
+ * $Revision: 1.9 $
+ * $Name: hawki-1_8_9 $
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cpl_test.h>
+
+#include "irplib_cat.h"
+
+/*-----------------------------------------------------------------------------
+ Static functions
+ -----------------------------------------------------------------------------*/
+static void irplib_cat_all_test(void);
+
+/*-----------------------------------------------------------------------------
+ Main
+ -----------------------------------------------------------------------------*/
+int main (void)
+{
+
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ irplib_cat_all_test();
+
+ return cpl_test_end(0);
+}
+
+static void irplib_cat_all_test(void)
+{
+ cpl_propertylist * prop_wcs;
+ cpl_wcs * wcs = NULL;
+ double ra1, ra2, dec1, dec2;
+
+ /* Create WCS object */
+ prop_wcs = cpl_propertylist_new();
+ cpl_test_nonnull(prop_wcs);
+ cpl_propertylist_append_double(prop_wcs, "CRVAL1", 0.);
+ cpl_propertylist_append_double(prop_wcs, "CRVAL2", 0.);
+ cpl_propertylist_append_int(prop_wcs, "CRPIX1", 1);
+ cpl_propertylist_append_int(prop_wcs, "CRPIX2", 1);
+ cpl_propertylist_append_double(prop_wcs, "CD1_1", .001);
+ cpl_propertylist_append_double(prop_wcs, "CD1_2", 0.);
+ cpl_propertylist_append_double(prop_wcs, "CD2_1", 00.);
+ cpl_propertylist_append_double(prop_wcs, "CD2_2", .001);
+ cpl_propertylist_append_int(prop_wcs, "NAXIS", 2);
+ cpl_propertylist_append_int(prop_wcs, "NAXIS1", 1000);
+ cpl_propertylist_append_int(prop_wcs, "NAXIS2", 1000);
+ wcs = cpl_wcs_new_from_propertylist(prop_wcs);
+ if(cpl_error_get_code() == CPL_ERROR_NO_WCS)
+ {
+ cpl_msg_warning(__func__,"No WCS present. Tests disabled");
+ cpl_test_error(CPL_ERROR_NO_WCS);
+ cpl_test_null(wcs);
+ cpl_propertylist_delete(prop_wcs);
+ return;
+ }
+ cpl_test_nonnull(wcs);
+
+ irplib_cat_get_image_limits(wcs, 0., &ra1, &ra2, &dec1, &dec2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(ra1, 0.00, DBL_EPSILON);
+ cpl_test_abs(ra2, 0.99, DBL_EPSILON);
+ cpl_test_abs(dec1, 0.00, DBL_EPSILON);
+ cpl_test_abs(dec2, 0.99, DBL_EPSILON);
+
+ /* Free */
+ cpl_wcs_delete(wcs);
+ cpl_propertylist_delete(prop_wcs);
+}
diff --git a/irplib/tests/irplib_framelist-test.c b/irplib/tests/irplib_framelist-test.c
new file mode 100644
index 0000000..a2a6bdc
--- /dev/null
+++ b/irplib/tests/irplib_framelist-test.c
@@ -0,0 +1,98 @@
+/* *
+ * This file is part of the ESO IRPLIB package *
+ * Copyright (C) 2004,2005 European Southern Observatory *
+ * *
+ * This library 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
+ * */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <irplib_framelist.h>
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_framelist_test Testing of the IRPLIB framelist object
+ */
+/*----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Unit tests of framelist module
+**/
+/*----------------------------------------------------------------------------*/
+
+int main(void)
+{
+
+ irplib_framelist * flist;
+ irplib_framelist * nulllist;
+ cpl_frameset * fset;
+ cpl_frameset * nullset;
+ int i;
+
+ /* Initialize CPL for unit testing */
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ /* Some NULL tests */
+
+ irplib_framelist_delete(NULL);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ nulllist = irplib_framelist_cast(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_test_null(nulllist);
+
+ nullset = irplib_frameset_cast(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_test_null(nullset);
+
+ irplib_framelist_empty(NULL);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ i = irplib_framelist_get_size(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_test_leq(i, -1);
+
+
+ /* Some tests on an empty list */
+ flist = irplib_framelist_new();
+
+ cpl_test_zero(irplib_framelist_get_size(flist));
+
+ irplib_framelist_empty(flist);
+
+ cpl_test_zero(irplib_framelist_get_size(flist));
+
+ fset = irplib_frameset_cast(flist);
+
+ irplib_framelist_delete(flist);
+
+ flist = irplib_framelist_cast(fset);
+
+ cpl_test_zero(irplib_framelist_get_size(flist));
+
+ cpl_frameset_delete(fset);
+ irplib_framelist_delete(flist);
+
+ return cpl_test_end(0);
+}
diff --git a/irplib/tests/irplib_hist-test.c b/irplib/tests/irplib_hist-test.c
new file mode 100644
index 0000000..61947e7
--- /dev/null
+++ b/irplib/tests/irplib_hist-test.c
@@ -0,0 +1,150 @@
+/* *
+ * This file is part of the ESO IRPLIB package *
+ * Copyright (C) 2004,2005 European Southern Observatory *
+ * *
+ * This library 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
+ * */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*----------------------------------------------------------------------------
+ Includes
+ ----------------------------------------------------------------------------*/
+
+
+#include <irplib_hist.h>
+
+#include <math.h>
+/*---------------------------------------------------------------------------*/
+/*
+ * @defgroup irplib_hist_test Testing of the IRPLIB utilities
+ */
+/*---------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+ Defines
+ ----------------------------------------------------------------------------*/
+
+#define NBINS 100
+
+/*----------------------------------------------------------------------------
+ Private Function prototypes
+ ----------------------------------------------------------------------------*/
+
+static void irplib_hist_tests(void);
+
+/*---------------------------------------------------------------------------*/
+/*
+ * @brief Unit tests of fit module
+ */
+/*---------------------------------------------------------------------------*/
+
+int main(void)
+{
+ /* Initialize CPL + IRPLIB */
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ irplib_hist_tests();
+
+ return cpl_test_end(0);
+}
+
+static void irplib_hist_tests(void)
+{
+ irplib_hist * hist;
+ cpl_image * image;
+ cpl_error_code error;
+ int i, j;
+ float * data;
+
+ unsigned long max_where;
+
+ /* 1. trial: Create a right histogram */
+ hist = irplib_hist_new();
+ cpl_test_nonnull(hist);
+ cpl_test_error(CPL_ERROR_NONE);
+ irplib_hist_delete(hist);
+
+ /* 3. trial: Histogram for a uniform image */
+ image = cpl_image_new(100, 100, CPL_TYPE_FLOAT);
+ cpl_image_add_scalar(image, 202);
+
+ hist = irplib_hist_new();
+
+ error = irplib_hist_init(hist, NBINS, 0, 500);
+ cpl_test_zero(error);
+ error = irplib_hist_fill(hist, image);
+ cpl_test_zero(error);
+
+ for(i = 0; i < 40; i++) {
+ cpl_test_zero(irplib_hist_get_value(hist, i));
+ }
+
+ /* The following call retrieves the value of the 42-st bin */
+ /* When i = 41, 42-th is retrieved. 500 - 0 / 100 = 5; 202/5=40,xx
+ it should be in the 41-th bin but it is in the next one because
+ there is one before left empty for possible values out of range
+ 0 (hinit) < 202 (image constant)
+ */
+
+ cpl_test_eq(irplib_hist_get_value(hist, 40), 10000);
+ for(i = 42; i < NBINS; i++) {
+ cpl_test_zero(irplib_hist_get_value(hist, i));
+ }
+
+ irplib_hist_delete(hist);
+ cpl_image_delete(image);
+
+ /* 4. trial: Histogram for a normal image: no checking of the output */
+ image = cpl_image_new(100, 100, CPL_TYPE_FLOAT);
+ cpl_image_fill_noise_uniform(image, 0, 200);
+
+ hist = irplib_hist_new();
+ error = irplib_hist_fill(hist,image);
+ cpl_test_zero(error);
+
+ irplib_hist_delete(hist);
+ cpl_image_delete(image);
+
+ /* 5. trial: Histogram */
+ image = cpl_image_new(100, 100, CPL_TYPE_FLOAT);
+ data = cpl_image_get_data_float(image);
+ for (i = 0; i < 100; i++) {
+ for (j = 0; j < 100; j++) {
+ *(data + 100*i + j) = i +j;
+ }
+ }
+
+ hist = irplib_hist_new();
+ error = irplib_hist_fill(hist, image);
+
+ irplib_hist_get_max(hist, &max_where);
+
+ /* The following call retrieves the value of the 41-st bin */
+ /* cpl_test_eq(irplib_hist_get_value(hist, 40), 10000);
+ for(i = 42; i < NBINS; i++) {
+ cpl_test_zero(irplib_hist_get_value(hist, i));
+ }*/
+
+ /* 6. trial: all by default ( we use the same image) */
+
+ cpl_test_eq(max_where, irplib_hist_get_nbins(hist)/2);
+
+ irplib_hist_delete(hist);
+ cpl_image_delete(image);
+}
diff --git a/irplib/tests/irplib_plugin-test.c b/irplib/tests/irplib_plugin-test.c
new file mode 100644
index 0000000..ad8dd5c
--- /dev/null
+++ b/irplib/tests/irplib_plugin-test.c
@@ -0,0 +1,129 @@
+/* *
+ * This file is part of the ESO IRPLIB package *
+ * Copyright (C) 2004,2005 European Southern Observatory *
+ * *
+ * This library 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
+ * */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <irplib_plugin.h>
+#include <string.h>
+#include <float.h>
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_plugin_test Testing of the IRPLIB utilities
+ */
+/*----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Unit tests of plugin module
+**/
+/*----------------------------------------------------------------------------*/
+
+int main(void)
+{
+
+
+
+ cpl_parameterlist * parlist;
+
+ /* Initialize CPL for unit testing */
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ parlist = cpl_parameterlist_new();
+
+
+ (void)irplib_parameterlist_get_double(parlist, "INST", "RECIPE", NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_double(parlist, "INST", NULL, "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_double(parlist, NULL, "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_double(NULL, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_double(parlist, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
+
+
+ (void)irplib_parameterlist_get_int(parlist, "INST", "RECIPE", NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_int(parlist, "INST", NULL, "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_int(parlist, NULL, "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_int(NULL, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_int(parlist, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
+
+
+ (void)irplib_parameterlist_get_bool(parlist, "INST", "RECIPE", NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_bool(parlist, "INST", NULL, "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_bool(parlist, NULL, "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_bool(NULL, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_bool(parlist, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
+
+
+ (void)irplib_parameterlist_get_string(parlist, "INST", "RECIPE", NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_string(parlist, "INST", NULL, "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_string(parlist, NULL, "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_string(NULL, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ (void)irplib_parameterlist_get_string(parlist, "INST", "RECIPE", "PAR");
+ cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
+
+
+ cpl_parameterlist_delete(parlist);
+
+ return cpl_test_end(0);
+}
diff --git a/irplib/tests/irplib_polynomial-test.c b/irplib/tests/irplib_polynomial-test.c
new file mode 100644
index 0000000..9755a97
--- /dev/null
+++ b/irplib/tests/irplib_polynomial-test.c
@@ -0,0 +1,582 @@
+/* $Id: irplib_polynomial-test.c,v 1.35 2011/12/14 13:05:01 llundin Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2001-2004 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: llundin $
+ * $Date: 2011/12/14 13:05:01 $
+ * $Revision: 1.35 $
+ * $Name: hawki-1_8_9 $
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <irplib_polynomial.h>
+#include <math.h>
+#include <float.h>
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+#define MAXDEGREE 6
+
+#define irplib_polynomial_test_root_all(A, B, C, D, E) \
+ irplib_polynomial_test_root_all_macro(A, B, C, D, E, __LINE__)
+
+/*-----------------------------------------------------------------------------
+ Static functions
+ -----------------------------------------------------------------------------*/
+
+static cpl_error_code irplib_polynomial_multiply_1d_factor(cpl_polynomial *,
+ const cpl_vector *,
+ cpl_size);
+static void irplib_polynomial_solve_1d_all_test(void);
+
+static void irplib_polynomial_test_root_all_macro(const cpl_vector *, cpl_size,
+ double, double, double,
+ unsigned);
+
+/*-----------------------------------------------------------------------------
+ Main
+ -----------------------------------------------------------------------------*/
+int main(void)
+{
+ /* Initialize CPL */
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ irplib_polynomial_solve_1d_all_test();
+
+ return cpl_test_end(0);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test irplib_polynomial_solve_1d_all()
+ @see irplib_polynomial_solve_1d_all()
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_polynomial_solve_1d_all_test(void)
+{
+
+ cpl_polynomial * p2d = cpl_polynomial_new(2);
+ cpl_polynomial * p1d = cpl_polynomial_new(1);
+ cpl_vector * xtrue = cpl_vector_new(2);
+ const cpl_size maxdegree = 4; /* Largest robustly handled degree */
+ cpl_size nreal = 0;
+ cpl_size i;
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(NULL, xtrue, &nreal),
+ CPL_ERROR_NULL_INPUT);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p1d, NULL, &nreal),
+ CPL_ERROR_NULL_INPUT);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p1d, xtrue, NULL),
+ CPL_ERROR_NULL_INPUT);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p2d, xtrue, &nreal),
+ CPL_ERROR_INVALID_TYPE);
+ cpl_test_error(CPL_ERROR_INVALID_TYPE);
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p1d, xtrue, &nreal),
+ CPL_ERROR_DATA_NOT_FOUND);
+ cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
+
+ /* Create a 1st degree polynomial, x = 0 */
+ i = 1;
+ cpl_test_eq(cpl_polynomial_set_coeff(p1d, &i, 1.0), CPL_ERROR_NONE);
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p1d, xtrue, &nreal),
+ CPL_ERROR_INCOMPATIBLE_INPUT);
+ cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT);
+
+ cpl_polynomial_delete(p1d);
+ cpl_polynomial_delete(p2d);
+
+ for (nreal = 1; nreal <= maxdegree; nreal++) {
+ /* A single, zero-valued root with multiplicity equal to degree */
+ double xreal = 0.0;
+
+
+ cpl_vector_set_size(xtrue, nreal);
+
+ (void)cpl_vector_fill(xtrue, xreal);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ /* A single, non-zero integer root with multiplicity equal to degree */
+ xreal = 1.0;
+
+ (void)cpl_vector_fill(xtrue, xreal);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, 1.0,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ /* degree distinct real roots - with rounding */
+ for (i = 0; i < nreal; i++) {
+ (void)cpl_vector_set(xtrue, i, 2.0 * (double)i - CPL_MATH_E);
+ }
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 20.0 * DBL_EPSILON,
+ 300.0 * DBL_EPSILON);
+
+ /* All real, one zero, one positive, rest negative, sum zero */
+ for (i = 0; i < nreal-1; i++) {
+ (void)cpl_vector_set(xtrue, nreal-i-2, (double)(-i));
+ }
+ (void)cpl_vector_set(xtrue, nreal-1, (double)(nreal-1)); /* FIXME: ? */
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 16.0*DBL_EPSILON, 600.0*DBL_EPSILON);
+
+ if (nreal < 2) continue;
+ /* Two complex, conjugate roots, the rest is real
+ with multiplicity degree-2 */
+
+ (void)cpl_vector_fill(xtrue, 2.0);
+ (void)cpl_vector_set(xtrue, nreal-2, -1.0);
+ (void)cpl_vector_set(xtrue, nreal-1, 1.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal-2, CPL_MATH_PI,
+ 30.0*DBL_EPSILON, 25.0*DBL_EPSILON);
+
+ if (nreal < 3) continue;
+ if (nreal > 4) {
+ /* Two real roots, the smaller with multiplicity degree-1 */
+ (void)cpl_vector_fill(xtrue, 1.0);
+ (void)cpl_vector_set(xtrue, nreal - 1 , 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ DBL_EPSILON, DBL_EPSILON);
+ /* Same with negative roots */
+ (void)cpl_vector_fill(xtrue, -1.0);
+ (void)cpl_vector_set(xtrue, 0 , -2.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ DBL_EPSILON, DBL_EPSILON);
+ /* Two real roots, the larger with multiplicity degree-1 */
+ (void)cpl_vector_fill(xtrue, 2.0);
+ (void)cpl_vector_set(xtrue, 0, 1.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ DBL_EPSILON, DBL_EPSILON);
+ }
+
+ if (nreal > 3) continue;
+
+ /* Same with negative roots */
+ (void)cpl_vector_fill(xtrue, -2.0 * FLT_EPSILON);
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ DBL_EPSILON, 2.0*DBL_EPSILON);
+
+ /* A more extreme case: Same with negative roots */
+ (void)cpl_vector_fill(xtrue, -2.0e-4 * FLT_EPSILON);
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ FLT_EPSILON, 3.0*DBL_EPSILON);
+
+ if (nreal != 3) {
+ /* The most extreme case: Same with negative roots */
+ (void)cpl_vector_fill(xtrue, -2.0 * DBL_EPSILON);
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ DBL_EPSILON, 2.0*DBL_EPSILON);
+
+
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+ (void)cpl_vector_set(xtrue, 1, -2.0e-4 * FLT_EPSILON);
+ (void)cpl_vector_set(xtrue, 2, 2.0e-4 * FLT_EPSILON);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ FLT_EPSILON, 2.0*DBL_EPSILON);
+ }
+
+ /* Two complex conjugate roots, remaining:
+ small, with multiplicity degree-2 */
+ (void)cpl_vector_fill(xtrue, 2.0*DBL_EPSILON);
+ (void)cpl_vector_set(xtrue, nreal - 2 , 3.0);
+ (void)cpl_vector_set(xtrue, nreal - 1 , 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal - 2, CPL_MATH_PI,
+ 4.0 * DBL_EPSILON, DBL_EPSILON);
+
+ /* Two complex conjugate roots with small real part, remaining:
+ with multiplicity degree-2 */
+ (void)cpl_vector_fill(xtrue, 3.0);
+ (void)cpl_vector_set(xtrue, nreal - 2 , -1.0);
+ (void)cpl_vector_set(xtrue, nreal - 1 , 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal - 2, CPL_MATH_PI,
+ 6.0*DBL_EPSILON, 220.0*DBL_EPSILON);
+
+
+ }
+
+#if MAXDEGREE > 2
+ /* Cover branch fixing cancellation with one negative,
+ one positive near-zero and one positive root. */
+ nreal = 3;
+
+ cpl_vector_set_size(xtrue, nreal);
+
+ /* -2, epsilon, 1 */
+ (void)cpl_vector_set(xtrue, 0, -2.0);
+ (void)cpl_vector_set(xtrue, 1, 2.0 * DBL_EPSILON);
+ (void)cpl_vector_set(xtrue, 2, 1.5);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, 1.0,
+ 4.0*DBL_EPSILON, 30.0*DBL_EPSILON);
+
+#if MAXDEGREE > 3
+ nreal = 4;
+
+ cpl_vector_set_size(xtrue, nreal);
+
+ /* Depressed has zero as root */
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+ (void)cpl_vector_set(xtrue, 1, 1.0);
+ (void)cpl_vector_set(xtrue, 2, 2.0);
+ (void)cpl_vector_set(xtrue, 3, 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ /* Depressed has zero as root, and two complex roots*/
+ irplib_polynomial_test_root_all(xtrue, 2, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+
+ /* Depressed is biquadratic, with 4 real roots */
+ (void)cpl_vector_set(xtrue, 0, -2.0);
+ (void)cpl_vector_set(xtrue, 1, -1.0);
+ (void)cpl_vector_set(xtrue, 2, 1.0);
+ (void)cpl_vector_set(xtrue, 3, 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ /* Depressed is biquadratic, with 2 real roots */
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+ (void)cpl_vector_set(xtrue, 1, 1.0);
+ (void)cpl_vector_set(xtrue, 2, 0.0);
+ (void)cpl_vector_set(xtrue, 3, 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, 2, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ /* Depressed is biquadratic (the quadratic has real, negative roots),
+ with 0 real roots */
+ (void)cpl_vector_set(xtrue, 0, 1.0);
+ (void)cpl_vector_set(xtrue, 1, 2.0);
+ (void)cpl_vector_set(xtrue, 2, 1.0);
+ (void)cpl_vector_set(xtrue, 3, 3.0);
+
+ irplib_polynomial_test_root_all(xtrue, 0, CPL_MATH_PI,
+ 10.0 * DBL_EPSILON, 10.0 * DBL_EPSILON);
+
+ /* roots: 0, 0, ai, -ai */
+ (void)cpl_vector_set(xtrue, 0, 0.0);
+ (void)cpl_vector_set(xtrue, 1, 0.0);
+ (void)cpl_vector_set(xtrue, 2, 0.0);
+ (void)cpl_vector_set(xtrue, 3, 2.0);
+
+ irplib_polynomial_test_root_all(xtrue, 2, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ p1d = cpl_polynomial_new(1);
+
+ i = 0;
+ cpl_polynomial_set_coeff(p1d, &i, -5.0);
+ i = 1;
+ cpl_polynomial_set_coeff(p1d, &i, -1.0);
+ i = 2;
+ cpl_polynomial_set_coeff(p1d, &i, -2.0);
+ i = 4;
+ cpl_polynomial_set_coeff(p1d, &i, 1.0);
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p1d, xtrue, &nreal),
+ CPL_ERROR_NONE);
+
+ cpl_msg_info(cpl_func, "Computed roots (%" CPL_SIZE_FORMAT " real): ",
+ nreal);
+ if (cpl_msg_get_level() <= CPL_MSG_INFO)
+ cpl_vector_dump(xtrue, stderr);
+ cpl_msg_info(cpl_func, "Residual: %g -> %g ", cpl_vector_get(xtrue, 0),
+ cpl_polynomial_eval_1d(p1d, cpl_vector_get(xtrue, 0), NULL) );
+ cpl_msg_info(cpl_func, "Residual: %g -> %g ", cpl_vector_get(xtrue, 1),
+ cpl_polynomial_eval_1d(p1d, cpl_vector_get(xtrue, 1), NULL) );
+
+ cpl_polynomial_delete(p1d);
+
+ (void)cpl_vector_set(xtrue, 0, 0.0);
+ (void)cpl_vector_set(xtrue, 1, 2.0);
+ (void)cpl_vector_set(xtrue, 2, 1.0);
+ (void)cpl_vector_set(xtrue, 3, 1.0);
+
+ irplib_polynomial_test_root_all(xtrue, 0, CPL_MATH_PI,
+ 2.0 * DBL_EPSILON, 2.0 * DBL_EPSILON);
+
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+ (void)cpl_vector_set(xtrue, 1, 2.0);
+ (void)cpl_vector_set(xtrue, 2, 1.0);
+ (void)cpl_vector_set(xtrue, 3, 3.0);
+
+ irplib_polynomial_test_root_all(xtrue, 0, CPL_MATH_PI,
+ 3.0 * DBL_EPSILON, 3.0 * DBL_EPSILON);
+#if MAXDEGREE > 4
+ nreal = 5;
+
+ cpl_vector_set_size(xtrue, nreal);
+
+ /* Depressed has zero as root */
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+ (void)cpl_vector_set(xtrue, 1, 1.0);
+ (void)cpl_vector_set(xtrue, 2, 2.0);
+ (void)cpl_vector_set(xtrue, 3, 3.0);
+ (void)cpl_vector_set(xtrue, 4, 4.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 48.0 * DBL_EPSILON, 2800.0 * DBL_EPSILON);
+
+ irplib_polynomial_test_root_all(xtrue, nreal-2, CPL_MATH_PI,
+ 8.0 * DBL_EPSILON, 4000.0 * DBL_EPSILON);
+
+ irplib_polynomial_test_root_all(xtrue, nreal-4, CPL_MATH_PI,
+ 4.0 * DBL_EPSILON, 600.0 * DBL_EPSILON);
+
+#if MAXDEGREE > 5
+ nreal = 6;
+
+ cpl_vector_set_size(xtrue, nreal);
+
+ /* Depressed has zero as root */
+ (void)cpl_vector_set(xtrue, 0, -1.0);
+ (void)cpl_vector_set(xtrue, 1, 1.0);
+ (void)cpl_vector_set(xtrue, 2, 2.0);
+ (void)cpl_vector_set(xtrue, 3, 3.0);
+ (void)cpl_vector_set(xtrue, 4, 4.0);
+ (void)cpl_vector_set(xtrue, 5, 5.0);
+
+ irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
+ 240.0 * DBL_EPSILON, 50.0e3 * DBL_EPSILON);
+
+ irplib_polynomial_test_root_all(xtrue, nreal-2, CPL_MATH_PI,
+ 8.0 * DBL_EPSILON, 25.0e3 * DBL_EPSILON);
+
+ irplib_polynomial_test_root_all(xtrue, nreal-4, CPL_MATH_PI,
+ 12.0 * DBL_EPSILON, 1600.0 * DBL_EPSILON);
+
+#endif
+#endif
+#endif
+#endif
+
+ cpl_vector_delete(xtrue);
+
+ return;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Multiply a polynomial by (x-v1)(x-v2)...(x-vn)
+ @param self The 1D-polynomial to modify
+ @param roots The roots to use for the extension
+ @pram nreal The number of real roots
+ @return CPL_ERROR_NONE or the relevant CPL error code.
+
+
+ */
+/*----------------------------------------------------------------------------*/
+static
+cpl_error_code irplib_polynomial_multiply_1d_factor(cpl_polynomial * self,
+ const cpl_vector * roots,
+ cpl_size nreal)
+{
+
+ const cpl_size nroots = cpl_vector_get_size(roots);
+ cpl_size i, degree;
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(roots != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_ensure_code(nreal >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(nreal <= nroots,
+ CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code((cpl_vector_get_size(roots) - nreal) % 2 == 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ i = 0;
+ degree = cpl_polynomial_get_degree(self);
+ cpl_ensure_code(degree > 0 || cpl_polynomial_get_coeff(self, &i) != 0.0,
+ CPL_ERROR_DATA_NOT_FOUND);
+
+ for (i = 0; i < nreal; i++) {
+ const double root = cpl_vector_get(roots, i);
+ double prev = 0.0;
+ cpl_size j;
+
+ degree++;
+
+ for (j = degree; j >= 0; j--) {
+ double value = 0.0;
+ double newval;
+
+ if (j > 0) {
+ const cpl_size jj = j - 1;
+ newval = value = cpl_polynomial_get_coeff(self, &jj);
+ } else {
+ newval = 0.0;
+ }
+
+ if (j < degree) {
+ newval -= root * prev;
+ }
+
+ cpl_polynomial_set_coeff(self, &j, newval);
+
+ prev = value;
+
+ }
+ }
+
+ /* Multiplication with the complex conjugate root
+ (x-a-ib) (x-a+ib) p(x) = (x-a)^2 p(x) + b^2 p(x) */
+ for (; i < nroots; i += 2) {
+ const double a = cpl_vector_get(roots, i);
+ const double b = cpl_vector_get(roots, i+1);
+ cpl_vector * aroot = cpl_vector_new(2);
+ cpl_polynomial * copy = cpl_polynomial_duplicate(self);
+
+ cpl_vector_fill(aroot, a);
+
+ irplib_polynomial_multiply_1d_factor(self, aroot, 2);
+
+ irplib_polynomial_multiply_scalar(copy, copy, b * b);
+
+ irplib_polynomial_add(self, self, copy);
+
+ cpl_vector_delete(aroot);
+ cpl_polynomial_delete(copy);
+
+ }
+
+ return CPL_ERROR_NONE;
+
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the roots of a 1D-polynomial
+ @param self The roots to use for the extension
+ @pram nreal The number of real roots in self
+ @param factor The factor of the leading polynomial term
+ @param tolerance The acceptable absolute tolerance on each root
+ @param resitol The acceptable absolute residual of each root
+ @param line __LINE__
+ @return void
+
+ */
+/*----------------------------------------------------------------------------*/
+static void
+irplib_polynomial_test_root_all_macro(const cpl_vector * self, cpl_size nreal,
+ double factor, double tolerance,
+ double resitol, unsigned line)
+{
+
+ const cpl_size degree = cpl_vector_get_size(self);
+ cpl_polynomial * p1d = cpl_polynomial_new(1);
+ cpl_vector * roots = cpl_vector_new(degree);
+ cpl_size i = 0;
+ cpl_size jreal;
+
+ cpl_test_eq(cpl_polynomial_set_coeff(p1d, &i, factor), CPL_ERROR_NONE);
+
+ cpl_test_eq(irplib_polynomial_multiply_1d_factor(p1d, self, nreal),
+ CPL_ERROR_NONE);
+
+ cpl_test_eq(irplib_polynomial_solve_1d_all(p1d, roots, &jreal),
+ CPL_ERROR_NONE);
+
+ cpl_test_eq(jreal, nreal);
+ if (jreal != nreal) {
+ cpl_msg_info(cpl_func, "1D-polynomial:");
+ cpl_polynomial_dump(p1d, stderr);
+ cpl_msg_error(cpl_func, "True roots (%" CPL_SIZE_FORMAT
+ " real): (line=%u)", nreal, line);
+ cpl_vector_dump(self, stderr);
+ cpl_msg_error(cpl_func, "Computed roots (%" CPL_SIZE_FORMAT " real): ",
+ jreal);
+ cpl_vector_dump(roots, stderr);
+ } else if (cpl_msg_get_level() < CPL_MSG_WARNING) {
+ cpl_bivector * dump =
+ cpl_bivector_wrap_vectors((cpl_vector*)self, roots);
+
+ cpl_msg_warning(cpl_func, "Comparing %" CPL_SIZE_FORMAT " roots (%"
+ CPL_SIZE_FORMAT " real): (line=%u)",
+ degree, nreal, line);
+ cpl_bivector_dump(dump, stderr);
+ cpl_bivector_unwrap_vectors(dump);
+ }
+
+ for (i = 0; i < jreal; i++) {
+ const double root = cpl_vector_get(roots, i);
+ const double residual = cpl_polynomial_eval_1d(p1d, root, NULL);
+
+ cpl_test_abs(root, cpl_vector_get(self, i), tolerance);
+
+ cpl_test_abs(residual, 0.0, resitol);
+
+ }
+
+ for (i = nreal; i < degree; i++) {
+ const double root = cpl_vector_get(roots, i);
+
+ cpl_test_abs(root, cpl_vector_get(self, i), tolerance);
+
+ /* FIXME: Verify residual as well */
+
+ }
+
+ cpl_vector_delete(roots);
+ cpl_polynomial_delete(p1d);
+
+ return;
+}
diff --git a/irplib/tests/irplib_utils-test.c b/irplib/tests/irplib_utils-test.c
new file mode 100644
index 0000000..7d75f3f
--- /dev/null
+++ b/irplib/tests/irplib_utils-test.c
@@ -0,0 +1,331 @@
+/* *
+ * This file is part of the ESO IRPLIB package *
+ * Copyright (C) 2004,2005 European Southern Observatory *
+ * *
+ * This library 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
+ * */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <irplib_utils.h>
+#include <string.h>
+#include <float.h>
+
+/*-----------------------------------------------------------------------------
+ Function prototypes
+ -----------------------------------------------------------------------------*/
+
+static IRPLIB_UTIL_SET_ROW(my_table_set_row);
+static IRPLIB_UTIL_CHECK(my_table_check);
+
+static void test_irplib_image_split(void);
+static void test_irplib_dfs_table_convert(void);
+static void test_irplib_isnaninf(void);
+static void bench_irplib_image_split(int, int);
+static void frameset_sort_test(int sz);
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_utils_test Testing of the IRPLIB utilities
+ */
+/*----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Unit tests of utils module
+**/
+/*----------------------------------------------------------------------------*/
+
+int main(void)
+{
+ /* Initialize CPL for unit testing */
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ test_irplib_isnaninf();
+
+ test_irplib_dfs_table_convert();
+
+ test_irplib_image_split();
+
+ frameset_sort_test(122); /* test even */
+ frameset_sort_test(127); /* test odd */
+
+ if (cpl_msg_get_level() <= CPL_MSG_INFO) {
+ bench_irplib_image_split(1024, 100);
+ } else {
+ bench_irplib_image_split(64, 1);
+ }
+
+ return cpl_test_end(0);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test of irplib_isinf and irplib_isnan
+**/
+/*----------------------------------------------------------------------------*/
+static void test_irplib_isnaninf(void)
+{
+ double infinity = DBL_MAX * DBL_MAX;
+ double number[] = {17, 0};
+
+ /* The computation oo/oo must result in NaN according to
+ the IEEE 754 standard. However, some GCC 4.x versions erroneously
+ optimize this to 1.
+
+ Alternatively, a NaN could be produced using a IEEE 754 defined bit
+ pattern. But that is likely to depend on the machine's word size.
+ Therefore this test is disabled.
+
+ double not_a_number = infinity / infinity;
+ */
+
+ cpl_test_zero(irplib_isnan(infinity) );
+ /* cpl_test( irplib_isnan(not_a_number) ); */
+ cpl_test_zero(irplib_isnan(number[0]) );
+ cpl_test_zero(irplib_isnan(number[1]) );
+
+ cpl_test( irplib_isinf(infinity) );
+ /* cpl_test_zero(irplib_isinf(not_a_number) ); */
+ cpl_test_zero(irplib_isinf(number[0]) );
+ cpl_test_zero(irplib_isinf(number[1]) );
+
+ return;
+}
+
+
+static cpl_boolean my_table_set_row(cpl_table * self,
+ const char * line,
+ int irow,
+ const cpl_frame * rawframe,
+ const cpl_parameterlist * parlist)
+{
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(line != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(irow >= 0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(rawframe != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
+
+ return CPL_ERROR_NONE;
+
+}
+
+static cpl_error_code my_table_check(cpl_table * self,
+ const cpl_frameset * useframes,
+ const cpl_parameterlist * parlist)
+{
+
+ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(useframes != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
+
+ return CPL_ERROR_NONE;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test irplib_dfs_table_convert() and irplib_table_read_from_frameset()
+
+**/
+/*----------------------------------------------------------------------------*/
+static void test_irplib_dfs_table_convert(void)
+{
+
+ /* FIXME: Room for improvement... */
+ cpl_error_code error
+ = irplib_dfs_table_convert(NULL, NULL, NULL, 1024, '#',
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, my_table_set_row,
+ my_table_check);
+
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error =
+ irplib_table_read_from_frameset(NULL, NULL, 1024, '#', NULL,
+ my_table_set_row);
+
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test irplib_dfs_table_convert() and irplib_table_read_from_frameset()
+
+**/
+/*----------------------------------------------------------------------------*/
+static void bench_irplib_image_split(int nxy, int nsplit) {
+
+ const double th_low = 0.0;
+ const double th_high = 50.0;
+ const double alt_low = th_low - 1.0;
+ const double alt_high = th_high + 1.0;
+ cpl_image * test = cpl_image_new(nxy, nxy, CPL_TYPE_FLOAT);
+ double tsum = 0.0;
+ int i;
+
+ for (i = 0; i < nsplit; i++) {
+ double time1;
+ const double time0 = cpl_test_get_cputime();
+ const cpl_error_code error =
+ irplib_image_split(test, NULL, test, NULL,
+ th_low, CPL_TRUE, th_high, CPL_TRUE,
+ alt_low, alt_high,
+ CPL_TRUE, CPL_FALSE, CPL_TRUE);
+ time1 = cpl_test_get_cputime();
+
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ if (time1 > time0) tsum += time1 - time0;
+ }
+
+ cpl_msg_info(cpl_func,"Time to split with image size %d [ms]: %g", nxy,
+ 1e3*tsum/nsplit);
+
+ cpl_image_delete(test);
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test irplib_dfs_table_convert() and irplib_table_read_from_frameset()
+
+**/
+/*----------------------------------------------------------------------------*/
+static void test_irplib_image_split(void) {
+
+ const double th_low = 0.0;
+ const double th_high = 50.0;
+ const double alt_low = th_low - 1.0;
+ const double alt_high = th_high + 1.0;
+
+ cpl_image * test = cpl_image_new(100, 100, CPL_TYPE_DOUBLE);
+ cpl_image * result = cpl_image_new(100, 100, CPL_TYPE_DOUBLE);
+
+ /* Various error conditions */
+ cpl_error_code error
+ = irplib_image_split(NULL, test, result, test,
+ 0.0, CPL_FALSE, 0.0, CPL_FALSE,
+ 0.0, 0.0,
+ CPL_FALSE, CPL_FALSE, CPL_FALSE);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+
+ error = irplib_image_split(test, NULL, NULL, NULL,
+ th_low, CPL_TRUE, th_high, CPL_TRUE,
+ alt_low, alt_high,
+ CPL_TRUE, CPL_FALSE, CPL_TRUE);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_image_split(test, NULL, result, NULL,
+ th_low, CPL_TRUE, alt_low, CPL_TRUE,
+ alt_low, alt_high,
+ CPL_TRUE, CPL_FALSE, CPL_TRUE);
+
+ cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Verify against cpl_image_threshold() */
+ error = cpl_image_fill_noise_uniform(test, -100.0, 100.0);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = irplib_image_split(test, NULL, result, NULL,
+ th_low, CPL_TRUE, th_high, CPL_TRUE,
+ alt_low, alt_high,
+ CPL_TRUE, CPL_FALSE, CPL_TRUE);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_image_threshold(test, th_low, th_high, alt_low, alt_high);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_image_subtract(result, test);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_leq(cpl_image_get_absflux(result), DBL_EPSILON);
+
+ cpl_image_delete(test);
+ cpl_image_delete(result);
+
+}
+
+static void frameset_sort_test(int sz)
+{
+ /* 1. create a test frameset - each frame should contain EXPTIME property */
+ cpl_frameset * pframeset = cpl_frameset_new();
+ int * idx = cpl_malloc(sz * sizeof(*idx));
+ double * exptime = cpl_malloc(sz * sizeof(*exptime));
+ cpl_error_code error;
+ int i;
+
+ cpl_test_nonnull(pframeset);
+
+ for (i = 0; i < sz; i++) {
+ cpl_frame * pframe = cpl_frame_new();
+ cpl_propertylist * plist = cpl_propertylist_new();
+ char * filename = cpl_sprintf("dummyon%d.fits", i);
+ const double value = (i % 2) > 0 ? i : sz - i - 1;
+
+
+ cpl_test_nonnull(pframe);
+ /* assign exptime; */
+ error = cpl_frame_set_filename(pframe, filename);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_frame_set_tag(pframe, "ON");
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_frame_set_type(pframe, CPL_FRAME_TYPE_IMAGE);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_frame_set_group(pframe, CPL_FRAME_GROUP_RAW);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = cpl_frameset_insert(pframeset, pframe);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_propertylist_append_double(plist, "EXPTIME", value);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+ error = cpl_propertylist_save(plist, filename, CPL_IO_CREATE);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_propertylist_delete(plist);
+ cpl_free(filename);
+ }
+
+ error = irplib_frameset_sort(pframeset, idx, exptime);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ for (i = 0; i < sz; i++) {
+ int k = i + 1 - (sz % 2);
+ int j = sz -i - 1 ;
+ cpl_test_eq(idx[i], (((i + (sz % 2)) % 2) == 0 ? k : j));
+ }
+
+ cpl_free(idx);
+ cpl_free(exptime);
+ cpl_frameset_delete(pframeset);
+ cpl_test_zero(system("rm *.fits"));
+}
diff --git a/irplib/tests/irplib_wcs-test.c b/irplib/tests/irplib_wcs-test.c
new file mode 100644
index 0000000..af75703
--- /dev/null
+++ b/irplib/tests/irplib_wcs-test.c
@@ -0,0 +1,307 @@
+/* $Id: irplib_wcs-test.c,v 1.8 2010/10/07 14:10:55 llundin Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2001-2008 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: llundin $
+ * $Date: 2010/10/07 14:10:55 $
+ * $Revision: 1.8 $
+ * $Name: hawki-1_8_9 $
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cpl_test.h>
+
+#include "irplib_wcs.h"
+
+/*-----------------------------------------------------------------------------
+ Static functions
+ -----------------------------------------------------------------------------*/
+static void irplib_wcs_all_test(void);
+
+static void irplib_wcs_mjd_test(void);
+
+
+/*-----------------------------------------------------------------------------
+ Main
+ -----------------------------------------------------------------------------*/
+int main (void)
+{
+
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ irplib_wcs_all_test();
+
+ irplib_wcs_mjd_test();
+
+ return cpl_test_end(0);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the WCS functions
+ @return void
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_wcs_all_test(void)
+{
+ const double xorig = 1.0;
+ const double yorig = 2.0;
+ double xnew,ynew;
+ double ra, dec;
+ cpl_propertylist * prop_wcs;
+ cpl_wcs * wcs = NULL;
+ cpl_error_code error;
+
+
+ /* Create WCS object */
+ prop_wcs = cpl_propertylist_new();
+ cpl_test_nonnull(prop_wcs);
+
+ cpl_propertylist_append_double(prop_wcs, "CRVAL1", 10.);
+ cpl_propertylist_append_double(prop_wcs, "CRVAL2", 20.);
+ cpl_propertylist_append_int(prop_wcs, "CRPIX1", 1);
+ cpl_propertylist_append_int(prop_wcs, "CRPIX2", 2);
+ cpl_propertylist_append_double(prop_wcs, "CD1_1", 10.);
+ cpl_propertylist_append_double(prop_wcs, "CD1_2", 11.);
+ cpl_propertylist_append_double(prop_wcs, "CD2_1", 13.);
+ cpl_propertylist_append_double(prop_wcs, "CD2_2", 14.);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ wcs = cpl_wcs_new_from_propertylist(prop_wcs);
+ cpl_propertylist_delete(prop_wcs);
+
+ if (cpl_error_get_code() == CPL_ERROR_NO_WCS) {
+
+ cpl_msg_warning(cpl_func, "No WCS present. Tests disabled");
+ cpl_test_error(CPL_ERROR_NO_WCS);
+ cpl_test_null(wcs);
+
+ } else {
+
+ cpl_test_nonnull(wcs);
+
+ /* Test that a simple call to xytoradec does not fail*/
+ error = irplib_wcs_xytoradec(wcs, xorig, yorig, &ra, &dec);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ /* Get the transformation back and compare */
+ error = irplib_wcs_radectoxy(wcs, ra, dec, &xnew, &ynew);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_abs(xnew, xorig, 2.0 * DBL_EPSILON);
+ cpl_test_abs(ynew, yorig, 2.0 * DBL_EPSILON);
+
+ /* Error testing */
+
+ error = irplib_wcs_xytoradec(wcs, xorig, yorig, NULL, &dec);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_radectoxy(wcs, ra, dec, NULL, &ynew);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_xytoradec(wcs, xorig, yorig, &ra, NULL);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_radectoxy(wcs, ra, dec, &xnew, NULL);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ cpl_wcs_delete(wcs);
+
+ }
+
+ /* Error testing */
+
+ error = irplib_wcs_xytoradec(NULL, xorig, yorig, &ra, &dec);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_radectoxy(NULL, ra, dec, &xnew, &ynew);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the MJD functions
+ @return void
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_wcs_mjd_test(void)
+{
+
+ /* Matching example from some VLT header */
+ const char * iso8601 = "2010-07-13T23:24:39.284";
+ const double mjd = 55390.97545467;
+
+ /* Two equal dates */
+ const char * iso8601a = "2010-07-13T24:00:00";
+ const char * iso8601b = "2010-07-14T00:00:00.000";
+
+ const double mstol = 1e-3/86400.0; /* 1ms tolerance in MJD */
+ int year, day, month, hour, minute;
+ double second;
+ double tmjd, tmjd2;
+ cpl_error_code error;
+
+ /* The MJD counts the number of days since November 17, 1858 */
+ /* Test 1a: Conversion of MJD == 0 */
+ error = irplib_wcs_iso8601_from_mjd(&year, &month, &day, &hour,
+ &minute, &second, 0.0);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_eq(year, 1858);
+ cpl_test_eq(month, 11);
+ cpl_test_eq(day, 17);
+ cpl_test_eq(hour, 0);
+ cpl_test_eq(minute, 0);
+ cpl_test_abs(second, 0.0, 2.0 * DBL_EPSILON);
+
+ /* Test 1b: - and convert back */
+ error = irplib_wcs_mjd_from_iso8601(&tmjd, year, month, day, hour, minute,
+ second);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_abs(tmjd, 0.0, 2.0 * DBL_EPSILON);
+
+ /* Test 2: Conversion back and forth of some recent date */
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = irplib_wcs_mjd_from_iso8601(&tmjd, year, month, day, hour, minute,
+ second);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_abs(mjd, tmjd, mstol);
+
+ error = irplib_wcs_mjd_from_string(&tmjd, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_abs(mjd, tmjd, mstol);
+
+ error = irplib_wcs_iso8601_from_mjd(&year, &month, &day, &hour,
+ &minute, &second, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = irplib_wcs_mjd_from_iso8601(&tmjd, year, month, day, hour, minute,
+ second);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_abs(mjd, tmjd, 2.0 * DBL_EPSILON);
+
+ /* Test 3: 24:00:00 == 00.00.00 + 1 day */
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second, iso8601a);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = irplib_wcs_mjd_from_iso8601(&tmjd, year, month, day, hour, minute,
+ second);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second, iso8601b);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ error = irplib_wcs_mjd_from_iso8601(&tmjd2, year, month, day, hour, minute,
+ second);
+ cpl_test_eq_error(error, CPL_ERROR_NONE);
+
+ cpl_test_abs(tmjd, tmjd2, 2.0 * DBL_EPSILON);
+
+ /* Test 4: Do not allow days from y10k */
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second,
+ "10000-07-13T23:24:39.284");
+ cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Test 5: Verify validation of length of a non-leap year month */
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second,
+ "2010-02-29T23:24:39.284");
+ cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* Test 6: NULL pointer checking */
+ error = irplib_wcs_mjd_from_iso8601(NULL, year, month, day, hour, minute,
+ second);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(NULL, &month, &day, &hour,
+ &minute, &second, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(&year, NULL, &day, &hour,
+ &minute, &second, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(&year, &month, NULL, &hour,
+ &minute, &second, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, NULL,
+ &minute, &second, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ NULL, &second, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, NULL, iso8601);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_string(&year, &month, &day, &hour,
+ &minute, &second, NULL);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_mjd(NULL, &month, &day, &hour,
+ &minute, &second, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_mjd(&year, NULL, &day, &hour,
+ &minute, &second, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_mjd(&year, &month, NULL, &hour,
+ &minute, &second, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_mjd(&year, &month, &day, NULL,
+ &minute, &second, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_mjd(&year, &month, &day, &hour,
+ NULL, &second, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+ error = irplib_wcs_iso8601_from_mjd(&year, &month, &day, &hour,
+ &minute, NULL, mjd);
+ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT);
+
+}
diff --git a/irplib/tests/irplib_wlxcorr-test.c b/irplib/tests/irplib_wlxcorr-test.c
new file mode 100644
index 0000000..629cae9
--- /dev/null
+++ b/irplib/tests/irplib_wlxcorr-test.c
@@ -0,0 +1,483 @@
+/* $Id: irplib_wlxcorr-test.c,v 1.15 2012/01/12 12:38:38 llundin Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2001-2004 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: llundin $
+ * $Date: 2012/01/12 12:38:38 $
+ * $Revision: 1.15 $
+ * $Name: hawki-1_8_9 $
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <irplib_wlxcorr.h>
+
+#include <irplib_wavecal_impl.h>
+
+#include <cpl_plot.h>
+
+#include <math.h>
+#include <float.h>
+
+/* TEMPORARY SUPPORT OF CPL 5.x */
+#ifndef CPL_SIZE_FORMAT
+#define CPL_SIZE_FORMAT "d"
+#define cpl_size int
+#endif
+/* END TEMPORARY SUPPORT OF CPL 5.x */
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup irplib_wlcalib_test Testing of the CPL Wavelength calibration
+ */
+/*----------------------------------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------------
+ Private Function prototypes
+ -----------------------------------------------------------------------------*/
+
+static void irplib_wlxcorr_best_poly_test(void);
+static void irplib_wlxcorr_best_poly_test_one(int, int, cpl_boolean, int, int);
+static void irplib_wlxcorr_convolve_create_kernel_test(void);
+static void irplib_wlxcorr_convolve_create_kernel_test_one(double, double);
+static double irplib_wlcalib_lss(double, double, double);
+static void irplib_wavecal_profile_compare(int, double, double);
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Unit tests of wlcalib module
+**/
+/*----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Main
+ -----------------------------------------------------------------------------*/
+int main(void)
+{
+ /* Initialize CPL + IRPLIB */
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ irplib_wavecal_profile_compare(100, 4.0, 4.0);
+ irplib_wlxcorr_convolve_create_kernel_test();
+ irplib_wlxcorr_best_poly_test();
+
+ return cpl_test_end(0);
+}
+
+
+static void irplib_wlxcorr_best_poly_test(void)
+{
+ cpl_polynomial * poly;
+ const cpl_boolean do_bench = cpl_msg_get_level() <= CPL_MSG_INFO
+ ? CPL_TRUE : CPL_FALSE;
+ const int spec_size = do_bench ? 1024 : 256;
+ const int nreps = do_bench ? 3 : 1;
+ const int nsamples = do_bench ? 30 : 10;
+
+
+ /* 1st test: NULL input */
+ poly = irplib_wlxcorr_best_poly(NULL, NULL, 1, NULL, NULL, 1, 1.0, 1.0,
+ NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_test_null( poly );
+
+#if 1
+ /* 2nd test: Resampling of catalog lines */
+ irplib_wlxcorr_best_poly_test_one(spec_size, spec_size*10, CPL_TRUE,
+ nsamples, nreps);
+#endif
+
+ /* 3rd test: No resampling of catalog lines */
+ irplib_wlxcorr_best_poly_test_one(spec_size, spec_size/50, CPL_FALSE,
+ nsamples, nreps);
+}
+
+static void irplib_wlxcorr_best_poly_test_one(int spec_size, int cat_size,
+ cpl_boolean do_resample,
+ int nsamples, int nreps)
+{
+ const int degree = 2;
+ cpl_vector * spectrum = cpl_vector_new(spec_size);
+ cpl_bivector * catalog = cpl_bivector_new(cat_size);
+ cpl_polynomial * true_poly = cpl_polynomial_new(1);
+ cpl_polynomial * guess_poly = cpl_polynomial_new(1);
+ cpl_vector * wl_err = cpl_vector_new(degree+1);
+ double xc;
+ const double slitw = 2.0;
+ const double fwhm = 2.0;
+ const double xtrunc = 0.5 * slitw + 5.0 * fwhm * CPL_MATH_SIG_FWHM;
+ const double rel_error = 0.05; /* Introduce error */
+
+ /* A black-body with T=253K should emit mostly in the range [2;50[ micron */
+ const double temp_bb = 253.0;
+
+ const double b_true = 2e-6;
+ const double a_true = 48e-6 / spec_size;
+
+ const double a_error = a_true * rel_error;
+ const double b_error = b_true * rel_error;
+ const double a = a_true + a_error;
+ const double b = b_true + b_error;
+ double wl_errmax;
+ cpl_size pow_ind;
+ int i;
+ FILE * stream = cpl_msg_get_level() > CPL_MSG_INFO
+ ? fopen("/dev/null", "a") : stdout;
+
+
+ cpl_test_nonnull( stream );
+
+ /* First guess P(x) = ax + b */
+ /* The true and distorted polynomials */
+ pow_ind = 1;
+ cpl_polynomial_set_coeff(true_poly, &pow_ind, a_true);
+ cpl_polynomial_set_coeff(guess_poly, &pow_ind, a);
+ pow_ind = 0;
+ cpl_polynomial_set_coeff(true_poly, &pow_ind, b_true);
+ cpl_polynomial_set_coeff(guess_poly, &pow_ind, b);
+
+ cpl_msg_info(cpl_func, "First guess polynomial:");
+ cpl_polynomial_dump(guess_poly, stream);
+
+ /* Try also to shift the guess of the solution */
+ cpl_test_zero(cpl_polynomial_shift_1d(guess_poly, 0, 25.0));
+
+ cpl_msg_info(cpl_func, "True polynomial:");
+ cpl_polynomial_dump(true_poly, stream);
+
+
+ if (do_resample) {
+ cpl_vector * evalpoints = cpl_vector_new(spec_size);
+
+ /* Wavelengths of the spectrum */
+ cpl_vector_fill_polynomial(evalpoints, true_poly, 1.0, 1.0);
+
+ /* Catalog */
+ /* The sampled profile is a black body radiation */
+ cpl_vector_fill_polynomial(cpl_bivector_get_x(catalog), true_poly,
+ -1.0, 1.5 * spec_size / cat_size);
+
+ cpl_photom_fill_blackbody(cpl_bivector_get_y(catalog), CPL_UNIT_LESS,
+ cpl_bivector_get_x_const(catalog),
+ CPL_UNIT_LENGTH, temp_bb);
+
+ cpl_photom_fill_blackbody(spectrum, CPL_UNIT_LESS,
+ evalpoints, CPL_UNIT_LENGTH, temp_bb);
+
+ cpl_vector_delete(evalpoints);
+
+ } else {
+ /* Place some lines with different intensities */
+ double * dx = cpl_bivector_get_x_data(catalog);
+ double * dy = cpl_bivector_get_y_data(catalog);
+
+ for (i = 0; i < cat_size; i++) {
+ const double wli = cpl_polynomial_eval_1d(true_poly, 3.0 * i * i
+ -10.0, NULL);
+
+ dx[i] = wli;
+ dy[i] = sin(i * CPL_MATH_PI / cat_size);
+
+ }
+
+ irplib_vector_fill_line_spectrum_model(spectrum, NULL, NULL, true_poly,
+ catalog, slitw, fwhm, xtrunc,
+ 0, CPL_FALSE, CPL_FALSE, NULL);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ /* FIXME: Add some random noise to the spectrum */
+
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG) {
+ cpl_plot_bivector( "", "t 'Catalog' w lines", "", catalog);
+ cpl_plot_vector( "", "t 'Spectrum' w lines", "", spectrum);
+ }
+
+
+ /* Error */
+ /* Compute an error bound certain to include to true solution */
+ wl_errmax = cpl_polynomial_eval_1d(guess_poly, spec_size, NULL)
+ - cpl_polynomial_eval_1d(true_poly, spec_size, NULL);
+ cpl_vector_fill(wl_err, 2.0 * wl_errmax);
+
+ /* Multiple calls for bench-marking */
+
+ for (i=0; i < nreps; i++) {
+ cpl_table * wl_res;
+ cpl_vector * xcorrs;
+ cpl_polynomial * poly
+ = irplib_wlxcorr_best_poly(spectrum, catalog, degree,
+ guess_poly, wl_err, nsamples,
+ slitw, fwhm, &xc, &wl_res, &xcorrs);
+ cpl_test_nonnull(poly);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ if (i == 0 && poly != NULL) {
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG) {
+ const char * labels[] = {IRPLIB_WLXCORR_COL_WAVELENGTH,
+ IRPLIB_WLXCORR_COL_CAT_INIT,
+ IRPLIB_WLXCORR_COL_CAT_FINAL,
+ IRPLIB_WLXCORR_COL_OBS};
+
+ cpl_plot_vector( "", "t 'X corr values' w lines", "", xcorrs);
+
+ cpl_test_zero(cpl_plot_columns("", "", "", wl_res, labels, 4));
+ }
+
+ cpl_msg_info(cpl_func, "Corrected polynomial:");
+ cpl_polynomial_dump(poly, stream);
+
+ /* Corrected polynomial must be monotone, with same sign
+ as a_true. */
+ cpl_test_zero(cpl_polynomial_derivative(poly, 0));
+ cpl_test_leq(0.0, a_true * cpl_polynomial_eval_1d(poly, 1.0, NULL));
+ cpl_test_leq(0.0, a_true
+ * cpl_polynomial_eval_1d(poly, 0.5 * spec_size, NULL));
+ cpl_test_leq(0.0, a_true
+ * cpl_polynomial_eval_1d(poly, spec_size, NULL));
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ }
+
+ cpl_table_delete(wl_res);
+ cpl_vector_delete(xcorrs);
+ cpl_polynomial_delete(poly);
+ }
+
+ cpl_vector_delete(wl_err);
+ cpl_vector_delete(spectrum);
+ cpl_bivector_delete(catalog);
+ cpl_polynomial_delete(true_poly);
+ cpl_polynomial_delete(guess_poly);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ if (stream != stdout) cpl_test_zero( fclose(stream) );
+
+ return;
+}
+
+
+static void irplib_wlxcorr_convolve_create_kernel_test_one(double slitw,
+ double fwhm)
+{
+
+ cpl_vector * kernel;
+ double sum = 0.0;
+ /* Maximum value of profile */
+ const double maxval = irplib_wlcalib_lss(0.0, slitw, fwhm);
+ double prev = maxval;
+ int n, i;
+
+ cpl_msg_info(cpl_func, "Slit-width=%g, FWHM=%g", slitw, fwhm);
+
+ kernel = irplib_wlxcorr_convolve_create_kernel(0.0, fwhm);
+
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_test_null(kernel);
+
+ kernel = irplib_wlxcorr_convolve_create_kernel(slitw, 0.0);
+
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_test_null(kernel);
+
+ kernel = irplib_wlxcorr_convolve_create_kernel(slitw, fwhm);
+
+ cpl_test_nonnull(kernel);
+
+ n = cpl_vector_get_size(kernel);
+
+ for (i = 0; i < n; i++) {
+ const double val = cpl_vector_get(kernel, i);
+ sum += i ? 2.0*val : val; /* Non-central elements twice */
+
+ /* Profile consists of non-negative values */
+ cpl_test_leq(0.0, val);
+
+ /* The max of the profile is less than maxval and decreases */
+ cpl_test_leq(val, prev);
+
+ if (i > 0) {
+ /* The profile at i is less than the continuous profile at
+ i - 0.5, and greater than that at i + 0.5 */
+ cpl_test_leq(val, irplib_wlcalib_lss(i - 0.5, slitw, fwhm));
+ cpl_test_leq(irplib_wlcalib_lss(i + 0.5, slitw, fwhm), val);
+ }
+
+ /* The profile has a FWHM (sligthly) greater than slitw */
+ if ((double)i < 0.5 * slitw) {
+ /* Thus if x is less than half the slit width, then
+ the value has to be greater than half the maximum */
+ cpl_test_leq(0.5 * maxval, val);
+ } else if (val < 0.5 * maxval) {
+ /* On the other hand, if the value is less than the maximum,
+ then x must exceed half the slitw */
+ cpl_test_leq(0.5*slitw, (double)i);
+ }
+
+ prev = val;
+ }
+
+ /* Integral is supposed to be 1 */
+ cpl_test_abs(sum, 1.0, 1e-5); /* FIXME: Improve tolerance */
+
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG) {
+ char * title = cpl_sprintf("t 'LSS profile, slitw=%g, fwhm=%g' "
+ "w linespoints", slitw, fwhm);
+ cpl_plot_vector("set grid;", title, "", kernel);
+ cpl_free(title);
+ }
+
+ cpl_vector_delete(kernel);
+}
+
+static void irplib_wlxcorr_convolve_create_kernel_test(void)
+{
+
+ irplib_wlxcorr_convolve_create_kernel_test_one(0.86, 2.0);
+ irplib_wlxcorr_convolve_create_kernel_test_one(1.72, 3.0);
+ irplib_wlxcorr_convolve_create_kernel_test_one(40.0, 2.0);
+ irplib_wlxcorr_convolve_create_kernel_test_one(3.0, 40.0);
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief The intensity of the line profile at distance x
+ @param x x
+ @param slitw The slit width
+ @param fwhm The FWHM of the (Gaussian) transfer function
+ @return The intensity of the line profile at distance x
+
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_wlcalib_lss(double x, double slitw, double fwhm)
+{
+ const double sigmasqrt2 = fwhm * CPL_MATH_SIG_FWHM * CPL_MATH_SQRT2;
+ const double result = 0.5 / slitw *
+ (erf((x+0.5*slitw)/sigmasqrt2) - erf((x-0.5*slitw)/sigmasqrt2));
+
+ cpl_test_lt(0.0, slitw);
+ cpl_test_lt(0.0, sigmasqrt2);
+
+ /* Protect against round-off (on SunOS 5.8) */
+ return result < 0.0 ? 0.0 : result;
+
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Compare the standard and fast profiles
+ @param spec_size Number of points in the spectrum
+ @param slitw The slit width
+ @param fwhm The FWHM of the (Gaussian) transfer function
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_wavecal_profile_compare(int spec_size, double slitw,
+ double fwhm)
+{
+
+ cpl_vector * spectrum1 = cpl_vector_new(spec_size);
+ cpl_vector * spectrum2 = cpl_vector_new(spec_size);
+ cpl_bivector * catalog = cpl_bivector_new(2);
+ cpl_polynomial * dispersion = cpl_polynomial_new(1);
+ const double a = 1.0;
+ const double b = 100.0;
+ const double xtrunc = 0.5 * slitw + 2.0 * fwhm * CPL_MATH_SIG_FWHM;
+ double mean;
+ cpl_error_code error;
+ cpl_size pow_ind;
+
+
+ pow_ind = 1;
+ cpl_polynomial_set_coeff(dispersion, &pow_ind, a);
+ pow_ind = 0;
+ cpl_polynomial_set_coeff(dispersion, &pow_ind, b);
+
+ cpl_vector_set(cpl_bivector_get_x(catalog), 0, b + spec_size / 3.0);
+ cpl_vector_set(cpl_bivector_get_y(catalog), 0, 100);
+
+ cpl_vector_set(cpl_bivector_get_x(catalog), 1, b + spec_size / 1.5);
+ cpl_vector_set(cpl_bivector_get_y(catalog), 1, 100);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ error = irplib_vector_fill_line_spectrum_model(spectrum1, NULL, NULL,
+ dispersion, catalog, slitw,
+ fwhm, xtrunc, 0, CPL_FALSE,
+ CPL_FALSE, NULL);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(error, CPL_ERROR_NONE);
+
+
+ error = irplib_vector_fill_line_spectrum_model(spectrum2, NULL, NULL,
+ dispersion, catalog, slitw,
+ fwhm, xtrunc, 0, CPL_TRUE,
+ CPL_FALSE, NULL);
+
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(error, CPL_ERROR_NONE);
+
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG) {
+ error = cpl_plot_vector("set grid;", "t 'Spectrum' w lines", "",
+ spectrum1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(error, CPL_ERROR_NONE);
+ error = cpl_plot_vector("set grid;", "t 'Spectrum' w lines", "",
+ spectrum2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(error, CPL_ERROR_NONE);
+ }
+
+ cpl_vector_subtract(spectrum1, spectrum2);
+ mean = cpl_vector_get_mean(spectrum1);
+ if (mean != 0.0) {
+ cpl_msg_info(cpl_func, "Error: %g", mean);
+ if (cpl_msg_get_level() <= CPL_MSG_DEBUG) {
+ error = cpl_plot_vector("set grid;", "t 'Spectrum error' w lines",
+ "", spectrum1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(error, CPL_ERROR_NONE);
+ }
+ }
+
+ cpl_polynomial_delete(dispersion);
+ cpl_vector_delete(spectrum1);
+ cpl_vector_delete(spectrum2);
+ cpl_bivector_delete(catalog);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+}
diff --git a/m4macros/cpl.m4 b/m4macros/cpl.m4
new file mode 100644
index 0000000..e1a27c1
--- /dev/null
+++ b/m4macros/cpl.m4
@@ -0,0 +1,1499 @@
+# CPL_CHECK_CFITSIO(version)
+#---------------------------
+# Checks for the cfitsio library and header files.
+AC_DEFUN([CPL_CHECK_CFITSIO],
+[
+
+ AC_REQUIRE([ESO_CHECK_THREADS_POSIX])
+
+ cpl_cfitsio_check_version="$1"
+ cpl_cfitsio_check_header="fitsio.h"
+ cpl_cfitsio_check_lib="libcfitsio.a"
+
+ cpl_cfitsio_incdirs=""
+ cpl_cfitsio_libdirs=""
+ cpl_cfitsio_includes=""
+ cpl_cfitsio_libraries=""
+
+ AC_ARG_WITH(cfitsio,
+ AC_HELP_STRING([--with-cfitsio],
+ [location where cfitsio is installed]),
+ [
+ cpl_with_cfitsio=$withval
+ ])
+
+ AC_ARG_WITH(cfitsio-includes,
+ AC_HELP_STRING([--with-cfitsio-includes],
+ [location of the cfitsio header files]),
+ cpl_with_cfitsio_includes=$withval)
+
+ AC_ARG_WITH(cfitsio-libs,
+ AC_HELP_STRING([--with-cfitsio-libs],
+ [location of the cfitsio library]),
+ cpl_with_cfitsio_libs=$withval)
+
+ AC_ARG_ENABLE(cfitsio-test,
+ AC_HELP_STRING([--disable-cfitsio-test],
+ [disables checks for the cfitsio library and headers]),
+ cpl_enable_cfitsio_test=$enableval,
+ cpl_enable_cfitsio_test=yes)
+
+
+ # We need libpthread for the folloing tests
+
+ if test -z "$LIBPTHREAD"; then
+ AC_MSG_ERROR([POSIX thread library was not found on your system! Please check!])
+ fi
+
+
+ AC_MSG_CHECKING([for cfitsio])
+
+ if test "x$cpl_enable_cfitsio_test" = xyes; then
+
+ # Check for the cfitsio includes
+
+ if test -z "$cpl_with_cfitsio_includes"; then
+
+ if test -z "$cpl_with_cfitsio"; then
+
+ # Try some known system locations
+
+ cpl_cfitsio_incdirs="/opt/cfitsio/include"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include/libcfitsio0"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include/cfitsio"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include/libcfitsio0"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include/cfitsio"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include"
+
+ test -n "$CFITSIODIR" && \
+ cpl_cfitsio_incdirs="$CFITSIODIR/include/libcfitsio0 \
+ $CFITSIODIR/include/cfitsio \
+ $CFITSIODIR/include \
+ $cpl_cfitsio_incdirs"
+
+ test -n "$CPLDIR" && \
+ cpl_cfitsio_incdirs="$CPLDIR/include/libcfitsio0 \
+ $CPLDIR/include/cfitsio \
+ $CPLDIR/include \
+ $cpl_cfitsio_incdirs"
+
+ else
+
+ cpl_cfitsio_incdirs="$cpl_with_cfitsio/include/libcfitsio0"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs $cpl_with_cfitsio/include/cfitsio"
+ cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs $cpl_with_cfitsio/include"
+
+ fi
+
+ else
+ cpl_cfitsio_incdirs="$cpl_with_cfitsio_includes"
+ fi
+
+ ESO_FIND_FILE($cpl_cfitsio_check_header, $cpl_cfitsio_incdirs,
+ cpl_cfitsio_includes)
+
+
+ # Check for the cfitsio library
+
+ if test -z "$cpl_with_cfitsio_libs"; then
+
+ if test -z "$cpl_with_cfitsio"; then
+
+ # Try some known system locations
+
+ cpl_cfitsio_libdirs="/opt/cfitsio/lib"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib64"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib32"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib64"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib32"
+
+ test -n "$CFITSIODIR" && \
+ cpl_cfitsio_libdirs="$CFITSIODIR/lib64 $CFITSIODIR/lib \
+ $CFITSIODIR/lib32 $cpl_cfitsio_libdirs"
+
+ test -n "$CPLDIR" && \
+ cpl_cfitsio_libdirs="$CPLDIR/lib64 $CPLDIR/lib $CPLDIR/lib32 \
+ $cpl_cfitsio_libdirs"
+
+ else
+
+ cpl_cfitsio_libdirs="$cpl_with_cfitsio/lib64"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs $cpl_with_cfitsio/lib"
+ cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs $cpl_with_cfitsio/lib32"
+
+ fi
+
+ else
+ cpl_cfitsio_libdirs="$cpl_with_cfitsio_libs"
+ fi
+
+ ESO_FIND_FILE($cpl_cfitsio_check_lib, $cpl_cfitsio_libdirs,
+ cpl_cfitsio_libraries)
+
+
+ if test x"$cpl_cfitsio_includes" = xno || \
+ test x"$cpl_cfitsio_libraries" = xno; then
+ cpl_cfitsio_notfound=""
+
+ if test x"$cpl_cfitsio_includes" = xno; then
+ if test x"$cpl_cfitsio_libraries" = xno; then
+ cpl_cfitsio_notfound="(headers and libraries)"
+ else
+ cpl_cfitsio_notfound="(headers)"
+ fi
+ else
+ cpl_cfitsio_notfound="(libraries)"
+ fi
+
+ AC_MSG_ERROR([cfitsio $cpl_cfitsio_notfound was not found on your system. Please check!])
+ else
+ AC_MSG_RESULT([libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes])
+ fi
+
+ # Set up the symbols
+
+ # Add '-lz' to the static library symbol, as distributors apparently
+ # remove the libz code from the cfitsio sources.
+
+ CFITSIO_INCLUDES="-I$cpl_cfitsio_includes"
+ CFITSIO_LDFLAGS="-L$cpl_cfitsio_libraries"
+ LIBCFITSIO="-lcfitsio"
+ LIBCFITSIO_STATIC="$cpl_cfitsio_libraries/$cpl_cfitsio_check_lib"
+
+ # Do not add redundant libraries
+ echo $LIBS | grep -q -e '-lm' || LIBS="-lm $LIBS"
+
+
+ # Check whether cfitsio can be used
+
+ AC_MSG_CHECKING([whether cfitsio can be used])
+ AC_LANG_PUSH(C)
+
+ cpl_cfitsio_cflags_save="$CFLAGS"
+ cpl_cfitsio_ldflags_save="$LDFLAGS"
+ cpl_cfitsio_libs_save="$LIBS"
+
+ CFLAGS="$CFITSIO_INCLUDES $CFLAGS"
+ LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCFITSIO_STATIC $LIBPTHREAD -lm"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <fitsio.h>
+ ]],
+ [
+ float v;
+ fits_get_version(&v);
+ ])],
+ [cpl_cfitsio_is_usable="yes"],
+ [cpl_cfitsio_is_usable="no"])
+
+ AC_MSG_RESULT([$cpl_cfitsio_is_usable])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_cfitsio_cflags_save"
+ LDFLAGS="$cpl_cfitsio_ldflags_save"
+ LIBS="$cpl_cfitsio_libs_save"
+
+ if test x"$cpl_cfitsio_is_usable" = xno; then
+ AC_MSG_ERROR([Linking with cfitsio failed! Please check architecture!])
+ fi
+
+
+ # Check cfitsio version
+
+ AC_MSG_CHECKING([for a cfitsio version >= $cpl_cfitsio_check_version])
+
+ AC_LANG_PUSH(C)
+
+ cpl_cfitsio_cflags_save="$CFLAGS"
+ cpl_cfitsio_ldflags_save="$LDFLAGS"
+ cpl_cfitsio_libs_save="$LIBS"
+
+ CFLAGS="$CFITSIO_INCLUDES $CFLAGS"
+ LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCFITSIO_STATIC $LIBPTHREAD -lm"
+
+ AC_RUN_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <fitsio.h>
+ ]],
+ [
+ int vlib = 0;
+ int vmin = (int)(1000. * $cpl_cfitsio_check_version + 0.5);
+
+ float v;
+
+ fits_get_version(&v);
+ vlib = (int)(v * 1000 + 0.5);
+
+ FILE* f = fopen("conftest.out", "w");
+ fprintf(f, "%5.3f\n", v);
+ fclose(f);
+
+ if (vlib < vmin) {
+ return 1;
+ }
+
+ return 0;
+ ])],
+ [cpl_cfitsio_version="`cat conftest.out`"],
+ [
+ cpl_cfitsio_version="no";
+ cpl_cfitsio_version_found="`cat conftest.out`"
+ ])
+
+ AC_MSG_RESULT([$cpl_cfitsio_version])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_cfitsio_cflags_save"
+ LDFLAGS="$cpl_cfitsio_ldflags_save"
+ LIBS="$cpl_cfitsio_libs_save"
+
+ if test x"$cpl_cfitsio_version" = xno; then
+ AC_MSG_ERROR([Installed cfitsio ($cpl_cfitsio_version_found) is too old. Please update to version $cpl_cfitsio_check_version or newer.])
+ fi
+
+
+ # Check whether cfitsio has large file support
+
+ AC_LANG_PUSH(C)
+
+ cpl_cfitsio_cflags_save="$CFLAGS"
+ cpl_cfitsio_ldflags_save="$LDFLAGS"
+ cpl_cfitsio_libs_save="$LIBS"
+
+ CFLAGS="$CFITSIO_INCLUDES $CFLAGS"
+ LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCFITSIO_STATIC -lm $LIBPTHREAD"
+
+ AC_MSG_CHECKING([whether cfitsio provides fits_hdu_getoff()])
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <fitsio.h>
+ ]],
+ [
+ fitsfile f;
+ int sts;
+ fits_get_hduoff(&f, NULL, NULL, NULL, &sts);
+ ])],
+ [cpl_cfitsio_have_fits_get_hduoff="yes"],
+ [cpl_cfitsio_have_fits_get_hduoff="no"])
+
+ AC_MSG_RESULT([$cpl_cfitsio_have_fits_get_hduoff])
+
+ AC_MSG_CHECKING([whether cfitsio provides fits_get_hduaddrll()])
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <fitsio.h>
+ ]],
+ [
+ fitsfile f;
+ int sts;
+ fits_get_hduaddrll(&f, NULL, NULL, NULL, &sts);
+ ])],
+ [cpl_cfitsio_have_fits_get_hduaddrll="yes"],
+ [cpl_cfitsio_have_fits_get_hduaddrll="no"])
+
+ AC_MSG_RESULT([$cpl_cfitsio_have_fits_get_hduaddrll])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_cfitsio_cflags_save"
+ LDFLAGS="$cpl_cfitsio_ldflags_save"
+ LIBS="$cpl_cfitsio_libs_save"
+
+
+ # Check whether cfitsio is thread-safe
+
+ AC_MSG_CHECKING([whether cfitsio requires libpthread])
+ AC_LANG_PUSH(C)
+
+ cpl_cfitsio_cflags_save="$CFLAGS"
+ cpl_cfitsio_ldflags_save="$LDFLAGS"
+ cpl_cfitsio_libs_save="$LIBS"
+
+ CFLAGS="$CFITSIO_INCLUDES $CFLAGS"
+ LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCFITSIO_STATIC -lm"
+
+
+ cpl_cfitsio_provides_pthread="no"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <fitsio.h>
+ ]],
+ [
+ float v;
+ fits_get_version(&v);
+ ])],
+ [cpl_cfitsio_requires_pthread="no"],
+ [cpl_cfitsio_requires_pthread="undefined"])
+
+ if test x"$cpl_cfitsio_requires_pthread" = xno; then
+
+ # If libpthread is not required this means either cfitsio is
+ # not compiled with thread support, or the library dependencies
+ # are compiled into cfitsio.
+
+ # Check whether shared library dependencies are present
+ # Don't use pthread_mutex_init/destroy here, since glibc
+ # provides these symbols too! Sigh!
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <pthread.h>
+ #include <fitsio.h>
+ ]],
+ [
+ float v;
+ pthread_mutexattr_t attrb;
+ pthread_mutexattr_init(&attrb);
+ fits_get_version(&v);
+ pthread_mutexattr_destroy(&attrb);
+ ])],
+ [cpl_cfitsio_provides_pthread="yes"],
+ [cpl_cfitsio_provides_pthread="no"])
+
+ else
+
+ LIBS="$LIBCFITSIO_STATIC -lm $LIBPTHREAD"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <fitsio.h>
+ ]],
+ [
+ float v;
+ fits_get_version(&v);
+ ])],
+ [cpl_cfitsio_requires_pthread="yes"],
+ AC_MSG_FAILURE([Cannot link with cfitsio! Please check!]))
+
+ fi
+
+ AC_MSG_RESULT([$cpl_cfitsio_requires_pthread])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_cfitsio_cflags_save"
+ LDFLAGS="$cpl_cfitsio_ldflags_save"
+ LIBS="$cpl_cfitsio_libs_save"
+
+
+ AC_MSG_CHECKING([whether cfitsio was compiled with thread support])
+
+ if test x"$cpl_cfitsio_requires_pthread" = xyes || \
+ test x"$cpl_cfitsio_provides_pthread" = xyes; then
+ cpl_cfitsio_is_thread_safe=yes
+ else
+ cpl_cfitsio_is_thread_safe=no
+ fi
+
+ AC_MSG_RESULT([$cpl_cfitsio_is_thread_safe])
+
+
+ # Set compiler flags and libraries
+
+ if test x"$cpl_cfitsio_have_fits_get_hduoff" = xyes || \
+ test x"$cpl_cfitsio_have_fits_get_hduaddrll" = xyes; then
+
+ CFLAGS="-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 $CFLAGS"
+
+ if test x"$cpl_cfitsio_have_fits_get_hduoff"; then
+ AC_DEFINE([HAVE_FITS_GET_HDUOFF], [1],
+ [Define if you have the `fits_get_hduoff' function])
+ else
+ AC_DEFINE([HAVE_FITS_GET_HDUADDRLL], [1],
+ [Define if you have the `fits_get_hduaddrll' function])
+ fi
+
+ fi
+
+ if test x"$cpl_cfitsio_requires_pthread" = xyes; then
+ echo $LIBS | grep -q -e "$LIBPTHREAD" || LIBS="$LIBPTHREAD $LIBS"
+ fi
+
+ else
+ AC_MSG_RESULT([disabled])
+ AC_MSG_WARN([cfitsio checks have been disabled! This package may not build!])
+ CFITSIO_INCLUDES=""
+ CFITSIO_LDFLAGS=""
+ LIBCFITSIO=""
+
+ cpl_cfitsio_is_thread_safe="undefined"
+ cpl_cfitsio_requires_pthread="undefined"
+ fi
+
+ AC_CACHE_VAL(cpl_cv_cfitsio_requires_pthread,
+ cpl_cv_cfitsio_requires_pthread=$cpl_cfitsio_requires_pthread)
+ AC_CACHE_VAL(cpl_cv_cfitsio_is_thread_safe,
+ cpl_cv_cfitsio_is_thread_safe=$cpl_cfitsio_is_thread_safe)
+
+ AC_SUBST(CFITSIO_INCLUDES)
+ AC_SUBST(CFITSIO_LDFLAGS)
+ AC_SUBST(LIBCFITSIO)
+
+])
+
+
+# CPL_CHECK_CEXT(incdirs=[], libdirs=[])
+#---------------------------------------
+# Checks for the C extension library and header files.
+AC_DEFUN([CPL_CHECK_CEXT],
+[
+
+ AC_MSG_CHECKING([for libcext])
+
+ cpl_cext_check_header="cxtypes.h"
+ cpl_cext_check_lib="libcext.a"
+
+ cpl_cext_incdirs=""
+ cpl_cext_libdirs=""
+
+ cpl_cext_includes=""
+ cpl_cext_libraries=""
+
+
+ # Initialize directory search paths with the arguments provided
+
+ if test -n "$1"; then
+ cpl_cext_incdirs="$1"
+ fi
+
+ if test -n "$2"; then
+ cpl_cext_libdirs="$2"
+ fi
+
+
+ AC_ARG_WITH(cext,
+ AC_HELP_STRING([--with-cext],
+ [location where libcext is installed]),
+ [
+ cpl_with_cext=$withval
+ ])
+
+ AC_ARG_WITH(cext-includes,
+ AC_HELP_STRING([--with-cext-includes],
+ [location of the libcext header files]),
+ cpl_with_cext_includes=$withval)
+
+ AC_ARG_WITH(cext-libs,
+ AC_HELP_STRING([--with-cext-libs],
+ [location of the libcext library]),
+ cpl_with_cext_libs=$withval)
+
+ AC_ARG_ENABLE(cext-test,
+ AC_HELP_STRING([--disable-cext-test],
+ [disables checks for the libcext library and headers]),
+ cpl_enable_cext_test=$enableval,
+ cpl_enable_cext_test=yes)
+
+
+ if test "x$cpl_enable_cext_test" = xyes; then
+
+ # Check for the libcext includes
+
+ if test -z "$cpl_with_cext_includes"; then
+
+ if test -z "$cpl_with_cext"; then
+
+ if test -z "$cpl_cext_incdirs"; then
+
+ # Try some known system locations
+
+ cpl_cext_incdirs="/opt/cext/include"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include/cext"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/include/cext"
+ cpl_cext_incdirs="$cpl_cext_incdirs /usr/include"
+
+ test -n "$CPLDIR" && \
+ cpl_cext_incdirs="$CPLDIR/include/cext \
+ $CPLDIR/include \
+ $cpl_cext_incdirs"
+
+ fi
+
+ else
+
+ cpl_cext_incdirs="$cpl_with_cext/include/cext"
+ cpl_cext_incdirs="$cpl_cext_incdirs $cpl_with_cext/include"
+
+ fi
+
+ else
+ cpl_cext_incdirs="$cpl_with_cext_includes"
+ fi
+
+ ESO_FIND_FILE($cpl_cext_check_header, $cpl_cext_incdirs,
+ cpl_cext_includes)
+
+
+ # Check for the libcext library
+
+ if test -z "$cpl_with_cext_libs"; then
+
+ if test -z "$cpl_with_cext"; then
+
+ if test -z "$cpl_cext_libdirs"; then
+
+ # Try some known system locations
+
+ cpl_cext_libdirs="/opt/cext/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib64"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib32"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib64"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib32"
+
+ test -n "$CPLDIR" && \
+ cpl_cext_libdirs="$CPLDIR/lib64 \
+ $CPLDIR/lib \
+ $CPLDIR/lib32 \
+ $cpl_cext_libdirs"
+
+ fi
+
+ else
+
+ cpl_cext_libdirs="$cpl_with_cext/lib64"
+ cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib"
+ cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib32"
+
+ fi
+
+ else
+ cpl_cext_libdirs="$cpl_with_cext_libs"
+ fi
+
+ ESO_FIND_FILE($cpl_cext_check_lib, $cpl_cext_libdirs,
+ cpl_cext_libraries)
+
+
+ if test x"$cpl_cext_includes" = xno || \
+ test x"$cpl_cext_libraries" = xno; then
+ cpl_cext_notfound=""
+
+ if test x"$cpl_cext_includes" = xno; then
+ if test x"$cpl_cext_libraries" = xno; then
+ cpl_cext_notfound="(headers and libraries)"
+ else
+ cpl_cext_notfound="(headers)"
+ fi
+ else
+ cpl_cext_notfound="(libraries)"
+ fi
+
+ AC_MSG_ERROR([libcext $cpl_cext_notfound was not found on your system. Please check!])
+ else
+ AC_MSG_RESULT([libraries $cpl_cext_libraries, headers $cpl_cext_includes])
+ fi
+
+
+ # Set up the symbols
+
+ CX_INCLUDES="-I$cpl_cext_includes"
+ CX_LDFLAGS="-L$cpl_cext_libraries"
+ LIBCEXT="-lcext"
+
+
+ AC_MSG_CHECKING([whether libcext can be used])
+ AC_LANG_PUSH(C)
+
+ cpl_cext_cflags_save="$CFLAGS"
+ cpl_cext_ldflags_save="$LDFLAGS"
+ cpl_cext_libs_save="$LIBS"
+
+ CFLAGS="$CX_INCLUDES $CFLAGS"
+ LDFLAGS="$CX_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCEXT"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <cxutils.h>
+ ]],
+ [
+ cx_program_set_name("MyProgram");
+ ])],
+ [cpl_cext_is_usable="yes"],
+ [cpl_cext_is_usable="no"])
+
+ AC_MSG_RESULT([$cpl_cext_is_usable])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_cext_cflags_save"
+ LDFLAGS="$cpl_cext_ldflags_save"
+ LIBS="$cpl_cext_libs_save"
+
+ if test x"$cpl_cext_is_usable" = xno; then
+ AC_MSG_ERROR([Linking with libcext failed! Please check architecture!])
+ fi
+
+ else
+
+ AC_MSG_RESULT([disabled])
+ AC_MSG_WARN([libcext checks have been disabled! This package may not build!])
+ CX_INCLUDES=""
+ CX_LDFLAGS=""
+ LIBCEXT=""
+
+ fi
+
+ AC_SUBST(CX_INCLUDES)
+ AC_SUBST(CX_LDFLAGS)
+ AC_SUBST(LIBCEXT)
+
+])
+
+
+# CPL_CHECK_WCS(version)
+#-----------------------
+# Checks for the wcs library and header files.
+AC_DEFUN([CPL_CHECK_WCS],
+[
+ AC_MSG_CHECKING([for libwcs])
+
+
+ cpl_wcs_check_version="$1"
+ cpl_wcs_check_header="wcslib/wcslib.h"
+ cpl_wcs_check_lib="libwcs.a"
+
+ cpl_wcs_includes=""
+ cpl_wcs_libraries=""
+
+
+ AC_ARG_WITH(wcs,
+ AC_HELP_STRING([--with-wcs],
+ [location where wcs is installed]),
+ [
+ cpl_with_wcs=$withval
+ ])
+
+ AC_ARG_WITH(wcs-includes,
+ AC_HELP_STRING([--with-wcs-includes],
+ [location of the libwcs header files]),
+ cpl_with_wcs_includes=$withval)
+
+ AC_ARG_WITH(wcs-libs,
+ AC_HELP_STRING([--with-wcs-libs],
+ [location of the libwcs library]),
+ cpl_with_wcs_libs=$withval)
+
+
+ # Check for the wcs includes
+
+ if test -z "$cpl_with_wcs_includes"; then
+
+ if test -z "$cpl_with_wcs"; then
+
+ # Try some known system locations
+
+ cpl_wcs_incdirs="/opt/wcslib/include/wcslib"
+ cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/local/include/wcslib"
+ cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/local/include"
+ cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/include/wcslib"
+ cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/include"
+
+ test -n "$WCSDIR" && \
+ cpl_wcs_incdirs="$WCSDIR/include \
+ $cpl_wcs_incdirs"
+
+ else
+
+ cpl_wcs_incdirs="$cpl_with_wcs/include"
+
+ fi
+
+ else
+
+ cpl_wcs_incdirs="$cpl_with_wcs_includes"
+
+ fi
+
+ ESO_FIND_FILE($cpl_wcs_check_header, $cpl_wcs_incdirs, cpl_wcs_includes)
+
+
+ # Check for the wcs library
+
+ if test -z "$cpl_with_wcs_libs"; then
+
+ if test -z "$cpl_with_wcs"; then
+
+ # Try some known system locations
+
+ cpl_wcs_libdirs="/opt/wcslib/lib64"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /opt/wcslib/lib"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /opt/wcslib/lib32"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib64"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib32"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib64"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib32"
+
+ test -n "$WCSDIR" && \
+ cpl_wcs_libdirs="$WCSDIR/lib64 \
+ $WCSDIR/lib \
+ $WCSDIR/lib32 \
+ $cpl_wcs_libdirs"
+
+ else
+
+ cpl_wcs_libdirs="$cpl_with_wcs/lib64"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs $cpl_with_wcs/lib"
+ cpl_wcs_libdirs="$cpl_wcs_libdirs $cpl_with_wcs/lib32"
+
+ fi
+
+ else
+
+ cpl_wcs_libdirs="$cpl_with_wcs_libs"
+
+ fi
+
+ ESO_FIND_FILE($cpl_wcs_check_lib, $cpl_wcs_libdirs, cpl_wcs_libraries)
+
+
+ if test x"$cpl_wcs_includes" = xno || \
+ test x"$cpl_wcs_libraries" = xno; then
+ cpl_wcs_notfound=""
+
+ if test x"$cpl_wcs_includes" = xno; then
+ if test x"$cpl_wcs_libraries" = xno; then
+ cpl_wcs_notfound="(headers and libraries)"
+ else
+ cpl_wcs_notfound="(headers)"
+ fi
+ else
+ cpl_wcs_notfound="(libraries)"
+ fi
+
+ AC_MSG_WARN([libwcs $cpl_wcs_notfound was not found on your system. WCS support will be disabled!])
+
+ else
+
+ AC_MSG_RESULT([libraries $cpl_wcs_libraries, headers $cpl_wcs_includes])
+
+
+ # Setup the symbols
+
+ WCS_INCLUDES="-I$cpl_wcs_includes/wcslib"
+ WCS_LDFLAGS="-L$cpl_wcs_libraries"
+ LIBWCS="-lwcs -lm"
+ LIBWCS_STATIC="$cpl_wcs_libraries/$cpl_wcs_check_lib -lm"
+
+
+ # Check wcs library version
+
+ AC_MSG_CHECKING([for a libwcs version >= $cpl_wcs_check_version])
+
+ AC_LANG_PUSH(C)
+
+ cpl_wcs_cflags_save="$CFLAGS"
+ cpl_wcs_ldflags_save="$LDFLAGS"
+ cpl_wcs_libs_save="$LIBS"
+
+ CFLAGS="$WCS_INCLUDES $CFLAGS"
+ LDFLAGS="$WCS_LDFLAGS $LDFLAGS"
+ LIBS="$LIBWCS_STATIC"
+
+ AC_RUN_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <wcslib.h>
+
+ #define stringify(v) stringify_arg(v)
+ #define stringify_arg(v) #v
+ ]],
+ [
+ char vmin[[]] = "$cpl_wcs_check_version";
+ char vlib[[]] = stringify(WCSLIB_VERSION);
+
+ int min_major = 0;
+ int min_minor = 0;
+ int min_micro = 0;
+
+ int lib_major = 0;
+ int lib_minor = 0;
+ int lib_micro = 0;
+
+ sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro);
+ sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro);
+
+ FILE* f = fopen("conftest.out", "w");
+ fprintf(f, "%s\n", vlib);
+ fclose(f);
+
+ if (lib_major < min_major) {
+ return 1;
+ }
+ else {
+ if (lib_major == min_major) {
+ if (lib_minor < min_minor) {
+ return 1;
+ }
+ else {
+ if (lib_minor == min_minor) {
+ if (lib_micro < min_micro) {
+ return 1;
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+ ])],
+ [cpl_wcs_version="`cat conftest.out`"],
+ [
+ cpl_wcs_version="no";
+ cpl_wcs_version_found="`cat conftest.out`"
+ ])
+
+ AC_MSG_RESULT([$cpl_wcs_version])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_wcs_cflags_save"
+ LDFLAGS="$cpl_wcs_ldflags_save"
+ LIBS="$cpl_wcs_libs_save"
+
+
+ if test x"$cpl_wcs_version" = xno; then
+
+ AC_MSG_WARN([Installed libwcs ($cpl_wcs_version_found) is too old. WCS support will not be available!])
+
+ WCS_INCLUDES=""
+ WCS_LDFLAGS=""
+ LIBWCS=""
+
+ else
+ AC_DEFINE_UNQUOTED(CPL_WCS_INSTALLED, 1, [Defined if WCS is available])
+ fi
+
+ AC_SUBST(WCS_INCLUDES)
+ AC_SUBST(WCS_LDFLAGS)
+ AC_SUBST(LIBWCS)
+
+ fi
+
+])
+
+
+# CPL_CHECK_FFTW(version)
+#------------------------
+# Checks for the wcs library and header files.
+AC_DEFUN([CPL_CHECK_FFTW],
+[
+
+ cpl_fftw_check_version="$1"
+ cpl_fftw_check_header="fftw3.h"
+ cpl_fftw_check_lib="libfftw3.a"
+ cpl_fftwf_check_lib="libfftw3f.a"
+
+ cpl_fftw_includes=""
+ cpl_fftw_libraries=""
+ cpl_fftwf_libraries=""
+
+ AC_ARG_WITH(fftw,
+ AC_HELP_STRING([--with-fftw],
+ [location where fftw is installed]),
+ [
+ cpl_with_fftw=$withval
+ ])
+
+ AC_ARG_WITH(fftw-includes,
+ AC_HELP_STRING([--with-fftw-includes],
+ [location of the fftw header files]),
+ cpl_with_fftw_includes=$withval)
+
+ AC_ARG_WITH(fftw-libs,
+ AC_HELP_STRING([--with-fftw-libs],
+ [location of the fftw libraries]),
+ cpl_with_fftw_libs=$withval)
+
+
+ AC_MSG_CHECKING([for fftw (normal-precision)])
+
+
+ # Check for the fftw includes
+
+ if test -z "$cpl_with_fftw_includes"; then
+
+ if test -z "$cpl_with_fftw"; then
+
+ # Try some known system locations
+
+ cpl_fftw_incdirs="/opt/fftw/include"
+ cpl_fftw_incdirs="$cpl_fftw_incdirs /usr/local/include"
+ cpl_fftw_incdirs="$cpl_fftw_incdirs /usr/include"
+
+ test -n "$FFTWDIR" && \
+ cpl_fftw_incdirs="$FFTWDIR/include \
+ $cpl_fftw_incdirs"
+
+ else
+
+ cpl_fftw_incdirs="$cpl_with_fftw/include"
+
+ fi
+
+ else
+
+ cpl_fftw_incdirs="$cpl_with_fftw_includes"
+
+ fi
+
+ ESO_FIND_FILE($cpl_fftw_check_header, $cpl_fftw_incdirs, cpl_fftw_includes)
+
+
+ # Check for normal-precision fftw library
+
+ if test -z "$cpl_with_fftw_libs"; then
+
+ if test -z "$cpl_with_fftw"; then
+
+ # Try some known system locations
+
+ cpl_fftw_libdirs="/opt/fftw/lib64"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /opt/fftw/lib"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /opt/fftw/lib32"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib64"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib32"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib64"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib32"
+
+ test -n "$FFTWDIR" && \
+ cpl_fftw_libdirs="$FFTWDIR/lib64 \
+ $FFTWDIR/lib \
+ $FFTWDIR/lib32 \
+ $cpl_fftw_libdirs"
+
+ else
+
+ cpl_fftw_libdirs="$cpl_with_fftw/lib64"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs $cpl_with_fftw/lib"
+ cpl_fftw_libdirs="$cpl_fftw_libdirs $cpl_with_fftw/lib32"
+
+ fi
+
+ else
+
+ cpl_fftw_libdirs="$cpl_with_fftw_libs"
+
+ fi
+
+ ESO_FIND_FILE($cpl_fftw_check_lib, $cpl_fftw_libdirs, cpl_fftw_libraries)
+
+ if test x"$cpl_fftw_includes" = xno || \
+ test x"$cpl_fftw_libraries" = xno; then
+ cpl_fftw_notfound=""
+
+ if test x"$cpl_fftw_includes" = xno; then
+ if test x"$cpl_fftw_libraries" = xno; then
+ cpl_fftw_notfound="(headers and libraries)"
+ else
+ cpl_fftw_notfound="(headers)"
+ fi
+ else
+ cpl_fftw_notfound="(libraries)"
+ fi
+
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([fftw (normal-precision) $cpl_fftw_notfound was not found on your system.])
+
+ else
+
+ AC_MSG_RESULT([libraries $cpl_fftw_libraries, headers $cpl_fftw_includes])
+
+
+ # Set up the symbols
+
+ FFTW_INCLUDES="-I$cpl_fftw_includes"
+ FFTW_LDFLAGS="-L$cpl_fftw_libraries"
+ LIBFFTW="-lfftw3 -lm"
+ LIBFFTW_STATIC="$cpl_fftw_libraries/$cpl_fftw_check_lib -lm"
+
+
+ # Check fftw (normal-precision) library version
+
+ AC_MSG_CHECKING([for a fftw (normal-precision) version >= $cpl_fftw_check_version])
+
+ AC_LANG_PUSH(C)
+
+ cpl_fftw_cflags_save="$CFLAGS"
+ cpl_fftw_ldflags_save="$LDFLAGS"
+ cpl_fftw_libs_save="$LIBS"
+
+ CFLAGS="$FFTW_INCLUDES $CFLAGS"
+ LDFLAGS="$FFTW_LDFLAGS $LDFLAGS"
+ LIBS="$LIBFFTW_STATIC"
+
+ AC_RUN_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <fftw3.h>
+ ]],
+ [
+ char vmin[[]] = "$cpl_fftw_check_version";
+ char *vstr = strdup(fftw_version);
+ char *vlib = vstr;
+ char *suffix = NULL;
+
+ int min_major = 0;
+ int min_minor = 0;
+ int min_micro = 0;
+
+ int lib_major = 0;
+ int lib_minor = 0;
+ int lib_micro = 0;
+
+ vlib = strchr(vstr, '-') + 1;
+ suffix = strrchr(vlib, '-');
+
+ if (suffix) {
+ *suffix = '\0';
+ }
+
+ sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro);
+ sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro);
+
+ FILE* f = fopen("conftest.out", "w");
+ fprintf(f, "%s\n", vlib);
+ fclose(f);
+
+ free(vstr);
+
+ if (lib_major < min_major) {
+ return 1;
+ }
+ else {
+ if (lib_major == min_major) {
+ if (lib_minor < min_minor) {
+ return 1;
+ }
+ else {
+ if (lib_minor == min_minor) {
+ if (lib_micro < min_micro) {
+ return 1;
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+ ])],
+ [cpl_fftw_version="`cat conftest.out`"],
+ [
+ cpl_fftw_version="no";
+ cpl_fftw_version_found="`cat conftest.out`"
+ ])
+
+ AC_MSG_RESULT([$cpl_fftw_version])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_fftw_cflags_save"
+ LDFLAGS="$cpl_fftw_ldflags_save"
+ LIBS="$cpl_fftw_libs_save"
+
+ if test x"$cpl_fftw_version" = xno; then
+
+ AC_MSG_WARN([Installed normal-precision fftw ($cpl_fftw_version_found) is too old])
+
+ FFTW_INCLUDES=""
+ FFTW_LDFLAGS=""
+ LIBFFTW=""
+
+ else
+ AC_DEFINE_UNQUOTED(CPL_FFTW_INSTALLED, 1, [Defined if FFTW (normal-precision) is available])
+ fi
+
+ AC_SUBST(FFTW_INCLUDES)
+ AC_SUBST(FFTW_LDFLAGS)
+ AC_SUBST(LIBFFTW)
+
+ fi
+
+
+ # Check for single-precision fftw
+
+ AC_MSG_CHECKING([for fftw (single-precision)])
+
+ ESO_FIND_FILE($cpl_fftwf_check_lib, $cpl_fftw_libdirs, cpl_fftwf_libraries)
+
+ if test x"$cpl_fftw_includes" = xno || \
+ test x"$cpl_fftwf_libraries" = xno; then
+ cpl_fftw_notfound=""
+
+ if test x"$cpl_fftw_includes" = xno; then
+ if test x"$cpl_fftwf_libraries" = xno; then
+ cpl_fftw_notfound="(headers and libraries)"
+ else
+ cpl_fftw_notfound="(headers)"
+ fi
+ else
+ cpl_fftw_notfound="(libraries)"
+ fi
+
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([fftw (single-precision) $cpl_fftw_notfound was not found on your system.])
+
+ else
+
+ AC_MSG_RESULT([libraries $cpl_fftwf_libraries, headers $cpl_fftw_includes])
+
+
+ # Set up the symbols
+
+ FFTWF_INCLUDES="-I$cpl_fftw_includes"
+ FFTWF_LDFLAGS="-L$cpl_fftwf_libraries"
+ LIBFFTWF="-lfftw3f -lm"
+ LIBFFTWF_STATIC="$cpl_fftwf_libraries/$cpl_fftwf_check_lib -lm"
+
+
+ # Check fftw (single-precision) library version
+
+ AC_MSG_CHECKING([for a fftw (single-precision) version >= $cpl_fftw_check_version])
+
+ AC_LANG_PUSH(C)
+
+ cpl_fftw_cflags_save="$CFLAGS"
+ cpl_fftw_ldflags_save="$LDFLAGS"
+ cpl_fftw_libs_save="$LIBS"
+
+ CFLAGS="$FFTWF_INCLUDES $CFLAGS"
+ LDFLAGS="$FFTWF_LDFLAGS $LDFLAGS"
+ LIBS="$LIBFFTWF"
+
+ AC_RUN_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <fftw3.h>
+ ]],
+ [
+ char vmin[[]] = "$cpl_fftw_check_version";
+ char *vstr = strdup(fftwf_version);
+ char *vlib = vstr;
+ char *suffix = NULL;
+
+ int min_major = 0;
+ int min_minor = 0;
+ int min_micro = 0;
+
+ int lib_major = 0;
+ int lib_minor = 0;
+ int lib_micro = 0;
+
+ vlib = strchr(vstr, '-') + 1;
+ suffix = strrchr(vlib, '-');
+
+ if (suffix) {
+ *suffix = '\0';
+ }
+
+ sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro);
+ sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro);
+
+ FILE* f = fopen("conftest.out", "w");
+ fprintf(f, "%s\n", vlib);
+ fclose(f);
+
+ free(vstr);
+
+ if (lib_major < min_major) {
+ return 1;
+ }
+ else {
+ if (lib_major == min_major) {
+ if (lib_minor < min_minor) {
+ return 1;
+ }
+ else {
+ if (lib_minor == min_minor) {
+ if (lib_micro < min_micro) {
+ return 1;
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+ ])],
+ [cpl_fftwf_version="`cat conftest.out`"],
+ [
+ cpl_fftwf_version="no";
+ cpl_fftwf_version_found="`cat conftest.out`"
+ ])
+
+ AC_MSG_RESULT([$cpl_fftwf_version])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_fftw_cflags_save"
+ LDFLAGS="$cpl_fftw_ldflags_save"
+ LIBS="$cpl_fftw_libs_save"
+
+ if test x"$cpl_fftwf_version" = xno; then
+
+ AC_MSG_WARN([Installed single-precision fftw ($cpl_fftw_version_found) is too old!])
+
+ FFTWF_INCLUDES=""
+ FFTWF_LDFLAGS=""
+ LIBFFTWF=""
+
+ else
+ AC_DEFINE_UNQUOTED(CPL_FFTWF_INSTALLED, 1, [Defined if FFTW (single-precision) is available])
+ fi
+
+ AC_SUBST(FFTWF_INCLUDES)
+ AC_SUBST(FFTWF_LDFLAGS)
+ AC_SUBST(LIBFFTWF)
+
+ fi
+
+])
+
+
+#
+# CPL_CREATE_SYMBOLS(build=[])
+#-----------------------------
+# Sets the Makefile symbols for the CPL libraries. If an argument is
+# provided the symbols are setup for building CPL, if no argument is
+# given (default) the symbols are set for using the libraries
+# for external package development.
+AC_DEFUN([CPL_CREATE_SYMBOLS],
+[
+
+ if test -z "$1"; then
+ LIBCPLCORE='-lcplcore'
+ LIBCPLDRS='-lcpldrs'
+ LIBCPLUI='-lcplui'
+ LIBCPLDFS='-lcpldfs'
+ else
+ LIBCPLCORE='$(top_builddir)/cplcore/libcplcore.la'
+ LIBCPLDRS='$(top_builddir)/cpldrs/libcpldrs.la'
+ LIBCPLUI='$(top_builddir)/cplui/libcplui.la'
+ LIBCPLDFS='$(top_builddir)/cpldfs/libcpldfs.la'
+ fi
+
+ AC_SUBST(LIBCPLCORE)
+ AC_SUBST(LIBCPLDRS)
+ AC_SUBST(LIBCPLUI)
+ AC_SUBST(LIBCPLDFS)
+
+])
+
+
+# CPL_CHECK_LIBS
+#---------------
+# Checks for the CPL libraries and header files.
+AC_DEFUN([CPL_CHECK_LIBS],
+[
+
+ AC_MSG_CHECKING([for CPL])
+
+ cpl_check_cpl_header="cpl.h"
+ cpl_check_cpl_lib="libcplcore.a"
+
+ cpl_incdirs=""
+ cpl_libdirs=""
+ cpl_includes=""
+ cpl_libraries=""
+
+ AC_ARG_WITH(cpl,
+ AC_HELP_STRING([--with-cpl],
+ [location where CPL is installed]),
+ [
+ cpl_with_cpl=$withval
+ ])
+
+ AC_ARG_WITH(cpl-includes,
+ AC_HELP_STRING([--with-cpl-includes],
+ [location of the CPL header files]),
+ cpl_with_cpl_includes=$withval)
+
+ AC_ARG_WITH(cpl-libs,
+ AC_HELP_STRING([--with-cpl-libs],
+ [location of the CPL library]),
+ cpl_with_cpl_libs=$withval)
+
+ AC_ARG_ENABLE(cpl-test,
+ AC_HELP_STRING([--disable-cpl-test],
+ [disables checks for the CPL library and headers]),
+ cpl_enable_cpl_test=$enableval,
+ cpl_enable_cpl_test=yes)
+
+
+ if test "x$cpl_enable_cpl_test" = xyes; then
+
+ # Check for the CPL includes
+
+ if test -z "$cpl_with_cpl_includes"; then
+
+ if test -z "$cpl_with_cpl"; then
+
+ # Try some known system locations
+
+ cpl_incdirs="/opt/cpl/include"
+ cpl_incdirs="$cpl_incdirs /usr/local/include"
+ cpl_incdirs="$cpl_incdirs /usr/include"
+
+ test -n "$CPLDIR" && \
+ cpl_incdirs="$CPLDIR/include \
+ $cpl_incdirs"
+
+ else
+
+ cpl_incdirs="$cpl_with_cpl/include"
+
+ fi
+
+ else
+ cpl_incdirs="$cpl_with_cpl_includes"
+ fi
+
+ ESO_FIND_FILE($cpl_check_cpl_header, $cpl_incdirs, cpl_includes)
+
+
+ # Check for the CPL libraries
+
+ if test -z "$cpl_with_cpl_libs"; then
+
+ if test -z "$cpl_with_cpl"; then
+
+ # Try some known system locations
+
+ cpl_libdirs="/opt/cpl/lib"
+ cpl_libdirs="$cpl_libdirs /usr/local/lib64"
+ cpl_libdirs="$cpl_libdirs /usr/local/lib"
+ cpl_libdirs="$cpl_libdirs /usr/local/lib32"
+ cpl_libdirs="$cpl_libdirs /usr/lib64"
+ cpl_libdirs="$cpl_libdirs /usr/lib"
+ cpl_libdirs="$cpl_libdirs /usr/lib32"
+
+ test -n "$CPLDIR" && \
+ cpl_libdirs="$CPLDIR/lib64 $CPLDIR/lib $CPLDIR/lib32 \
+ $cpl_libdirs"
+
+ else
+
+ cpl_libdirs="$cpl_with_cpl/lib64"
+ cpl_libdirs="$cpl_libdirs $cpl_with_cpl/lib"
+ cpl_libdirs="$cpl_libdirs $cpl_with_cpl/lib32"
+
+ fi
+
+ else
+ cpl_libdirs="$cpl_with_cpl_libs"
+ fi
+
+ ESO_FIND_FILE($cpl_check_cpl_lib, $cpl_libdirs, cpl_libraries)
+
+
+ if test x"$cpl_includes" = xno || test x"$cpl_libraries" = xno; then
+ cpl_notfound=""
+
+ if test x"$cpl_includes" = xno; then
+ if test x"$cpl_libraries" = xno; then
+ cpl_notfound="(headers and libraries)"
+ else
+ cpl_notfound="(headers)"
+ fi
+ else
+ cpl_notfound="(libraries)"
+ fi
+
+ AC_MSG_ERROR([CPL $cpl_notfound was not found on your system. Please check!])
+ else
+ AC_MSG_RESULT([libraries $cpl_libraries, headers $cpl_includes])
+ fi
+
+ # The libcext headers are required. By default it part of the
+ # CPL installation and it is assumed that the cext headers are
+ # present in the same location as the CPL headers
+
+ CPL_CHECK_CEXT($cpl_includes, $cpl_libraries)
+
+
+ # Set up the symbols
+
+ CPL_INCLUDES="-I$cpl_includes $CX_INCLUDES $CFITSIO_INCLUDES"
+ CPL_LDFLAGS="-L$cpl_libraries $CX_LDFLAGS $CFITSIO_LDFLAGS"
+ CPL_CREATE_SYMBOLS
+
+
+ AC_MSG_CHECKING([whether CPL can be used])
+ AC_LANG_PUSH(C)
+
+ cpl_cflags_save="$CFLAGS"
+ cpl_ldflags_save="$LDFLAGS"
+ cpl_libs_save="$LIBS"
+
+ CFLAGS="$CPL_INCLUDES $CFLAGS"
+ LDFLAGS="$CPL_LDFLAGS $LDFLAGS"
+ LIBS="$LIBCPLCORE $LIBCEXT $LIBS"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <cpl.h>
+ ]],
+ [
+ cpl_init(CPL_INIT_DEFAULT);
+ ])],
+ [cpl_is_usable="yes"],
+ [cpl_is_usable="no"])
+
+ AC_MSG_RESULT([$cpl_is_usable])
+
+ AC_LANG_POP(C)
+
+ CFLAGS="$cpl_cflags_save"
+ LDFLAGS="$cpl_ldflags_save"
+ LIBS="$cpl_libs_save"
+
+ if test x"$cpl_is_usable" = xno; then
+ AC_MSG_ERROR([Linking with CPL failed! Please check architecture!])
+ fi
+
+ else
+
+ AC_MSG_RESULT([disabled])
+ AC_MSG_WARN([CPL checks have been disabled! This package may not build!])
+ CPL_INCLUDES=""
+ CPL_LDFLAGS=""
+ LIBCPLCORE=""
+ LIBCPLDRS=""
+ LIBCPLUI=""
+ LIBCPLDFS=""
+
+ fi
+
+ AC_SUBST(CPL_INCLUDES)
+ AC_SUBST(CPL_LDFLAGS)
+ AC_SUBST(LIBCPLCORE)
+ AC_SUBST(LIBCPLDRS)
+ AC_SUBST(LIBCPLUI)
+ AC_SUBST(LIBCPLDFS)
+
+])
diff --git a/m4macros/eso.m4 b/m4macros/eso.m4
new file mode 100644
index 0000000..86e1839
--- /dev/null
+++ b/m4macros/eso.m4
@@ -0,0 +1,1065 @@
+# ESO_PROG_CC_FLAG(FLAG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#-----------------------------------------------------------------
+AC_DEFUN([ESO_PROG_CC_FLAG],
+[
+ AC_REQUIRE([AC_PROG_CC])
+
+ flag=`echo $1 | sed 'y%.=/+-%___p_%'`
+ AC_CACHE_CHECK([whether $CC supports -$1],
+ [eso_cv_prog_cc_$flag],
+ [
+ eval "eso_cv_prog_cc_$flag=no"
+ AC_LANG_PUSH(C)
+
+ echo 'int main() { return 0; }' >conftest.$ac_ext
+
+ try_compile="`$CC -$1 -c conftest.$ac_ext 2>&1`"
+ if test -z "$try_compile"; then
+ try_link="`$CC -$1 -o conftest$ac_exeext \
+ conftest.$ac_ext 2>&1`"
+ if test -z "$try_link"; then
+ eval "eso_cv_prog_cc_$flag=yes"
+ fi
+ fi
+ rm -f conftest*
+
+ AC_LANG_POP(C)
+ ])
+
+ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+ :
+ $2
+ else
+ :
+ $3
+ fi
+])
+
+
+# ESO_ENABLE_DEBUG(debug=no)
+#---------------------------
+AC_DEFUN([ESO_ENABLE_DEBUG],
+[
+ AC_REQUIRE([AC_PROG_CC])
+
+ AC_ARG_ENABLE(debug,
+ AC_HELP_STRING([--enable-debug],
+ [creates debugging code [[default=$1]]]),
+ eso_enable_debug=$enableval, eso_enable_debug=$1)
+
+ AC_CACHE_CHECK([whether debugging code should be created],
+ eso_cv_enable_debug,
+ eso_cv_enable_debug=$eso_enable_debug)
+
+ if test x"$eso_cv_enable_debug" = xyes; then
+
+ eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]//g' \
+ -e 's/-g[[0-9]]//g' \
+ -e 's/-g[[a-z,A-Z]]* / /g' \
+ -e 's/-[[Og]]//g'`"
+
+ ESO_PROG_CC_FLAG([g3], [CFLAGS="$CFLAGS -g3"])
+
+ if test x"$eso_cv_prog_cc_g3" = xyes; then
+ CFLAGS="-g3"
+ else
+ if test x"$ac_cv_prog_cc_g" = xyes; then
+ CFLAGS="-g"
+ else
+ CFLAGS=""
+ fi
+ fi
+
+ ESO_PROG_CC_FLAG([ggdb], [CFLAGS="$CFLAGS -ggdb"])
+ ESO_PROG_CC_FLAG([O0], [CFLAGS="$CFLAGS -O0"])
+ ESO_PROG_CC_FLAG([rdynamic], [CFLAGS="$CFLAGS -rdynamic"])
+ ESO_PROG_CC_FLAG([Wall], [CFLAGS="$CFLAGS -Wall"])
+ ESO_PROG_CC_FLAG([W], [CFLAGS="$CFLAGS -W"])
+
+ CFLAGS="$CFLAGS $eso_clean_CFLAGS"
+ ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG"
+ else
+ ESO_DEBUG_FLAGS="-DNDEBUG"
+ fi
+
+ AC_SUBST(ESO_DEBUG_FLAGS)
+])
+
+
+# ESO_ENABLE_STRICT(strict=no)
+#-----------------------------
+AC_DEFUN([ESO_ENABLE_STRICT],
+[
+ AC_REQUIRE([AC_PROG_EGREP])
+ AC_REQUIRE([AC_PROG_CC])
+
+ AC_ARG_ENABLE(strict,
+ AC_HELP_STRING([--enable-strict],
+ [compiles with strict compiler options (may not work!) [[default=$1]]]),
+ eso_enable_strict=$enableval, eso_enable_strict=$1)
+
+ AC_CACHE_CHECK([whether strict compiler options should be used],
+ eso_cv_enable_strict,
+ eso_cv_enable_strict=$eso_enable_strict)
+
+
+ if test x"$eso_cv_enable_strict" = xyes; then
+
+ eso_enable_strict_std_set=no
+
+ if test -n "$CFLAGS"; then
+ echo $CFLAGS | $EGREP '(\-std=|-ansi)' >/dev/null 2>&1
+ if test x"$?" = x0; then
+ eso_enable_strict_std_set=yes
+ fi
+ fi
+
+ if test x"$eso_enable_strict_std_set" = xno; then
+ ESO_PROG_CC_FLAG([std=c99], [CFLAGS="$CFLAGS -std=c99"])
+ fi
+
+ ESO_PROG_CC_FLAG([pedantic], [CFLAGS="$CFLAGS -pedantic"])
+
+ fi
+])
+
+
+# ESO_ENABLE_PROFILE(profile=no)
+#-----------------------------
+AC_DEFUN([ESO_ENABLE_PROFILE],
+[
+ AC_REQUIRE([AC_PROG_CC])
+
+ AC_ARG_ENABLE(profile,
+ AC_HELP_STRING([--enable-profile],
+ [compiles with compiler options necessary for profiling (may not work!) [[default=$1]]]),
+ eso_enable_profile=$enableval, eso_enable_profile=$1)
+
+ AC_CACHE_CHECK([whether profiling compiler options should be used],
+ eso_cv_enable_profile,
+ eso_cv_enable_profile=$eso_enable_profile)
+
+
+ if test x"$eso_cv_enable_profile" = xyes; then
+ ESO_PROG_CC_FLAG([pg], [CFLAGS="$CFLAGS -pg"])
+ ESO_PROG_CC_FLAG([g], [CFLAGS="$CFLAGS -g"])
+ ESO_PROG_CC_FLAG([static-libgcc], [CFLAGS="$CFLAGS -static-libgcc"])
+
+ AC_ENABLE_SHARED(no)
+ AC_ENABLE_STATIC(yes)
+ fi
+])
+
+
+# ESO_CHECK_DOCTOOLS
+#-------------------
+AC_DEFUN([ESO_CHECK_DOCTOOLS],
+[
+ AC_ARG_VAR([DOXYGEN], [doxygen command])
+ AC_PATH_PROG([DOXYGEN], [doxygen])
+
+ AC_ARG_VAR([LATEX], [latex command])
+ AC_PATH_PROG([LATEX], [latex])
+
+
+ if test -z "${DOXYGEN}"; then
+ DOXYGEN=":"
+ fi
+
+ if test -z "${LATEX}"; then
+ LATEX=":"
+ fi
+
+])
+
+
+# ESO_PROG_AR
+#------------
+# Checks if ar is in the path
+AC_DEFUN([ESO_PROG_AR],
+[
+ AC_CHECK_PROG(AR, ar, ar, NONE)
+
+ if test x"$AR" = xNONE; then
+ AC_MSG_ERROR([Cannot find \'ar\'])
+ fi
+
+])
+
+
+# ESO_CHECK_EXTRA_LIBS
+#---------------------
+# Check for non-standard headers and libraries
+AC_DEFUN([ESO_CHECK_EXTRA_LIBS],
+[
+
+ AC_ARG_WITH(extra-includes,
+ AC_HELP_STRING([--with-extra-includes=DIR],
+ [adds non standard include paths]),
+ eso_with_extra_includes=$withval, eso_with_extra_includes=NONE)
+
+ AC_ARG_WITH(extra-libs,
+ AC_HELP_STRING([--with-extra-libs=DIR],
+ [adds non standard library paths]),
+ eso_with_extra_libs=$withval, eso_with_extra_libs=NONE)
+
+ AC_MSG_CHECKING([for extra includes])
+ AC_CACHE_VAL([eso_cv_with_extra_includes],
+ [
+ eso_cv_with_extra_includes=$eso_with_extra_includes
+ ])
+
+ if test x"$eso_cv_with_extra_includes" != xNONE; then
+ eso_save_IFS=$IFS
+ IFS=':'
+
+ for dir in $eso_cv_with_extra_includes; do
+ EXTRA_INCLUDES="$EXTRA_INCLUDES -I$dir"
+ done
+
+ IFS=$eso_save_IFS
+ AC_MSG_RESULT(added)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+
+ AC_MSG_CHECKING([for extra libs])
+ AC_CACHE_VAL([eso_cv_with_extra_libs],
+ [
+ eso_cv_with_extra_libs=$eso_with_extra_libs
+ ])
+
+ if test x"$eso_cv_with_extra_libs" != xNONE; then
+ eso_save_IFS=$IFS
+ IFS=':'
+
+ for dir in $eso_cv_with_extra_libs; do
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$dir"
+ done
+
+ IFS=$eso_save_IFS
+ AC_MSG_RESULT(added)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+])
+
+
+# ESO_CHECK_THREADS_POSIX
+#------------------------
+# Check whether the POSIX threads are available. The cached result is
+# set to 'yes' if either the compiler supports the '-pthread' flag, or linking
+# with the POSIX thread library works, and the header file defining the POSIX
+# threads symbols is present. If POSIX threads are not supported, the
+# result is set to 'no'. Whether the compiler supports POSIX threads,
+# or whether the library, and the header are available is stored in cache
+# variables.
+AC_DEFUN([ESO_CHECK_THREADS_POSIX],
+[
+ AC_REQUIRE([AC_PROG_CC])
+
+ ESO_PROG_CC_FLAG([pthread], [], [])
+
+ AC_CHECK_LIB([pthread], [pthread_create],
+ [eso_threads_have_libpthread=yes],
+ [eso_threads_have_libpthread=no])
+
+ AC_CHECK_HEADER([pthread.h],
+ [eso_threads_have_pthread_h=yes],
+ [eso_threads_have_pthread_h=no])
+
+ if test x"$eso_threads_have_pthread_h" != xyes; then
+ eso_threads_posix=no
+ else
+ if test x"$eso_threads_have_libpthread" != xyes && \
+ test x"$eso_cv_prog_cc_pthread" != xyes; then
+ eso_threads_posix=no
+ else
+ eso_threads_posix=yes
+ fi
+ fi
+
+
+ # Setup the POSIX thread symbols
+
+ if test x"$eso_threads_have_pthread_h" = xyes; then
+ AC_DEFINE([HAVE_PTHREAD_H], [1],
+ [Define to 1 if you have <pthread.h>.])
+ fi
+
+ if test x"$eso_threads_posix" = xyes; then
+
+ if test x"$eso_cv_prog_cc_pthread" = xyes; then
+ PTHREAD_CFLAGS="-pthread"
+ else
+ PTHREAD_CFLAGS=""
+ fi
+
+ if test x"$eso_threads_have_libpthread" = xyes; then
+ LIBPTHREAD="-lpthread"
+ else
+ LIBPTHREAD=""
+ fi
+
+ fi
+
+ AC_CACHE_VAL(eso_cv_threads_posix_header,
+ eso_cv_threads_posix_header=$eso_threads_have_pthread_h)
+ AC_CACHE_VAL(eso_cv_threads_posix_lib,
+ eso_cv_threads_posix_lib=$eso_threads_have_libpthread)
+ AC_CACHE_VAL(eso_cv_threads_posix_flags,
+ eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread)
+ AC_CACHE_VAL(eso_cv_threads_posix,
+ eso_cv_threads_posix=$eso_threads_posix)
+
+ AC_SUBST(PTHREAD_CFLAGS)
+ AC_SUBST(LIBPTHREAD)
+
+])
+
+
+# ESO_CHECK_FUNC(FUNCTION, INCLUDES, SYMBOL)
+#-------------------------------------------
+# Checks whether a function is available and declared.
+AC_DEFUN([ESO_CHECK_FUNC],
+[
+
+ AC_LANG_PUSH(C)
+
+ AC_CHECK_DECL($1, [], [], [$2])
+
+ eso_save_CFLAGS="$CFLAGS"
+
+ if test x"$GCC" = xyes; then
+ CFLAGS="$CFLAGS -pedantic-errors"
+ fi
+
+ AC_CHECK_FUNC($1)
+
+ CFLAGS="$eso_save_CFLAGS"
+
+ AC_LANG_POP(C)
+
+ if test x"$ac_cv_have_decl_$1" = xyes &&
+ test x"$ac_cv_func_$1" = xyes; then
+ AC_DEFINE($3)
+ fi
+
+])
+
+
+# ESO_FUNC_VSNPRINTF_C99
+#-----------------------
+# Check whether vsnprintf() has C99 semantics.
+AC_DEFUN([ESO_FUNC_VSNPRINTF_C99],
+[
+
+ AH_TEMPLATE([HAVE_VSNPRINTF_C99],
+ [Define if you have the C99 `vsnprintf' function.])
+
+ AC_CACHE_CHECK([whether vsnprintf has C99 semantics],
+ [eso_cv_func_vsnprintf_c99],
+ [
+ AC_LANG_PUSH(C)
+
+ eso_cppflags_save="$CPPFLAGS"
+ eso_cflags_save="$CFLAGS"
+ eso_ldflags_save="$LDFLAGS"
+ eso_libs_save="$LIBS"
+
+ if test x$GCC = xyes; then
+ CFLAGS="$CFLAGS -pedantic-errors"
+ CPPFLAGS="$CPPFLAGS $CFLAGS"
+ fi
+
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int
+doit(char * s, ...)
+{
+ char buffer[32];
+ va_list args;
+ int q, r;
+
+ va_start(args, s);
+ q = vsnprintf(NULL, 0, s, args);
+ r = vsnprintf(buffer, 5, s, args);
+ va_end(args);
+
+ if (q != 7 || r != 7)
+ exit(1);
+
+ exit(0);
+}
+]],
+[[
+ doit((char*)"1234567");
+ exit(1);
+]])
+ ],
+ [eso_cv_func_vsnprintf_c99=yes],
+ [eso_cv_func_vsnprintf_c99=no],
+ [eso_cv_func_vsnprintf_c99=no])
+
+ CPPFLAGS="$eso_cppflags_save"
+ CFLAGS="$eso_cflags_save"
+ LDFLAGS="$eso_ldflags_save"
+ LIBS="$eso_libs_save"
+
+ AC_LANG_POP(C)
+ ])
+
+# Note that the default is to be pessimistic in the case of cross compilation.
+# If you know that the target has a C99 vsnprintf(), you can get around this
+# by setting eso_func_vsnprintf_c99 to yes, as described in the Autoconf
+# manual.
+
+ if test x$eso_cv_func_vsnprintf_c99 = xyes; then
+ AC_DEFINE(HAVE_VSNPRINTF_C99)
+ fi
+
+])
+
+
+# ESO_CHECK_PRINTF_FORMATS
+#-------------------------
+# Checks for printf() format peculiarities.
+AC_DEFUN([ESO_CHECK_PRINTF_FORMATS],
+[
+
+ # Check if string format for NULL is `(null)'
+
+ AH_TEMPLATE([HAVE_PRINTF_STR_FMT_NULL],
+ [Define if printf outputs `(null)' when printing NULL using
+ `%s'])
+
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdio.h>
+#include <string.h>
+]],
+[[
+ char s[128];
+
+ sprintf(s, "%s", NULL);
+ return strncmp(s, "(null)", 6) ? 1 : 0;
+]])
+ ],
+ [eso_have_printf_str_format_null=yes],
+ [eso_have_printf_str_format_null=no],
+ [eso_have_printf_str_format_null=no])
+
+ if test x$eso_have_printf_str_format_null = xyes; then
+ AC_DEFINE(HAVE_PRINTF_STR_FMT_NULL)
+ fi
+
+
+ # Check if pointer format for NULL is `(nil)'
+
+ AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_NIL],
+ [Define if printf outputs `(nil)' when printing NULL using
+ `%p'])
+
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdio.h>
+#include <string.h>
+]],
+[[
+ char s[128];
+
+ sprintf(s, "%p", NULL);
+ return strncmp(s, "(nil)", 5) ? 1 : 0;
+]])
+ ],
+ [eso_have_printf_ptr_format_nil=yes],
+ [eso_have_printf_ptr_format_nil=no],
+ [eso_have_printf_ptr_format_nil=no])
+
+ if test x$eso_have_printf_ptr_format_nil = xyes; then
+ AC_DEFINE(HAVE_PRINTF_PTR_FMT_NIL)
+ fi
+
+
+ # Check if output for `%p' is the same as `%#x'
+
+ AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_ALTERNATE],
+ [Define if printf format `%p' produces the same output as
+ `%#x' or `%#lx'])
+
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdio.h>
+#include <string.h>
+]],
+[[
+ char s1[128], s2[128];
+
+ sprintf(s1, "%p", s1);
+ sprintf(s2, "%#x", s1);
+ return strncmp(s1, s2, 3) ? 1 : 0;
+]])
+ ],
+ [eso_have_printf_ptr_format_alternate=yes],
+ [eso_have_printf_ptr_format_alternate=no],
+ [eso_have_printf_ptr_format_alternate=no])
+
+ if test x$eso_have_printf_ptr_format_alternate = xyes; then
+ AC_DEFINE(HAVE_PRINTF_PTR_FMT_ALTERNATE)
+ fi
+
+
+ # Check if pointers are treated as signed
+
+ AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_SIGNED],
+ [Define if printf treats pointers as signed when using a sign
+ flag])
+
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdio.h>
+]],
+[[
+ char s[128];
+
+ sprintf(s, "%+p", s);
+ return s[0] == '+' ? 0 : 1;
+]])
+ ],
+ [eso_have_printf_ptr_format_signed=yes],
+ [eso_have_printf_ptr_format_signed=no],
+ [eso_have_printf_ptr_format_signed=no])
+
+ if test x$eso_have_printf_ptr_format_signed = xyes; then
+ AC_DEFINE(HAVE_PRINTF_PTR_FMT_SIGNED)
+ fi
+
+
+ # Check if default precision for conversion specifier `g' is 1 (as
+ # required by ISO C) or 6.
+
+ AH_TEMPLATE([HAVE_PRINTF_FLT_FMT_G_STD],
+ [Define if printf default precision for format `g' is 1
+ (ISO C standard) or 6])
+
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdio.h>
+]],
+[[
+ char s1[128], s2[128];
+ int n1, n2;
+
+ sprintf(s1, "%g%n", 1.123456, &n1);
+ sprintf(s2, "%.1g%n", 1.123456, &n2);
+ return n1 > n2 ? 1 : 0;
+]])
+ ],
+ [eso_have_printf_flt_format_g_std=yes],
+ [eso_have_printf_flt_format_g_std=no],
+ [eso_have_printf_flt_format_g_std=no])
+
+ if test x$eso_have_printf_flt_format_g_std = xyes; then
+ AC_DEFINE(HAVE_PRINTF_FLT_FMT_G_STD)
+ fi
+
+])
+
+
+# ESO_FUNC_VSNPRINTF
+#-------------------
+# Checks for vsnprintf and snprintf declaration and function.
+AC_DEFUN([ESO_FUNC_VSNPRINTF],
+[
+
+ eso_compile_snprintf=no
+
+ AH_TEMPLATE([HAVE_VSNPRINTF],
+ [Define if you have the `vsnprintf' function])
+ ESO_CHECK_FUNC(vsnprintf, [
+#include <stdio.h>
+#include <stdarg.h>
+ ], HAVE_VSNPRINTF)
+
+ if test x$ac_cv_func_vsnprintf = xyes &&
+ test x$ac_cv_have_decl_vsnprintf = xyes; then
+
+ ESO_FUNC_VSNPRINTF_C99
+
+ if test x$eso_cv_func_vsnprintf_c99 != xyes; then
+ eso_compile_snprintf=yes
+ fi
+
+ else
+ eso_compile_snprintf=yes
+ fi
+
+ if test x$eso_compile_snprintf = xyes; then
+ if test -n "$LIBTOOL"; then
+ SNPRINTF=snprintf.lo
+ else
+ SNPRINTF=snprintf.$ac_objext
+ fi
+ fi
+
+ AC_SUBST(SNPRINTF)
+
+ # The symbols defined by the following macro are only needed to setup the
+ # vsnprintf() replacement. May be useless if the vsnprintf implementation
+ # changes.
+ ESO_CHECK_PRINTF_FORMATS
+
+ AH_TEMPLATE([HAVE_SNPRINTF],
+ [Define if you have the `snprintf' function])
+ ESO_CHECK_FUNC(snprintf, [#include <stdio.h>], HAVE_SNPRINTF)
+
+])
+
+
+# ESO_FUNC_VASPRINTF
+#-------------------
+# Checks for vasprintf and asprintf declaration and function.
+AC_DEFUN([ESO_FUNC_VASPRINTF],
+[
+
+ AH_TEMPLATE([HAVE_VASPRINTF],
+ [Define if you have the `vasprintf' function])
+ ESO_CHECK_FUNC(vasprintf, [
+#include <stdio.h>
+#include <stdarg.h>
+ ], HAVE_VASPRINTF)
+
+ AH_TEMPLATE([HAVE_ASPRINTF],
+ [Define if you have the `asprintf' function])
+ ESO_CHECK_FUNC(asprintf, [
+#include <stdio.h>
+ ], HAVE_ASPRINTF)
+
+])
+
+
+# ESO_FUNC_FPATHCONF
+#-------------------
+# Checks for fpathconf declaration and function.
+AC_DEFUN([ESO_FUNC_FPATHCONF],
+[
+
+ AH_TEMPLATE([HAVE_FPATHCONF],
+ [Define if you have the `fpathconf' function])
+ ESO_CHECK_FUNC(fpathconf, [#include <unistd.h>], HAVE_FPATHCONF)
+
+ # If we have fpathconf we should also have pathconf, but who knows.
+ AH_TEMPLATE([HAVE_PATHCONF],
+ [Define if you have the `pathconf' function])
+ ESO_CHECK_FUNC(pathconf, [#include <unistd.h>], HAVE_PATHCONF)
+
+])
+
+
+# ESO_FUNC_SYSCONF
+#-----------------
+# Checks for sysconf declaration and function.
+AC_DEFUN([ESO_FUNC_SYSCONF],
+[
+
+ AH_TEMPLATE([HAVE_SYSCONF],
+ [Define if you have the `sysconf' function])
+ ESO_CHECK_FUNC(sysconf, [#include <unistd.h>], HAVE_SYSCONF)
+
+])
+
+
+# ESO_FUNC_GETOPT
+#----------------
+# Checks for GNU getopt_long declaration and function.
+AC_DEFUN([ESO_FUNC_GETOPT],
+[
+
+ AH_TEMPLATE([HAVE_GETOPT_LONG],
+ [Define if you have the `getopt_long' function])
+
+ ESO_CHECK_FUNC(getopt_long, [#include <getopt.h>], HAVE_GETOPT_LONG)
+
+ if test x"$ac_cv_func_getopt_long" = xno ||
+ test x"$eso_cv_have_decl_getopt_long" = xno; then
+ if test -n "$LIBTOOL"; then
+ GETOPT="getopt.lo getopt1.lo"
+ else
+ GETOPT="getopt.$ac_objext getopt1.$ac_objext"
+ fi
+ fi
+
+ AC_SUBST(GETOPT)
+
+
+])
+
+
+# ESO_FUNC_GETPWUID
+#------------------
+# Checks for getpwuid declaration and function.
+AC_DEFUN([ESO_FUNC_GETPWUID],
+[
+
+ AH_TEMPLATE([HAVE_GETPWUID],
+ [Define if you have the `getpwuid' function])
+
+ ESO_CHECK_FUNC(getpwuid, [#include <pwd.h>], HAVE_GETPWUID)
+
+])
+
+
+# ESO_FUNC_GETUID
+#----------------
+AC_DEFUN([ESO_FUNC_GETUID],
+[
+
+ AH_TEMPLATE([HAVE_GETUID],
+ [Define if you have the `getuid' function])
+
+ ESO_CHECK_FUNC(getuid, [#include <unistd.h>], HAVE_GETUID)
+
+])
+
+
+# ESO_FUNC_LSTAT
+#---------------
+AC_DEFUN([ESO_FUNC_LSTAT],
+[
+
+ AH_TEMPLATE([HAVE_LSTAT],
+ [Define if you have the `lstat' function])
+
+ ESO_CHECK_FUNC(lstat, [#include <sys/stat.h>], HAVE_LSTAT)
+
+])
+
+
+# ESO_FUNC_STRDUP
+#----------------
+AC_DEFUN([ESO_FUNC_STRDUP],
+[
+
+ AH_TEMPLATE([HAVE_STRDUP],
+ [Define if you have the `strdup' function])
+
+ ESO_CHECK_FUNC(strdup, [#include <string.h>], HAVE_STRDUP)
+
+ AH_BOTTOM([
+#ifndef HAVE_STRDUP
+# define strdup cx_strdup
+#endif
+ ])
+])
+
+
+# ESO_FUNC_STPCPY
+#----------------
+AC_DEFUN([ESO_FUNC_STPCPY],
+[
+
+ AH_TEMPLATE([HAVE_STPCPY],
+ [Define if you have the `stpcpy' function])
+
+ ESO_CHECK_FUNC(stpcpy, [#include <stpcpy.h>], HAVE_STPCPY)
+
+])
+
+
+# ESO_FUNC_SYMLINK
+#-----------------
+AC_DEFUN([ESO_FUNC_SYMLINK],
+[
+
+ AH_TEMPLATE([HAVE_SYMLINK],
+ [Define if you have the `symlink' function])
+
+ ESO_CHECK_FUNC(symlink, [#include <unistd.h>], HAVE_SYMLINK)
+
+])
+
+
+# ESO_FUNC_WORDEXP
+#-----------------
+AC_DEFUN([ESO_FUNC_WORDEXP],
+[
+
+ AH_TEMPLATE([HAVE_WORDEXP],
+ [Define if you have the `wordexp' function])
+
+ ESO_CHECK_FUNC(wordexp, [#include <wordexp.h>], HAVE_WORDEXP)
+
+])
+
+
+# ESO_FUNC_GETTIMEOFDAY
+#----------------------
+AC_DEFUN([ESO_FUNC_GETTIMEOFDAY],
+[
+
+ AH_TEMPLATE([HAVE_GETTIMEOFDAY],
+ [Define if you have the `gettimeofday' function])
+
+ ESO_CHECK_FUNC(gettimeofday,
+ [
+ #include <unistd.h>
+ #include <sys/time.h>
+ ],
+ HAVE_GETTIMEOFDAY)
+])
+
+
+# ESO_FUNC_VA_COPY(symbol)
+#-------------------------
+# Check for an implementation of va_copy(). The argument which must be
+# given is the preprocessor symbol that is defined to be either va_copy
+# or __va_copy depending on the available function, provided that an
+# implementation of va_copy is available at all.
+AC_DEFUN([ESO_FUNC_VA_COPY],
+[
+
+ # Check for all three va_copy possibilities, so we get
+ # all results in config.log for bug reports.
+
+ # Check for availability of va_copy(). This is ISO C. Available with
+ # gcc since version 3.0.
+ AC_CACHE_CHECK([for an implementation of va_copy()],
+ [eso_cv_have_va_copy],
+ [
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+void f(int i, ...)
+{
+ va_list args1, args2;
+ va_start (args1, i);
+ va_copy (args2, args1);
+
+ if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+ exit (1);
+
+ va_end (args1);
+ va_end (args2);
+}
+]],
+[[
+ f(0, 42);
+]])
+ ],
+ [eso_cv_have_va_copy=yes],
+ [eso_cv_have_va_copy=no],
+ [eso_cv_have_va_copy=no])
+ ])
+
+
+ # Check for availability of __va_copy(). Some compilers provide
+ # this. Available with gcc since version 2.8.1.
+ AC_CACHE_CHECK([for an implementation of __va_copy()],
+ [eso_cv_have__va_copy],
+ [
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+void f(int i, ...)
+{
+ va_list args1, args2;
+
+ va_start (args1, i);
+ __va_copy (args2, args1);
+
+ if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+ exit (1);
+
+ va_end (args1);
+ va_end (args2);
+}
+]],
+[[
+ f(0, 42);
+]])
+ ],
+ [eso_cv_have__va_copy=yes],
+ [eso_cv_have__va_copy=no],
+ [eso_cv_have__va_copy=no])
+ ])
+
+ AH_TEMPLATE([HAVE_VA_COPY],
+ [Define if you have an implementation of `va_copy()'.])
+ AH_TEMPLATE([HAVE___VA_COPY],
+ [Define if you have an implementation of `__va_copy()'.])
+
+ if test "x$eso_cv_have_va_copy" = "xyes"; then
+ eso_func_va_copy=va_copy
+ AC_DEFINE(HAVE_VA_COPY)
+ else
+ if test "x$eso_cv_have__va_copy" = "xyes"; then
+ eso_func_va_copy=__va_copy
+ AC_DEFINE(HAVE___VA_COPY)
+ fi
+ fi
+
+ AH_TEMPLATE([HAVE_VA_COPY_STYLE_FUNCTION],
+ [Define if you have an implementation of a `va_copy()' style
+ function.])
+ AH_TEMPLATE([$1], [A `va_copy()' style function])
+
+ if test -n "$eso_func_va_copy"; then
+ AC_DEFINE_UNQUOTED([$1], $eso_func_va_copy)
+ AC_DEFINE(HAVE_VA_COPY_STYLE_FUNCTION)
+ fi
+
+ # Check whether va_lists can be copied by value
+ AC_CACHE_CHECK([whether va_lists can be copied by value],
+ [eso_cv_have_va_value_copy],
+ [
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+void f(int i, ...)
+{
+ va_list args1, args2;
+ va_start (args1, i);
+ args2 = args1;
+
+ if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+ exit (1);
+
+ va_end (args1);
+ va_end (args2);
+}
+]],
+[[
+ f(0, 42);
+]])
+ ],
+ [eso_cv_have_va_value_copy=yes],
+ [eso_cv_have_va_value_copy=no],
+ [eso_cv_have_va_value_copy=no])
+ ])
+
+ AH_TEMPLATE([HAVE_VA_LIST_COPY_BY_VALUE],
+ [Define if `va_lists' can be copied by value])
+ if test "x$eso_cv_have_va_value_copy" = "xyes"; then
+ AC_DEFINE(HAVE_VA_LIST_COPY_BY_VALUE)
+ fi
+
+])
+
+
+# ESO_FUNC_REALLOC_SANITY
+#-------------------------
+# Check whether realloc(NULL,) works.
+AC_DEFUN([ESO_FUNC_REALLOC_SANITY],
+[
+ AC_CACHE_CHECK([whether realloc(NULL,) works],
+ [eso_cv_have_sane_realloc],
+ [
+ AC_RUN_IFELSE(
+ [
+AC_LANG_PROGRAM(
+[[
+#include <stdlib.h>
+]],
+[[
+ return realloc (0, sizeof (int)) == 0;
+]])
+ ],
+ [eso_cv_have_sane_realloc=yes],
+ [eso_cv_have_sane_realloc=no],
+ [eso_cv_have_sane_realloc=no])
+ ])
+
+ AH_TEMPLATE([HAVE_WORKING_REALLOC],
+ [Define if realloc(NULL,) works])
+
+ if test x$eso_cv_have_sane_realloc = xyes; then
+ AC_DEFINE(HAVE_WORKING_REALLOC)
+ fi
+
+])
+
+
+# ESO_FIND_FILE(file, directories, variable)
+#------------------------------------------
+# Search for file in directories. Set variable to the first location
+# where file was found, if file is not found at all variable is set to NO.
+AC_DEFUN([ESO_FIND_FILE],
+[
+ $3=no
+
+ for i in $2; do
+ for j in $1; do
+
+ echo "configure: __oline__: $i/$j" >&AC_FD_CC
+
+ if test -r "$i/$j"; then
+ echo "taking that" >&AC_FD_CC
+ $3=$i
+ break 2
+ fi
+ done
+ done
+])
+
+
+# ESO_SET_LIBRARY_VERSION([CURRENT], [REVISION], [AGE])
+#------------------------------------------------------
+# Sets the libtool versioning symbols LT_CURRENT, LT_REVISION, LT_AGE.
+AC_DEFUN([ESO_SET_LIBRARY_VERSION],
+[
+
+ if test -z "$1"; then
+ LT_CURRENT=0
+ else
+ LT_CURRENT="$1"
+ fi
+
+ if test -z "$2"; then
+ LT_REVISION=0
+ else
+ LT_REVISION="$2"
+ fi
+
+ if test -z "$3"; then
+ LT_AGE=0
+ else
+ LT_AGE="$3"
+ fi
+
+ AC_SUBST(LT_CURRENT)
+ AC_SUBST(LT_REVISION)
+ AC_SUBST(LT_AGE)
+])
diff --git a/m4macros/gsl.m4 b/m4macros/gsl.m4
new file mode 100644
index 0000000..eba8c4e
--- /dev/null
+++ b/m4macros/gsl.m4
@@ -0,0 +1,23 @@
+# LIB_CHECK_GSL
+#------------------
+# Checks for the gsl library and header files.
+AC_DEFUN([CPL_CHECK_GSL],
+[
+
+ AC_MSG_CHECKING([for gsl])
+
+ AC_ARG_WITH(gsl,
+ AC_HELP_STRING([--with-gsl],
+ [location where gsl is installed]),
+ [
+ cpl_gsl_dir=$withval
+ ])
+
+ export PKG_CONFIG_PATH="$cpl_gsl_dir/lib/pkgconfig:$GSLDIR/lib/pkgconfig/:$PKG_CONFIG_PATH"
+
+ AC_SUBST(PKG_CONFIG_PATH)
+ PKG_CHECK_MODULES([GSL], [gsl],
+ AC_DEFINE([HAVE_LIBGSL], [1], [1 if GSL present]),
+ AC_MSG_WARN([No GSL available]))
+
+])
diff --git a/m4macros/libtool.m4 b/m4macros/libtool.m4
new file mode 100644
index 0000000..88de383
--- /dev/null
+++ b/m4macros/libtool.m4
@@ -0,0 +1,7835 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+# Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+# Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable. If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins. After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script. The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+
+Report bugs to <bug-libtool at gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars. Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_REPLACE_SHELLFNS
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+ AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+ [lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+ echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+ $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+ echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+ $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+ lt_aix_libpath_sed='[
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }]'
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi],[])
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+ fi
+ ])
+ aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+case "$ECHO" in
+ printf*) AC_MSG_RESULT([printf]) ;;
+ print*) AC_MSG_RESULT([print -r]) ;;
+ *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test "X`printf %s $ECHO`" = "X$ECHO" \
+ || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[ --with-sysroot[=DIR] Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted. We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ AC_MSG_RESULT([${with_sysroot}])
+ AC_MSG_ERROR([The sysroot must be an absolute path.])
+ ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+ [lt_cv_ar_at_file=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+ ])
+ ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+ [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+ [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[123]]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+ [lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [lt_cv_shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+ ])
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Add ABI-specific directories to the system library path.
+ sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[List of archive names. First name is the real one, the rest are links.
+ The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+ [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="m4_if([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+ [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+ [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+ [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+ [lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+ esac
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT@&t at _DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+ [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ case $host_os in
+ aix[[4-9]]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ case $cc_basename in
+ cl*) ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ ;;
+ esac
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+ *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ m4_if($1, [], [
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ _LT_LINKER_OPTION([if $CC understands -b],
+ _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+ [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+ [lt_cv_irix_exported_symbol],
+ [save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+ [C++], [[int foo (void) { return 0; }]],
+ [Fortran 77], [[
+ subroutine foo
+ end]],
+ [Fortran], [[
+ subroutine foo
+ end]])])],
+ [lt_cv_irix_exported_symbol=yes],
+ [lt_cv_irix_exported_symbol=no])
+ LDFLAGS="$save_LDFLAGS"])
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+ [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+ [$RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ ])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+ [[If ld is used when linking, flag to hardcode $libdir into a binary
+ during linking. This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+ [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will actually be built
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+else
+ _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_CFLAGS=$CFLAGS
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ CFLAGS=$CXXFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $GXX,$cc_basename in
+ ,cl* | no,cl*)
+ # Native MSVC
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ func_to_tool_file "$lt_outputfile"~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # g++
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+ '"$_LT_TAGVAR(old_archive_cmds, $1)"
+ _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+ '"$_LT_TAGVAR(reload_cmds, $1)"
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case ${prev}${p} in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ fi
+
+ # Expand the sysroot to ease extracting the directories later.
+ if test -z "$prev"; then
+ case $p in
+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+ esac
+ fi
+ case $p in
+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+ esac
+ if test "$pre_test_object_deps_done" = no; then
+ case ${prev} in
+ -L | -R)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ prev=
+ ;;
+
+ *.lto.$objext) ;; # Ignore GCC LTO objects
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${F77-"f77"}
+ CFLAGS=$FFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+ CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${FC-"f95"}
+ CFLAGS=$FCFLAGS
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+ func_split_long_opt_name=${1%%=*}
+ func_split_long_opt_arg=${1#*=}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+ func_split_short_opt_arg=${1#??}
+ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
+
+ _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
+
+ _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+ func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+ eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+ [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+ [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4macros/ltoptions.m4 b/m4macros/ltoptions.m4
new file mode 100644
index 0000000..17cfd51
--- /dev/null
+++ b/m4macros/ltoptions.m4
@@ -0,0 +1,369 @@
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4macros/ltsugar.m4 b/m4macros/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/m4macros/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/m4macros/ltversion.m4 b/m4macros/ltversion.m4
new file mode 100644
index 0000000..9c7b5d4
--- /dev/null
+++ b/m4macros/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3293 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4])
+m4_define([LT_PACKAGE_REVISION], [1.3293])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4'
+macro_revision='1.3293'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/m4macros/lt~obsolete.m4 b/m4macros/lt~obsolete.m4
new file mode 100644
index 0000000..c573da9
--- /dev/null
+++ b/m4macros/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/m4macros/openmp.m4 b/m4macros/openmp.m4
new file mode 100644
index 0000000..22e8006
--- /dev/null
+++ b/m4macros/openmp.m4
@@ -0,0 +1,103 @@
+# NOTE:
+# The macros in this file were taken from c.m4 which is shipped with
+# Autoconf. Newer version of Autoconf provide these macros to check for
+# OpenMP support. For preparing CPL releases it would be sufficient to use
+# a recent Autotools installation, however the nightly build system, is still
+# using an Autotools installation which is too old, and there is no plan for
+# upgrading it yet, hence the macros have been copied and the renamed so that
+# there are no name clashes in case a new version of Autoconf is used.
+#
+# However the symbols produced by these macros are kept identical to the
+# official macro versions, so that removing this file will have (almost) no
+# impact when the Autotools installation of the nightly build system will
+# be upgraded.
+#
+# In addition, the command line option to disable OpenMP support has been
+# remove, so that the macro just reports the results, which can be used
+# by a calling custom macro.
+#
+
+# _CPL_LANG_OPENMP
+# ---------------
+# Expands to some language dependent source code for testing the presence of
+# OpenMP.
+AC_DEFUN([_CPL_LANG_OPENMP],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# _CPL_LANG_OPENMP(C)
+# ------------------
+m4_define([_CPL_LANG_OPENMP(C)],
+[
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+])
+
+# _CPL_LANG_OPENMP(C++)
+# --------------------
+m4_copy([_CPL_LANG_OPENMP(C)], [_CPL_LANG_OPENMP(C++)])
+
+# _CPL_LANG_OPENMP(Fortran 77)
+# ---------------------------
+m4_define([_CPL_LANG_OPENMP(Fortran 77)],
+[AC_LANG_FUNC_LINK_TRY([omp_get_num_threads])])
+
+# _CPL_LANG_OPENMP(Fortran)
+# ---------------------------
+m4_copy([_CPL_LANG_OPENMP(Fortran 77)], [_CPL_LANG_OPENMP(Fortran)])
+
+# CPL_OPENMP
+# ---------
+# Check which options need to be passed to the C compiler to support OpenMP.
+# Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these
+# options.
+# The options are necessary at compile time (so the #pragmas are understood)
+# and at link time (so the appropriate library is linked with).
+# This macro takes care to not produce redundant options if $CC $CFLAGS already
+# supports OpenMP. It also is careful to not pass options to compilers that
+# misinterpret them; for example, most compilers accept "-openmp" and create
+# an output file called 'penmp' rather than activating OpenMP support.
+AC_DEFUN([CPL_OPENMP],
+[
+ OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
+ dnl AC_ARG_ENABLE([openmp],
+ dnl [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
+ dnl if test "$enable_openmp" != no; then
+ AC_CACHE_CHECK([for the compiler option to support OpenMP],
+ [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
+ [AC_LINK_IFELSE([_CPL_LANG_OPENMP],
+ [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
+ [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
+ dnl Try these flags:
+ dnl GCC >= 4.2 -fopenmp
+ dnl SunPRO C -xopenmp
+ dnl Intel C -openmp
+ dnl SGI C, PGI C -mp
+ dnl Tru64 Compaq C -omp
+ dnl IBM C (AIX, Linux) -qsmp=omp
+ dnl If in this loop a compiler is passed an option that it doesn't
+ dnl understand or that it misinterprets, the AC_LINK_IFELSE test
+ dnl will fail (since we know that it failed without the option),
+ dnl therefore the loop will continue searching for an option, and
+ dnl no output file called 'penmp' or 'mp' is created.
+ for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
+ ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
+ AC_LINK_IFELSE([_CPL_LANG_OPENMP],
+ [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
+ _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
+ if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
+ break
+ fi
+ done])])
+ case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
+ "none needed" | unsupported)
+ ;; #(
+ *)
+ OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
+ esac
+ dnl fi
+ AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS])
+])
diff --git a/m4macros/purify.m4 b/m4macros/purify.m4
new file mode 100644
index 0000000..0d080bf
--- /dev/null
+++ b/m4macros/purify.m4
@@ -0,0 +1,27 @@
+# PURIFY
+#------------------------
+# Checks for the INTROOT area
+AC_DEFUN([CHECK_PURIFY],
+[
+
+ AC_MSG_CHECKING([for PURIFY])
+
+ AC_ARG_ENABLE(purify,
+ AC_HELP_STRING([--disable-purify],
+ [disalbes the check for the PURIFY installation]),
+ enable_purify=$enableval,
+ enable_purify=yes)
+
+ if test "x$enable_purify" = xyes ; then
+ AC_MSG_RESULT([enabled])
+ AC_CHECK_PROG([PURIFY_CMD], [purify], [purify],[NONE])
+ if test "$PURIFY_CMD" = "NONE" ; then
+ AC_MSG_WARN([Disabling purify support])
+ enable_purify=no
+ fi
+ else
+ AC_MSG_RESULT([disabled])
+ fi
+
+ AM_CONDITIONAL([PURIFY], [test "x$enable_purify" = "xyes"])
+])
diff --git a/recipes/Makefile.am b/recipes/Makefile.am
new file mode 100644
index 0000000..6ef3694
--- /dev/null
+++ b/recipes/Makefile.am
@@ -0,0 +1,149 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the HAWKI Pipeline
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS =
+
+plugin_LTLIBRARIES = hawki_cal_dark.la \
+ hawki_cal_flat.la \
+ hawki_cal_zpoint.la \
+ hawki_cal_distortion.la \
+ hawki_sci_jitter.la \
+ hawki_step_basic_calib.la \
+ hawki_step_stats.la \
+ hawki_step_compute_bkg.la \
+ hawki_step_subtract_bkg.la \
+ hawki_step_apply_dist.la \
+ hawki_step_refine_offsets.la \
+ hawki_step_combine.la \
+ hawki_step_detect_obj.la \
+ hawki_step_photom_2mass.la \
+ hawki_step_stitch.la \
+ hawki_tec_filtchk.la \
+ hawki_util_stdstars.la \
+ hawki_util_gendist.la \
+ hawki_util_extinction.la
+
+hawki_cal_dark_la_SOURCES = hawki_cal_dark.c
+hawki_cal_dark_la_LIBADD = $(LIBHAWKI)
+hawki_cal_dark_la_LDFLAGS = -module -avoid-version
+hawki_cal_dark_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_cal_flat_la_SOURCES = hawki_cal_flat.c
+hawki_cal_flat_la_LIBADD = $(LIBHAWKI)
+hawki_cal_flat_la_LDFLAGS = -module -avoid-version
+hawki_cal_flat_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_cal_zpoint_la_SOURCES = hawki_cal_zpoint.c
+hawki_cal_zpoint_la_LIBADD = $(LIBHAWKI)
+hawki_cal_zpoint_la_LDFLAGS = -module -avoid-version
+hawki_cal_zpoint_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_util_extinction_la_SOURCES = hawki_util_extinction.c
+hawki_util_extinction_la_LIBADD = $(LIBHAWKI)
+hawki_util_extinction_la_LDFLAGS = -module -avoid-version
+hawki_util_extinction_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_cal_distortion_la_SOURCES = hawki_cal_distortion.c
+hawki_cal_distortion_la_LIBADD = $(LIBHAWKI)
+hawki_cal_distortion_la_LDFLAGS = -module -avoid-version
+hawki_cal_distortion_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_sci_jitter_la_SOURCES = hawki_sci_jitter.c
+hawki_sci_jitter_la_LIBADD = $(LIBHAWKI)
+hawki_sci_jitter_la_LDFLAGS = -module -avoid-version
+hawki_sci_jitter_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_basic_calib_la_SOURCES = hawki_step_basic_calib.c
+hawki_step_basic_calib_la_LIBADD = $(LIBHAWKI)
+hawki_step_basic_calib_la_LDFLAGS = -module -avoid-version
+hawki_step_basic_calib_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_stats_la_SOURCES = hawki_step_stats.c
+hawki_step_stats_la_LIBADD = $(LIBHAWKI)
+hawki_step_stats_la_LDFLAGS = -module -avoid-version
+hawki_step_stats_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_compute_bkg_la_SOURCES = hawki_step_compute_bkg.c
+hawki_step_compute_bkg_la_LIBADD = $(LIBHAWKI)
+hawki_step_compute_bkg_la_LDFLAGS = -module -avoid-version
+hawki_step_compute_bkg_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_subtract_bkg_la_SOURCES = hawki_step_subtract_bkg.c
+hawki_step_subtract_bkg_la_LIBADD = $(LIBHAWKI)
+hawki_step_subtract_bkg_la_LDFLAGS = -module -avoid-version
+hawki_step_subtract_bkg_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_stitch_la_SOURCES = hawki_step_stitch.c
+hawki_step_stitch_la_LIBADD = $(LIBHAWKI)
+hawki_step_stitch_la_LDFLAGS = -module -avoid-version
+hawki_step_stitch_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_apply_dist_la_SOURCES = hawki_step_apply_dist.c
+hawki_step_apply_dist_la_LIBADD = $(LIBHAWKI)
+hawki_step_apply_dist_la_LDFLAGS = -module -avoid-version
+hawki_step_apply_dist_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_refine_offsets_la_SOURCES = hawki_step_refine_offsets.c
+hawki_step_refine_offsets_la_LIBADD = $(LIBHAWKI)
+hawki_step_refine_offsets_la_LDFLAGS = -module -avoid-version
+hawki_step_refine_offsets_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_combine_la_SOURCES = hawki_step_combine.c
+hawki_step_combine_la_LIBADD = $(LIBHAWKI)
+hawki_step_combine_la_LDFLAGS = -module -avoid-version
+hawki_step_combine_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_detect_obj_la_SOURCES = hawki_step_detect_obj.c
+hawki_step_detect_obj_la_LIBADD = $(LIBHAWKI)
+hawki_step_detect_obj_la_LDFLAGS = -module -avoid-version
+hawki_step_detect_obj_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_step_photom_2mass_la_SOURCES = hawki_step_photom_2mass.c
+hawki_step_photom_2mass_la_LIBADD = $(LIBHAWKI)
+hawki_step_photom_2mass_la_LDFLAGS = -module -avoid-version
+hawki_step_photom_2mass_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_tec_filtchk_la_SOURCES = hawki_tec_filtchk.c
+hawki_tec_filtchk_la_LIBADD = $(LIBHAWKI)
+hawki_tec_filtchk_la_LDFLAGS = -module -avoid-version
+hawki_tec_filtchk_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_util_gendist_la_SOURCES = hawki_util_gendist.c
+hawki_util_gendist_la_LIBADD = $(LIBHAWKI)
+hawki_util_gendist_la_LDFLAGS = -module -avoid-version
+hawki_util_gendist_la_DEPENDENCIES = $(LIBHAWKI)
+
+hawki_util_stdstars_la_SOURCES = hawki_util_stdstars.c
+hawki_util_stdstars_la_LIBADD = $(LIBHAWKI)
+hawki_util_stdstars_la_LDFLAGS = -module -avoid-version
+hawki_util_stdstars_la_DEPENDENCIES = $(LIBHAWKI)
diff --git a/recipes/Makefile.in b/recipes/Makefile.in
new file mode 100644
index 0000000..2908f53
--- /dev/null
+++ b/recipes/Makefile.in
@@ -0,0 +1,868 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = recipes
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am_hawki_cal_dark_la_OBJECTS = hawki_cal_dark.lo
+hawki_cal_dark_la_OBJECTS = $(am_hawki_cal_dark_la_OBJECTS)
+hawki_cal_dark_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_cal_dark_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_cal_distortion_la_OBJECTS = hawki_cal_distortion.lo
+hawki_cal_distortion_la_OBJECTS = \
+ $(am_hawki_cal_distortion_la_OBJECTS)
+hawki_cal_distortion_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_cal_distortion_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_cal_flat_la_OBJECTS = hawki_cal_flat.lo
+hawki_cal_flat_la_OBJECTS = $(am_hawki_cal_flat_la_OBJECTS)
+hawki_cal_flat_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_cal_flat_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_cal_zpoint_la_OBJECTS = hawki_cal_zpoint.lo
+hawki_cal_zpoint_la_OBJECTS = $(am_hawki_cal_zpoint_la_OBJECTS)
+hawki_cal_zpoint_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_cal_zpoint_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_sci_jitter_la_OBJECTS = hawki_sci_jitter.lo
+hawki_sci_jitter_la_OBJECTS = $(am_hawki_sci_jitter_la_OBJECTS)
+hawki_sci_jitter_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_sci_jitter_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_step_apply_dist_la_OBJECTS = hawki_step_apply_dist.lo
+hawki_step_apply_dist_la_OBJECTS = \
+ $(am_hawki_step_apply_dist_la_OBJECTS)
+hawki_step_apply_dist_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_step_apply_dist_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_step_basic_calib_la_OBJECTS = hawki_step_basic_calib.lo
+hawki_step_basic_calib_la_OBJECTS = \
+ $(am_hawki_step_basic_calib_la_OBJECTS)
+hawki_step_basic_calib_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(hawki_step_basic_calib_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_hawki_step_combine_la_OBJECTS = hawki_step_combine.lo
+hawki_step_combine_la_OBJECTS = $(am_hawki_step_combine_la_OBJECTS)
+hawki_step_combine_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_step_combine_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_step_compute_bkg_la_OBJECTS = hawki_step_compute_bkg.lo
+hawki_step_compute_bkg_la_OBJECTS = \
+ $(am_hawki_step_compute_bkg_la_OBJECTS)
+hawki_step_compute_bkg_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(hawki_step_compute_bkg_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_hawki_step_detect_obj_la_OBJECTS = hawki_step_detect_obj.lo
+hawki_step_detect_obj_la_OBJECTS = \
+ $(am_hawki_step_detect_obj_la_OBJECTS)
+hawki_step_detect_obj_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_step_detect_obj_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_step_photom_2mass_la_OBJECTS = hawki_step_photom_2mass.lo
+hawki_step_photom_2mass_la_OBJECTS = \
+ $(am_hawki_step_photom_2mass_la_OBJECTS)
+hawki_step_photom_2mass_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(hawki_step_photom_2mass_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_hawki_step_refine_offsets_la_OBJECTS = \
+ hawki_step_refine_offsets.lo
+hawki_step_refine_offsets_la_OBJECTS = \
+ $(am_hawki_step_refine_offsets_la_OBJECTS)
+hawki_step_refine_offsets_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(hawki_step_refine_offsets_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_hawki_step_stats_la_OBJECTS = hawki_step_stats.lo
+hawki_step_stats_la_OBJECTS = $(am_hawki_step_stats_la_OBJECTS)
+hawki_step_stats_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_step_stats_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_step_stitch_la_OBJECTS = hawki_step_stitch.lo
+hawki_step_stitch_la_OBJECTS = $(am_hawki_step_stitch_la_OBJECTS)
+hawki_step_stitch_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_step_stitch_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_step_subtract_bkg_la_OBJECTS = hawki_step_subtract_bkg.lo
+hawki_step_subtract_bkg_la_OBJECTS = \
+ $(am_hawki_step_subtract_bkg_la_OBJECTS)
+hawki_step_subtract_bkg_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(hawki_step_subtract_bkg_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_hawki_tec_filtchk_la_OBJECTS = hawki_tec_filtchk.lo
+hawki_tec_filtchk_la_OBJECTS = $(am_hawki_tec_filtchk_la_OBJECTS)
+hawki_tec_filtchk_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_tec_filtchk_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_util_extinction_la_OBJECTS = hawki_util_extinction.lo
+hawki_util_extinction_la_OBJECTS = \
+ $(am_hawki_util_extinction_la_OBJECTS)
+hawki_util_extinction_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_util_extinction_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_util_gendist_la_OBJECTS = hawki_util_gendist.lo
+hawki_util_gendist_la_OBJECTS = $(am_hawki_util_gendist_la_OBJECTS)
+hawki_util_gendist_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_util_gendist_la_LDFLAGS) $(LDFLAGS) -o $@
+am_hawki_util_stdstars_la_OBJECTS = hawki_util_stdstars.lo
+hawki_util_stdstars_la_OBJECTS = $(am_hawki_util_stdstars_la_OBJECTS)
+hawki_util_stdstars_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(hawki_util_stdstars_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(hawki_cal_dark_la_SOURCES) \
+ $(hawki_cal_distortion_la_SOURCES) \
+ $(hawki_cal_flat_la_SOURCES) $(hawki_cal_zpoint_la_SOURCES) \
+ $(hawki_sci_jitter_la_SOURCES) \
+ $(hawki_step_apply_dist_la_SOURCES) \
+ $(hawki_step_basic_calib_la_SOURCES) \
+ $(hawki_step_combine_la_SOURCES) \
+ $(hawki_step_compute_bkg_la_SOURCES) \
+ $(hawki_step_detect_obj_la_SOURCES) \
+ $(hawki_step_photom_2mass_la_SOURCES) \
+ $(hawki_step_refine_offsets_la_SOURCES) \
+ $(hawki_step_stats_la_SOURCES) $(hawki_step_stitch_la_SOURCES) \
+ $(hawki_step_subtract_bkg_la_SOURCES) \
+ $(hawki_tec_filtchk_la_SOURCES) \
+ $(hawki_util_extinction_la_SOURCES) \
+ $(hawki_util_gendist_la_SOURCES) \
+ $(hawki_util_stdstars_la_SOURCES)
+DIST_SOURCES = $(hawki_cal_dark_la_SOURCES) \
+ $(hawki_cal_distortion_la_SOURCES) \
+ $(hawki_cal_flat_la_SOURCES) $(hawki_cal_zpoint_la_SOURCES) \
+ $(hawki_sci_jitter_la_SOURCES) \
+ $(hawki_step_apply_dist_la_SOURCES) \
+ $(hawki_step_basic_calib_la_SOURCES) \
+ $(hawki_step_combine_la_SOURCES) \
+ $(hawki_step_compute_bkg_la_SOURCES) \
+ $(hawki_step_detect_obj_la_SOURCES) \
+ $(hawki_step_photom_2mass_la_SOURCES) \
+ $(hawki_step_refine_offsets_la_SOURCES) \
+ $(hawki_step_stats_la_SOURCES) $(hawki_step_stitch_la_SOURCES) \
+ $(hawki_step_subtract_bkg_la_SOURCES) \
+ $(hawki_tec_filtchk_la_SOURCES) \
+ $(hawki_util_extinction_la_SOURCES) \
+ $(hawki_util_gendist_la_SOURCES) \
+ $(hawki_util_stdstars_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+DISTCLEANFILES = *~
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
+INCLUDES = $(all_includes)
+noinst_HEADERS =
+plugin_LTLIBRARIES = hawki_cal_dark.la \
+ hawki_cal_flat.la \
+ hawki_cal_zpoint.la \
+ hawki_cal_distortion.la \
+ hawki_sci_jitter.la \
+ hawki_step_basic_calib.la \
+ hawki_step_stats.la \
+ hawki_step_compute_bkg.la \
+ hawki_step_subtract_bkg.la \
+ hawki_step_apply_dist.la \
+ hawki_step_refine_offsets.la \
+ hawki_step_combine.la \
+ hawki_step_detect_obj.la \
+ hawki_step_photom_2mass.la \
+ hawki_step_stitch.la \
+ hawki_tec_filtchk.la \
+ hawki_util_stdstars.la \
+ hawki_util_gendist.la \
+ hawki_util_extinction.la
+
+hawki_cal_dark_la_SOURCES = hawki_cal_dark.c
+hawki_cal_dark_la_LIBADD = $(LIBHAWKI)
+hawki_cal_dark_la_LDFLAGS = -module -avoid-version
+hawki_cal_dark_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_cal_flat_la_SOURCES = hawki_cal_flat.c
+hawki_cal_flat_la_LIBADD = $(LIBHAWKI)
+hawki_cal_flat_la_LDFLAGS = -module -avoid-version
+hawki_cal_flat_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_cal_zpoint_la_SOURCES = hawki_cal_zpoint.c
+hawki_cal_zpoint_la_LIBADD = $(LIBHAWKI)
+hawki_cal_zpoint_la_LDFLAGS = -module -avoid-version
+hawki_cal_zpoint_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_util_extinction_la_SOURCES = hawki_util_extinction.c
+hawki_util_extinction_la_LIBADD = $(LIBHAWKI)
+hawki_util_extinction_la_LDFLAGS = -module -avoid-version
+hawki_util_extinction_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_cal_distortion_la_SOURCES = hawki_cal_distortion.c
+hawki_cal_distortion_la_LIBADD = $(LIBHAWKI)
+hawki_cal_distortion_la_LDFLAGS = -module -avoid-version
+hawki_cal_distortion_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_sci_jitter_la_SOURCES = hawki_sci_jitter.c
+hawki_sci_jitter_la_LIBADD = $(LIBHAWKI)
+hawki_sci_jitter_la_LDFLAGS = -module -avoid-version
+hawki_sci_jitter_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_basic_calib_la_SOURCES = hawki_step_basic_calib.c
+hawki_step_basic_calib_la_LIBADD = $(LIBHAWKI)
+hawki_step_basic_calib_la_LDFLAGS = -module -avoid-version
+hawki_step_basic_calib_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_stats_la_SOURCES = hawki_step_stats.c
+hawki_step_stats_la_LIBADD = $(LIBHAWKI)
+hawki_step_stats_la_LDFLAGS = -module -avoid-version
+hawki_step_stats_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_compute_bkg_la_SOURCES = hawki_step_compute_bkg.c
+hawki_step_compute_bkg_la_LIBADD = $(LIBHAWKI)
+hawki_step_compute_bkg_la_LDFLAGS = -module -avoid-version
+hawki_step_compute_bkg_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_subtract_bkg_la_SOURCES = hawki_step_subtract_bkg.c
+hawki_step_subtract_bkg_la_LIBADD = $(LIBHAWKI)
+hawki_step_subtract_bkg_la_LDFLAGS = -module -avoid-version
+hawki_step_subtract_bkg_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_stitch_la_SOURCES = hawki_step_stitch.c
+hawki_step_stitch_la_LIBADD = $(LIBHAWKI)
+hawki_step_stitch_la_LDFLAGS = -module -avoid-version
+hawki_step_stitch_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_apply_dist_la_SOURCES = hawki_step_apply_dist.c
+hawki_step_apply_dist_la_LIBADD = $(LIBHAWKI)
+hawki_step_apply_dist_la_LDFLAGS = -module -avoid-version
+hawki_step_apply_dist_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_refine_offsets_la_SOURCES = hawki_step_refine_offsets.c
+hawki_step_refine_offsets_la_LIBADD = $(LIBHAWKI)
+hawki_step_refine_offsets_la_LDFLAGS = -module -avoid-version
+hawki_step_refine_offsets_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_combine_la_SOURCES = hawki_step_combine.c
+hawki_step_combine_la_LIBADD = $(LIBHAWKI)
+hawki_step_combine_la_LDFLAGS = -module -avoid-version
+hawki_step_combine_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_detect_obj_la_SOURCES = hawki_step_detect_obj.c
+hawki_step_detect_obj_la_LIBADD = $(LIBHAWKI)
+hawki_step_detect_obj_la_LDFLAGS = -module -avoid-version
+hawki_step_detect_obj_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_step_photom_2mass_la_SOURCES = hawki_step_photom_2mass.c
+hawki_step_photom_2mass_la_LIBADD = $(LIBHAWKI)
+hawki_step_photom_2mass_la_LDFLAGS = -module -avoid-version
+hawki_step_photom_2mass_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_tec_filtchk_la_SOURCES = hawki_tec_filtchk.c
+hawki_tec_filtchk_la_LIBADD = $(LIBHAWKI)
+hawki_tec_filtchk_la_LDFLAGS = -module -avoid-version
+hawki_tec_filtchk_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_util_gendist_la_SOURCES = hawki_util_gendist.c
+hawki_util_gendist_la_LIBADD = $(LIBHAWKI)
+hawki_util_gendist_la_LDFLAGS = -module -avoid-version
+hawki_util_gendist_la_DEPENDENCIES = $(LIBHAWKI)
+hawki_util_stdstars_la_SOURCES = hawki_util_stdstars.c
+hawki_util_stdstars_la_LIBADD = $(LIBHAWKI)
+hawki_util_stdstars_la_LDFLAGS = -module -avoid-version
+hawki_util_stdstars_la_DEPENDENCIES = $(LIBHAWKI)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign recipes/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign recipes/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+hawki_cal_dark.la: $(hawki_cal_dark_la_OBJECTS) $(hawki_cal_dark_la_DEPENDENCIES)
+ $(hawki_cal_dark_la_LINK) -rpath $(plugindir) $(hawki_cal_dark_la_OBJECTS) $(hawki_cal_dark_la_LIBADD) $(LIBS)
+hawki_cal_distortion.la: $(hawki_cal_distortion_la_OBJECTS) $(hawki_cal_distortion_la_DEPENDENCIES)
+ $(hawki_cal_distortion_la_LINK) -rpath $(plugindir) $(hawki_cal_distortion_la_OBJECTS) $(hawki_cal_distortion_la_LIBADD) $(LIBS)
+hawki_cal_flat.la: $(hawki_cal_flat_la_OBJECTS) $(hawki_cal_flat_la_DEPENDENCIES)
+ $(hawki_cal_flat_la_LINK) -rpath $(plugindir) $(hawki_cal_flat_la_OBJECTS) $(hawki_cal_flat_la_LIBADD) $(LIBS)
+hawki_cal_zpoint.la: $(hawki_cal_zpoint_la_OBJECTS) $(hawki_cal_zpoint_la_DEPENDENCIES)
+ $(hawki_cal_zpoint_la_LINK) -rpath $(plugindir) $(hawki_cal_zpoint_la_OBJECTS) $(hawki_cal_zpoint_la_LIBADD) $(LIBS)
+hawki_sci_jitter.la: $(hawki_sci_jitter_la_OBJECTS) $(hawki_sci_jitter_la_DEPENDENCIES)
+ $(hawki_sci_jitter_la_LINK) -rpath $(plugindir) $(hawki_sci_jitter_la_OBJECTS) $(hawki_sci_jitter_la_LIBADD) $(LIBS)
+hawki_step_apply_dist.la: $(hawki_step_apply_dist_la_OBJECTS) $(hawki_step_apply_dist_la_DEPENDENCIES)
+ $(hawki_step_apply_dist_la_LINK) -rpath $(plugindir) $(hawki_step_apply_dist_la_OBJECTS) $(hawki_step_apply_dist_la_LIBADD) $(LIBS)
+hawki_step_basic_calib.la: $(hawki_step_basic_calib_la_OBJECTS) $(hawki_step_basic_calib_la_DEPENDENCIES)
+ $(hawki_step_basic_calib_la_LINK) -rpath $(plugindir) $(hawki_step_basic_calib_la_OBJECTS) $(hawki_step_basic_calib_la_LIBADD) $(LIBS)
+hawki_step_combine.la: $(hawki_step_combine_la_OBJECTS) $(hawki_step_combine_la_DEPENDENCIES)
+ $(hawki_step_combine_la_LINK) -rpath $(plugindir) $(hawki_step_combine_la_OBJECTS) $(hawki_step_combine_la_LIBADD) $(LIBS)
+hawki_step_compute_bkg.la: $(hawki_step_compute_bkg_la_OBJECTS) $(hawki_step_compute_bkg_la_DEPENDENCIES)
+ $(hawki_step_compute_bkg_la_LINK) -rpath $(plugindir) $(hawki_step_compute_bkg_la_OBJECTS) $(hawki_step_compute_bkg_la_LIBADD) $(LIBS)
+hawki_step_detect_obj.la: $(hawki_step_detect_obj_la_OBJECTS) $(hawki_step_detect_obj_la_DEPENDENCIES)
+ $(hawki_step_detect_obj_la_LINK) -rpath $(plugindir) $(hawki_step_detect_obj_la_OBJECTS) $(hawki_step_detect_obj_la_LIBADD) $(LIBS)
+hawki_step_photom_2mass.la: $(hawki_step_photom_2mass_la_OBJECTS) $(hawki_step_photom_2mass_la_DEPENDENCIES)
+ $(hawki_step_photom_2mass_la_LINK) -rpath $(plugindir) $(hawki_step_photom_2mass_la_OBJECTS) $(hawki_step_photom_2mass_la_LIBADD) $(LIBS)
+hawki_step_refine_offsets.la: $(hawki_step_refine_offsets_la_OBJECTS) $(hawki_step_refine_offsets_la_DEPENDENCIES)
+ $(hawki_step_refine_offsets_la_LINK) -rpath $(plugindir) $(hawki_step_refine_offsets_la_OBJECTS) $(hawki_step_refine_offsets_la_LIBADD) $(LIBS)
+hawki_step_stats.la: $(hawki_step_stats_la_OBJECTS) $(hawki_step_stats_la_DEPENDENCIES)
+ $(hawki_step_stats_la_LINK) -rpath $(plugindir) $(hawki_step_stats_la_OBJECTS) $(hawki_step_stats_la_LIBADD) $(LIBS)
+hawki_step_stitch.la: $(hawki_step_stitch_la_OBJECTS) $(hawki_step_stitch_la_DEPENDENCIES)
+ $(hawki_step_stitch_la_LINK) -rpath $(plugindir) $(hawki_step_stitch_la_OBJECTS) $(hawki_step_stitch_la_LIBADD) $(LIBS)
+hawki_step_subtract_bkg.la: $(hawki_step_subtract_bkg_la_OBJECTS) $(hawki_step_subtract_bkg_la_DEPENDENCIES)
+ $(hawki_step_subtract_bkg_la_LINK) -rpath $(plugindir) $(hawki_step_subtract_bkg_la_OBJECTS) $(hawki_step_subtract_bkg_la_LIBADD) $(LIBS)
+hawki_tec_filtchk.la: $(hawki_tec_filtchk_la_OBJECTS) $(hawki_tec_filtchk_la_DEPENDENCIES)
+ $(hawki_tec_filtchk_la_LINK) -rpath $(plugindir) $(hawki_tec_filtchk_la_OBJECTS) $(hawki_tec_filtchk_la_LIBADD) $(LIBS)
+hawki_util_extinction.la: $(hawki_util_extinction_la_OBJECTS) $(hawki_util_extinction_la_DEPENDENCIES)
+ $(hawki_util_extinction_la_LINK) -rpath $(plugindir) $(hawki_util_extinction_la_OBJECTS) $(hawki_util_extinction_la_LIBADD) $(LIBS)
+hawki_util_gendist.la: $(hawki_util_gendist_la_OBJECTS) $(hawki_util_gendist_la_DEPENDENCIES)
+ $(hawki_util_gendist_la_LINK) -rpath $(plugindir) $(hawki_util_gendist_la_OBJECTS) $(hawki_util_gendist_la_LIBADD) $(LIBS)
+hawki_util_stdstars.la: $(hawki_util_stdstars_la_OBJECTS) $(hawki_util_stdstars_la_DEPENDENCIES)
+ $(hawki_util_stdstars_la_LINK) -rpath $(plugindir) $(hawki_util_stdstars_la_OBJECTS) $(hawki_util_stdstars_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_cal_dark.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_cal_distortion.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_cal_flat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_cal_zpoint.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_sci_jitter.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_apply_dist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_basic_calib.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_combine.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_compute_bkg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_detect_obj.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_photom_2mass.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_refine_offsets.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_stats.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_stitch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_step_subtract_bkg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_tec_filtchk.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_util_extinction.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_util_gendist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hawki_util_stdstars.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pluginLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/recipes/hawki_cal_dark.c b/recipes/hawki_cal_dark.c
new file mode 100644
index 0000000..76a1bf5
--- /dev/null
+++ b/recipes/hawki_cal_dark.c
@@ -0,0 +1,885 @@
+/* $Id: hawki_cal_dark.c,v 1.21 2011/02/16 16:33:21 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/02/16 16:33:21 $
+ * $Revision: 1.21 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_utils.h"
+#include "hawki_image_stats.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_variance.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_cal_dark_create(cpl_plugin *) ;
+static int hawki_cal_dark_exec(cpl_plugin *) ;
+static int hawki_cal_dark_destroy(cpl_plugin *) ;
+static int hawki_cal_dark(cpl_parameterlist *, cpl_frameset *) ;
+
+void hawki_cal_dark_initialise_qc(void);
+static int hawki_cal_dark_retrieve_input_param
+(cpl_parameterlist * parlist);
+static double hawki_cal_dark_ron(const cpl_image *, const cpl_image *, int) ;
+static int hawki_cal_dark_save
+(const cpl_imagelist * dark,
+ const cpl_imagelist * master_dark_err,
+ const cpl_imagelist * bpmdark,
+ cpl_table ** raw_dark_stats,
+ const cpl_vector ** rons,
+ const cpl_frameset * used_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct {
+ /* Inputs */
+ int hsize ;
+ int nsamples ;
+ double sigma ;
+ int llx ;
+ int lly ;
+ int urx ;
+ int ury ;
+ double gain;
+ double ron;
+ int error_tracking;
+} hawki_cal_dark_config ;
+
+static struct {
+ /* Outputs */
+ int nb_badpix[HAWKI_NB_DETECTORS] ;
+ double master_dark_mean[HAWKI_NB_DETECTORS] ;
+ double master_dark_med[HAWKI_NB_DETECTORS] ;
+ double master_dark_stdev[HAWKI_NB_DETECTORS] ;
+ double master_dark_error_mean[HAWKI_NB_DETECTORS] ;
+ double master_dark_error_med[HAWKI_NB_DETECTORS] ;
+ double master_dark_error_stdev[HAWKI_NB_DETECTORS] ;
+ double vc_mean[HAWKI_NB_DETECTORS][HAWKI_NB_VC] ;
+ double vc_med[HAWKI_NB_DETECTORS][HAWKI_NB_VC] ;
+ double vc_stdev[HAWKI_NB_DETECTORS][HAWKI_NB_VC] ;
+ double dit;
+ int ndit;
+ int ndsamples;
+} hawki_cal_dark_outputs;
+
+static char hawki_cal_dark_description[] =
+"hawki_cal_dark -- Dark recipe\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"raw-file.fits "HAWKI_CAL_DARK_RAW" or\n"
+"raw-file.fits "HAWKI_TEC_FLAT_RAW".\n"
+"The recipe creates as an output:\n"
+"hawki_cal_dark.fits ("HAWKI_CALPRO_DARK"): The master dark\n"
+"hawki_cal_dark_bpmdark.fits("HAWKI_CALPRO_BPM_HOT"): The bad pixel mask associated to the dark\n"
+"hawki_cal_dark_stats.fits("HAWKI_CALPRO_DARK_STATS"): Statistics of the raw darks\n"
+"Optionally it also creates:\n"
+"hawki_cal_dark_err.fits("HAWKI_CALPRO_DARK_ERR"): The error in the master dark\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok, -1 otherwise
+
+ Create the recipe instance and make it available to the application using the
+ interface. This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe ) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_cal_dark",
+ "Dark recipe",
+ hawki_cal_dark_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_cal_dark_create,
+ hawki_cal_dark_exec,
+ hawki_cal_dark_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Defining the command-line/configuration parameters for the recipe.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_dark_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Check that the plugin is part of a valid recipe */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+
+ /* Fill the parameters list */
+ /* --sigma */
+ p = cpl_parameter_new_value("hawki.hawki_cal_dark.sigma",
+ CPL_TYPE_DOUBLE, "sigma for hot bad pixels detection",
+ "hawki.hawki_cal_dark", 10.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --nsamples */
+ p = cpl_parameter_new_value("hawki.hawki_cal_dark.nsamples",
+ CPL_TYPE_INT, "number of samples for RON computation",
+ "hawki.hawki_cal_dark", 100) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nsamples") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --hsize */
+ p = cpl_parameter_new_value("hawki.hawki_cal_dark.hsize",
+ CPL_TYPE_INT, "half size of the window for RON computation",
+ "hawki.hawki_cal_dark", 6) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "hsize") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --zone */
+ p = cpl_parameter_new_value("hawki.hawki_cal_dark.zone",
+ CPL_TYPE_STRING,
+ "Stats zone",
+ "hawki.hawki_cal_dark",
+ "512,512,1536,1536") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "zone") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --gain */
+ p = cpl_parameter_new_value("hawki.hawki_cal_dark.gain",
+ CPL_TYPE_DOUBLE,
+ "Detector nominal gain (e-/ADU)",
+ "hawki.hawki_cal_dark",
+ -1.);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "gain") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --ron */
+ p = cpl_parameter_new_value("hawki.hawki_cal_dark.ron",
+ CPL_TYPE_DOUBLE,
+ "Detector nominal RON for a single readout (ADU)",
+ "hawki.hawki_cal_dark",
+ -1.);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ron") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_dark_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_cal_dark(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_dark_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Interpret the command line options and execute the data processing
+ @param parlist the parameters list
+ @param frameset the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_dark(
+ cpl_parameterlist * parlist,
+ cpl_frameset * frameset)
+{
+ cpl_frameset * rawframes ;
+ cpl_frame * ref_frame ;
+ cpl_propertylist * plist ;
+ cpl_imagelist * darks_raw ;
+ cpl_imagelist * master_dark;
+ cpl_imagelist * master_dark_err;
+ cpl_imagelist * bpmdark;
+ cpl_image * bpm ;
+ cpl_image * ima_curr ;
+ cpl_image * ima_next ;
+ cpl_image * ima_accu ;
+ cpl_image * ima_accu_err = NULL;
+ int nframes ;
+ cpl_vector * rons[HAWKI_NB_DETECTORS] ;
+ cpl_table ** raw_dark_stats;
+ double ron ;
+ int vc_urx, vc_ury, vc_llx, vc_lly ;
+ int j, k ;
+ int idet;
+ cpl_errorstate error_prevstate;
+
+ /* Initialise */
+ rawframes = NULL ;
+ ima_accu = NULL ;
+ ima_next = NULL ;
+ master_dark_err = NULL;
+ hawki_cal_dark_initialise_qc();
+
+ /* Retrieve input parameters */
+ if(hawki_cal_dark_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(frameset)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve raw frames */
+ rawframes = hawki_extract_frameset(frameset, HAWKI_CAL_DARK_RAW) ;
+
+ /* Test if raw frames have been found */
+ if (rawframes == NULL) {
+ cpl_msg_error(__func__, "No raw frame in input (%s)",HAWKI_CAL_DARK_RAW);
+ return -1 ;
+ }
+
+ /* At least 3 frames */
+ if (cpl_frameset_get_size(rawframes) < 3) {
+ cpl_msg_error(__func__, "Not enough input frames");
+ cpl_frameset_delete(rawframes) ;
+ return -1 ;
+ }
+
+ /* Get DIT / NDIT from the header */
+ error_prevstate = cpl_errorstate_get();
+ ref_frame = cpl_frameset_get_frame(rawframes, 0) ;
+ if ((plist=cpl_propertylist_load(cpl_frame_get_filename(ref_frame),
+ 0)) == NULL) {
+ cpl_msg_error(__func__, "Cannot get header from frame");
+ cpl_msg_indent_less() ;
+ cpl_frameset_delete(rawframes) ;
+ return -1 ;
+ }
+ hawki_cal_dark_outputs.dit = hawki_pfits_get_dit(plist) ;
+ hawki_cal_dark_outputs.ndit = hawki_pfits_get_ndit(plist) ;
+ hawki_cal_dark_outputs.ndsamples = hawki_pfits_get_ndsamples(plist);
+ cpl_propertylist_delete(plist) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_error(__func__, "Cannot get the DIT/NDIT/NDSAMPLES from the header") ;
+ cpl_msg_indent_less() ;
+ cpl_frameset_delete(rawframes) ;
+ return -1 ;
+ }
+ cpl_msg_info(__func__, "DIT value: %g sec.", hawki_cal_dark_outputs.dit);
+ cpl_msg_info(__func__, "NDIT value: %d", hawki_cal_dark_outputs.ndit);
+ cpl_msg_info(__func__, "NDSAMPLES value: %d", hawki_cal_dark_outputs.ndsamples);
+
+ /* Check that DIT/NDIT and NDSAMPLES are the same for all the frames */
+ if(!hawki_utils_check_equal_double_keys(rawframes, &hawki_pfits_get_dit) ||
+ !hawki_utils_check_equal_int_keys(rawframes, &hawki_pfits_get_ndit)||
+ !hawki_utils_check_equal_int_keys(rawframes, &hawki_pfits_get_ndsamples))
+ {
+ cpl_msg_error(__func__, "Not all input darks have the same "
+ "DIT/NDIT/NDSAMPLES values");
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+
+ /* Number of frames */
+ nframes = cpl_frameset_get_size(rawframes) ;
+
+ /* Create the statistics table */
+ raw_dark_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ raw_dark_stats[idet] = cpl_table_new(nframes);
+ }
+ hawki_image_stats_initialize(raw_dark_stats);
+
+ /* Loop on the detectors */
+ master_dark = cpl_imagelist_new();
+ if(hawki_cal_dark_config.error_tracking)
+ master_dark_err = cpl_imagelist_new();
+ bpmdark = cpl_imagelist_new();
+ cpl_msg_info(__func__, "Dark computation");
+ cpl_msg_indent_more() ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_msg_info(__func__, "Handle chip number %d", idet+1) ;
+
+ /* Create the rons vectors */
+ rons[idet] = cpl_vector_new(nframes) ;
+
+ /* Load the input data */
+ darks_raw = hawki_load_detector(rawframes, idet+1, CPL_TYPE_FLOAT) ;
+
+ /* Loop on the frames */
+ for (j=0 ; j<nframes ; j++) {
+ /* Load the current and next images */
+ if (j==nframes-1) {
+ ima_curr = cpl_imagelist_get(darks_raw, j) ;
+ ima_next = cpl_imagelist_get(darks_raw, 0) ;
+ } else {
+ ima_curr = cpl_imagelist_get(darks_raw, j) ;
+ ima_next = cpl_imagelist_get(darks_raw, j+1) ;
+ }
+
+ /* Compute the dark stats and store in table */
+ if(hawki_image_stats_fill_from_image
+ (raw_dark_stats,
+ ima_curr,
+ hawki_cal_dark_config.llx,
+ hawki_cal_dark_config.lly,
+ hawki_cal_dark_config.urx,
+ hawki_cal_dark_config.ury,
+ idet,
+ j) != 0)
+ {
+ cpl_msg_error(__func__, "Cannot compute statistics") ;
+ cpl_msg_indent_less() ;
+ cpl_frameset_delete(rawframes) ;
+ cpl_imagelist_delete(master_dark);
+ if(hawki_cal_dark_config.error_tracking)
+ cpl_imagelist_delete(master_dark_err);
+ cpl_imagelist_delete(darks_raw);
+ cpl_imagelist_delete(bpmdark) ;
+ for (k=0 ; k<=idet ; k++)
+ cpl_vector_delete(rons[k]) ;
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_table_delete(raw_dark_stats[idet]);
+ cpl_free(raw_dark_stats);
+ return -1 ;
+ }
+
+ /* Compute the RON */
+ ron = hawki_cal_dark_ron(ima_curr, ima_next, hawki_cal_dark_outputs.ndit) ;
+ cpl_vector_set(rons[idet], j, ron);
+ }
+
+ /* Collapse */
+ if (nframes > 2)
+ {
+ ima_accu = cpl_imagelist_collapse_minmax_create(darks_raw, 0, 1) ;
+ if(hawki_cal_dark_config.error_tracking)
+ {
+ cpl_imagelist * variances;
+ cpl_image * accu_var;
+ cpl_msg_info(__func__, "Computing the uncertainty in dark");
+ variances = hawki_imglist_create_variances_and_delete
+ (darks_raw, hawki_cal_dark_config.gain,
+ hawki_cal_dark_config.ron, hawki_cal_dark_outputs.ndit,
+ hawki_cal_dark_outputs.ndsamples);
+ /* The variances are collapsed, like the dark_raw. Given that
+ * the variances are a monotically increasing function with
+ * respect to the dark_raw, the minmax algorithm will select
+ * the same values as for the dark_raw
+ * The nframes - 1 is because only one frame is being rejected*/
+ accu_var = cpl_imagelist_collapse_minmax_create(variances,0,1);
+ cpl_image_divide_scalar(accu_var, nframes - 1);
+ ima_accu_err = cpl_image_duplicate(accu_var);
+ cpl_image_power(ima_accu_err, 0.5);
+ cpl_imagelist_delete(variances);
+ cpl_image_delete(accu_var);
+ }
+
+ } else {
+ ima_accu = cpl_imagelist_collapse_create(darks_raw) ;
+ if(hawki_cal_dark_config.error_tracking)
+ {
+ cpl_imagelist * variances;
+ cpl_image * accu_var;
+ cpl_msg_info(__func__, "Computing the uncertainty in dark");
+ variances = hawki_imglist_create_variances_and_delete
+ (darks_raw, hawki_cal_dark_config.gain,
+ hawki_cal_dark_config.ron, hawki_cal_dark_outputs.ndit,
+ hawki_cal_dark_outputs.ndsamples);
+ accu_var = cpl_imagelist_collapse_create(variances);
+ cpl_image_divide_scalar(accu_var, nframes);
+ ima_accu_err = cpl_image_duplicate(accu_var);
+ cpl_image_power(ima_accu_err, 0.5);
+ cpl_imagelist_delete(variances);
+ cpl_image_delete(accu_var);
+ }
+ }
+ if (ima_accu == NULL) {
+ cpl_msg_error(__func__, "Cannot compute the average") ;
+ cpl_frameset_delete(rawframes) ;
+ cpl_imagelist_delete(bpmdark) ;
+ cpl_imagelist_delete(master_dark) ;
+ if(ima_accu_err != NULL)
+ cpl_image_delete(ima_accu_err);
+ cpl_imagelist_delete(darks_raw);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_vector_delete(rons[idet]) ;
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_table_delete(raw_dark_stats[idet]);
+ cpl_free(raw_dark_stats);
+ return -1 ;
+ }
+ cpl_imagelist_delete(darks_raw) ;
+
+ /* Put the result in the list */
+ cpl_imagelist_set(master_dark, ima_accu, idet) ;
+ if(hawki_cal_dark_config.error_tracking)
+ cpl_imagelist_set(master_dark_err, ima_accu_err, idet) ;
+
+ /* Compute the dark_med and stdev */
+ hawki_cal_dark_outputs.master_dark_med[idet]=
+ cpl_image_get_median(ima_accu) / hawki_cal_dark_outputs.dit;
+ hawki_cal_dark_outputs.master_dark_mean[idet] =
+ cpl_image_get_mean(ima_accu) / hawki_cal_dark_outputs.dit;
+ hawki_cal_dark_outputs.master_dark_stdev[idet] =
+ cpl_image_get_stdev(ima_accu) / hawki_cal_dark_outputs.dit;
+ if(hawki_cal_dark_config.error_tracking)
+ {
+ hawki_cal_dark_outputs.master_dark_error_med[idet]=
+ cpl_image_get_median(ima_accu_err) / hawki_cal_dark_outputs.dit;
+ hawki_cal_dark_outputs.master_dark_error_mean[idet] =
+ cpl_image_get_mean(ima_accu_err) / hawki_cal_dark_outputs.dit;
+ hawki_cal_dark_outputs.master_dark_error_stdev[idet] =
+ cpl_image_get_stdev(ima_accu_err) / hawki_cal_dark_outputs.dit;
+ }
+
+ /* Compute the Video Channels stats */
+ vc_lly = 973 ;
+ vc_ury = 1036 ;
+ for (j=0 ; j<HAWKI_NB_VC ; j++) {
+ vc_llx = j*(2048/HAWKI_NB_VC) + 1 ;
+ vc_urx = (j+1)*(2048/HAWKI_NB_VC) ;
+
+ hawki_cal_dark_outputs.vc_mean[idet][j] =
+ cpl_image_get_mean_window(ima_accu, vc_llx, vc_lly,
+ vc_urx, vc_ury) ;
+
+ hawki_cal_dark_outputs.vc_med[idet][j] =
+ cpl_image_get_median_window(ima_accu, vc_llx, vc_lly,
+ vc_urx, vc_ury) ;
+
+ hawki_cal_dark_outputs.vc_stdev[idet][j] =
+ cpl_image_get_stdev_window(ima_accu, vc_llx, vc_lly,
+ vc_urx, vc_ury) ;
+ }
+
+ /* Compute the HOT pixels map */
+ cpl_msg_info(__func__, "Compute the BPM from the dark") ;
+ cpl_msg_indent_more() ;
+ if ((bpm=hawki_compute_darkbpm(ima_accu,
+ hawki_cal_dark_config.sigma)) == NULL) {
+ cpl_msg_error(__func__, "Cannot compute the hot pixels") ;
+ cpl_msg_indent_less() ;
+ cpl_frameset_delete(rawframes) ;
+ cpl_imagelist_delete(bpmdark) ;
+ cpl_imagelist_delete(master_dark);
+ if(hawki_cal_dark_config.error_tracking)
+ cpl_imagelist_delete(master_dark_err);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_vector_delete(rons[idet]) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_table_delete(raw_dark_stats[idet]);
+ cpl_free(raw_dark_stats);
+ return -1 ;
+ }
+ cpl_imagelist_set(bpmdark, bpm, idet) ;
+ hawki_cal_dark_outputs.nb_badpix[idet]=(int)cpl_image_get_flux(bpm);
+ cpl_msg_indent_less() ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Divide by DIT */
+ cpl_msg_info(__func__, "Division by DIT") ;
+ cpl_imagelist_divide_scalar(master_dark, hawki_cal_dark_outputs.dit);
+ if(hawki_cal_dark_config.error_tracking)
+ cpl_imagelist_divide_scalar(master_dark_err, hawki_cal_dark_outputs.dit);
+
+ /* Save the product */
+ cpl_msg_info(__func__, "Save the products") ;
+ cpl_msg_indent_more() ;
+ if (hawki_cal_dark_save(master_dark, master_dark_err,
+ bpmdark, raw_dark_stats,
+ (const cpl_vector **)rons,
+ rawframes,
+ parlist, frameset))
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space");
+
+ /* Free */
+ cpl_frameset_delete(rawframes) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_vector_delete(rons[idet]) ;
+ cpl_imagelist_delete(master_dark) ;
+ if(hawki_cal_dark_config.error_tracking)
+ cpl_imagelist_delete(master_dark_err);
+ cpl_imagelist_delete(bpmdark) ;
+ cpl_msg_indent_less() ;
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_table_delete(raw_dark_stats[idet]);
+ cpl_free(raw_dark_stats);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The RON computation
+ @param ima1 the first input image
+ @param ima2 the second input image
+ @param ndit the NDIT
+ @return the RON or -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+static double hawki_cal_dark_ron(
+ const cpl_image * ima1,
+ const cpl_image * ima2,
+ int ndit)
+{
+ cpl_image * ima ;
+ double norm ;
+ double ron ;
+
+ /* Test entries */
+ if (ima1 == NULL) return -1.0 ;
+ if (ima2 == NULL) return -1.0 ;
+ if (ndit < 1) return -1.0 ;
+
+ /* Compute norm */
+ norm = 0.5 * ndit ;
+ norm = sqrt(norm) ;
+
+ /* Subtraction */
+ if ((ima = cpl_image_subtract_create(ima2, ima1)) == NULL) return -1.0 ;
+
+ /* RON measurement */
+ cpl_flux_get_noise_window(ima, NULL, hawki_cal_dark_config.hsize,
+ hawki_cal_dark_config.nsamples, &ron, NULL) ;
+ cpl_image_delete(ima) ;
+ return norm*ron ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the products
+ @param dark the dark images
+ @param bpmdark the BPM from the dark
+ @param rons the list of RONS for the HAWKI_NB_DETECTORS detectors
+ @param parlist the parameters list
+ @param set the frames set
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_dark_save
+(const cpl_imagelist * master_dark,
+ const cpl_imagelist * master_dark_err,
+ const cpl_imagelist * bpmdark,
+ cpl_table ** raw_dark_stats,
+ const cpl_vector ** rons,
+ const cpl_frameset * used_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set)
+{
+ cpl_propertylist ** qclists ;
+ const cpl_frame * ref_frame ;
+ char sval[32] ;
+ cpl_propertylist * inputlist ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_cal_dark" ;
+ int i, j ;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+ /* Get the reference frame */
+ ref_frame = irplib_frameset_get_first_from_group(set, CPL_FRAME_GROUP_RAW) ;
+
+ /* Create the QC lists */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ qclists[i] = cpl_propertylist_new();
+ cpl_propertylist_append_int(qclists[i], "ESO QC DARK NBADPIX",
+ hawki_cal_dark_outputs.nb_badpix[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK MEAN",
+ hawki_cal_dark_outputs.master_dark_mean[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK MED",
+ hawki_cal_dark_outputs.master_dark_med[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK STDEV",
+ hawki_cal_dark_outputs.master_dark_stdev[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK NONORM MEAN",
+ hawki_cal_dark_outputs.master_dark_mean[i] * hawki_cal_dark_outputs.dit);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK NONORM MED",
+ hawki_cal_dark_outputs.master_dark_med[i] * hawki_cal_dark_outputs.dit);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK NONORM STDEV",
+ hawki_cal_dark_outputs.master_dark_stdev[i] * hawki_cal_dark_outputs.dit);
+ if(hawki_cal_dark_config.error_tracking)
+ {
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK ERR MEAN",
+ hawki_cal_dark_outputs.master_dark_error_mean[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK ERR MED",
+ hawki_cal_dark_outputs.master_dark_error_med[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK ERR STDEV",
+ hawki_cal_dark_outputs.master_dark_error_stdev[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK ERR NONORM MEAN",
+ hawki_cal_dark_outputs.master_dark_error_mean[i] * hawki_cal_dark_outputs.dit);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK ERR NONORM MED",
+ hawki_cal_dark_outputs.master_dark_error_med[i] * hawki_cal_dark_outputs.dit);
+ cpl_propertylist_append_double(qclists[i], "ESO QC DARK ERR NONORM STDEV",
+ hawki_cal_dark_outputs.master_dark_error_stdev[i] * hawki_cal_dark_outputs.dit);
+ }
+ for (j=0 ; j<HAWKI_NB_VC ; j++) {
+ sprintf(sval, "ESO QC DARK VC%d MEAN", j+1) ;
+ cpl_propertylist_append_double(qclists[i], sval,
+ hawki_cal_dark_outputs.vc_mean[i][j]) ;
+ sprintf(sval, "ESO QC DARK VC%d MED", j+1) ;
+ cpl_propertylist_append_double(qclists[i], sval,
+ hawki_cal_dark_outputs.vc_med[i][j]) ;
+ sprintf(sval, "ESO QC DARK VC%d STDEV", j+1) ;
+ cpl_propertylist_append_double(qclists[i], sval,
+ hawki_cal_dark_outputs.vc_stdev[i][j]) ;
+ }
+ for (j=0 ; j<cpl_vector_get_size(rons[i]) ; j++) {
+ sprintf(sval, "ESO QC RON%d", j+1) ;
+ cpl_propertylist_append_double(qclists[i], sval,
+ cpl_vector_get(rons[i], j)) ;
+ }
+ cpl_propertylist_append_double(qclists[i], "ESO QC RON MEAN",
+ cpl_vector_get_mean(rons[i])) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC RON MED",
+ cpl_vector_get_median_const(rons[i])) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC RON STDEV",
+ cpl_vector_get_stdev(rons[i])) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC DATANCOM",
+ cpl_frameset_get_size(set)) ;
+
+ /* Propagate some keywords from input raw frame extensions */
+ ext_nb=hawki_get_ext_from_detector(cpl_frame_get_filename(ref_frame), i+1);
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0) ;
+ cpl_propertylist_append(qclists[i], inputlist) ;
+ cpl_propertylist_delete(inputlist) ;
+ }
+ /* Statistics of the raw images in the QC */
+ hawki_image_stats_stats(raw_dark_stats, qclists);
+
+ /* Write the dark image */
+ hawki_imagelist_save(set,
+ parlist,
+ used_frames,
+ master_dark,
+ recipe_name,
+ HAWKI_CALPRO_DARK,
+ HAWKI_PROTYPE_DARK,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ "hawki_cal_dark.fits") ;
+
+ /* Write the dark image error */
+ if(master_dark_err != NULL)
+ {
+ hawki_imagelist_save(set,
+ parlist,
+ used_frames,
+ master_dark_err,
+ recipe_name,
+ HAWKI_CALPRO_DARK_ERR,
+ HAWKI_PROTYPE_DARK_ERR,
+ NULL,
+ NULL,
+ "hawki_cal_dark_err.fits") ;
+ }
+
+ /* Write the bpmdark pixels image */
+ hawki_imagelist_save(set,
+ parlist,
+ used_frames,
+ bpmdark,
+ recipe_name,
+ HAWKI_CALPRO_BPM_HOT,
+ HAWKI_PROTYPE_BPM,
+ NULL,
+ NULL,
+ "hawki_cal_dark_bpmdark.fits") ;
+
+
+ /* Write the table with the statistics */
+ hawki_tables_save(set,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_dark_stats,
+ recipe_name,
+ HAWKI_CALPRO_DARK_STATS,
+ HAWKI_PROTYPE_DARK_STATS,
+ NULL,
+ NULL,
+ "hawki_cal_dark_stats.fits") ;
+
+ /* Free and return */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ cpl_propertylist_delete(qclists[i]) ;
+ }
+ cpl_free(qclists) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
+
+static int hawki_cal_dark_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+ const char * sval ;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Retrieve input parameters */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_dark.sigma") ;
+ hawki_cal_dark_config.sigma = cpl_parameter_get_double(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_dark.hsize") ;
+ hawki_cal_dark_config.hsize = cpl_parameter_get_int(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_dark.nsamples") ;
+ hawki_cal_dark_config.nsamples = cpl_parameter_get_int(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_dark.zone") ;
+ sval = cpl_parameter_get_string(par) ;
+ if (sscanf(sval, "%d,%d,%d,%d",
+ &hawki_cal_dark_config.llx,
+ &hawki_cal_dark_config.lly,
+ &hawki_cal_dark_config.urx,
+ &hawki_cal_dark_config.ury)!=4) {
+ return -1 ;
+ }
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_dark.gain") ;
+ hawki_cal_dark_config.gain = cpl_parameter_get_double(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_dark.ron") ;
+ hawki_cal_dark_config.ron = cpl_parameter_get_double(par);
+ hawki_cal_dark_config.error_tracking = 0;
+ if(hawki_cal_dark_config.gain > 0 && hawki_cal_dark_config.ron > 0)
+ hawki_cal_dark_config.error_tracking = 1;
+
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ return -1;
+
+ return 0;
+}
+
+void hawki_cal_dark_initialise_qc(void)
+{
+ int idet;
+ int j;
+
+ for(idet=0; idet<HAWKI_NB_DETECTORS; idet++)
+ {
+ hawki_cal_dark_outputs.nb_badpix[idet] = -1 ;
+ hawki_cal_dark_outputs.master_dark_mean[idet] = -1.0 ;
+ hawki_cal_dark_outputs.master_dark_med[idet] = -1.0 ;
+ hawki_cal_dark_outputs.master_dark_stdev[idet] = -1.0 ;
+ hawki_cal_dark_outputs.master_dark_error_mean[idet] = -1.0 ;
+ hawki_cal_dark_outputs.master_dark_error_med[idet] = -1.0 ;
+ hawki_cal_dark_outputs.master_dark_error_stdev[idet] = -1.0 ;
+ for (j=0 ; j<HAWKI_NB_VC ; j++)
+ {
+ hawki_cal_dark_outputs.vc_mean[idet][j] = -1.0 ;
+ hawki_cal_dark_outputs.vc_med[idet][j] = -1.0 ;
+ hawki_cal_dark_outputs.vc_stdev[idet][j] = -1.0 ;
+ }
+ }
+}
diff --git a/recipes/hawki_cal_distortion.c b/recipes/hawki_cal_distortion.c
new file mode 100644
index 0000000..0e9d812
--- /dev/null
+++ b/recipes/hawki_cal_distortion.c
@@ -0,0 +1,1352 @@
+/* $Id: hawki_cal_distortion.c,v 1.14 2012/04/23 10:02:57 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/04/23 10:02:57 $
+ * $Revision: 1.14 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <string.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_alloc.h"
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_distortion.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "irplib_cat.h"
+#include "irplib_stdstar.h"
+#include "irplib_match_cats.h"
+#include "hawki_match_cats.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_cal_distortion_create(cpl_plugin *) ;
+static int hawki_cal_distortion_exec(cpl_plugin *) ;
+static int hawki_cal_distortion_destroy(cpl_plugin *) ;
+static int hawki_cal_distortion(cpl_parameterlist * parlist,
+ cpl_frameset * frameset);
+
+
+static int hawki_cal_distortion_get_apertures_from_raw_distor
+(cpl_frameset * raw_target,
+ const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm,
+ cpl_image ** master_sky,
+ double sigma_det,
+ cpl_apertures *** apertures);
+
+static int hawki_cal_distortion_load_master_calib
+(const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm,
+ cpl_imagelist ** flat_images,
+ cpl_imagelist ** dark_images,
+ cpl_imagelist ** bpm_images);
+
+static cpl_image ** hawki_cal_distortion_get_master_sky
+(cpl_frameset * raw_target,
+ const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm);
+
+static int hawki_cal_distortion_subtract_sky
+(cpl_imagelist * distor_corrected,
+ cpl_image * master_sky);
+
+static hawki_distortion ** hawki_cal_distortion_compute_dist_solution
+(cpl_apertures *** apertures,
+ int nframes,
+ cpl_bivector * offsets,
+ int grid_points,
+ int * nmatched_pairs,
+ double * rms,
+ hawki_distortion ** distortion_guess);
+
+static cpl_apertures * hawki_cal_distortion_get_image_apertures
+(cpl_image * image,
+ double sigma_det);
+
+static int hawki_cal_distortion_fill_obj_pos
+(cpl_table * objects_positions,
+ cpl_apertures * apertures);
+
+static int hawki_cal_distortion_add_offset_to_positions
+(cpl_table ** objects_positions,
+ cpl_bivector * offsets);
+
+static int hawki_cal_distortion_fit_first_order_solution
+(hawki_distortion * distortion,
+ cpl_polynomial * fit2d_x,
+ cpl_polynomial * fit2d_y);
+
+static cpl_propertylist ** hawki_cal_distortion_qc
+(hawki_distortion ** distortion,
+ int * nmatched_pairs,
+ double * rms);
+
+static int hawki_cal_distortion_save
+(hawki_distortion ** distortion,
+ cpl_parameterlist * parlist,
+ cpl_propertylist ** qclists,
+ cpl_frameset * recipe_set);
+
+static int hawki_cal_distortion_retrieve_input_param
+(cpl_parameterlist * parlist);
+
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct
+{
+ /* Inputs */
+ double sigma_det;
+ int grid_points;
+ int borders;
+ int subtract_linear;
+} hawki_cal_distortion_config;
+
+static char hawki_cal_distortion_description[] =
+"hawki_cal_distortion -- HAWK-I distortion and astrometry autocalibration.\n\n"
+"The input files must be tagged:\n"
+"distortion_field.fits "HAWKI_CAL_DISTOR_RAW"\n"
+"sky_distortion.fits "HAWKI_CAL_DISTOR_SKY_RAW"\n"
+"flat-file.fits "HAWKI_CALPRO_FLAT" (optional)\n"
+"dark-file.fits "HAWKI_CALPRO_DARK" (optional)\n"
+"bpm-file.fits "HAWKI_CALPRO_BPM" (optional)\n\n"
+"The recipe creates as an output:\n"
+"hawki_cal_distortion_distx.fits ("HAWKI_CALPRO_DISTORTION_X") \n"
+"hawki_cal_distortion_disty.fits ("HAWKI_CALPRO_DISTORTION_Y") \n\n"
+"The recipe performs the following steps:\n"
+"-Basic calibration of astrometry fields\n"
+"-Autocalibration of distortion, using method in A&A 454,1029 (2006)\n\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_cal_distortion",
+ "Distortion autocalibration",
+ hawki_cal_distortion_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_cal_distortion_create,
+ hawki_cal_distortion_exec,
+ hawki_cal_distortion_destroy);
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --sigma_det */
+ p = cpl_parameter_new_value("hawki.hawki_cal_distortion.sigma_det",
+ CPL_TYPE_DOUBLE, "detection level",
+ "hawki.hawki_cal_distortion", 6.) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma_det") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --grid_points */
+ p = cpl_parameter_new_value("hawki.hawki_cal_distortion.grid_points",
+ CPL_TYPE_INT,
+ "number of points in distortion grid",
+ "hawki.hawki_cal_distortion", 9) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "grid_points") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --borders */
+ p = cpl_parameter_new_value("hawki.hawki_cal_distortion.borders",
+ CPL_TYPE_INT,
+ "number of pixels to trim at the borders",
+ "hawki.hawki_cal_distortion", 6) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "borders") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --subtract_linear */
+ p = cpl_parameter_new_value("hawki.hawki_cal_distortion.subtract_linear",
+ CPL_TYPE_BOOL,
+ "Subtract a linear term to the solution",
+ "hawki.hawki_cal_distortion", TRUE) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "subtract_linear") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_cal_distortion(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion(cpl_parameterlist * parlist,
+ cpl_frameset * frameset)
+{
+ const cpl_frame * flat = NULL;
+ const cpl_frame * dark = NULL;
+ const cpl_frame * bpm = NULL;
+ cpl_frameset * distorframes = NULL;
+ cpl_frameset * skyframes = NULL;
+ const cpl_frame * distorxguess = NULL;
+ const cpl_frame * distoryguess = NULL;
+ hawki_distortion ** distortionguess = NULL;
+ hawki_distortion ** distortion = NULL;
+ cpl_propertylist ** qclists = NULL;
+ cpl_image ** master_sky = NULL;
+ cpl_bivector * nominal_offsets = NULL;
+ cpl_apertures ** apertures[HAWKI_NB_DETECTORS];
+ int nmatched_pairs[HAWKI_NB_DETECTORS];
+ double rms[HAWKI_NB_DETECTORS];
+ int idet;
+ int ioff;
+ int iframe;
+ int nframes;
+
+
+ /* Retrieve input parameters */
+ if(hawki_cal_distortion_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(frameset)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve calibration data */
+ cpl_msg_info(__func__, "Identifying calibration data");
+ flat = cpl_frameset_find_const(frameset, HAWKI_CALPRO_FLAT);
+ dark = cpl_frameset_find_const(frameset, HAWKI_CALPRO_DARK);
+ bpm = cpl_frameset_find_const(frameset, HAWKI_CALPRO_BPM);
+
+ /* Retrieve raw frames */
+ cpl_msg_info(__func__, "Identifying distortion and sky data");
+ distorframes = hawki_extract_frameset(frameset, HAWKI_CAL_DISTOR_RAW) ;
+ if (distorframes == NULL)
+ {
+ cpl_msg_error(__func__, "Distortion images have to be provided (%s)",
+ HAWKI_CAL_DISTOR_RAW);
+ return -1 ;
+ }
+ /* Retrieve sky frames */
+ skyframes = hawki_extract_frameset(frameset, HAWKI_CAL_DISTOR_SKY_RAW) ;
+ if (skyframes == NULL)
+ {
+ cpl_msg_error(__func__, "Sky images have to be provided (%s)",
+ HAWKI_CAL_DISTOR_SKY_RAW);
+ cpl_frameset_delete(distorframes);
+ return -1 ;
+ }
+ /* Retrieve the distortion first guess (if provided) */
+ distorxguess = cpl_frameset_find_const(frameset, HAWKI_CALPRO_DISTORTION_X);
+ distoryguess = cpl_frameset_find_const(frameset, HAWKI_CALPRO_DISTORTION_Y);
+ if(distorxguess != NULL && distoryguess != NULL)
+ {
+ //distortionguess = hawki_distortion_load(distorxtguess)
+ }
+
+ /* Get the master sky frame */
+ cpl_msg_info(__func__, "Computing the master sky image");
+ master_sky = hawki_cal_distortion_get_master_sky(skyframes, flat, dark, bpm);
+ if(master_sky == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot get master sky image") ;
+ cpl_frameset_delete(distorframes);
+ cpl_frameset_delete(skyframes);
+ return -1;
+ }
+
+ /* Aperture detection, basic reduction and sky subtraction of distortion images */
+ cpl_msg_info(__func__, "Getting objects from distortion images");
+ if(hawki_cal_distortion_get_apertures_from_raw_distor
+ (distorframes, flat, dark, bpm, master_sky,
+ hawki_cal_distortion_config.sigma_det, apertures) == -1)
+ {
+ cpl_msg_error(__func__,
+ "Cannot get objects from distortion images");
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ cpl_image_delete(master_sky[idet]);
+ cpl_free(master_sky);
+ cpl_frameset_delete(distorframes);
+ cpl_frameset_delete(skyframes);
+ return -1 ;
+ }
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ cpl_image_delete(master_sky[idet]);
+ cpl_free(master_sky);
+
+ /* Get the nominal offsets from the header */
+ cpl_msg_info(__func__,"Getting the nominal offsets");
+ nominal_offsets = hawki_get_header_tel_offsets(distorframes);
+ if (nominal_offsets == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the header offsets") ;
+ cpl_frameset_delete(distorframes);
+ cpl_frameset_delete(skyframes);
+ return -1;
+ }
+
+ /* Get the oposite offsets. This is to change from
+ * telescope convention to cpl convention */
+ cpl_vector_multiply_scalar(cpl_bivector_get_x(nominal_offsets), -1.0);
+ cpl_vector_multiply_scalar(cpl_bivector_get_y(nominal_offsets), -1.0);
+
+ /* Print the header offsets */
+ cpl_msg_indent_more();
+ for (ioff=0 ; ioff<cpl_bivector_get_size(nominal_offsets) ; ioff++)
+ {
+ cpl_msg_info(__func__, "Telescope offsets (Frame %d): %g %g", ioff+1,
+ cpl_bivector_get_x_data(nominal_offsets)[ioff],
+ cpl_bivector_get_y_data(nominal_offsets)[ioff]);
+ }
+ cpl_msg_indent_less();
+
+ /* Get the distortion solution, the real stuff */
+ cpl_msg_info(__func__, "Computing the distortion");
+ nframes = cpl_frameset_get_size(distorframes);
+ distortion = hawki_cal_distortion_compute_dist_solution
+ (apertures, nframes, nominal_offsets,
+ hawki_cal_distortion_config.grid_points,
+ nmatched_pairs, rms,
+ distortionguess);
+ cpl_bivector_delete(nominal_offsets);
+ if(distortion == NULL)
+ {
+ cpl_frameset_delete(distorframes);
+ cpl_frameset_delete(skyframes);
+ return -1;
+ }
+
+ /* Get some QC */
+ qclists = hawki_cal_distortion_qc(distortion, nmatched_pairs, rms);
+
+ /* Save the products */
+ cpl_msg_info(__func__,"Saving products");
+ if(hawki_cal_distortion_save(distortion,
+ parlist, qclists, frameset) == -1)
+ {
+ cpl_msg_error(__func__,"Could not save products");
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_propertylist_delete(qclists[idet]);
+ cpl_free(qclists);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ hawki_distortion_delete(distortion[idet]);
+ cpl_free(distortion);
+ cpl_frameset_delete(distorframes);
+ cpl_frameset_delete(skyframes);
+ return -1;
+ }
+
+ /* Free and return */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_propertylist_delete(qclists[idet]);
+ cpl_free(qclists);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ hawki_distortion_delete(distortion[idet]);
+ cpl_free(distortion);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ for(iframe = 0 ; iframe < nframes; iframe++)
+ cpl_apertures_delete(apertures[idet][iframe]);
+ cpl_free(apertures[idet]);
+ }
+ cpl_frameset_delete(distorframes);
+ cpl_frameset_delete(skyframes);
+
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function loads the master calibrations
+ @param dark the dark frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @param flat_images the flat images
+ @param dark_images the dark images (not scaled)
+ @param bpm_images the bpm images
+ @return 0 if ok. -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion_load_master_calib
+(const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm,
+ cpl_imagelist ** flat_images,
+ cpl_imagelist ** dark_images,
+ cpl_imagelist ** bpm_images)
+{
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Initializing the pointers */
+ *flat_images = NULL;
+ *dark_images = NULL;
+ *bpm_images = NULL;
+
+ /* Loading the calibration files */
+ cpl_msg_info(__func__, "Loading the calibration data") ;
+ if(flat != NULL)
+ {
+ *flat_images = hawki_load_frame(flat, CPL_TYPE_FLOAT);
+ if(flat_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading flat") ;
+ return -1;
+ }
+ }
+ if(dark != NULL)
+ {
+ *dark_images = hawki_load_frame(dark, CPL_TYPE_FLOAT);
+ if(dark_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading dark") ;
+ cpl_imagelist_delete(*flat_images);
+ return -1;
+ }
+ }
+ if(bpm != NULL)
+ {
+ *bpm_images = hawki_load_frame(bpm, CPL_TYPE_INT);
+ if(bpm_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading bpm") ;
+ cpl_imagelist_delete(*flat_images);
+ cpl_imagelist_delete(*dark_images);
+ return -1;
+ }
+ }
+
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "A problem happened loading calibration");
+ cpl_imagelist_delete(*flat_images);
+ cpl_imagelist_delete(*dark_images);
+ cpl_imagelist_delete(*bpm_images);
+ return -1;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The detection of apertures and basic calibration of the images is here
+ @param obj the objects frames
+ @param obj the sky frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @return an imagelist with the reduced images.
+ imagelist[idet] is the image serie for detector idet.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion_get_apertures_from_raw_distor
+(cpl_frameset * raw_distor,
+ const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm,
+ cpl_image ** master_sky,
+ double sigma_det,
+ cpl_apertures *** apertures)
+{
+ cpl_imagelist * flat_images;
+ cpl_imagelist * dark_images;
+ cpl_imagelist * bpm_images;
+ cpl_propertylist * plist;
+
+ double science_dit;
+ int iframe;
+ int nframes;
+ int idet;
+
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Indentation */
+ cpl_msg_indent_more();
+
+ /* Loading calibrations */
+ hawki_cal_distortion_load_master_calib
+ (flat, dark, bpm, &flat_images, &dark_images, &bpm_images);
+
+ /* Multiply the dark image by the science exposure time */
+ if(dark != NULL)
+ {
+ if ((plist=cpl_propertylist_load
+ (cpl_frame_get_filename
+ (cpl_frameset_get_first_const(raw_distor)), 0)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot get header from frame");
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ return -1;
+ }
+ science_dit = hawki_pfits_get_dit(plist);
+ cpl_imagelist_multiply_scalar(dark_images, science_dit);
+ cpl_propertylist_delete(plist);
+ }
+
+ /* Loop on detectors */
+ nframes = cpl_frameset_get_size(raw_distor);
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ cpl_imagelist * distor_serie;
+ cpl_imagelist * distor_serie_trimmed;
+
+ cpl_msg_info(__func__, "Working on detector %d", idet + 1);
+ cpl_msg_indent_more();
+
+ /* Loading the distortion images for one detector */
+ cpl_msg_info(__func__, "Loading distortion images");
+ distor_serie = hawki_load_detector(raw_distor, idet + 1, CPL_TYPE_FLOAT);
+ if(distor_serie== NULL)
+ {
+ cpl_msg_error(__func__, "Error reading distortion images");
+ return -1;
+ }
+
+ /* Applying the calibrations */
+ cpl_msg_info(__func__, "Applying basic calibration") ;
+ cpl_msg_indent_more();
+ if (hawki_flat_dark_bpm_detector_calib
+ (distor_serie,
+ cpl_imagelist_get(flat_images, idet),
+ cpl_imagelist_get(dark_images, idet),
+ cpl_imagelist_get(bpm_images, idet)) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot calibrate frame") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_imagelist_delete(distor_serie);
+ cpl_msg_indent_less() ;
+ return -1;
+ }
+ cpl_msg_indent_less();
+
+ /* Discard the pixels on the sides */
+ if (hawki_cal_distortion_config.borders > 0)
+ {
+ distor_serie_trimmed = hawki_trim_detector_calib(distor_serie,
+ hawki_cal_distortion_config.borders);
+ cpl_imagelist_delete(distor_serie);
+ }
+ else
+ distor_serie_trimmed = distor_serie;
+
+ /* Subtract sky */
+ cpl_msg_info(__func__, "Subtracting master sky") ;
+ if(hawki_cal_distortion_subtract_sky(distor_serie_trimmed, master_sky[idet]) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot subtract the sky") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_imagelist_delete(distor_serie_trimmed);
+ return -1;
+ }
+
+ /* Creating apertures */
+ apertures[idet] = cpl_malloc(sizeof(*(apertures[idet])) * nframes);
+ for(iframe = 0 ; iframe < nframes; iframe++)
+ {
+ cpl_image * this_image = cpl_imagelist_get(distor_serie_trimmed, iframe);
+ cpl_msg_info(__func__,"Working with distortion image %d", iframe+1);
+ cpl_msg_indent_more();
+ apertures[idet][iframe] =
+ hawki_cal_distortion_get_image_apertures(this_image, sigma_det);
+ cpl_msg_indent_less();
+ }
+
+ /* Delete the list of images */
+ cpl_imagelist_delete(distor_serie_trimmed);
+ cpl_msg_indent_less();
+ }
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+
+
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "A problem happened with basic calibration");
+ return -1 ;
+ }
+ return 0;
+}
+
+static cpl_image ** hawki_cal_distortion_get_master_sky
+(cpl_frameset * raw_sky_frames,
+ const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm)
+{
+ cpl_propertylist * plist;
+ double science_dit;
+ int idet;
+ int jdet;
+ cpl_imagelist * flat_images;
+ cpl_imagelist * dark_images;
+ cpl_imagelist * bpm_images;
+ cpl_image ** bkg_images = NULL;
+
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Indentation */
+ cpl_msg_indent_more();
+
+ /* Reading calibrations */
+ hawki_cal_distortion_load_master_calib
+ (flat, dark, bpm, &flat_images, &dark_images, &bpm_images);
+
+ /* Multiply the dark image by the science exposure time */
+ if(dark != NULL)
+ {
+ if ((plist=cpl_propertylist_load
+ (cpl_frame_get_filename
+ (cpl_frameset_get_first_const(raw_sky_frames)), 0)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot get header from frame");
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ return NULL;
+ }
+ science_dit = hawki_pfits_get_dit(plist);
+ cpl_imagelist_multiply_scalar(dark_images, science_dit);
+ cpl_propertylist_delete(plist);
+ }
+
+ /* Compute the sky median */
+ bkg_images = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(*bkg_images));
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ cpl_imagelist * sky_serie;
+ cpl_imagelist * sky_serie_trimmed;
+
+ /* Loading the sky images for one detector */
+ sky_serie = hawki_load_detector(raw_sky_frames, idet + 1, CPL_TYPE_FLOAT);
+ if(sky_serie== NULL)
+ {
+ cpl_msg_error(__func__, "Error reading object image") ;
+ return NULL;
+ }
+
+ /* Applying the calibrations */
+ cpl_msg_info(__func__, "Working on detector %d", idet + 1);
+ cpl_msg_indent_more();
+ if (hawki_flat_dark_bpm_detector_calib
+ (sky_serie,
+ cpl_imagelist_get(flat_images, idet),
+ cpl_imagelist_get(dark_images, idet),
+ cpl_imagelist_get(bpm_images, idet)) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot calibrate frame") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_imagelist_delete(sky_serie);
+ for(jdet = 0; jdet < idet; ++jdet)
+ cpl_image_delete(bkg_images[jdet]);
+ cpl_free(bkg_images);
+ cpl_msg_indent_less() ;
+ return NULL;
+ }
+
+ /* Discard the pixels on the sides */
+ if (hawki_cal_distortion_config.borders > 0)
+ {
+ sky_serie_trimmed = hawki_trim_detector_calib(sky_serie,
+ hawki_cal_distortion_config.borders);
+ cpl_imagelist_delete(sky_serie);
+ }
+ else
+ sky_serie_trimmed = sky_serie;
+
+ /* Averaging */
+ if ((bkg_images[idet] =
+ cpl_imagelist_collapse_median_create(sky_serie_trimmed)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot compute the median of obj images");
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_imagelist_delete(sky_serie_trimmed);
+ for(jdet = 0; jdet < idet; ++jdet)
+ cpl_image_delete(bkg_images[jdet]);
+ cpl_free(bkg_images);
+ cpl_msg_indent_less();
+ return NULL;
+ }
+ cpl_imagelist_delete(sky_serie_trimmed);
+ cpl_msg_indent_less();
+ }
+
+ /* Subtract the median of the frame */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS ; ++idet)
+ cpl_image_subtract_scalar(bkg_images[idet],
+ cpl_image_get_median(bkg_images[idet]));
+
+ /* Cleaning up */
+ cpl_msg_indent_less();
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "A problem happened with basic calibration");
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_image_delete(bkg_images[idet]);
+ cpl_free(bkg_images);
+ return NULL ;
+ }
+ return bkg_images;
+}
+
+static int hawki_cal_distortion_subtract_sky
+(cpl_imagelist * distor_corrected,
+ cpl_image * master_sky)
+{
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Subtract the background to each object frame */
+ int idist, ndistor;
+ ndistor = cpl_imagelist_get_size(distor_corrected);
+ for(idist = 0; idist < ndistor; ++idist)
+ {
+ cpl_image * target_image =
+ cpl_imagelist_get(distor_corrected, idist);
+ /* First subtract the median of the image */
+ cpl_image_subtract_scalar
+ (target_image, cpl_image_get_median(target_image));
+
+ if (cpl_image_subtract
+ (target_image, master_sky)!=CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot apply the bkg to the images");
+ return -1 ;
+ }
+ }
+
+ /* Free and return */
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "A problem happened with sky subtraction");
+ return -1;
+ }
+ return 0;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function computes the distortion solution
+ @param obj the objects frames
+ @param obj the sky frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @param skybg the computed sky background values
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static hawki_distortion ** hawki_cal_distortion_compute_dist_solution
+(cpl_apertures *** apertures,
+ int nframes,
+ cpl_bivector * offsets,
+ int grid_points,
+ int * nmatched_pairs,
+ double * rms,
+ hawki_distortion ** distortion_guess)
+{
+ int idet;
+ hawki_distortion ** distortion = NULL;
+
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Allocate the distortion */
+ distortion = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(*distortion));
+
+ /* Loop on the detectors */
+ cpl_msg_indent_more();
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_table ** obj_pos;
+ cpl_table ** obj_pos_offset;
+ int iframe;
+ cpl_table * matches;
+ hawki_distortion * dist_guess;
+ cpl_polynomial * fit2d_x = NULL;
+ cpl_polynomial * fit2d_y = NULL;
+
+
+ cpl_msg_info(__func__, "Working on detector %d", idet+1);
+ cpl_msg_indent_more();
+
+ /* Initialize the objects positions */
+ obj_pos =
+ cpl_malloc(sizeof(*obj_pos) * nframes);
+ obj_pos_offset =
+ cpl_malloc(sizeof(*obj_pos_offset) * nframes);
+ for(iframe = 0; iframe < nframes; ++iframe)
+ {
+ obj_pos[iframe] = cpl_table_new(0);
+ cpl_table_new_column
+ (obj_pos[iframe], HAWKI_COL_OBJ_POSX, CPL_TYPE_DOUBLE);
+ cpl_table_new_column
+ (obj_pos[iframe], HAWKI_COL_OBJ_POSY, CPL_TYPE_DOUBLE);
+ }
+
+ /* Loop on images to fill object_positions */
+ for(iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ cpl_apertures * this_apertures;
+
+ /* Create the detected apertures list */
+ this_apertures = apertures[idet][iframe];
+
+ /* Fill the objects position table */
+ hawki_cal_distortion_fill_obj_pos(obj_pos[iframe],
+ this_apertures);
+ obj_pos_offset[iframe] = cpl_table_duplicate(obj_pos[iframe]);
+ }
+
+ /* Get the objects positions with offsets */
+ hawki_cal_distortion_add_offset_to_positions
+ (obj_pos_offset, offsets);
+
+ /* Get the all the matching pairs */
+ cpl_msg_info(__func__, "Matching all catalogs (may take a while)");
+ matches = irplib_match_cat_pairs(obj_pos_offset, nframes,
+ hawki_match_condition_5_pix);
+ for(iframe = 0; iframe < nframes; ++iframe)
+ cpl_table_delete(obj_pos_offset[iframe]);
+ cpl_free(obj_pos_offset);
+ if(matches == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot match objects ");
+ for(iframe = 0; iframe < nframes; ++iframe)
+ cpl_table_delete(obj_pos[iframe]);
+ cpl_free(obj_pos);
+ return NULL;
+ }
+ cpl_msg_info(__func__,"Number of matching pairs %"CPL_SIZE_FORMAT,
+ cpl_table_get_nrow(matches));
+ nmatched_pairs[idet] = cpl_table_get_nrow(matches);
+
+ /* Compute the distortion */
+ cpl_msg_info(__func__, "Computing distortion with the matched objects");
+ cpl_msg_info(__func__, " (This step will take a long time to run)");
+ if(distortion_guess != NULL)
+ dist_guess = distortion_guess[idet];
+ else
+ dist_guess = NULL;
+ distortion[idet] = hawki_distortion_compute_solution
+ ((const cpl_table **)obj_pos, offsets, matches,
+ nframes, HAWKI_DET_NPIX_X , HAWKI_DET_NPIX_Y, grid_points,
+ dist_guess, rms + idet);
+ if(distortion[idet] == NULL)
+ {
+ int jdet;
+ cpl_msg_error(__func__,"Could not get the distortion");
+ for(iframe = 0; iframe < nframes; ++iframe)
+ cpl_table_delete(obj_pos[iframe]);
+ cpl_free(obj_pos);
+ for(jdet = 0; jdet < idet; ++jdet)
+ hawki_distortion_delete(distortion[idet]);
+ cpl_table_delete(matches);
+ return NULL;
+ }
+
+ /* Removing the first order polinomial to the distortion */
+ if(hawki_cal_distortion_config.subtract_linear)
+ {
+ cpl_msg_info(__func__,"Subtracting first order polynomial");
+ fit2d_x = cpl_polynomial_new(2);
+ fit2d_y = cpl_polynomial_new(2);
+ hawki_cal_distortion_fit_first_order_solution
+ (distortion[idet], fit2d_x, fit2d_y);
+ }
+
+ /* Free */
+ for(iframe = 0; iframe < nframes; ++iframe)
+ cpl_table_delete(obj_pos[iframe]);
+ cpl_free(obj_pos);
+ if(hawki_cal_distortion_config.subtract_linear)
+ {
+ cpl_polynomial_delete(fit2d_x);
+ cpl_polynomial_delete(fit2d_y);
+ }
+ cpl_table_delete(matches);
+ cpl_msg_indent_less();
+ }
+
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "A problem happened computing the distortion");
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ hawki_distortion_delete(distortion[idet]);
+ return NULL ;
+ }
+ /* Free and return */
+ return distortion;
+}
+
+static cpl_apertures * hawki_cal_distortion_get_image_apertures
+(cpl_image * image,
+ double sigma_det)
+{
+ cpl_apertures * apertures = NULL;
+ cpl_mask * kernel = NULL;
+ cpl_mask * object_mask = NULL;
+ cpl_image * labels = NULL;
+ cpl_size nobj;
+ double median;
+ double med_dist;
+ double threshold;
+
+ /* Get the threshold */
+ median = cpl_image_get_median_dev(image, &med_dist);
+ threshold = median + sigma_det * med_dist;
+ cpl_msg_info(__func__,"Detection threshold: %f", threshold);
+
+ /* Create the mask */
+ object_mask = cpl_mask_threshold_image_create
+ (image, threshold, DBL_MAX);
+ if (object_mask == NULL)
+ return NULL;
+
+ /* Apply morphological opening to remove single pixel detections */
+ kernel = cpl_mask_new(3,3);
+ cpl_mask_not(kernel);
+
+ if (cpl_mask_filter(object_mask, object_mask, kernel,
+ CPL_FILTER_OPENING, CPL_BORDER_ZERO) != CPL_ERROR_NONE) {
+ cpl_mask_delete(object_mask) ;
+ cpl_mask_delete(kernel) ;
+ return NULL;
+ }
+ cpl_mask_delete(kernel);
+
+ /* Labelise the different detected apertures */
+ labels = cpl_image_labelise_mask_create(object_mask, &nobj);
+ if (labels == NULL)
+ {
+ cpl_mask_delete(object_mask);
+ return NULL;
+ }
+ cpl_mask_delete(object_mask);
+ cpl_msg_info(__func__, "Number of objects detected: %"CPL_SIZE_FORMAT,
+ nobj);
+
+ /* Create the detected apertures list */
+ apertures = cpl_apertures_new_from_image(image, labels);
+ if (apertures == NULL)
+ {
+ cpl_image_delete(labels);
+ return NULL;
+ }
+ cpl_image_delete(labels);
+ return apertures;
+}
+
+static int hawki_cal_distortion_fill_obj_pos
+(cpl_table * objects_positions,
+ cpl_apertures * apertures)
+{
+ cpl_size nobjs;
+ cpl_size iobj;
+ double border_off = 0;
+
+ /* Take into account that the images have been trimmed */
+ if(hawki_cal_distortion_config.borders > 0)
+ border_off = hawki_cal_distortion_config.borders;
+
+ nobjs = cpl_apertures_get_size(apertures);
+ cpl_table_set_size(objects_positions, nobjs);
+
+ for (iobj=0 ; iobj<nobjs ; iobj++)
+ {
+ /* Fill with the already known information */
+ cpl_table_set_double(objects_positions, HAWKI_COL_OBJ_POSX, iobj,
+ cpl_apertures_get_centroid_x(apertures,
+ iobj+1) + border_off);
+ cpl_table_set_double(objects_positions, HAWKI_COL_OBJ_POSY, iobj,
+ cpl_apertures_get_centroid_y(apertures,
+ iobj+1) + border_off);
+ }
+
+ return 0;
+}
+
+static int hawki_cal_distortion_add_offset_to_positions
+(cpl_table ** objects_positions,
+ cpl_bivector * offsets)
+{
+ int nframes;
+ int iframe;
+ cpl_size nobjs;
+ cpl_size iobj;
+
+ nframes = cpl_bivector_get_size(offsets);
+
+ for(iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ double offset_x;
+ double offset_y;
+ int null;
+ offset_x = cpl_bivector_get_x_data(offsets)[iframe];
+ offset_y = cpl_bivector_get_y_data(offsets)[iframe];
+ nobjs = cpl_table_get_nrow(objects_positions[iframe]);
+ for (iobj=0 ; iobj<nobjs ; iobj++)
+ {
+ cpl_table_set_double(objects_positions[iframe],
+ HAWKI_COL_OBJ_POSX, iobj,
+ cpl_table_get_double(objects_positions[iframe],
+ HAWKI_COL_OBJ_POSX, iobj, &null) + offset_x);
+ cpl_table_set_double(objects_positions[iframe],
+ HAWKI_COL_OBJ_POSY, iobj,
+ cpl_table_get_double(objects_positions[iframe],
+ HAWKI_COL_OBJ_POSY, iobj, &null) + offset_y);
+ }
+ }
+
+ return 0;
+}
+
+static int hawki_cal_distortion_fit_first_order_solution
+(hawki_distortion * distortion,
+ cpl_polynomial * fit2d_x,
+ cpl_polynomial * fit2d_y)
+{
+ cpl_matrix * pixel_pos;
+ cpl_vector * dist_x_val;
+ cpl_vector * dist_y_val;
+ int nx;
+ int ny;
+ int i;
+ int j;
+ int null;
+ const cpl_size mindeg2d[] = {0, 0};
+ const cpl_size maxdeg2d[] = {1, 1};
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+ cpl_vector * pix;
+ cpl_image * dist_x_plane;
+ cpl_image * dist_y_plane;
+ double dist_x_mean;
+ double dist_y_mean;
+
+ /* Fill the bivector with pixel positions in X,Y */
+ nx = hawki_distortion_get_size_x(distortion);
+ ny = hawki_distortion_get_size_y(distortion);
+ pixel_pos = cpl_matrix_new(2, nx * ny);
+ dist_x_val = cpl_vector_new(nx*ny);
+ dist_y_val = cpl_vector_new(nx*ny);
+ for(i = 0; i < nx; ++i)
+ for(j = 0; j < ny; ++j)
+ {
+ cpl_matrix_set(pixel_pos, 0, i + nx * j, (double)i);
+ cpl_matrix_set(pixel_pos, 1, i + nx * j, (double)j);
+ cpl_vector_set(dist_x_val, i + nx * j,
+ cpl_image_get(distortion->dist_x, i+1, j+1, &null));
+ cpl_vector_set(dist_y_val, i + nx * j,
+ cpl_image_get(distortion->dist_y, i+1, j+1, &null));
+ }
+
+ /* Fit the polynomial */
+ cpl_polynomial_fit(fit2d_x, pixel_pos, NULL, dist_x_val,
+ NULL, CPL_FALSE, mindeg2d, maxdeg2d);
+ cpl_polynomial_fit(fit2d_y, pixel_pos, NULL, dist_y_val,
+ NULL, CPL_FALSE, mindeg2d, maxdeg2d);
+ /* Removing the constant term */
+ cpl_polynomial_set_coeff(fit2d_x, mindeg2d, 0.);
+ cpl_polynomial_set_coeff(fit2d_y, mindeg2d, 0.);
+
+ /* Subtract the linear term */
+ pix = cpl_vector_new(2);
+ dist_x_plane = cpl_image_new(nx,ny,cpl_image_get_type(distortion->dist_x));
+ dist_y_plane = cpl_image_new(nx,ny,cpl_image_get_type(distortion->dist_y));
+ for(i = 0; i < nx; ++i)
+ for(j = 0; j < ny; ++j)
+ {
+ double fit_value_x;
+ double fit_value_y;
+ cpl_vector_set(pix, 0, (double)i);
+ cpl_vector_set(pix, 1, (double)j);
+ fit_value_x = cpl_polynomial_eval(fit2d_x, pix);
+ fit_value_y = cpl_polynomial_eval(fit2d_y, pix);
+ cpl_image_set(dist_x_plane, i+1, j+1, fit_value_x);
+ cpl_image_set(dist_y_plane, i+1, j+1, fit_value_y);
+ }
+ cpl_image_subtract(distortion->dist_x, dist_x_plane);
+ cpl_image_subtract(distortion->dist_y, dist_y_plane);
+
+ /* Subtract the mean distortion, again */
+ dist_x_mean = cpl_image_get_mean(distortion->dist_x);
+ dist_y_mean = cpl_image_get_mean(distortion->dist_y);
+ cpl_msg_warning(__func__,"Subtracting mean distortion in X %f",dist_x_mean);
+ cpl_msg_warning(__func__,"Subtracting mean distortion in Y %f",dist_y_mean);
+ cpl_image_subtract_scalar(distortion->dist_x, dist_x_mean);
+ cpl_image_subtract_scalar(distortion->dist_y, dist_y_mean);
+
+ /* Free and return */
+ cpl_matrix_delete(pixel_pos);
+ cpl_vector_delete(dist_x_val);
+ cpl_vector_delete(dist_y_val);
+ cpl_vector_delete(pix);
+ cpl_image_delete(dist_x_plane);
+ cpl_image_delete(dist_y_plane);
+
+ if(!cpl_errorstate_is_equal(error_prevstate ))
+ {
+ cpl_msg_error(__func__, "A problem happened computing the linear term");
+ cpl_msg_error(__func__,"Error %s",cpl_error_get_message());
+ //cpl_msg_error(__func__,"Where %s",cpl_error_get_where());
+ return -1;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute some basic quality control
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_propertylist ** hawki_cal_distortion_qc
+(hawki_distortion ** distortion,
+ int * nmatched_pairs,
+ double * rms)
+{
+ int idet;
+ cpl_propertylist ** qclists;
+
+ /* Allocate the qclists */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+
+ /* Loop on the detectors to get the mean zpoint */
+ for(idet = 0 ; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ /* Allocate this qclist */
+ qclists[idet] = cpl_propertylist_new() ;
+
+ cpl_propertylist_append_double
+ (qclists[idet], "ESO QC DIST NMATCHED", nmatched_pairs[idet]);
+
+ cpl_propertylist_append_double
+ (qclists[idet], "ESO QC DIST TOTAL RMS", rms[idet]);
+
+ /* Getting the jacobian of the distortion map */
+ /* The jacobian has to be definitive positive in all the detector to
+ * be have a biyective function invertible anywhere:
+ * http://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant#Jacobian_determinant
+ * http://en.wikipedia.org/wiki/Inverse_function#Inverses_and_derivatives
+ * This should be a QC check.
+ */
+
+
+ //cpl_propertylist_append_double
+ //(qclists[idet], "ESO QC DIST JACOBIAN_1_1", jacobian[1][1]);
+ }
+
+ return qclists;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the recipe product on disk
+ @param tab the table to save
+ @param images the images where the photometry is computed
+ @param parlist the parameter list
+ @param qclists the QC lists for each detector
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_distortion_save
+(hawki_distortion ** distortion,
+ cpl_parameterlist * parlist,
+ cpl_propertylist ** qclists,
+ cpl_frameset * recipe_set)
+{
+ const char * recipe_name = "hawki_cal_distortion";
+
+ /* Write the distortion in both axes */
+ hawki_distortion_save(recipe_set,
+ parlist,
+ recipe_set,
+ (const hawki_distortion **) distortion,
+ recipe_name,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ "hawki_cal_distortion_x.fits",
+ "hawki_cal_distortion_y.fits");
+
+ /* Free and return */
+ return 0;
+}
+
+static int hawki_cal_distortion_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+
+ par = NULL ;
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_cal_distortion.sigma_det");
+ hawki_cal_distortion_config.sigma_det = cpl_parameter_get_double(par);
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_cal_distortion.grid_points");
+ hawki_cal_distortion_config.grid_points = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_cal_distortion.borders");
+ hawki_cal_distortion_config.borders = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_cal_distortion.subtract_linear");
+ hawki_cal_distortion_config.subtract_linear = cpl_parameter_get_bool(par);
+
+
+ return 0;
+}
diff --git a/recipes/hawki_cal_flat.c b/recipes/hawki_cal_flat.c
new file mode 100644
index 0000000..fda775f
--- /dev/null
+++ b/recipes/hawki_cal_flat.c
@@ -0,0 +1,1952 @@
+/* $Id: hawki_cal_flat.c,v 1.25 2012/01/11 15:02:18 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/01/11 15:02:18 $
+ * $Revision: 1.25 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <string.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_utils.h"
+#include "hawki_image_stats.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_cal_flat_create(cpl_plugin *) ;
+static int hawki_cal_flat_exec(cpl_plugin *) ;
+static int hawki_cal_flat_destroy(cpl_plugin *) ;
+static int hawki_cal_flat(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_cal_flat_retrieve_input_param
+(cpl_parameterlist * parlist);
+static cpl_imagelist ** hawki_cal_flat_reduce(
+ cpl_frameset * flatframes,
+ const char * dark_file,
+ cpl_table ** raw_flat_stats,
+ cpl_table ** raw_flat_odd_column_stats,
+ cpl_table ** raw_flat_even_column_stats,
+ cpl_table ** raw_flat_odd_row_stats,
+ cpl_table ** raw_flat_even_row_stats,
+ cpl_vector ** selected);
+static int hawki_cal_flat_clean_outliers(cpl_image *, cpl_imagelist *,
+ cpl_imagelist *, cpl_vector *, cpl_image **) ;
+static int hawki_cal_flat_save
+(cpl_imagelist ** flat,
+ cpl_table ** raw_flat_stats,
+ cpl_table ** raw_flat_odd_column_stats,
+ cpl_table ** raw_flat_even_column_stats,
+ cpl_table ** raw_flat_odd_row_stats,
+ cpl_table ** raw_flat_even_row_stats,
+ cpl_vector ** raw_selected,
+ int set_nb,
+ const cpl_frame * bpmdark,
+ cpl_frameset * flatframes,
+ cpl_frameset * calibframes,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set_tot);
+static int hawki_cal_flat_compare(const cpl_frame *, const cpl_frame *) ;
+static cpl_imagelist * hawki_cal_flat_merge_bpms
+(const cpl_frame * bpm_orig,
+ cpl_imagelist * bpm_to_add);
+static int hawki_cal_flat_select
+(cpl_vector * meds,
+ cpl_vector * rms,
+ int auto_flag,
+ int auto_max_bins,
+ double min_level,
+ double max_level,
+ double max_rms,
+ int min_nframes,
+ cpl_vector * selection);
+static cpl_vector * hawki_cal_flat_extract_vector(cpl_vector *,
+ cpl_vector *) ;
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct {
+ /* Inputs */
+ int llx ;
+ int lly ;
+ int urx ;
+ int ury ;
+ int normalise ;
+ int second_pass ;
+ double sigma_badres ;
+ double sigma_bpm ;
+ double lowval_bpm ;
+ double highval_bpm ;
+ int select_auto ;
+ int select_auto_max_bins;
+ double select_min_level[HAWKI_NB_DETECTORS];
+ double select_max_level[HAWKI_NB_DETECTORS];
+ double select_max_rms[HAWKI_NB_DETECTORS];
+ int select_min_nframes ;
+ int extra_stats;
+} hawki_cal_flat_config ;
+
+static struct {
+ /* Outputs */
+ int nb_badpix[HAWKI_NB_DETECTORS];
+ double norm[HAWKI_NB_DETECTORS];
+ double med_stdev[HAWKI_NB_DETECTORS];
+ double med_avg[HAWKI_NB_DETECTORS];
+ double med_med[HAWKI_NB_DETECTORS];
+ double med_min[HAWKI_NB_DETECTORS];
+ double med_max[HAWKI_NB_DETECTORS];
+} hawki_cal_flat_outputs;
+
+static char hawki_cal_flat_description[] =
+"hawki_cal_flat -- HAWKĪI imaging flat-field creation from twillight images.\n"
+"The input of the recipe files listed in the Set Of Frames (sof-file)\n"
+"must be tagged as:\n"
+"raw-file.fits "HAWKI_CAL_FLAT_RAW" or\n"
+"Optional inputs are:\n"
+"bpmdark-file.fits "HAWKI_CALPRO_BPM_HOT"\n"
+"dark-file.fits "HAWKI_CALPRO_DARK"\n"
+"dark_err-file.fits "HAWKI_CALPRO_DARK_ERR"\n"
+"The recipe creates as an output:\n"
+"hawki_cal_flat_setxx.fits ("HAWKI_CALPRO_FLAT"): Master flat for filter xx\n"
+"hawki_cal_flat_err_setxx.fits ("HAWKI_CALPRO_FLAT_ERRMAP"): Master flat residuals\n"
+"hawki_cal_flat_bpmflat_setxx.fits ("HAWKI_CALPRO_BPM_COLD"): BPM from the flat\n"
+"hawki_cal_flat_stats_setxx.fits ("HAWKI_CALPRO_FLAT_STATS"): Stats of the individual flats\n"
+"Optionally it also creates:\n"
+"hawki_cal_flat_bpm_setxx.fits ("HAWKI_CALPRO_BPM"): Bad pixel mask combining bpm from dark and flat\n"
+"hawki_cal_flat_stats_ec_setxx.fits ("HAWKI_CALPRO_FLAT_STATS_EVEN_COL"): Stats of the individual flats for even columns\n"
+"hawki_cal_flat_stats_oc_setxx.fits ("HAWKI_CALPRO_FLAT_STATS_ODD_COL"): Stats of the individual flats for odd columns\n"
+"hawki_cal_flat_stats_er_setxx.fits ("HAWKI_CALPRO_FLAT_STATS_EVEN_ROW"): Stats of the individual flats for even rows\n"
+"hawki_cal_flat_stats_or_setxx.fits ("HAWKI_CALPRO_FLAT_STATS_ODD_ROW"): Stats of the individual flats for odd rows\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+
+
+
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_cal_flat",
+ "Twillight flat recipe",
+ hawki_cal_flat_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_cal_flat_create,
+ hawki_cal_flat_exec,
+ hawki_cal_flat_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+
+ /* Fill the parameters list */
+ /* --zone */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.zone",
+ CPL_TYPE_STRING,
+ "Stats zone",
+ "hawki.hawki_cal_flat",
+ "1,1,2048,2048") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "zone") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --normalise */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.normalise",
+ CPL_TYPE_BOOL, "Flag to apply the normalisation",
+ "hawki.hawki_cal_flat", FALSE) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "normalise") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --second_pass */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.second_pass",
+ CPL_TYPE_BOOL, "Flag to apply a second pass computation",
+ "hawki.hawki_cal_flat", TRUE) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "second_pass") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --sigma_badres */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.sigma_badres",
+ CPL_TYPE_DOUBLE, "sigma for detection of bad flat results",
+ "hawki.hawki_cal_flat", 1.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma_badres") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --sigma_bpm */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.sigma_bpm",
+ CPL_TYPE_DOUBLE, "sigma for detection of bad pixels",
+ "hawki.hawki_cal_flat", 10.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma_bpm") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --lowval_bpm */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.lowval_bpm",
+ CPL_TYPE_DOUBLE, "values of the flat below this will be included "
+ "in the bpm. In units of final flat (normalised if normalise is on)",
+ "hawki.hawki_cal_flat", .1) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lowval_bpm") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --highval_bpm */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.highval_bpm",
+ CPL_TYPE_DOUBLE, "values of the flat above this will be included "
+ "in the bpm. In units of final flat (normalized if normalise is on)",
+ "hawki.hawki_cal_flat", 10.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "highval_bpm") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --select_auto */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.select_auto",
+ CPL_TYPE_BOOL, "Flag to automatically select the good input frames",
+ "hawki.hawki_cal_flat", TRUE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "select_auto") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --select_auto_max_bins */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.select_auto_max_bins",
+ CPL_TYPE_INT, "Maximum number of frames requested",
+ "hawki.hawki_cal_flat", 10) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "select_auto_max_bins");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --select_min_level */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.select_min_level",
+ CPL_TYPE_STRING, "Minimum ADU level for frames selection",
+ "hawki.hawki_cal_flat", "-1.0") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "select_min_level") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --select_max_level */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.select_max_level",
+ CPL_TYPE_STRING, "Maximum ADU level for frames selection",
+ "hawki.hawki_cal_flat", "25000");
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "select_max_level");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --select_max_rms */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.select_max_rms",
+ CPL_TYPE_STRING, "Maximum RMS for frames selection",
+ "hawki.hawki_cal_flat", "4000");
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "select_max_rms");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --select_min_nframes */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.select_min_nframes",
+ CPL_TYPE_INT, "Minimum number of frames requested",
+ "hawki.hawki_cal_flat", 3);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "select_min_nframes") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --extra_stats */
+ p = cpl_parameter_new_value("hawki.hawki_cal_flat.extra_stats",
+ CPL_TYPE_BOOL, "Request for even/odd column/rows statistics",
+ "hawki.hawki_cal_flat", FALSE) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "extra_stats") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_cal_flat(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_size * labels ;
+ cpl_size nlabels ;
+ cpl_frameset * flatframes ;
+ int nflats;
+ const char * dark ;
+ const char * dark_err;
+ const cpl_frame * bpmdark ;
+ cpl_imagelist ** twflat ;
+ cpl_table ** raw_flat_stats;
+ cpl_table ** raw_flat_odd_column_stats = NULL;
+ cpl_table ** raw_flat_even_column_stats = NULL;
+ cpl_table ** raw_flat_odd_row_stats = NULL;
+ cpl_table ** raw_flat_even_row_stats = NULL;
+ cpl_vector ** raw_selected;
+ cpl_size i;
+ int j ;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Retrieve input parameters */
+ if(hawki_cal_flat_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1;
+ }
+
+ /* Retrieve raw frames */
+ if ((flatframes = hawki_extract_frameset(framelist,
+ HAWKI_CAL_FLAT_RAW)) == NULL) {
+ cpl_msg_error(__func__, "Cannot find flat frames in the input list (%s)",
+ HAWKI_CAL_FLAT_RAW);
+ return -1 ;
+ }
+
+ /* Retrieve calibration frames */
+ bpmdark = cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM_HOT);
+ dark = hawki_extract_first_filename(framelist, HAWKI_CALPRO_DARK);
+ dark_err = hawki_extract_first_filename(framelist, HAWKI_CALPRO_DARK_ERR);
+
+ /* Labelise all input flat frames */
+ labels = cpl_frameset_labelise(flatframes, hawki_cal_flat_compare,
+ &nlabels);
+ if (labels == NULL) {
+ cpl_msg_error(__func__, "Cannot labelise input frames") ;
+ cpl_frameset_delete(flatframes);
+ return -1;
+ }
+
+ /* Extract sets and reduce each of them */
+ for (i=0 ; i<nlabels ; i++)
+ {
+ cpl_frameset * this_filter_flats;
+
+ /* Reduce data set nb i */
+ cpl_msg_info(__func__, "Reduce data set no %d out of %d", i+1, nlabels);
+ cpl_msg_indent_more() ;
+ this_filter_flats = cpl_frameset_extract(flatframes, labels, i) ;
+ nflats = cpl_frameset_get_size(this_filter_flats);
+
+ /* Allocate and initialize statistics */
+ raw_flat_stats = cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_table*));
+ raw_selected = cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_vector*));
+ for (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+ {
+ raw_selected[j] = cpl_vector_new(nflats);
+ raw_flat_stats[j] = cpl_table_new(nflats);
+ }
+ /* Initialize the statistics table */
+ hawki_image_stats_initialize(raw_flat_stats);
+ if(hawki_cal_flat_config.extra_stats)
+ {
+ raw_flat_odd_column_stats =
+ cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_table*));
+ raw_flat_even_column_stats =
+ cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_table*));
+ raw_flat_odd_row_stats =
+ cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_table*));
+ raw_flat_even_row_stats =
+ cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_table*));
+ for (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+ {
+ raw_flat_odd_column_stats[j] = cpl_table_new(nflats);
+ raw_flat_even_column_stats[j] = cpl_table_new(nflats);
+ raw_flat_odd_row_stats[j] = cpl_table_new(nflats);
+ raw_flat_even_row_stats[j] = cpl_table_new(nflats);
+ }
+ /* Initialize the statistics table */
+ hawki_image_stats_initialize(raw_flat_odd_column_stats);
+ hawki_image_stats_initialize(raw_flat_even_column_stats);
+ hawki_image_stats_initialize(raw_flat_odd_row_stats);
+ hawki_image_stats_initialize(raw_flat_even_row_stats);
+ }
+
+ /* Reduce */
+ if ((twflat = hawki_cal_flat_reduce
+ (this_filter_flats,
+ dark,
+ raw_flat_stats,
+ raw_flat_odd_column_stats,
+ raw_flat_even_column_stats,
+ raw_flat_odd_row_stats,
+ raw_flat_even_row_stats,
+ raw_selected)) == NULL)
+ {
+ for (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+ {
+ cpl_table_delete(raw_flat_stats[j]);
+ cpl_vector_delete(raw_selected[j]);
+ }
+ cpl_free(raw_flat_stats);
+ cpl_free(raw_selected);
+ if(hawki_cal_flat_config.extra_stats)
+ {
+ for (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+ {
+ cpl_table_delete(raw_flat_odd_column_stats[j]);
+ cpl_table_delete(raw_flat_even_column_stats[j]);
+ cpl_table_delete(raw_flat_odd_row_stats[j]);
+ cpl_table_delete(raw_flat_even_row_stats[j]);
+ }
+ cpl_free(raw_flat_odd_column_stats);
+ cpl_free(raw_flat_even_column_stats);
+ cpl_free(raw_flat_odd_row_stats);
+ cpl_free(raw_flat_even_row_stats);
+ }
+ cpl_frameset_delete(this_filter_flats);
+ cpl_frameset_delete(flatframes);
+ cpl_free(labels);
+ cpl_msg_error(__func__, "Cannot reduce set nb %d", i+1) ;
+ return 1;
+
+ } else {
+ /* Save the products */
+ cpl_frameset * calib_frames;
+
+ cpl_msg_info(__func__, "Save the products") ;
+ calib_frames = cpl_frameset_new();
+ if(bpmdark)
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(bpmdark));
+ if(dark)
+ cpl_frameset_insert(calib_frames,
+ cpl_frame_duplicate(cpl_frameset_find_const(framelist,
+ HAWKI_CALPRO_DARK)));
+ if(dark_err)
+ cpl_frameset_insert(calib_frames,
+ cpl_frame_duplicate(cpl_frameset_find_const(framelist,
+ HAWKI_CALPRO_DARK_ERR)));
+ hawki_cal_flat_save
+ (twflat, raw_flat_stats,
+ raw_flat_odd_column_stats,
+ raw_flat_even_column_stats,
+ raw_flat_odd_row_stats,
+ raw_flat_even_row_stats,
+ raw_selected,
+ i+1, bpmdark, this_filter_flats, calib_frames,
+ parlist, framelist);
+ cpl_imagelist_delete(twflat[0]);
+ cpl_imagelist_delete(twflat[1]);
+ cpl_imagelist_delete(twflat[2]);
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(twflat[3]);
+ cpl_free(twflat);
+ for (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+ {
+ cpl_table_delete(raw_flat_stats[j]);
+ cpl_vector_delete(raw_selected[j]);
+ }
+ cpl_free(raw_flat_stats);
+ cpl_free(raw_selected);
+ if(hawki_cal_flat_config.extra_stats)
+ {
+ for (j=0 ; j<HAWKI_NB_DETECTORS ; j++)
+ {
+ cpl_table_delete(raw_flat_odd_column_stats[j]);
+ cpl_table_delete(raw_flat_even_column_stats[j]);
+ cpl_table_delete(raw_flat_odd_row_stats[j]);
+ cpl_table_delete(raw_flat_even_row_stats[j]);
+ }
+ cpl_free(raw_flat_odd_column_stats);
+ cpl_free(raw_flat_even_column_stats);
+ cpl_free(raw_flat_odd_row_stats);
+ cpl_free(raw_flat_even_row_stats);
+ }
+ cpl_frameset_delete(calib_frames);
+ }
+ cpl_msg_indent_less();
+ cpl_frameset_delete(this_filter_flats);
+ }
+
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ cpl_msg_warning(__func__,"Probably some data could not be saved. "
+ "Check permisions or disk space");
+
+
+ /* Free and return */
+ cpl_frameset_delete(flatframes);
+ cpl_free(labels);
+
+ /* Return */
+ if (cpl_error_get_code()) return -1 ;
+ else return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param flatframes the frames list with flat frames
+ @param dark_file the dark
+ @param fstats the tables to hold the stats
+ @return the 3 imagelist with the results
+ The first imagelistis the flat
+ The second imagelist is the error map
+ The third imagelist is the bad pixels map
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_imagelist ** hawki_cal_flat_reduce(
+ cpl_frameset * flatframes,
+ const char * dark_file,
+ cpl_table ** raw_flat_stats,
+ cpl_table ** raw_flat_odd_column_stats,
+ cpl_table ** raw_flat_even_column_stats,
+ cpl_table ** raw_flat_odd_row_stats,
+ cpl_table ** raw_flat_even_row_stats,
+ cpl_vector ** selected)
+{
+ int nima ;
+ cpl_image * ima_cur ;
+ cpl_image * big_ima ;
+ cpl_image * big_badres ;
+ cpl_vector * medians[HAWKI_NB_DETECTORS];
+ cpl_vector * stdevs[HAWKI_NB_DETECTORS];
+ cpl_vector * sub_medians ;
+ cpl_imagelist * in_quad ;
+ cpl_imagelist ** results ;
+ cpl_imagelist * res_quad[4] ;
+ cpl_image * err_quad[4] ;
+ cpl_image * badres_mask[4] ;
+ cpl_image * flat_image ;
+ cpl_image * dark ;
+ cpl_propertylist * plist;
+ double gradient ;
+ double flat_dit;
+ cpl_image * bpmflat;
+ int j, k ;
+ int idet;
+
+ /* Test entries */
+ if (flatframes == NULL) return NULL ;
+
+ /* Initialise */
+ nima = cpl_frameset_get_size(flatframes) ;
+ if (nima < 3) {
+ cpl_msg_error(__func__, "Not enough frames (%d)", nima) ;
+ return NULL ;
+ }
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ hawki_cal_flat_outputs.norm[idet] = 1.0 ;
+
+ /* Compute statistics */
+ cpl_msg_info(__func__, "Compute statistics") ;
+ cpl_msg_indent_more() ;
+ /* Loop on the HAWKI_NB_DETECTORS chips */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+
+ /* Compute some stats on input images */
+ cpl_msg_info(__func__, "Chip number %d", idet+1) ;
+ cpl_msg_info(__func__, "image min max med rms") ;
+ cpl_msg_info(__func__, "--------------------------------------------") ;
+ medians[idet] = cpl_vector_new(nima);
+ stdevs[idet] = cpl_vector_new(nima);
+ for (j=0 ; j<nima ; j++)
+ {
+ /* Load the image */
+ ima_cur = hawki_load_image(flatframes, j, idet+1, CPL_TYPE_FLOAT) ;
+
+ /* Compute the stats */
+ if(hawki_image_stats_fill_from_image
+ (raw_flat_stats,
+ ima_cur,
+ hawki_cal_flat_config.llx,
+ hawki_cal_flat_config.lly,
+ hawki_cal_flat_config.urx,
+ hawki_cal_flat_config.ury,
+ idet,
+ j) !=0 )
+ {
+ cpl_msg_error(__func__, "Cannot compute stats on image %d",j+1);
+ cpl_msg_indent_less() ;
+ cpl_image_delete(ima_cur);
+ for (k=0 ; k<=idet ; k++) cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<=idet ; k++) cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+
+ if(hawki_cal_flat_config.extra_stats)
+ {
+ if(hawki_image_stats_odd_even_column_row_fill_from_image
+ (raw_flat_odd_column_stats,
+ raw_flat_even_column_stats,
+ raw_flat_odd_row_stats,
+ raw_flat_even_row_stats,
+ ima_cur,
+ idet,
+ j) !=0 )
+ {
+ cpl_msg_error(__func__, "Cannot compute extra stats");
+ cpl_msg_indent_less() ;
+ cpl_image_delete(ima_cur);
+ for (k=0 ; k<=idet ; k++) cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<=idet ; k++) cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+ }
+ cpl_vector_set(medians[idet], j, cpl_table_get_double
+ (raw_flat_stats[idet],HAWKI_COL_STAT_MED,j,NULL )) ;
+ cpl_vector_set(stdevs[idet], j, cpl_table_get_double
+ (raw_flat_stats[idet],HAWKI_COL_STAT_RMS,j,NULL )) ;
+ cpl_msg_info(__func__, "%02d %10.2f %10.2f %10.2f %10.2f",
+ j+1,
+ cpl_table_get_double(raw_flat_stats[idet],
+ HAWKI_COL_STAT_MIN,j,NULL ),
+ cpl_table_get_double(raw_flat_stats[idet],
+ HAWKI_COL_STAT_MAX,j,NULL ),
+ cpl_table_get_double(raw_flat_stats[idet],
+ HAWKI_COL_STAT_MED,j,NULL ),
+ cpl_table_get_double(raw_flat_stats[idet],
+ HAWKI_COL_STAT_RMS,j,NULL ));
+ if (cpl_table_get_double
+ (raw_flat_stats[idet],HAWKI_COL_STAT_MED,j,NULL ) < 1e-6)
+ {
+ cpl_msg_error(__func__, "image %d has negative flux: aborting",
+ j+1) ;
+ cpl_msg_indent_less() ;
+ for (k=0 ; k<=idet ; k++) cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<=idet ; k++) cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+ cpl_image_delete(ima_cur);
+ }
+ cpl_msg_info(__func__, "--------------------------------------------") ;
+
+ /* Compute min max stdev and mean of the medians */
+ hawki_cal_flat_outputs.med_min[idet] =
+ cpl_vector_get_min(medians[idet]);
+ hawki_cal_flat_outputs.med_max[idet] =
+ cpl_vector_get_max(medians[idet]);
+ hawki_cal_flat_outputs.med_avg[idet] =
+ cpl_vector_get_mean(medians[idet]);
+ hawki_cal_flat_outputs.med_med[idet] =
+ cpl_vector_get_median_const(medians[idet]);
+ hawki_cal_flat_outputs.med_stdev[idet] =
+ cpl_vector_get_stdev(medians[idet]);
+
+ /* See if flux gradient is large enough for a correct fit */
+ gradient=fabs(hawki_cal_flat_outputs.med_max[idet]/
+ hawki_cal_flat_outputs.med_min[idet]) ;
+ if (gradient < 4.0) {
+ /* cpl_msg_warning(__func__, "Low flux gradient: %g", gradient) ;*/
+ }
+ }
+ cpl_msg_indent_less() ;
+
+ /* Allocate for results */
+ results = cpl_malloc(4 * sizeof(cpl_imagelist*)) ;
+ results[0] = cpl_imagelist_new() ;
+ results[1] = cpl_imagelist_new() ;
+ results[2] = cpl_imagelist_new() ;
+ if (hawki_cal_flat_config.second_pass) results[3] = cpl_imagelist_new() ;
+ else results[3] = NULL ;
+
+ cpl_msg_info(__func__, "Compute the flat") ;
+ cpl_msg_indent_more() ;
+ /* Loop on the HAWKI_NB_DETECTORS chips */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_msg_info(__func__, "Chip number %d", idet+1) ;
+ cpl_msg_indent_more() ;
+
+ /* Frames selection */
+ cpl_msg_info(__func__, "Apply the frames selection");
+ if ((hawki_cal_flat_select(medians[idet],
+ stdevs[idet],
+ hawki_cal_flat_config.select_auto,
+ hawki_cal_flat_config.select_auto_max_bins,
+ hawki_cal_flat_config.select_min_level[idet],
+ hawki_cal_flat_config.select_max_level[idet],
+ hawki_cal_flat_config.select_max_rms[idet],
+ hawki_cal_flat_config.select_min_nframes,
+ selected[idet])) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot apply the frames selection") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+
+ /* Apply the medians subselection */
+ sub_medians = hawki_cal_flat_extract_vector
+ (medians[idet], selected[idet]) ;
+
+ /* Loop on the 4 quadrants */
+ for (j=0 ; j<4 ; j++) {
+ /* Load input image chips */
+ if ((in_quad = hawki_load_quadrants(flatframes, idet+1, j+1,
+ CPL_TYPE_FLOAT))==NULL) {
+ cpl_msg_error(__func__, "Cannot load the raw quadrants") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ cpl_vector_delete(sub_medians) ;
+ return NULL ;
+ }
+
+ /* Apply subselection of the frames */
+ cpl_imagelist_erase(in_quad, selected[idet]);
+
+ /* Apply dark correction to all planes if requested */
+ if (dark_file) {
+ if (j==0) cpl_msg_info(__func__, "Subtracting dark") ;
+ /* Load dark */
+ if ((dark = hawki_load_quadrant_from_file(dark_file,
+ idet+1, j+1, CPL_TYPE_FLOAT)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load the dark quadrants") ;
+ cpl_imagelist_delete(in_quad) ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ cpl_vector_delete(sub_medians) ;
+ return NULL ;
+ }
+
+ /* Multiply by the dit */
+ if ((plist=cpl_propertylist_load
+ (cpl_frame_get_filename
+ (cpl_frameset_get_first_const(flatframes)), 0)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot get header from frame");
+ cpl_imagelist_delete(in_quad) ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ cpl_vector_delete(sub_medians) ;
+ cpl_image_delete(dark);
+ return NULL ;
+ }
+ flat_dit = hawki_pfits_get_dit(plist);
+ cpl_image_multiply_scalar(dark, flat_dit);
+ cpl_propertylist_delete(plist);
+
+ /* Dark correction */
+ cpl_imagelist_subtract_image(in_quad, dark) ;
+ cpl_image_delete(dark) ;
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ cpl_msg_warning(__func__,"Cannot subtract the dark frame");
+ cpl_error_reset() ;
+ }
+ }
+
+ /* Fit slopes */
+ err_quad[j] = cpl_image_duplicate(cpl_imagelist_get(in_quad, 0)) ;
+ res_quad[j] = cpl_fit_imagelist_polynomial(sub_medians, in_quad,
+ 0, 1, CPL_FALSE, CPL_TYPE_FLOAT, err_quad[j]) ;
+ if (res_quad[j] == NULL) {
+ cpl_msg_error(__func__, "Cannot create twilight flat-field") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ cpl_imagelist_delete(in_quad) ;
+ for (k=0 ; k<j ; k++) cpl_imagelist_delete(res_quad[k]) ;
+ for (k=0 ; k<=j ; k++) cpl_image_delete(err_quad[k]) ;
+ for (k=0 ; k<j ; k++)
+ if (badres_mask[k]) cpl_image_delete(badres_mask[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ cpl_vector_delete(sub_medians) ;
+ return NULL ;
+ }
+
+ /* Handle the pixels with a high error */
+ badres_mask[j] = NULL ;
+ if (hawki_cal_flat_config.second_pass) {
+ if (j==0) cpl_msg_info(__func__,
+ "Second pass to clean the outliers") ;
+ if (hawki_cal_flat_clean_outliers(err_quad[j], res_quad[j],
+ in_quad, sub_medians, &(badres_mask[j])) == -1) {
+ cpl_msg_error(__func__, "Cannot clean the outliers") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ cpl_imagelist_delete(in_quad) ;
+ for (k=0 ; k<=j ; k++) cpl_imagelist_delete(res_quad[k]) ;
+ for (k=0 ; k<=j ; k++) cpl_image_delete(err_quad[k]) ;
+ for (k=0 ; k<=j ; k++) cpl_image_delete(badres_mask[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ cpl_vector_delete(sub_medians) ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ }
+ cpl_imagelist_delete(in_quad) ;
+ }
+ cpl_vector_delete(sub_medians) ;
+
+ /* Rebuild the quadrants and put in results */
+ /* Rebuild RESULTS */
+ big_ima = hawki_rebuild_quadrants(
+ cpl_imagelist_get(res_quad[0],1),
+ cpl_imagelist_get(res_quad[1],1),
+ cpl_imagelist_get(res_quad[2],1),
+ cpl_imagelist_get(res_quad[3],1)) ;
+ for (j=0 ; j<4 ; j++) cpl_imagelist_delete(res_quad[j]) ;
+ cpl_imagelist_set(results[0], big_ima, idet) ;
+ if (big_ima == NULL) {
+ cpl_msg_error(__func__, "Cannot rebuild the image") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (j=0 ; j<4 ; j++) cpl_image_delete(err_quad[j]) ;
+ for (j=0 ; j<4 ; j++)
+ if (badres_mask[j]) cpl_image_delete(badres_mask[j]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+
+ /* Rebuild ERROR */
+ big_ima = hawki_rebuild_quadrants(err_quad[0], err_quad[1],
+ err_quad[2], err_quad[3]) ;
+ for (j=0 ; j<4 ; j++) cpl_image_delete(err_quad[j]) ;
+ if (big_ima == NULL) {
+ cpl_msg_error(__func__, "Cannot rebuild the image") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (j=0 ; j<4 ; j++)
+ if (badres_mask[j]) cpl_image_delete(badres_mask[j]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+ cpl_imagelist_set(results[1], big_ima, idet) ;
+
+ /* Rebuild BADRES_MASK */
+ big_badres = hawki_rebuild_quadrants(badres_mask[0], badres_mask[1],
+ badres_mask[2], badres_mask[3]) ;
+ if (hawki_cal_flat_config.second_pass) {
+ for (j=0 ; j<4 ; j++) cpl_image_delete(badres_mask[j]) ;
+ cpl_imagelist_set(results[3], big_badres, idet) ;
+ }
+
+ if (hawki_cal_flat_config.normalise) {
+ /* Normalize gain */
+ cpl_msg_info(__func__, "Normalise the flat") ;
+ flat_image = cpl_imagelist_get(results[0], idet) ;
+ hawki_cal_flat_outputs.norm[idet] =
+ cpl_image_get_median(flat_image) ;
+ cpl_image_divide_scalar
+ (flat_image, hawki_cal_flat_outputs.norm[idet]);
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "Cannot normalise") ;
+ cpl_imagelist_delete(results[0]) ;
+ cpl_imagelist_delete(results[1]) ;
+ cpl_imagelist_delete(results[2]) ;
+ if (hawki_cal_flat_config.second_pass)
+ cpl_imagelist_delete(results[3]) ;
+ cpl_free(results) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++)
+ cpl_vector_delete(stdevs[k]) ;
+ return NULL ;
+ }
+ }
+
+ /* BPM from the flat */
+ cpl_msg_info(__func__, "Compute the BPM from the flat") ;
+ bpmflat=hawki_compute_flatbpm(cpl_imagelist_get(results[0],idet),
+ hawki_cal_flat_config.sigma_bpm,
+ hawki_cal_flat_config.lowval_bpm,
+ hawki_cal_flat_config.highval_bpm);
+
+ cpl_imagelist_set(results[2], bpmflat, idet) ;
+ hawki_cal_flat_outputs.nb_badpix[idet]=
+ (int)cpl_image_get_flux(bpmflat);
+
+ cpl_msg_indent_less() ;
+ }
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++) cpl_vector_delete(medians[k]) ;
+ for (k=0 ; k<HAWKI_NB_DETECTORS ; k++) cpl_vector_delete(stdevs[k]) ;
+ cpl_msg_indent_less() ;
+
+ return results ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Clean the outliers in a second pass
+ @param error the error of the fit (recomputed)
+ @param flat the computed flat (recomputed)
+ @param raw the raw files
+ @param medians medians of the input frames for the fit
+ @param recomp_mask Mask of the recomputed zones or NULL
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_clean_outliers(
+ cpl_image * error,
+ cpl_imagelist * fit_res,
+ cpl_imagelist * raw,
+ cpl_vector * medians,
+ cpl_image ** recomp_mask)
+{
+ cpl_mask * recompute ;
+ cpl_binary * precompute ;
+ double med, stdev, threshold1, threshold2 ;
+ int nx, ny, pos, nbad, nima, out, ind, pix ;
+ cpl_image * cur_ima ;
+ float * pimaf ;
+ double val, fit_val, a, b, max ;
+ cpl_vector * z_pix ;
+ double * pz_pix ;
+ cpl_image * onepix ;
+ cpl_vector * med_purged ;
+ cpl_imagelist * raw_purged ;
+ cpl_imagelist * fit_one ;
+ cpl_image * err_one ;
+ int i, j, k ;
+
+ /* Check entries */
+ if (error == NULL) return -1 ;
+ if (fit_res == NULL) return -1 ;
+ if (raw == NULL) return -1 ;
+
+ /* Initialise */
+ if (recomp_mask) *recomp_mask = NULL ;
+
+ /* Identify the places to recompute */
+ med = cpl_image_get_median_dev(error, &stdev) ;
+ threshold1 = med - hawki_cal_flat_config.sigma_badres * stdev ;
+ threshold2 = med + hawki_cal_flat_config.sigma_badres * stdev ;
+ recompute = cpl_mask_threshold_image_create(error,threshold1,threshold2) ;
+ cpl_mask_not(recompute) ;
+
+ if ((nbad=cpl_mask_count(recompute)) == 0) {
+ if (recomp_mask)
+ *recomp_mask = cpl_image_new_from_mask(recompute) ;
+ cpl_mask_delete(recompute) ;
+ return 0 ;
+ }
+ nx = cpl_image_get_size_x(error) ;
+ ny = cpl_image_get_size_y(error) ;
+ nima = cpl_imagelist_get_size(raw) ;
+
+ /* Get access to the mask */
+ precompute = cpl_mask_get_data(recompute) ;
+ for (j=0 ; j<ny ; j++) {
+ for (i=0 ; i<nx ; i++) {
+ pos = i + j*nx ;
+ /* The pixel has to be recomputed */
+ if (precompute[pos] == CPL_BINARY_1) {
+ /* Get the pix_val-fit in a vector */
+ z_pix = cpl_vector_new(nima) ;
+ for (k=0 ; k<nima ; k++) {
+ cur_ima = cpl_imagelist_get(fit_res, 0) ;
+ pimaf = cpl_image_get_data_float(cur_ima) ;
+ a = pimaf[pos] ;
+ cur_ima = cpl_imagelist_get(fit_res, 1) ;
+ pimaf = cpl_image_get_data_float(cur_ima) ;
+ b = pimaf[pos] ;
+ med = cpl_vector_get(medians, k) ;
+ fit_val = a + b * med ;
+ cur_ima = cpl_imagelist_get(raw, k) ;
+ pimaf = cpl_image_get_data_float(cur_ima) ;
+ cpl_vector_set(z_pix, k, (double)(pimaf[pos]-fit_val)) ;
+ }
+
+ /* Identify the outlier */
+ out = -1 ;
+ max = -1.0 ;
+ pz_pix = cpl_vector_get_data(z_pix) ;
+ for (k=0 ; k<nima ; k++) {
+ if (fabs(pz_pix[k]) > max) {
+ max = fabs(pz_pix[k]) ;
+ out = k ;
+ }
+ }
+ cpl_vector_delete(z_pix) ;
+
+ /* Create 1-pixel purged image list and the purged medians */
+ med_purged = cpl_vector_new(nima-1) ;
+ raw_purged = cpl_imagelist_new() ;
+ ind = 0 ;
+ for (k=0 ; k<nima ; k++) {
+ if (k != out) {
+ /* Fill raw_purged */
+ cur_ima = cpl_imagelist_get(raw, k) ;
+ onepix=cpl_image_extract(cur_ima, i+1, j+1, i+1, j+1) ;
+ cpl_imagelist_set(raw_purged, onepix, ind) ;
+ /* Fill med_purged */
+ cpl_vector_set(med_purged, ind,
+ cpl_vector_get(medians, k)) ;
+ ind ++;
+ }
+ }
+
+ /* Perform the fit */
+ err_one = cpl_image_duplicate(cpl_imagelist_get(raw_purged,0));
+ fit_one = cpl_fit_imagelist_polynomial(med_purged, raw_purged,
+ 0, 1, CPL_FALSE, CPL_TYPE_FLOAT, err_one) ;
+ if (fit_one == NULL) {
+ cpl_msg_error(__func__, "Cannot fit in second pass") ;
+ cpl_mask_delete(recompute) ;
+ cpl_vector_delete(med_purged) ;
+ cpl_imagelist_delete(raw_purged) ;
+ cpl_image_delete(err_one) ;
+ return -1 ;
+ }
+ cpl_vector_delete(med_purged) ;
+ cpl_imagelist_delete(raw_purged) ;
+
+ /* Write the result in the input */
+ val = cpl_image_get(err_one, 1, 1, &pix) ;
+ cpl_image_set(error, i+1, j+1, val) ;
+ cpl_image_delete(err_one) ;
+
+ cur_ima = cpl_imagelist_get(fit_one, 0) ;
+ val = cpl_image_get(cur_ima, 1, 1, &pix) ;
+ cur_ima = cpl_imagelist_get(fit_res, 0) ;
+ cpl_image_set(cur_ima, i+1, j+1, val) ;
+
+ cur_ima = cpl_imagelist_get(fit_one, 1) ;
+ val = cpl_image_get(cur_ima, 1, 1, &pix) ;
+ cur_ima = cpl_imagelist_get(fit_res, 1) ;
+ cpl_image_set(cur_ima, i+1, j+1, val) ;
+ cpl_imagelist_delete(fit_one) ;
+ }
+ }
+ }
+ if (recomp_mask)
+ *recomp_mask = cpl_image_new_from_mask(recompute) ;
+ cpl_mask_delete(recompute) ;
+
+ /* Return */
+ if (cpl_error_get_code()) return -1 ;
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the lampflat recipe products on disk
+ @param flat the flat images produced
+ @param fstats the stats
+ @param set_nb current setting number
+ @param bpmdark The BPM from the dark
+ @param set the frames from the current setting
+ @param parlist the input list of parameters
+ @param set_tot the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_save
+(cpl_imagelist ** flat,
+ cpl_table ** raw_flat_stats,
+ cpl_table ** raw_flat_odd_column_stats,
+ cpl_table ** raw_flat_even_column_stats,
+ cpl_table ** raw_flat_odd_row_stats,
+ cpl_table ** raw_flat_even_row_stats,
+ cpl_vector ** raw_selected,
+ int set_nb,
+ const cpl_frame * bpmdark,
+ cpl_frameset * flat_frames,
+ cpl_frameset * calib_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set_tot)
+{
+ cpl_propertylist ** qclists ;
+ cpl_imagelist * bpm ;
+ const cpl_frame * ref_frame ;
+ cpl_frameset * used_frames;
+ char * filename ;
+ cpl_propertylist * inputlist ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_cal_flat" ;
+ int i ;
+ int iflat;
+ int nflat;
+ int nused;
+ char key_name[72];
+
+ /* Get the reference frame */
+ ref_frame = irplib_frameset_get_first_from_group(flat_frames, CPL_FRAME_GROUP_RAW) ;
+
+ /* Create the QC lists */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ qclists[i] = cpl_propertylist_new() ;
+
+ /* Add the raw flat selection keywords */
+ nflat = cpl_vector_get_size(raw_selected[i]);
+ nused = 0;
+ for(iflat = 0; iflat < nflat; ++iflat)
+ {
+ snprintf(key_name, 72, "ESO QC RAW%02d USED", iflat + 1);
+ cpl_propertylist_append_bool
+ (qclists[i], key_name,
+ (cpl_vector_get(raw_selected[i], iflat) + 1) / 2);
+ cpl_table_set_int
+ (raw_flat_stats[i],HAWKI_COL_STAT_USED, iflat,
+ cpl_vector_get(raw_selected[i], iflat));
+ if(hawki_cal_flat_config.extra_stats)
+ {
+ cpl_table_set_int
+ (raw_flat_odd_column_stats[i],HAWKI_COL_STAT_USED, iflat,
+ cpl_vector_get(raw_selected[i], iflat));
+ cpl_table_set_int
+ (raw_flat_even_column_stats[i],HAWKI_COL_STAT_USED, iflat,
+ cpl_vector_get(raw_selected[i], iflat));
+ cpl_table_set_int
+ (raw_flat_odd_row_stats[i],HAWKI_COL_STAT_USED, iflat,
+ cpl_vector_get(raw_selected[i], iflat));
+ cpl_table_set_int
+ (raw_flat_even_row_stats[i],HAWKI_COL_STAT_USED, iflat,
+ cpl_vector_get(raw_selected[i], iflat));
+ }
+ if(cpl_vector_get(raw_selected[i], iflat) == 1)
+ nused++;
+ }
+
+ /* Add the master flat statistics keywords */
+ cpl_propertylist_append_int(qclists[i], "ESO QC FLAT NBADPIX",
+ hawki_cal_flat_outputs.nb_badpix[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT NORM",
+ hawki_cal_flat_outputs.norm[i]) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDMEAN",
+ hawki_cal_flat_outputs.med_avg[i]) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDMED",
+ hawki_cal_flat_outputs.med_med[i]) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDSTDEV",
+ hawki_cal_flat_outputs.med_stdev[i]) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDMIN",
+ hawki_cal_flat_outputs.med_min[i]) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDMAX",
+ hawki_cal_flat_outputs.med_max[i]) ;
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDRANG",
+ hawki_cal_flat_outputs.med_max[i] -
+ hawki_cal_flat_outputs.med_min[i]);
+ cpl_propertylist_append_double(qclists[i], "ESO QC FLAT MEDNRANG",
+ (hawki_cal_flat_outputs.med_max[i] -
+ hawki_cal_flat_outputs.med_min[i]) /
+ hawki_cal_flat_outputs.med_med[i]);
+ cpl_propertylist_append_int(qclists[i], "ESO QC DATANCOM",
+ nused) ;
+
+ /* Propagate some keywords from input raw frame extensions */
+ ext_nb = hawki_get_ext_from_detector(
+ cpl_frame_get_filename(ref_frame), i+1);
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0) ;
+ cpl_propertylist_append(qclists[i], inputlist) ;
+
+ /* Cleaning */
+ cpl_propertylist_delete(inputlist) ;
+ }
+ /* Statistics of the raw images in the QC */
+ hawki_image_stats_stats(raw_flat_stats, qclists);
+
+ /* Get the used frames */
+ used_frames = cpl_frameset_duplicate(flat_frames);
+ for(i = 0; i< cpl_frameset_get_size(calib_frames); ++i)
+ cpl_frameset_insert(used_frames,
+ cpl_frame_duplicate(cpl_frameset_get_frame(calib_frames, i)));
+
+ /* Write the flat image */
+ filename = cpl_sprintf("hawki_cal_flat_set%02d.fits", set_nb) ;
+ hawki_imagelist_save(set_tot,
+ parlist,
+ used_frames,
+ flat[0],
+ recipe_name,
+ HAWKI_CALPRO_FLAT,
+ HAWKI_PROTYPE_FLAT,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ filename) ;
+ cpl_free(filename) ;
+
+ /* Write the error map */
+ filename = cpl_sprintf("hawki_cal_flat_err_set%02d.fits", set_nb) ;
+ hawki_imagelist_save(set_tot,
+ parlist,
+ used_frames,
+ flat[1],
+ recipe_name,
+ HAWKI_CALPRO_FLAT_ERRMAP,
+ HAWKI_PROTYPE_ERRMAP,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ filename) ;
+ cpl_free(filename) ;
+
+ /* Write the Cold pixels map */
+ filename = cpl_sprintf("hawki_cal_flat_bpmflat_set%02d.fits", set_nb) ;
+ hawki_imagelist_save(set_tot,
+ parlist,
+ used_frames,
+ flat[2],
+ recipe_name,
+ HAWKI_CALPRO_BPM_COLD,
+ HAWKI_PROTYPE_BPM,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ filename) ;
+ cpl_free(filename) ;
+
+ if (flat[3] != NULL) {
+ /* Write the recomputed map */
+ filename=cpl_sprintf("hawki_cal_flat_recomputed_set%02d.fits", set_nb) ;
+ hawki_imagelist_save(set_tot,
+ parlist,
+ used_frames,
+ flat[3],
+ recipe_name,
+ HAWKI_CALPRO_FLAT_RECOMPUTED,
+ HAWKI_PROTYPE_FLAT,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ filename) ;
+ cpl_free(filename) ;
+ }
+
+ /* If the HOT pixel map is passed, merge with the COLD one */
+ if (bpmdark != NULL) {
+ if ((bpm = hawki_cal_flat_merge_bpms(bpmdark, flat[2])) == NULL) {
+ cpl_msg_error(__func__, "Cannot merge bad pixel maps") ;
+ } else {
+ filename=cpl_sprintf("hawki_cal_flat_bpm_set%02d.fits", set_nb) ;
+ /* Get the used frames for statistics */
+ hawki_imagelist_save(set_tot,
+ parlist,
+ used_frames,
+ bpm,
+ recipe_name,
+ HAWKI_CALPRO_BPM,
+ HAWKI_PROTYPE_BPM,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ filename) ;
+ cpl_free(filename) ;
+ cpl_imagelist_delete(bpm) ;
+ }
+ }
+ cpl_frameset_delete(used_frames);
+
+ /* Get the used frames for statistics */
+ used_frames = cpl_frameset_duplicate(flat_frames);
+
+ /* Write the table with the statistics */
+ filename = cpl_sprintf("hawki_cal_flat_stats_set%02d.fits", set_nb) ;
+ hawki_tables_save(set_tot,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_flat_stats,
+ recipe_name,
+ HAWKI_CALPRO_FLAT_STATS,
+ HAWKI_PROTYPE_FLAT_STATS,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ filename) ;
+ cpl_free(filename) ;
+
+ if(hawki_cal_flat_config.extra_stats)
+ {
+ filename = cpl_sprintf("hawki_cal_flat_stats_ec_set%02d.fits", set_nb);
+ hawki_tables_save(set_tot,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_flat_even_column_stats,
+ recipe_name,
+ HAWKI_CALPRO_FLAT_STATS_EVEN_COL,
+ HAWKI_PROTYPE_FLAT_STATS_EVEN_COL,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ filename) ;
+ cpl_free(filename) ;
+ filename = cpl_sprintf("hawki_cal_flat_stats_oc_set%02d.fits", set_nb);
+ hawki_tables_save(set_tot,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_flat_odd_column_stats,
+ recipe_name,
+ HAWKI_CALPRO_FLAT_STATS_ODD_COL,
+ HAWKI_PROTYPE_FLAT_STATS_ODD_COL,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ filename) ;
+ cpl_free(filename) ;
+ filename = cpl_sprintf("hawki_cal_flat_stats_er_set%02d.fits", set_nb);
+ hawki_tables_save(set_tot,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_flat_even_row_stats,
+ recipe_name,
+ HAWKI_CALPRO_FLAT_STATS_EVEN_ROW,
+ HAWKI_PROTYPE_FLAT_STATS_EVEN_ROW,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ filename) ;
+ cpl_free(filename) ;
+ filename = cpl_sprintf("hawki_cal_flat_stats_or_set%02d.fits", set_nb);
+ hawki_tables_save(set_tot,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_flat_odd_row_stats,
+ recipe_name,
+ HAWKI_CALPRO_FLAT_STATS_ODD_ROW,
+ HAWKI_PROTYPE_FLAT_STATS_ODD_ROW,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ filename) ;
+ cpl_free(filename) ;
+ }
+ cpl_frameset_delete(used_frames);
+
+ /* Free and return */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ cpl_propertylist_delete(qclists[i]) ;
+ }
+ cpl_free(qclists) ;
+ if (cpl_error_get_code()) return -1 ;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Comparison function to identify different settings
+ @param frame1 first frame
+ @param frame2 second frame
+ @return 0 if frame1!=frame2, 1 if frame1==frame2, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_compare(
+ const cpl_frame * frame1,
+ const cpl_frame * frame2)
+{
+ int comparison ;
+ cpl_propertylist * plist1 ;
+ cpl_propertylist * plist2 ;
+ const char * sval1,
+ * sval2 ;
+ double dval1, dval2 ;
+
+
+ /* Test entries */
+ if (frame1==NULL || frame2==NULL) return -1 ;
+
+ /* Get property lists */
+ if ((plist1=cpl_propertylist_load(cpl_frame_get_filename(frame1),
+ 0)) == NULL) {
+ cpl_msg_error(__func__, "getting header from reference frame");
+ return -1 ;
+ }
+ if ((plist2=cpl_propertylist_load(cpl_frame_get_filename(frame2),
+ 0)) == NULL) {
+ cpl_msg_error(__func__, "getting header from reference frame");
+ cpl_propertylist_delete(plist1) ;
+ return -1 ;
+ }
+
+ /* Test status */
+ if (cpl_error_get_code()) {
+ cpl_propertylist_delete(plist1) ;
+ cpl_propertylist_delete(plist2) ;
+ return -1 ;
+ }
+
+ comparison = 1 ;
+
+ /* Compare filters */
+ sval1 = hawki_pfits_get_filter(plist1) ;
+ sval2 = hawki_pfits_get_filter(plist2) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "cannot get the filter");
+ cpl_propertylist_delete(plist1) ;
+ cpl_propertylist_delete(plist2) ;
+ return -1 ;
+ }
+ if (strcmp(sval1, sval2)) comparison = 0 ;
+
+ /* Compare DITs */
+ dval1 = hawki_pfits_get_dit(plist1) ;
+ dval2 = hawki_pfits_get_dit(plist2) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(__func__, "cannot get the DIT");
+ cpl_propertylist_delete(plist1) ;
+ cpl_propertylist_delete(plist2) ;
+ return -1 ;
+ }
+ if (fabs(dval1-dval2) > 1e-4) comparison = 0 ;
+
+ cpl_propertylist_delete(plist1) ;
+ cpl_propertylist_delete(plist2) ;
+ return comparison ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Merge the 2 bad pixels maps
+ @param bpm_file BPM file name
+ @param bpm_ilist BPM image list
+ @return The merged BPM or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_imagelist * hawki_cal_flat_merge_bpms
+(const cpl_frame * bpm_orig,
+ cpl_imagelist * bpm_to_merge)
+{
+ cpl_imagelist * merged ;
+ cpl_imagelist * bpm_orig_im;
+ cpl_image * tmp ;
+ int i ;
+
+ /* Test entries */
+ if (bpm_orig==NULL || bpm_to_merge ==NULL) return NULL ;
+
+ /* Create merged */
+ merged = cpl_imagelist_new() ;
+
+ /* Load the bpm_file */
+ bpm_orig_im = hawki_load_frame(bpm_orig, CPL_TYPE_INT);
+ if(bpm_orig_im == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot read existing bpm %s",
+ cpl_frame_get_filename(bpm_orig));
+ cpl_imagelist_delete(merged);
+ return NULL;
+ }
+
+ /* Loop on the chips */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+
+ /* Merge */
+ tmp = cpl_image_add_create(cpl_imagelist_get(bpm_orig_im, i),
+ cpl_imagelist_get(bpm_to_merge, i));
+ cpl_image_multiply(cpl_imagelist_get(bpm_orig_im, i),
+ cpl_imagelist_get(bpm_to_merge, i));
+ cpl_image_subtract(tmp, cpl_imagelist_get(bpm_orig_im, i)) ;
+
+ /* Store */
+ cpl_imagelist_set(merged, tmp, i) ;
+ }
+
+ /* Clean-up and return */
+ cpl_imagelist_delete(bpm_orig_im);
+ return merged ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the frames selection process
+ @param meds the vector with the medians
+ @param auto_flag Flag to apply the automatic selection
+ @param min_level Minimum level
+ @param max_level Maximum level
+ @param min_nframes Minimum number of frames
+ @param max_nframes Maximum number of frames
+ @return The selection vector (>0 for selected, <0 for rejected)
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_flat_select
+(cpl_vector * meds,
+ cpl_vector * rms,
+ int auto_flag,
+ int auto_max_bins,
+ double min_level,
+ double max_level,
+ double max_rms,
+ int min_nframes,
+ cpl_vector * selection)
+{
+ double * pselection ;
+ double * pmeds ;
+ double * prms ;
+ int nvals ;
+ int nsel ;
+ double first_val, last_val, bin_val, dist, dist_min;
+ double bin_low_val;
+ double bin_up_val;
+ int nbins, ind_closest ;
+ int ibin;
+ int ival;
+
+ /* Test entries */
+ if (meds == NULL) return -1;
+ if (rms == NULL) return -1;
+ if (selection == NULL) return -1;
+ if(cpl_vector_get_size(meds) != cpl_vector_get_size(selection))
+ {
+ cpl_msg_error(__func__,
+ "The meds and selection vectors have not the same size");
+ return -1;
+ }
+
+ /* Initialise. All the frames are selected by default */
+ nvals = cpl_vector_get_size(meds);
+ pmeds = cpl_vector_get_data(meds);
+ prms = cpl_vector_get_data(rms);
+ cpl_vector_fill(selection, 1.0);
+
+ /* Pointer to selection */
+ pselection = cpl_vector_get_data(selection) ;
+
+ /* First select based on minimum level, if applies */
+ if (min_level >= 0.0)
+ {
+ for (ival=0 ; ival<nvals ; ival++)
+ {
+ if (pmeds[ival] < min_level)
+ pselection[ival] = -1.0 ;
+ }
+ }
+
+ /* Second select based on maximum level, if applies */
+ if (max_level >= 0.0)
+ {
+ for (ival=0 ; ival<nvals ; ival++)
+ {
+ if (pmeds[ival] > max_level)
+ pselection[ival] = -1.0 ;
+ }
+ }
+
+ /* Third select based on rms maximum level, if applies */
+ if (max_rms >= 0.0)
+ {
+ for (ival=0 ; ival<nvals ; ival++)
+ {
+ if (prms[ival] > max_rms)
+ pselection[ival] = -1.0 ;
+ }
+ }
+
+ /* Apply the histogram selection */
+ if (auto_flag)
+ {
+ /* Automatic */
+ cpl_vector * auto_selection;
+ auto_selection = cpl_vector_new(nvals);
+ cpl_vector_fill(auto_selection, -1.0);
+ cpl_msg_info(__func__, "Automatic dynamic range selection");
+ first_val = hawki_vector_get_min_select(meds, selection);
+ last_val = hawki_vector_get_max_select(meds, selection);
+
+ nbins = nvals ;
+ if (auto_max_bins > 0 && auto_max_bins < nvals) nbins = auto_max_bins;
+ for (ibin=0 ; ibin<nbins ; ibin++)
+ {
+ if(ibin == 0)
+ bin_val = first_val + (last_val-first_val)*(ibin+1)/nbins ;
+ else if(ibin == nbins - 1)
+ bin_val = first_val + (last_val-first_val)*(ibin)/nbins ;
+ else
+ bin_val = first_val + (last_val-first_val)*(ibin+0.5)/nbins ;
+ bin_low_val = first_val + (last_val-first_val)*(ibin)/nbins ;
+ bin_up_val = first_val + (last_val-first_val)*(ibin+1)/nbins ;
+
+ /* Select the closest */
+ dist_min = fabs(pmeds[0] - bin_val) ;
+ ind_closest = -1;
+ for (ival=0 ; ival<nvals ; ival++)
+ {
+ dist = fabs(pmeds[ival] - bin_val) ;
+ if (dist < dist_min && pselection[ival] != -1)
+ {
+ dist_min = dist;
+ ind_closest = ival;
+ }
+ }
+ if(ind_closest != -1)
+ cpl_vector_set(auto_selection, ind_closest, 1.0);
+ }
+ /* Use the auto_selection */
+ cpl_vector_copy(selection, auto_selection);
+ cpl_vector_delete(auto_selection);
+ }
+
+ /* Print and count the selected frames */
+ nsel = 0;
+ cpl_msg_indent_more();
+ for (ival=0 ; ival<nvals ; ival++)
+ {
+ if(pselection[ival] != -1)
+ {
+ cpl_msg_info(__func__, "Selected frame %d", ival+1) ;
+ nsel++;
+ }
+ }
+ cpl_msg_indent_less();
+
+ /* Check the number of selected against min_nframes */
+ if (nsel == 0) {
+ cpl_msg_error(__func__, "No frame selected. Check selection criteria");
+ return -1;
+ }
+ if (min_nframes >= 0) {
+ if (nsel < min_nframes) {
+ cpl_msg_error(__func__, "Not enough selected frames (%d < %d)",
+ nsel, min_nframes) ;
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the frames selection process
+ @param in the input vector
+ @param selection the selection vector
+ @return The selected vector or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_vector * hawki_cal_flat_extract_vector(
+ cpl_vector * in,
+ cpl_vector * selection)
+{
+ int nvals ;
+ cpl_vector * selected ;
+ double * pin ;
+ double * pselection ;
+ double * pselected ;
+ int nselected ;
+ int i ;
+
+ /* Test entries */
+ if (in == NULL) return NULL ;
+ if (selection == NULL) return NULL ;
+
+ /* Initialise */
+ nvals = cpl_vector_get_size(in) ;
+ nselected = 0 ;
+ pin = cpl_vector_get_data(in) ;
+ pselection = cpl_vector_get_data(selection) ;
+
+ /* Test entries */
+ if (nvals != cpl_vector_get_size(selection)) return NULL ;
+
+ /* Count the selected values */
+ for (i=0 ; i<nvals ; i++) {
+ if (pselection[i] > 0.0) nselected++ ;
+ }
+ if (nselected == 0) return NULL ;
+
+ /* Create the selected vector */
+ selected = cpl_vector_new(nselected) ;
+ pselected = cpl_vector_get_data(selected) ;
+
+ nselected = 0 ;
+ for (i=0 ; i<nvals ; i++) {
+ if (pselection[i] > 0.0) {
+ pselected[nselected] = pin[i] ;
+ nselected++ ;
+ }
+ }
+ return selected ;
+}
+
+static int hawki_cal_flat_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ const char * sval;
+ cpl_parameter * par;
+ int idet;
+
+ /* Initialise */
+ par = NULL ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ hawki_cal_flat_outputs.nb_badpix[idet] = -1 ;
+ hawki_cal_flat_outputs.med_stdev[idet] = -1.0 ;
+ hawki_cal_flat_outputs.med_avg[idet] = -1.0 ;
+ hawki_cal_flat_outputs.med_med[idet] = -1.0 ;
+ hawki_cal_flat_outputs.med_min[idet] = -1.0 ;
+ hawki_cal_flat_outputs.med_max[idet] = -1.0 ;
+ }
+
+ /* Retrieve input parameters */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.zone") ;
+ sval = cpl_parameter_get_string(par) ;
+ if (sscanf(sval, "%d,%d,%d,%d",
+ &hawki_cal_flat_config.llx,
+ &hawki_cal_flat_config.lly,
+ &hawki_cal_flat_config.urx,
+ &hawki_cal_flat_config.ury)!=4)
+ {
+ return -1 ;
+ }
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.sigma_badres") ;
+ hawki_cal_flat_config.sigma_badres = cpl_parameter_get_double(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.sigma_bpm") ;
+ hawki_cal_flat_config.sigma_bpm = cpl_parameter_get_double(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.lowval_bpm") ;
+ hawki_cal_flat_config.lowval_bpm = cpl_parameter_get_double(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.highval_bpm") ;
+ hawki_cal_flat_config.highval_bpm = cpl_parameter_get_double(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.normalise") ;
+ hawki_cal_flat_config.normalise = cpl_parameter_get_bool(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.second_pass") ;
+ hawki_cal_flat_config.second_pass = cpl_parameter_get_bool(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.select_auto") ;
+ hawki_cal_flat_config.select_auto = cpl_parameter_get_bool(par) ;
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_cal_flat.select_auto_max_bins") ;
+ hawki_cal_flat_config.select_auto_max_bins = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_cal_flat.select_min_level") ;
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%lf,%lf,%lf,%lf",
+ &hawki_cal_flat_config.select_min_level[0],
+ &hawki_cal_flat_config.select_min_level[1],
+ &hawki_cal_flat_config.select_min_level[2],
+ &hawki_cal_flat_config.select_min_level[3])!=4)
+ {
+ if (sscanf(sval, "%f", &hawki_cal_flat_config.select_min_level[0])!=1)
+ {
+ return -1;
+ }
+ else
+ {
+ hawki_cal_flat_config.select_min_level[1] =
+ hawki_cal_flat_config.select_min_level[0];
+ hawki_cal_flat_config.select_min_level[2] =
+ hawki_cal_flat_config.select_min_level[0];
+ hawki_cal_flat_config.select_min_level[3] =
+ hawki_cal_flat_config.select_min_level[0];
+ }
+ }
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_cal_flat.select_max_level") ;
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%lf,%lf,%lf,%lf",
+ &hawki_cal_flat_config.select_max_level[0],
+ &hawki_cal_flat_config.select_max_level[1],
+ &hawki_cal_flat_config.select_max_level[2],
+ &hawki_cal_flat_config.select_max_level[3])!=4)
+ {
+ if (sscanf(sval, "%f", &hawki_cal_flat_config.select_max_level[0])!=1)
+ {
+ return -1;
+ }
+ else
+ {
+ hawki_cal_flat_config.select_max_level[1] =
+ hawki_cal_flat_config.select_max_level[0];
+ hawki_cal_flat_config.select_max_level[2] =
+ hawki_cal_flat_config.select_max_level[0];
+ hawki_cal_flat_config.select_max_level[3] =
+ hawki_cal_flat_config.select_max_level[0];
+ }
+ }
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_cal_flat.select_max_rms") ;
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%lf,%lf,%lf,%lf",
+ hawki_cal_flat_config.select_max_rms,
+ hawki_cal_flat_config.select_max_rms+1,
+ hawki_cal_flat_config.select_max_rms+2,
+ hawki_cal_flat_config.select_max_rms+3)!=4)
+ {
+ if (sscanf(sval, "%f", &hawki_cal_flat_config.select_max_rms[0])!=1)
+ {
+ return -1;
+ }
+ else
+ {
+ hawki_cal_flat_config.select_max_rms[1] =
+ hawki_cal_flat_config.select_max_rms[0];
+ hawki_cal_flat_config.select_max_rms[2] =
+ hawki_cal_flat_config.select_max_rms[0];
+ hawki_cal_flat_config.select_max_rms[3] =
+ hawki_cal_flat_config.select_max_rms[0];
+ }
+ }
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_cal_flat.select_min_nframes") ;
+ hawki_cal_flat_config.select_min_nframes = cpl_parameter_get_int(par) ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_flat.extra_stats") ;
+ hawki_cal_flat_config.extra_stats = cpl_parameter_get_bool(par) ;
+
+ if(hawki_cal_flat_config.select_auto_max_bins != -1 &&
+ !hawki_cal_flat_config.select_auto)
+ {
+ cpl_msg_error(__func__,"Max bins is only allowed with select_auto");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/recipes/hawki_cal_zpoint.c b/recipes/hawki_cal_zpoint.c
new file mode 100644
index 0000000..bdc612a
--- /dev/null
+++ b/recipes/hawki_cal_zpoint.c
@@ -0,0 +1,1892 @@
+/* $Id: hawki_cal_zpoint.c,v 1.34 2012/04/23 09:58:56 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/04/23 09:58:56 $
+ * $Revision: 1.34 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+#include "irplib_calib.h"
+#include "irplib_strehl.h"
+#include "irplib_stdstar.h"
+#include "irplib_cat.h"
+#include "irplib_wcs.h"
+
+#include "hawki_image_stats.h"
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_alloc.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_cal_zpoint_create(cpl_plugin *) ;
+static int hawki_cal_zpoint_exec(cpl_plugin *) ;
+static int hawki_cal_zpoint_destroy(cpl_plugin *) ;
+static int hawki_cal_zpoint(cpl_parameterlist *, cpl_frameset *) ;
+
+static void hawki_cal_zpoint_output_init(void);
+static int hawki_cal_zpoint_retrieve_input_param
+(cpl_parameterlist * parlist);
+static cpl_table ** hawki_cal_zpoint_reduce
+(cpl_frameset * set,
+ const char * stdstars,
+ const char * bpm,
+ const char * flat,
+ cpl_table ** raw_zpoint_stats,
+ int * labels,
+ cpl_imagelist ** images);
+static int hawki_cal_zpoint_save
+(cpl_table ** zpoint_tables,
+ int * labels,
+ cpl_imagelist * images,
+ cpl_table ** raw_zpoint_stats,
+ cpl_frameset * zpoint_frames,
+ cpl_frameset * calib_frames,
+ const cpl_frame * stars_frame,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set);
+static int hawki_cal_zpoint_compute_qc
+(cpl_propertylist * qcmainparams,
+ cpl_propertylist ** qcextparams,
+ cpl_frameset * set);
+static cpl_table ** hawki_cal_zpoint_photom
+(cpl_imagelist * ilist,
+ cpl_bivector * pos,
+ int * labels);
+static int hawki_cal_zpoint_get_mag(const char *, double, double, hawki_band) ;
+static int hawki_cal_zpoint_compute_keywords
+(cpl_frameset * set,
+ int * labels);
+static cpl_error_code hawki_cal_zpoint_get_expected_pos
+(cpl_frameset * set,
+ int * labels);
+int hawki_cal_zpoint_check_epoch_equinox(cpl_propertylist * plist);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct {
+ /* Inputs */
+ double xcoord[HAWKI_NB_DETECTORS] ;
+ double ycoord[HAWKI_NB_DETECTORS] ;
+ double target_ra;
+ double target_dec;
+ double stdstar_given_magnitude;
+ double detect_sigma ;
+ int sx ;
+ int sy ;
+ double phot_star_radius ;
+ double phot_bg_r1 ;
+ double phot_bg_r2 ;
+} hawki_cal_zpoint_config;
+
+static struct {
+ /* Outputs */
+ double dit;
+ double pixscale;
+ char filter[512];
+ hawki_band band;
+ char starname[512];
+ char sptype[512];
+ char catalog[512];
+ double humidity;
+ double airmass[HAWKI_NB_DETECTORS];
+ double zpoint[HAWKI_NB_DETECTORS];
+ double atx0[HAWKI_NB_DETECTORS];
+ double posx[HAWKI_NB_DETECTORS];
+ double posy[HAWKI_NB_DETECTORS];
+ double flux[HAWKI_NB_DETECTORS];
+ double instrmag[HAWKI_NB_DETECTORS];
+ double peak[HAWKI_NB_DETECTORS];
+ double bgd[HAWKI_NB_DETECTORS];
+ double fwhmx[HAWKI_NB_DETECTORS];
+ double fwhmy[HAWKI_NB_DETECTORS];
+ double fwhm[HAWKI_NB_DETECTORS];
+ double fwhmx_as[HAWKI_NB_DETECTORS];
+ double fwhmy_as[HAWKI_NB_DETECTORS];
+ double fwhm_as[HAWKI_NB_DETECTORS];
+ double mean_zpoint;
+ double mean_atx0;
+ double mean_airmass;
+ double ext_coeff;
+ double stdstar_ra;
+ double stdstar_dec;
+ double stdstar_mag_filter;
+ double stdstar_mag_H;
+ double stdstar_mag_J;
+ double stdstar_mag_K;
+ double stdstar_mag_Y;
+ int stdstar_incat_found;
+ int stdstar_mag_available;
+ int stdstar_image_detected[HAWKI_NB_DETECTORS];
+ int zpoint_computable[HAWKI_NB_DETECTORS];
+ int zpoint_mean_computable;
+} hawki_cal_zpoint_outputs;
+
+static char hawki_cal_zpoint_description[] =
+"hawki_cal_zpoint -- Zero point recipe\n"
+"The input of the recipe files listed in the Set Of Frames (sof-file)\n"
+"must be tagged as:\n"
+"raw-file.fits "HAWKI_CAL_ZPOINT_RAW" or\n"
+"stdstars-file.fits "HAWKI_CALPRO_STDSTARS" or\n"
+"flat-file.fits "HAWKI_CALPRO_FLAT" or\n"
+"bpm-file.fits "HAWKI_CALPRO_BPM"\n"
+"The recipe creates as an output:\n"
+"hawki_cal_zpoint.fits ("HAWKI_CALPRO_ZPOINT_TAB"): Zero point solution table\n"
+"hawki_cal_zpoint_check.fits ("HAWKI_CALPRO_ZPOINT_IMA"): Standard star images corrected (for checking purposes)\n"
+"hawki_cal_zpoint_stats.fits ("HAWKI_CALPRO_ZPOINT_STATS"): Statistics of the raw standard star images\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe));
+ cpl_plugin * plugin = &recipe->interface;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_cal_zpoint",
+ "Zero point computation recipe",
+ hawki_cal_zpoint_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_cal_zpoint_create,
+ hawki_cal_zpoint_exec,
+ hawki_cal_zpoint_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new();
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --detect_sigma */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.detect_sigma",
+ CPL_TYPE_DOUBLE, "the sigma value for object detection",
+ "hawki.hawki_cal_zpoint", 7.0);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "detect_sigma") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --star_r */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.star_r",CPL_TYPE_DOUBLE,
+ "the star radius", "hawki.hawki_cal_zpoint", -1.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "star_r") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --bg_r1 */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.bg_r1", CPL_TYPE_DOUBLE,
+ "the internal background radius", "hawki.hawki_cal_zpoint", -1.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bg_r1") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --bg_r2 */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.bg_r2", CPL_TYPE_DOUBLE,
+ "the external background radius", "hawki.hawki_cal_zpoint", -1.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bg_r2") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --ra */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.ra", CPL_TYPE_DOUBLE,
+ "RA in degrees", "hawki.hawki_cal_zpoint", 999.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ra") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --dec */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.dec", CPL_TYPE_DOUBLE,
+ "DEC in degrees", "hawki.hawki_cal_zpoint", 999.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dec") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --mag */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.mag", CPL_TYPE_DOUBLE,
+ "magnitude", "hawki.hawki_cal_zpoint", 99.0) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "mag") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --sx */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.sx", CPL_TYPE_INT,
+ "x half-size of the search box", "hawki.hawki_cal_zpoint", 100) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sx") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --sy */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.sy", CPL_TYPE_INT,
+ "y half-size of the search box", "hawki.hawki_cal_zpoint", 100) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sy") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --xcoord */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.xcoord", CPL_TYPE_STRING,
+ "Coordinates in X where the standard star is located. If -1 use WCS",
+ "hawki.hawki_cal_zpoint", "-1., -1., -1., -1.");
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xcoord") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+ /* --ycoord */
+ p = cpl_parameter_new_value("hawki.hawki_cal_zpoint.ycoord", CPL_TYPE_STRING,
+ "Coordinates in Y where the standard star is located. If -1 use WCS",
+ "hawki.hawki_cal_zpoint", "-1., -1., -1., -1.") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ycoord") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_cal_zpoint(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_parameter * par ;
+ const char * flat ;
+ const char * bpm ;
+ const char * stdstars ;
+ cpl_frameset * zpoint_frames ;
+ cpl_frameset * calib_frames ;
+ const cpl_frame * stars_frame;
+ cpl_table ** raw_zpoint_stats;
+ cpl_table ** zpoint_tables;
+ cpl_imagelist * std_star_images ;
+ int * labels;
+ int idet;
+
+ /* Initialise Output */
+ hawki_cal_zpoint_output_init();
+ zpoint_frames = NULL ;
+ par = NULL ;
+
+ /* Retrieve input parameters */
+ if(hawki_cal_zpoint_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve calibration data */
+ calib_frames = cpl_frameset_new();
+ flat = hawki_extract_first_filename(framelist, HAWKI_CALPRO_FLAT) ;
+ if(flat)
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+ cpl_frameset_find_const(framelist, HAWKI_CALPRO_FLAT)));
+ bpm = hawki_extract_first_filename(framelist, HAWKI_CALPRO_BPM) ;
+ if(bpm)
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+ cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM)));
+
+ /* STD stars catalog requested */
+ stars_frame = cpl_frameset_find_const(framelist, HAWKI_CALPRO_STDSTARS);
+ if (stars_frame == NULL)
+ {
+ cpl_msg_error(__func__,"Cannot find the catalog in the input list (%s)",
+ HAWKI_CALPRO_STDSTARS);
+ cpl_frameset_delete(calib_frames);
+ return -1 ;
+ }
+ stdstars = cpl_frame_get_filename(stars_frame);
+
+ /* Retrieve raw frames */
+ if ((zpoint_frames = hawki_extract_frameset(framelist,
+ HAWKI_CAL_ZPOINT_RAW)) != NULL) {
+ } else {
+ cpl_msg_error(__func__, "Cannot find raw frames in the input list (%s)",
+ HAWKI_CAL_ZPOINT_RAW);
+ cpl_frameset_delete(calib_frames);
+ return -1 ;
+ }
+
+ /* Exactly 4 images are expected */
+ if (cpl_frameset_get_size(zpoint_frames) != 4) {
+ cpl_msg_error(__func__,
+ "4 input raw frames are expected, not %"CPL_SIZE_FORMAT,
+ cpl_frameset_get_size(zpoint_frames)) ;
+ cpl_frameset_delete(zpoint_frames) ;
+ cpl_frameset_delete(calib_frames);
+ return -1 ;
+ }
+
+ /* Create the statistics table */
+ raw_zpoint_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ for(idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ raw_zpoint_stats[idet] = cpl_table_new(
+ cpl_frameset_get_size(zpoint_frames));
+ }
+ hawki_image_stats_initialize(raw_zpoint_stats);
+
+ /* Compute the zpoint values */
+ cpl_msg_info(__func__, "Reduce the data") ;
+ cpl_msg_indent_more() ;
+ labels = cpl_calloc(cpl_frameset_get_size(zpoint_frames), sizeof(int)) ;
+ if ((zpoint_tables = hawki_cal_zpoint_reduce(zpoint_frames, stdstars,
+ bpm, flat, raw_zpoint_stats, labels, &std_star_images))==NULL)
+ {
+ cpl_msg_error(__func__, "Cannot reduce the data") ;
+ cpl_frameset_delete(zpoint_frames) ;
+ cpl_frameset_delete(calib_frames);
+ hawki_table_delete(raw_zpoint_stats);
+ cpl_free(labels);
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Save the products") ;
+ cpl_msg_indent_more() ;
+ if (hawki_cal_zpoint_save
+ (zpoint_tables, labels, std_star_images, raw_zpoint_stats,
+ zpoint_frames, calib_frames, stars_frame,
+ parlist, framelist) == -1)
+ {
+ cpl_msg_warning(__func__, "Data could not be saved. "
+ "Check permisions or disk space") ;
+ cpl_frameset_delete(zpoint_frames);
+ hawki_table_delete(zpoint_tables) ;
+ cpl_imagelist_delete(std_star_images) ;
+ cpl_frameset_delete(calib_frames);
+ hawki_table_delete(raw_zpoint_stats);
+ cpl_free(labels);
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Free and return */
+ cpl_frameset_delete(zpoint_frames);
+ cpl_frameset_delete(calib_frames);
+ cpl_imagelist_delete(std_star_images);
+ hawki_table_delete(zpoint_tables);
+ hawki_table_delete(raw_zpoint_stats);
+ cpl_free(labels);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param set the set of frames
+ @param stdstars the stad stars
+ @param bpm the bad pixel map name or NULL
+ @param flat the flat field name or NULL
+ @param images the images where the photometry is computed
+ @return a cpl_table with the results or NULL
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_table ** hawki_cal_zpoint_reduce
+(cpl_frameset * set,
+ const char * stdstars,
+ const char * bpm,
+ const char * flat,
+ cpl_table ** raw_zpoint_stats,
+ int * labels,
+ cpl_imagelist ** star_images)
+{
+ cpl_frame * cur_frame ;
+ cpl_propertylist * plist ;
+ const char * sval ;
+ cpl_imagelist * star_images_frame_order ;
+ int nima ;
+ cpl_bivector * positions ;
+ cpl_image * filt_ima ;
+ cpl_mask * kernel;
+ int size_x, size_y ;
+ double pos_x, pos_y, pos_x_cen, pos_y_cen, dist, min_dist ;
+ cpl_apertures * aperts ;
+ cpl_table ** zpoint_tables;
+ cpl_image * tmp_ima ;
+ int iaper;
+ int idet;
+ int iframe;
+ int iframe_star = -1;
+ int nframes;
+ char rastr[32];
+ char decstr[32];
+ cpl_errorstate error_prevstate;
+ int return_code;
+
+ /* Check inputs */
+ if (set == NULL) return NULL ;
+ if (stdstars == NULL) return NULL ;
+ if (star_images == NULL) return NULL ;
+
+ /* Get the filter name, DIT, Target RA and DEC */
+ error_prevstate = cpl_errorstate_get();
+ cur_frame = cpl_frameset_get_frame(set, 0) ;
+ plist=cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0) ;
+ if ((sval = hawki_pfits_get_filter(plist)) == NULL) return NULL ;
+ else sprintf(hawki_cal_zpoint_outputs.filter, sval) ;
+ if (hawki_cal_zpoint_config.target_ra > 998.0)
+ {
+ hawki_cal_zpoint_config.target_ra = hawki_pfits_get_targ_alpha(plist);
+ //hawki_cal_zpoint_config.target_ra = hawki_pfits_get_ra(plist) -
+ //hawki_pfits_get_cumoffseta(plist) / 3600.;// Not valid before Nov 2008
+ if(hawki_cal_zpoint_check_epoch_equinox(plist) == -1)
+ {
+ cpl_propertylist_delete(plist);
+ return NULL;
+ }
+ }
+ if (hawki_cal_zpoint_config.target_dec > 998.0)
+ {
+ hawki_cal_zpoint_config.target_dec = hawki_pfits_get_targ_delta(plist);
+ //hawki_cal_zpoint_config.target_dec = hawki_pfits_get_dec(plist) -
+ //hawki_pfits_get_cumoffsetd(plist) / 3600.;// Not valid before Nov 2008
+ if(hawki_cal_zpoint_check_epoch_equinox(plist) == -1)
+ {
+ cpl_propertylist_delete(plist);
+ return NULL;
+ }
+ }
+ hawki_cal_zpoint_outputs.dit = hawki_pfits_get_dit(plist) ;
+ hawki_cal_zpoint_outputs.pixscale = hawki_pfits_get_pixscale(plist) ;
+ cpl_propertylist_delete(plist) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_error(__func__, "Cannot get keywords from main header:");
+ cpl_msg_indent_more();
+ cpl_msg_error(__func__, "%s",cpl_error_get_message());
+ cpl_msg_indent_less();
+ return NULL ;
+ }
+ cpl_msg_info(__func__,"Searching catalog stars closest to target:");
+ cpl_msg_indent_more();
+ hawki_utils_ra2str(rastr, 32, hawki_cal_zpoint_config.target_ra);
+ hawki_utils_dec2str(decstr, 32, hawki_cal_zpoint_config.target_dec);
+ cpl_msg_info(__func__,"RA = %g (%s); DEC = %g (%s)",
+ hawki_cal_zpoint_config.target_ra, rastr,
+ hawki_cal_zpoint_config.target_dec, decstr);
+ cpl_msg_info(__func__,"HAWK-I Filter: %s", hawki_cal_zpoint_outputs.filter);
+ cpl_msg_indent_less();
+
+ /* Get the band */
+ if ((hawki_cal_zpoint_outputs.band =
+ hawki_get_band(hawki_cal_zpoint_outputs.filter)) ==
+ HAWKI_BAND_UNKNOWN) {
+ cpl_msg_error(__func__, "Cannot associate the filter %s to a band",
+ hawki_cal_zpoint_outputs.filter) ;
+ return NULL ;
+ }
+
+ /* Get the standard star information from database */
+ cpl_msg_indent_more();
+ return_code = hawki_cal_zpoint_get_mag(stdstars,
+ hawki_cal_zpoint_config.target_ra,
+ hawki_cal_zpoint_config.target_dec,
+ hawki_cal_zpoint_outputs.band);
+ if (return_code == -1)
+ {
+ cpl_msg_error(__func__, "Could not open star database");
+ return NULL ;
+ }
+ else if(return_code == 1)
+ {
+ cpl_msg_warning(__func__,"No suitable star found in catalog");
+ cpl_msg_warning(__func__,"Using the target coordinates "
+ "as the standard star coordinates: ");
+ hawki_cal_zpoint_outputs.stdstar_ra =
+ hawki_cal_zpoint_config.target_ra;
+ hawki_cal_zpoint_outputs.stdstar_dec =
+ hawki_cal_zpoint_config.target_dec;
+ hawki_utils_ra2str(rastr, 32, hawki_cal_zpoint_outputs.stdstar_ra);
+ hawki_utils_dec2str(decstr, 32, hawki_cal_zpoint_outputs.stdstar_dec);
+ cpl_msg_info(__func__, " RA = %g (%s) ; DEC = %g (%s)",
+ hawki_cal_zpoint_outputs.stdstar_ra, rastr,
+ hawki_cal_zpoint_outputs.stdstar_dec, decstr);
+ }
+ else
+ {
+ cpl_msg_info(__func__, "Catalog where the star was found: %s",
+ hawki_cal_zpoint_outputs.catalog);
+ cpl_msg_info(__func__, "Star name: %s",
+ hawki_cal_zpoint_outputs.starname);
+ if(hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+ {
+ cpl_msg_info(__func__, "Star magnitude in filter %s : %g [mag]",
+ hawki_cal_zpoint_outputs.filter,
+ hawki_cal_zpoint_outputs.stdstar_mag_filter);
+ }
+ hawki_utils_ra2str(rastr, 32, hawki_cal_zpoint_outputs.stdstar_ra);
+ hawki_utils_dec2str(decstr, 32, hawki_cal_zpoint_outputs.stdstar_dec);
+ cpl_msg_info(__func__, "Star coordinates: RA = %g (%s) ; DEC = %g (%s)",
+ hawki_cal_zpoint_outputs.stdstar_ra, rastr,
+ hawki_cal_zpoint_outputs.stdstar_dec, decstr);
+ }
+ if (hawki_cal_zpoint_config.stdstar_given_magnitude < 98.0)
+ {
+ hawki_cal_zpoint_outputs.stdstar_mag_available = 1;
+ hawki_cal_zpoint_outputs.stdstar_mag_filter =
+ hawki_cal_zpoint_config.stdstar_given_magnitude;
+ cpl_msg_info(__func__, "Using user defined "
+ "star magnitude in filter %s : %g [mag]",
+ hawki_cal_zpoint_outputs.filter,
+ hawki_cal_zpoint_outputs.stdstar_mag_filter);
+ }
+ cpl_msg_indent_less();
+
+ /* Labelise frames */
+ cpl_msg_info(__func__, "Guessing which frame the STD is in for each chip");
+ hawki_detectors_locate_star
+ (set, hawki_cal_zpoint_outputs.stdstar_ra,
+ hawki_cal_zpoint_outputs.stdstar_dec, labels);
+ if (labels == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot determine which frame the STD is on") ;
+ return NULL ;
+ }
+
+ /* Compute the expected position of the star in pixels */
+ /* This is stored in hawki_cal_zpoint_config.xcoord, ycoord */
+ cpl_msg_indent_more();
+ if(hawki_cal_zpoint_get_expected_pos(set, labels) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Could not determine where the star is located");
+ cpl_msg_indent_less();
+ return NULL;
+ }
+ cpl_msg_indent_less();
+
+ /* Fetch the airmass and humidity */
+ hawki_cal_zpoint_compute_keywords(set, labels);
+
+ /* Create the positions vector */
+ nima = cpl_frameset_get_size(set) ;
+ positions = cpl_bivector_new(nima) ;
+
+ /* Initialize */
+ *star_images = cpl_imagelist_new();
+
+ /* Loop on the detectors */
+ nframes = cpl_frameset_get_size(set) ;
+ cpl_msg_info(__func__,"Loop on the chips");
+ cpl_msg_indent_more() ;
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_imagelist * sky_images;
+ cpl_image * star_ima = NULL;
+ cpl_image * sky;
+ cpl_image * flat_im;
+ int ext_nb;
+
+ cpl_msg_info(__func__, "Loading the chip %d", idet+1);
+ cpl_msg_indent_more() ;
+
+ /* Allocate */
+ sky_images = cpl_imagelist_new();
+
+ cpl_msg_indent_more() ;
+ for (iframe=0 ; iframe<nframes ; iframe++)
+ {
+ cpl_image * ima_cur;
+
+ /* Load the image */
+ ima_cur = hawki_load_image(set, iframe, idet+1, CPL_TYPE_FLOAT) ;
+ if(ima_cur == NULL)
+ {
+ cpl_bivector_delete(positions) ;
+ cpl_imagelist_delete(*star_images);
+ cpl_imagelist_delete(sky_images) ;
+ cpl_msg_error(__func__, "Error reading image");
+ return NULL;
+ }
+ /* Get image statistics */
+ size_x = cpl_image_get_size_x(ima_cur) ;
+ size_y = cpl_image_get_size_y(ima_cur) ;
+ if(hawki_image_stats_fill_from_image
+ (raw_zpoint_stats,
+ ima_cur,
+ 1,
+ 1,
+ size_x,
+ size_y,
+ idet,
+ iframe) !=0 )
+ {
+ cpl_msg_error(__func__,"Cannot compute stats on ima %d det %d",
+ iframe+1, idet+1);
+ cpl_bivector_delete(positions) ;
+ cpl_imagelist_delete(*star_images);
+ cpl_imagelist_delete(sky_images) ;
+ cpl_image_delete(ima_cur);
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+
+ /* Add the image to either the sky images or the star image */
+ if(labels[iframe] == idet + 1)
+ {
+ star_ima = ima_cur;
+ iframe_star = iframe;
+ }
+ else
+ cpl_imagelist_set(sky_images, ima_cur,
+ cpl_imagelist_get_size(sky_images));
+ }
+ cpl_msg_indent_less();
+
+ /* Create the sky */
+ cpl_msg_info(__func__, "Correct for the sky");
+ sky = cpl_imagelist_collapse_median_create(sky_images);
+ cpl_imagelist_delete(sky_images) ;
+
+ /* Subtract the sky */
+ cpl_image_subtract(star_ima, sky) ;
+ cpl_image_delete(sky) ;
+
+ /* Divide by the flatfield if one is provided */
+ if (flat) {
+ cpl_msg_info(__func__, "Correct for the flat") ;
+
+ /* Get the extension with the current chip */
+ if ((ext_nb = hawki_get_ext_from_detector(flat, idet + 1)) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot get the extension with chip %d",
+ idet + 1);
+ cpl_imagelist_delete(*star_images) ;
+ cpl_bivector_delete(positions) ;
+ return NULL ;
+ }
+ /* Load */
+ flat_im = cpl_image_load(flat, CPL_TYPE_FLOAT, 0, ext_nb) ;
+ cpl_image_divide(star_ima, flat_im) ;
+ cpl_image_delete(flat_im) ;
+ }
+
+ /* Correct the bad pixels */
+ if (bpm) {
+ cpl_msg_info(__func__, "Correct for the bad pixels") ;
+ if (hawki_bpm_calib(star_ima, bpm, idet + 1) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot correct the BPM for chip %d",
+ idet + 1);
+ cpl_imagelist_delete(*star_images) ;
+ cpl_bivector_delete(positions) ;
+ return NULL ;
+ }
+ }
+
+ /* Put the result in the image list */
+ cpl_imagelist_set(*star_images, star_ima,
+ cpl_imagelist_get_size(*star_images)) ;
+
+ /* Object detection */
+ cpl_msg_info(__func__,"For chip %d the STD should be on frame %d",
+ idet + 1, iframe_star+1);
+ pos_x_cen = pos_y_cen = -1.0 ;
+ size_x = cpl_image_get_size_x(star_ima) ;
+ size_y = cpl_image_get_size_y(star_ima) ;
+
+ /* Filtering the image*/
+ kernel = cpl_mask_new(3, 3);
+ cpl_mask_not(kernel);
+ filt_ima = cpl_image_new(cpl_image_get_size_x(star_ima),
+ cpl_image_get_size_y(star_ima),
+ cpl_image_get_type(star_ima));
+ cpl_image_filter_mask(filt_ima, star_ima, kernel, CPL_FILTER_MEDIAN,
+ CPL_BORDER_FILTER);
+ cpl_mask_delete(kernel);
+
+ /* Looking for apertures */
+ aperts = cpl_apertures_extract_sigma(filt_ima,
+ hawki_cal_zpoint_config.detect_sigma) ;
+ cpl_image_delete(filt_ima) ;
+ if (aperts == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find the central object") ;
+ cpl_imagelist_delete(*star_images) ;
+ cpl_bivector_delete(positions) ;
+ return NULL ;
+ }
+ min_dist = size_x * size_x + size_y * size_y ;
+ for (iaper=0 ; iaper<cpl_apertures_get_size(aperts) ; iaper++) {
+ pos_x = cpl_apertures_get_centroid_x(aperts, iaper+1) ;
+ pos_y = cpl_apertures_get_centroid_y(aperts, iaper+1) ;
+ dist = (pos_x-hawki_cal_zpoint_config.xcoord[idet])*
+ (pos_x-hawki_cal_zpoint_config.xcoord[idet]) +
+ (pos_y-hawki_cal_zpoint_config.ycoord[idet])*
+ (pos_y-hawki_cal_zpoint_config.ycoord[idet]);
+ if (dist<min_dist) {
+ min_dist = dist ;
+ pos_x_cen = pos_x ;
+ pos_y_cen = pos_y ;
+ }
+ }
+ cpl_apertures_delete(aperts) ;
+
+ cpl_vector_set(cpl_bivector_get_x(positions), iframe_star, pos_x_cen) ;
+ cpl_vector_set(cpl_bivector_get_y(positions), iframe_star, pos_y_cen) ;
+ cpl_msg_info(__func__, "Expected star position: %g %g",
+ hawki_cal_zpoint_config.xcoord[idet],
+ hawki_cal_zpoint_config.ycoord[idet]);
+ cpl_msg_info(__func__, "Bright object position: %g %g",
+ pos_x_cen, pos_y_cen) ;
+
+ /* Check that the star is within the search window */
+ if(fabs(pos_x_cen - hawki_cal_zpoint_config.xcoord[idet]) >
+ hawki_cal_zpoint_config.sx ||
+ fabs(pos_y_cen - hawki_cal_zpoint_config.ycoord[idet]) >
+ hawki_cal_zpoint_config.sy)
+ {
+ hawki_cal_zpoint_outputs.stdstar_image_detected[idet] = 0;
+ cpl_msg_warning(cpl_func,"No object has been found within the box"
+ "limits [%d, %d] around the expected position",
+ hawki_cal_zpoint_config.sx,
+ hawki_cal_zpoint_config.sy);
+ }
+ else
+ {
+ hawki_cal_zpoint_outputs.stdstar_image_detected[idet] = 1;
+ }
+
+ /* Free */
+ cpl_msg_indent_less() ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Reorder the images (frame order) */
+ star_images_frame_order = cpl_imagelist_new() ;
+ for (iframe=0 ; iframe< nframes; iframe++)
+ {
+ tmp_ima = cpl_image_duplicate
+ (cpl_imagelist_get(*star_images, labels[iframe] -1 ));
+ cpl_imagelist_set(star_images_frame_order, tmp_ima, iframe);
+ }
+
+ /* Compute the photometry */
+ cpl_msg_info(__func__, "Compute the photometry") ;
+ cpl_msg_indent_more() ;
+ if ((zpoint_tables = hawki_cal_zpoint_photom
+ (star_images_frame_order, positions, labels))==NULL) {
+ cpl_msg_error(__func__, "Cannot reduce") ;
+ cpl_bivector_delete(positions) ;
+ cpl_imagelist_delete(star_images_frame_order) ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+
+
+ /* Free and exit */
+ cpl_msg_indent_less() ;
+ cpl_bivector_delete(positions) ;
+ cpl_imagelist_delete(star_images_frame_order) ;
+
+ return zpoint_tables;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Reduce one image
+ @param ilist the input image list
+ @param pos the objects positions
+ @param labels the chip numbers
+ @return the newly allocated table with the following columns:
+ POSX POSY ZPOINT FLUX BGD PEAK FWHMX FWHMY
+ or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_table ** hawki_cal_zpoint_photom(
+ cpl_imagelist * ilist,
+ cpl_bivector * pos,
+ int * labels)
+{
+ cpl_table ** zpoint;
+ int nframes;
+ double r, r1, r2;
+ double stdstar_mag;
+ double dit;
+ double extinction;
+ double pixscale;
+ cpl_image * ima ;
+ double * pos_x ;
+ double * pos_y ;
+ double bgd, fl, zp, peak, fwhm_x, fwhm_y ;
+ cpl_bivector * iqe_res ;
+ int iframe;
+ int idet;
+
+ /* Test entries */
+ if (ilist == NULL) return NULL ;
+ if (pos == NULL) return NULL ;
+
+ /* Initialise */
+ nframes = cpl_imagelist_get_size(ilist) ;
+ stdstar_mag = hawki_cal_zpoint_outputs.stdstar_mag_filter;
+ dit = hawki_cal_zpoint_outputs.dit ;
+ pixscale = hawki_cal_zpoint_outputs.pixscale ;
+
+ /* Get extinction */
+ switch (hawki_cal_zpoint_outputs.band) {
+ case HAWKI_BAND_J: extinction = 0.098 ; break ;
+ case HAWKI_BAND_H: extinction = 0.039 ; break ;
+ case HAWKI_BAND_K: extinction = 0.065 ; break ;
+ case HAWKI_BAND_Y: extinction = 0.00 ; break ;
+ default: extinction = 0.00 ; break ;
+ }
+ hawki_cal_zpoint_outputs.ext_coeff = extinction;
+ cpl_msg_info(__func__,"Using tabulated extinction for band %s: %f",
+ hawki_cal_zpoint_outputs.filter, extinction);
+
+ /* Loop on the images */
+ for (iframe=0 ; iframe<nframes ; iframe++) {
+ idet = labels[iframe]-1;
+ if(hawki_cal_zpoint_outputs.stdstar_image_detected[idet] == 1)
+ {
+ /* Get the current image */
+ ima = cpl_imagelist_get(ilist, iframe) ;
+
+ /* Get the current position */
+ pos_x = cpl_bivector_get_x_data(pos) ;
+ pos_y = cpl_bivector_get_y_data(pos) ;
+
+ /* FWHM_X / FWHM_Y */
+ iqe_res = cpl_image_iqe
+ (ima, (int)(pos_x[iframe]-10.0), (int)(pos_y[iframe]-10.0),
+ (int)(pos_x[iframe]+10.0), (int)(pos_y[iframe]+10.0));
+ if (iqe_res == NULL)
+ {
+ cpl_msg_debug(__func__,"Cannot compute FWHM for chip %d",
+ idet + 1);
+ fwhm_x = fwhm_y = -1.0 ;
+ cpl_error_reset() ;
+ } else {
+ fwhm_x = cpl_vector_get(cpl_bivector_get_x(iqe_res), 2) ;
+ fwhm_y = cpl_vector_get(cpl_bivector_get_x(iqe_res), 3) ;
+ cpl_bivector_delete(iqe_res) ;
+ }
+
+ /* Determine the radii */
+ r = hawki_cal_zpoint_config.phot_star_radius ;
+ if (r < 0) {
+ if (fwhm_x>0 && fwhm_y>0) r = 5*(fwhm_x+fwhm_y)/2.0 ;
+ else r = HAWKI_PHOT_STAR_RADIUS ;
+ }
+ r1 = hawki_cal_zpoint_config.phot_bg_r1 ;
+ r2 = hawki_cal_zpoint_config.phot_bg_r2 ;
+ if (r1 < 0) r1 = r + 10.0 ;
+ if (r2 < 0) r2 = r1 + 20.0 ;
+ //cpl_msg_info(__func__, "Use radii for star: %g and background: %g, %g",
+ // r, r1, r2) ;
+
+ /* Compute the photometry */
+ /* Background */
+ bgd = irplib_strehl_ring_background(ima, (int)(pos_x[iframe]),
+ (int)(pos_y[iframe]), (int)r1, (int)r2, IRPLIB_BG_METHOD_MEDIAN);
+ /* Flux */
+ fl = irplib_strehl_disk_flux(ima,
+ (int)(pos_x[iframe]), (int)(pos_y[iframe]), (int)r, bgd);
+
+ //cpl_msg_info(__func__, "Zero point in chip %d: %g", labels[iframe], zp) ;
+ /* Peak */
+ peak = cpl_image_get_max_window(ima,
+ (int)(pos_x[iframe]-5), (int)(pos_y[iframe]-5),
+ (int)(pos_x[iframe]+5), (int)(pos_y[iframe]+5));
+
+ /* Zero Point */
+ if (hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+ {
+ if (fl > 0 && dit > 0)
+ {
+ hawki_cal_zpoint_outputs.zpoint_computable[idet] = 1;
+ zp = stdstar_mag + 2.5 * log10(fl) - 2.5 * log10(dit);
+
+ hawki_cal_zpoint_outputs.zpoint[idet] = zp;
+ hawki_cal_zpoint_outputs.atx0[idet] = zp +
+ extinction * hawki_cal_zpoint_outputs.airmass[idet];
+ }
+ else
+ hawki_cal_zpoint_outputs.zpoint_computable[idet] = 0;
+ }
+ hawki_cal_zpoint_outputs.posx[idet] = pos_x[iframe];
+ hawki_cal_zpoint_outputs.posy[idet] = pos_y[iframe];
+ hawki_cal_zpoint_outputs.flux[idet] = fl;
+ hawki_cal_zpoint_outputs.instrmag[idet] = 2.5 * log10(fl/dit);
+ hawki_cal_zpoint_outputs.peak[idet] = peak;
+ hawki_cal_zpoint_outputs.bgd[idet] = bgd;
+ hawki_cal_zpoint_outputs.fwhmx[idet] = fwhm_x;
+ hawki_cal_zpoint_outputs.fwhmy[idet] = fwhm_y;
+ if (fwhm_x > 0 && fwhm_y > 0)
+ hawki_cal_zpoint_outputs.fwhm[idet] = sqrt(fwhm_x*fwhm_y);
+ else
+ hawki_cal_zpoint_outputs.fwhm[idet] = -1.0;
+ hawki_cal_zpoint_outputs.fwhmx_as[idet] = fwhm_x * pixscale;
+ hawki_cal_zpoint_outputs.fwhmy_as[idet] = fwhm_y * pixscale;
+ if (fwhm_x > 0 && fwhm_y > 0)
+ hawki_cal_zpoint_outputs.fwhm_as[idet] =
+ sqrt(fwhm_x*fwhm_y*pixscale*pixscale);
+ else
+ hawki_cal_zpoint_outputs.fwhm_as[labels[iframe]-1] = -1.0;
+ }
+ else
+ {
+ cpl_msg_warning(cpl_func,"Standard star not detected in chip %d. "
+ "No zeropoint computed.", idet + 1);
+ }
+
+ }
+
+ /* Create the table */
+ zpoint = hawki_table_new(1);
+ //tab = cpl_table_new(nframes) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_CHIP, CPL_TYPE_INT);
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_STARNAME, CPL_TYPE_STRING);
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_POSX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],
+ HAWKI_COL_ZPOINT_POSX,"pix");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_POSY, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_POSY,"pix");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_ZPOINT, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_ZPOINT,"mag");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_ATX0, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_ATX0,"mag");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_AIRMASS, CPL_TYPE_DOUBLE);
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FLUX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FLUX,"ADU");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_INSTRMAG, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],
+ HAWKI_COL_ZPOINT_INSTRMAG,"log(ADU/s)");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FILTER, CPL_TYPE_STRING);
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_PEAK, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_PEAK,"ADU");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_BGD, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_BGD,"ADU");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FWHMX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMX,"pix");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FWHMY, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMY,"pix");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FWHM, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHM,"pix");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FWHMX_AS, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMX_AS,"arcsec");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FWHMY_AS, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHMY_AS,"arcsec");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_FWHM_AS, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_FWHM_AS,"arcsec");
+ cpl_table_new_column(zpoint[idet],
+ HAWKI_COL_ZPOINT_STARMAG, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(zpoint[idet],HAWKI_COL_ZPOINT_STARMAG,"mag");
+
+ cpl_table_set_int(zpoint[idet], HAWKI_COL_ZPOINT_CHIP, 0, idet+1) ;
+ cpl_table_set_string(zpoint[idet], HAWKI_COL_ZPOINT_FILTER, 0,
+ hawki_cal_zpoint_outputs.filter);
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_AIRMASS, 0,
+ hawki_cal_zpoint_outputs.airmass[idet]) ;
+ if(hawki_cal_zpoint_outputs.stdstar_incat_found== 1)
+ {
+ cpl_table_set_string(zpoint[idet], HAWKI_COL_ZPOINT_STARNAME, 0,
+ hawki_cal_zpoint_outputs.starname) ;
+ if(hawki_cal_zpoint_outputs.stdstar_mag_available== 1)
+ {
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_STARMAG, 0,
+ hawki_cal_zpoint_outputs.stdstar_mag_filter);
+ }
+ }
+ if(hawki_cal_zpoint_outputs.stdstar_image_detected[idet] == 1)
+ {
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_POSX, 0,
+ hawki_cal_zpoint_outputs.posx[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_POSY, 0,
+ hawki_cal_zpoint_outputs.posy[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FLUX, 0,
+ hawki_cal_zpoint_outputs.flux[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_INSTRMAG, 0,
+ hawki_cal_zpoint_outputs.instrmag[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_PEAK, 0,
+ hawki_cal_zpoint_outputs.peak[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_BGD, 0,
+ hawki_cal_zpoint_outputs.bgd[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMX, 0,
+ hawki_cal_zpoint_outputs.fwhmx[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMY, 0,
+ hawki_cal_zpoint_outputs.fwhmy[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHM, 0,
+ hawki_cal_zpoint_outputs.fwhm[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMX_AS, 0,
+ hawki_cal_zpoint_outputs.fwhmx_as[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHMY_AS, 0,
+ hawki_cal_zpoint_outputs.fwhmy_as[idet]) ;
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_FWHM_AS, 0,
+ hawki_cal_zpoint_outputs.fwhm_as[idet]) ;
+ if(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+ {
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_ZPOINT, 0,
+ hawki_cal_zpoint_outputs.zpoint[idet]);
+ cpl_table_set_double(zpoint[idet], HAWKI_COL_ZPOINT_ATX0, 0,
+ hawki_cal_zpoint_outputs.atx0[idet]);
+ }
+ }
+ }
+
+ /* Mean values */
+ if(hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+ {
+ int nzpoint = 0;
+ hawki_cal_zpoint_outputs.mean_zpoint = 0.0 ;
+ hawki_cal_zpoint_outputs.mean_atx0 = 0.0 ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ if(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+ {
+
+ hawki_cal_zpoint_outputs.mean_zpoint +=
+ hawki_cal_zpoint_outputs.zpoint[idet] ;
+ hawki_cal_zpoint_outputs.mean_atx0 +=
+ hawki_cal_zpoint_outputs.atx0[idet] ;
+ nzpoint++;
+ }
+ }
+ if(nzpoint > 0)
+ {
+ hawki_cal_zpoint_outputs.zpoint_mean_computable = 1;
+ hawki_cal_zpoint_outputs.mean_zpoint /= nzpoint ;
+ hawki_cal_zpoint_outputs.mean_atx0 /= nzpoint ;
+ }
+ }
+
+ /* Output results */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ if(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+ {
+ cpl_msg_info(__func__, "Zero point [at airmass=1] in chip %d:",
+ idet + 1);
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__," ZP: %g [%g]",
+ hawki_cal_zpoint_outputs.zpoint[idet],
+ hawki_cal_zpoint_outputs.atx0[idet]);
+ cpl_msg_info(__func__," Flux of star: %f",
+ hawki_cal_zpoint_outputs.flux[idet]);
+ cpl_msg_indent_less();
+ }
+ else
+ cpl_msg_info(__func__, "Zero point not available for chip %d",
+ idet + 1);
+
+ }
+
+ return zpoint;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the standard star magnitude
+ @param std_file the standard stars catalog
+ @param frame the input frame
+ @param mag the computed magnitude
+ @return 0 if ok, -1 in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_get_mag(
+ const char * std_file,
+ double pointing_ra,
+ double pointing_dec,
+ hawki_band band)
+{
+ cpl_table * catalogue;
+ char * star_name;
+ char * used_catname;
+ char * star_type;
+ double stdstar_ra;
+ double stdstar_dec;
+ double mag_filter;
+ double mag_J;
+ double mag_H;
+ double mag_K;
+ double mag_Y;
+ int mag_invalid;
+ int star_ind;
+
+ hawki_cal_zpoint_outputs.stdstar_incat_found = 0;
+
+ /* Load the catalog */
+ if ((catalogue = irplib_stdstar_load_catalog(std_file, "all")) == NULL) {
+ cpl_msg_error(cpl_func,"Cannot read catalogue file %s",std_file);
+ return -1;
+ }
+
+ /* Check that the columns are there */
+ if (irplib_stdstar_check_columns_exist(catalogue) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func,"Note all the columns are present"
+ " in the catalogue file %s",std_file);
+ return -1;
+ }
+
+ /* Select stars within a given distance */
+ if (irplib_stdstar_select_stars_dist(catalogue,
+ pointing_ra, pointing_dec, 5.0) == -1) {
+ cpl_table_delete(catalogue) ;
+ return 1;
+ }
+
+ /* Take the closest */
+ if ((star_ind=irplib_stdstar_find_closest(catalogue,
+ pointing_ra, pointing_dec)) < 0) {
+ cpl_table_delete(catalogue) ;
+ return 1;
+ }
+
+ /* Retrieve the star information */
+ hawki_cal_zpoint_outputs.stdstar_incat_found = 1;
+ star_name = cpl_strdup(cpl_table_get_string(catalogue,
+ IRPLIB_STDSTAR_STAR_COL, star_ind));
+ used_catname = cpl_strdup(cpl_table_get_string
+ (catalogue, IRPLIB_STDSTAR_CAT_COL, star_ind));
+ star_type = cpl_strdup(cpl_table_get_string(catalogue,
+ IRPLIB_STDSTAR_TYPE_COL, star_ind));
+ stdstar_ra = cpl_table_get_double(catalogue,
+ IRPLIB_STDSTAR_RA_COL, star_ind, NULL);
+ stdstar_dec = cpl_table_get_double(catalogue,
+ IRPLIB_STDSTAR_DEC_COL, star_ind, NULL);
+ mag_filter = cpl_table_get_double(catalogue, hawki_std_band_name(band),
+ star_ind, &mag_invalid);
+ mag_H = cpl_table_get_double(catalogue, hawki_std_band_name(HAWKI_BAND_H),
+ star_ind, NULL);
+ mag_J = cpl_table_get_double(catalogue, hawki_std_band_name(HAWKI_BAND_J),
+ star_ind, NULL);
+ mag_K = cpl_table_get_double(catalogue, hawki_std_band_name(HAWKI_BAND_K),
+ star_ind, NULL);
+ mag_Y = cpl_table_get_double(catalogue, hawki_std_band_name(HAWKI_BAND_Y),
+ star_ind, NULL);
+
+ /* Store results */
+ strcpy(hawki_cal_zpoint_outputs.starname, star_name) ;
+ strcpy(hawki_cal_zpoint_outputs.sptype, star_type) ;
+ strcpy(hawki_cal_zpoint_outputs.catalog, used_catname);
+ hawki_cal_zpoint_outputs.stdstar_ra = stdstar_ra;
+ hawki_cal_zpoint_outputs.stdstar_dec = stdstar_dec;
+ if(mag_invalid == 0)
+ {
+ hawki_cal_zpoint_outputs.stdstar_mag_available = 1;
+ hawki_cal_zpoint_outputs.stdstar_mag_filter = mag_filter;
+ }
+ else
+ hawki_cal_zpoint_outputs.stdstar_mag_available = 0;
+ hawki_cal_zpoint_outputs.stdstar_mag_H = mag_H;
+ hawki_cal_zpoint_outputs.stdstar_mag_J = mag_J;
+ hawki_cal_zpoint_outputs.stdstar_mag_K = mag_K;
+ hawki_cal_zpoint_outputs.stdstar_mag_Y = mag_Y;
+ cpl_free(star_name);
+ cpl_free(star_type);
+ cpl_free(used_catname);
+ cpl_table_delete(catalogue);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the recipe product on disk
+ @param tab the table to save
+ @param images the images where the photometry is computed
+ @param parlist the parameter list
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_save
+(cpl_table ** zpoint_tables,
+ int * labels,
+ cpl_imagelist * images,
+ cpl_table ** raw_zpoint_stats,
+ cpl_frameset * zpoint_frames,
+ cpl_frameset * calib_frames,
+ const cpl_frame * stars_frame,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set)
+{
+ cpl_propertylist * qcmainparams;
+ cpl_propertylist ** qcextparams;
+ cpl_propertylist * mainheader;
+ cpl_propertylist ** extheaders;
+ cpl_propertylist ** statsqcextparams;
+ cpl_propertylist ** statsextheaders;
+ cpl_frameset * used_frames;
+ const char * ref_filename;
+ const char * recipe_name = "hawki_cal_zpoint" ;
+ int idet;
+ int iframe;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+ /* Get the reference frame */
+ ref_filename = hawki_get_extref_file(set);
+
+ /* Create QC parameters for the zpoint table */
+ qcmainparams = cpl_propertylist_new();
+ qcextparams = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ qcextparams[idet] = cpl_propertylist_new();
+ /* Write QC parameters */
+ hawki_cal_zpoint_compute_qc(qcmainparams, qcextparams, set);
+
+ /* Create QC parameters for the stats table: Statistics of the raw images */
+ statsqcextparams = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ statsqcextparams[idet] = cpl_propertylist_new();
+ hawki_image_stats_stats(raw_zpoint_stats, statsqcextparams);
+
+ /* Create the main and extension headers for the zpoint table*/
+ mainheader = cpl_propertylist_new();
+ extheaders = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ extheaders[idet] = cpl_propertylist_new();
+ /* Copy QC params to the headers */
+ cpl_propertylist_append(mainheader, qcmainparams);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_propertylist_append(extheaders[idet], qcextparams[idet]) ;
+
+ /* Create the extension headers for the stats table*/
+ statsextheaders = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ statsextheaders[idet] = cpl_propertylist_duplicate(statsqcextparams[idet]);
+
+ /* Write additional keywords to the headers */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_propertylist * inputlist;
+ cpl_propertylist * wcslist;
+ int this_iframe = -1;
+ int ext_nb;
+
+ /* Propagate some keywords from input raw frame extensions */
+ ext_nb=hawki_get_ext_from_detector(ref_filename, idet+1);
+ inputlist = cpl_propertylist_load_regexp(ref_filename, ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+ cpl_propertylist_append(extheaders[idet], inputlist);
+ cpl_propertylist_append(statsextheaders[idet], inputlist);
+ cpl_propertylist_delete(inputlist);
+
+ /* Propagate WCS keywords */
+ for(iframe=0; iframe<cpl_frameset_get_size(zpoint_frames); iframe++)
+ if(labels[iframe] == idet + 1)
+ this_iframe = iframe;
+ wcslist = cpl_propertylist_load_regexp
+ (cpl_frame_get_filename(cpl_frameset_get_frame(zpoint_frames, this_iframe)),
+ ext_nb, HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_copy_property_regexp
+ (extheaders[idet], wcslist, HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_delete(wcslist);
+ }
+
+ /* Write the zpoint table */
+ used_frames = cpl_frameset_duplicate(zpoint_frames);
+ for(iframe = 0; iframe< cpl_frameset_get_size(calib_frames); ++iframe)
+ cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+ cpl_frameset_get_frame(calib_frames, iframe)));
+ cpl_frameset_insert(used_frames, cpl_frame_duplicate(stars_frame));
+ hawki_tables_save(set,
+ parlist,
+ used_frames,
+ (const cpl_table **)zpoint_tables,
+ recipe_name,
+ HAWKI_CALPRO_ZPOINT_TAB,
+ HAWKI_PROTYPE_ZPOINT_TAB,
+ mainheader,
+ (const cpl_propertylist **)extheaders,
+ "hawki_cal_zpoint.fits");
+ cpl_frameset_delete(used_frames);
+
+ /* Write the table with the raw zpoint objects statistics */
+ used_frames = cpl_frameset_duplicate(zpoint_frames);
+ hawki_tables_save(set,
+ parlist,
+ used_frames,
+ (const cpl_table **)raw_zpoint_stats,
+ recipe_name,
+ HAWKI_CALPRO_ZPOINT_STATS,
+ HAWKI_PROTYPE_ZPOINT_STATS,
+ NULL,
+ (const cpl_propertylist **)statsextheaders,
+ "hawki_cal_zpoint_stats.fits");
+
+ /* Write the images */
+ for(iframe = 0; iframe< cpl_frameset_get_size(calib_frames); ++iframe)
+ cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+ cpl_frameset_get_frame(calib_frames, iframe)));
+ hawki_imagelist_save(set,
+ parlist,
+ used_frames,
+ images,
+ recipe_name,
+ HAWKI_CALPRO_ZPOINT_IMA,
+ HAWKI_PROTYPE_ZPOINT_IMA,
+ NULL,
+ NULL,
+ "hawki_cal_zpoint_check.fits") ;
+ cpl_frameset_delete(used_frames);
+
+ /* Free */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_propertylist_delete(extheaders[idet]) ;
+ cpl_propertylist_delete(qcextparams[idet]) ;
+ cpl_propertylist_delete(statsqcextparams[idet]);
+ cpl_propertylist_delete(statsextheaders[idet]);
+ }
+ cpl_propertylist_delete(mainheader);
+ cpl_propertylist_delete(qcmainparams);
+ cpl_free(extheaders);
+ cpl_free(qcextparams);
+ cpl_free(statsqcextparams);
+ cpl_free(statsextheaders);
+
+ /* Free */
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the QC parameters
+ @param qcmainparams The main header
+ @param qcextparams The extensions headers
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_compute_qc
+(cpl_propertylist * qcmainparams,
+ cpl_propertylist ** qcextparams,
+ cpl_frameset * set)
+{
+ int idet;
+ int nframes;
+
+
+ nframes = cpl_frameset_get_size(set) ;
+
+ /* Check inputs */
+ if (qcmainparams == NULL) return -1;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ if (qcextparams[idet] == NULL) return -1;
+
+ /* Write the QC params common to all extensions in the main header */
+ cpl_propertylist_append_string(qcmainparams, "ESO QC FILTER OBS",
+ hawki_cal_zpoint_outputs.filter);
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC FILTER OBS",
+ "Observation filter");
+ cpl_propertylist_append_string(qcmainparams, "ESO QC FILTER REF",
+ hawki_std_band_name(hawki_cal_zpoint_outputs.band)) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC FILTER REF",
+ "Reference filter");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC AMBI RHUM AVG",
+ hawki_cal_zpoint_outputs.humidity);
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC AMBI RHUM AVG",
+ "(percent) ambient relative humidity @ 30/2 m");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC AIRMASS MEAN",
+ hawki_cal_zpoint_outputs.mean_airmass) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC AIRMASS MEAN",
+ "Average airmass");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC DATANCOM",
+ nframes);
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC DATANCOM",
+ "Number of files used for the reduction");
+ if(hawki_cal_zpoint_outputs.stdstar_incat_found == 1)
+ {
+ cpl_propertylist_append_string(qcmainparams, "ESO QC STDNAME",
+ hawki_cal_zpoint_outputs.starname) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC STDNAME",
+ "Standard star name");
+ cpl_propertylist_append_string(qcmainparams, "ESO QC SPECTYPE",
+ hawki_cal_zpoint_outputs.sptype) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC SPECTYPE",
+ "Standard star spectral type");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC STARMAG H",
+ hawki_cal_zpoint_outputs.stdstar_mag_H) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC STARMAG H",
+ "Standard star magnitude in H");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC STARMAG J",
+ hawki_cal_zpoint_outputs.stdstar_mag_J) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC STARMAG J",
+ "Standard star magnitude in J");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC STARMAG K",
+ hawki_cal_zpoint_outputs.stdstar_mag_K) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC STARMAG K",
+ "Standard star magnitude in K");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC STARMAG Y",
+ hawki_cal_zpoint_outputs.stdstar_mag_Y) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC STARMAG Y",
+ "Standard star magnitude in Y");
+ cpl_propertylist_append_string(qcmainparams, "ESO QC CATNAME",
+ hawki_cal_zpoint_outputs.catalog) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC CATNAME",
+ "Standard star catalogue name");
+ }
+ if(hawki_cal_zpoint_outputs.stdstar_mag_available == 1)
+ {
+ cpl_propertylist_append_double(qcmainparams, "ESO QC STARMAG",
+ hawki_cal_zpoint_outputs.stdstar_mag_filter) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC STARMAG",
+ "Standard star magnitude in observed filter");
+ }
+ if(hawki_cal_zpoint_outputs.zpoint_mean_computable == 1)
+ {
+ cpl_propertylist_append_double(qcmainparams, "ESO QC ZPOINT MEAN",
+ hawki_cal_zpoint_outputs.mean_zpoint) ;
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC ZPOINT MEAN",
+ "Mean measured zero-point for all the chips [mag]");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC ATX0 MEAN",
+ hawki_cal_zpoint_outputs.mean_atx0);
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC ATX0 MEAN",
+ "Mean extinction corrected zero-point for all the chips [mag]");
+ cpl_propertylist_append_double(qcmainparams, "ESO QC ZPOINT EXT COEFF",
+ hawki_cal_zpoint_outputs.ext_coeff);
+ cpl_propertylist_set_comment(qcmainparams, "ESO QC ZPOINT EXT COEFF",
+ "Extinction coefficient used in the computation of ATX0");
+ }
+
+ /* Write QC params that are specific of the extension */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ if(hawki_cal_zpoint_outputs.zpoint_computable[idet] == 1)
+ {
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT",
+ hawki_cal_zpoint_outputs.zpoint[idet]) ;
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT",
+ "Measured zero-point for a given chip [mag]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ATX0",
+ hawki_cal_zpoint_outputs.atx0[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ATX0",
+ "Extinction corrected zero-point for a given chip [mag]");
+ }
+ if(hawki_cal_zpoint_outputs.stdstar_image_detected[idet] == 1)
+ {
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT POSX",
+ hawki_cal_zpoint_outputs.posx[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT POSX",
+ "X position of the standard star [pixel]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT POSY",
+ hawki_cal_zpoint_outputs.posy[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT POSY",
+ "Y position of the standard star [pixel]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FLUX",
+ hawki_cal_zpoint_outputs.flux[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FLUX",
+ "Flux of the standard star [ADU]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT PEAK",
+ hawki_cal_zpoint_outputs.peak[idet]) ;
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT PEAK",
+ "Peak of the standard starr [ADU]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT BGD",
+ hawki_cal_zpoint_outputs.bgd[idet]) ;
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT BGD",
+ "Background around the standard star [ADU]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FWHMX",
+ hawki_cal_zpoint_outputs.fwhmx[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FWHMX",
+ "X FWHM of the standard star [pixel]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FWHMY",
+ hawki_cal_zpoint_outputs.fwhmy[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FWHMY",
+ "Y FWHM of the standard star [pixel]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FWHM",
+ hawki_cal_zpoint_outputs.fwhm[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FWHM",
+ "FWHM of the standard star [pixel]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FWHMX_AS",
+ hawki_cal_zpoint_outputs.fwhmx_as[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FWHMX_AS",
+ "X FWHM of the standard star [arcsec]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FWHMY_AS",
+ hawki_cal_zpoint_outputs.fwhmy_as[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FWHMY_AS",
+ "Y FWHM of the standard star [arcsec]");
+ cpl_propertylist_append_double(qcextparams[idet], "ESO QC ZPOINT FWHM_AS",
+ hawki_cal_zpoint_outputs.fwhm_as[idet]);
+ cpl_propertylist_set_comment(qcextparams[idet], "ESO QC ZPOINT FWHM_AS",
+ "FWHM of the standard star [arcsec]");
+ }
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute the median of the values of a key in several frames
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_cal_zpoint_compute_keywords(
+ cpl_frameset * set,
+ int * labels)
+{
+ int nframes ;
+ cpl_vector * hum_vec ;
+ cpl_frame * cur_frame ;
+ cpl_propertylist * plist ;
+ int iframe;
+
+ /* Test inputs */
+ if (set == NULL) return -1 ;
+
+ /* Initialize */
+ nframes = cpl_frameset_get_size(set) ;
+ hawki_cal_zpoint_outputs.mean_airmass = 0.0 ;
+
+ hum_vec = cpl_vector_new(nframes) ;
+
+ for (iframe=0 ; iframe<nframes ; iframe++) {
+ if (cpl_error_get_code()) {
+ cpl_vector_delete(hum_vec) ;
+ return -1 ;
+ }
+ cur_frame = cpl_frameset_get_frame(set, iframe) ;
+ plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0) ;
+ if (iframe==0)
+ hawki_cal_zpoint_outputs.mean_airmass +=
+ hawki_pfits_get_airmass_start(plist) ;
+ if (iframe==nframes-1)
+ hawki_cal_zpoint_outputs.mean_airmass +=
+ hawki_pfits_get_airmass_end(plist);
+ hawki_cal_zpoint_outputs.airmass[labels[iframe] - 1] =
+ (hawki_pfits_get_airmass_start(plist) +
+ hawki_pfits_get_airmass_end(plist)) / 2.;
+ cpl_vector_set(hum_vec, iframe, hawki_pfits_get_humidity_level(plist));
+ cpl_propertylist_delete(plist) ;
+ if (cpl_error_get_code()) {
+ cpl_vector_delete(hum_vec) ;
+ cpl_error_reset() ;
+ return -1 ;
+ }
+ }
+ hawki_cal_zpoint_outputs.humidity = cpl_vector_get_mean(hum_vec) ;
+ hawki_cal_zpoint_outputs.mean_airmass /= 2 ;
+
+ /* Free and return */
+ cpl_vector_delete(hum_vec) ;
+ if (cpl_error_get_code()) return -1 ;
+ return 0 ;
+}
+
+static cpl_error_code hawki_cal_zpoint_get_expected_pos
+(cpl_frameset * set,
+ int * labels)
+{
+ const char * filename;
+ int iframe;
+
+ for(iframe=0 ; iframe<HAWKI_NB_DETECTORS ; iframe++)
+ {
+ cpl_propertylist * wcs_plist;
+ cpl_wcs * wcs;
+ int idet;
+
+ idet = labels[iframe];
+ if(hawki_cal_zpoint_config.xcoord[idet - 1] == -1 ||
+ hawki_cal_zpoint_config.ycoord[idet - 1] == -1)
+ {
+ filename = cpl_frame_get_filename
+ (cpl_frameset_get_frame_const(set, iframe));
+ wcs_plist = cpl_propertylist_load
+ (filename, hawki_get_ext_from_detector(filename, idet));
+ wcs = cpl_wcs_new_from_propertylist(wcs_plist);
+ cpl_propertylist_delete(wcs_plist);
+ if(wcs == NULL)
+ {
+ cpl_msg_error(__func__, "Could not get WCS info");
+ cpl_wcs_delete(wcs);
+ return CPL_ERROR_ILLEGAL_INPUT;
+ }
+ if(irplib_wcs_radectoxy(wcs,
+ hawki_cal_zpoint_outputs.stdstar_ra,
+ hawki_cal_zpoint_outputs.stdstar_dec,
+ &(hawki_cal_zpoint_config.xcoord[idet - 1]),
+ &(hawki_cal_zpoint_config.ycoord[idet - 1]))
+ != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Could not get the expected position of star");
+ cpl_wcs_delete(wcs);
+ return CPL_ERROR_UNSPECIFIED;
+ }
+ cpl_msg_info(cpl_func,
+ "Star expected position in detector %d is X=%f Y=%f",
+ idet, hawki_cal_zpoint_config.xcoord[idet - 1],
+ hawki_cal_zpoint_config.ycoord[idet - 1]);
+
+ /* Free */
+ cpl_wcs_delete(wcs);
+ }
+ else
+ {
+ cpl_msg_info(cpl_func,
+ "Using given star position in detector %d: X=%f Y=%f",
+ idet,
+ hawki_cal_zpoint_config.xcoord[idet - 1],
+ hawki_cal_zpoint_config.ycoord[idet - 1]);
+
+ }
+ }
+
+ return 0;
+}
+
+
+static void hawki_cal_zpoint_output_init(void)
+{
+ int idet;
+
+ hawki_cal_zpoint_outputs.starname[0] = (char)0 ;
+ hawki_cal_zpoint_outputs.sptype[0] = (char)0 ;
+ hawki_cal_zpoint_outputs.filter[0] = (char)0 ;
+ hawki_cal_zpoint_outputs.catalog[0] = (char)0 ;
+ hawki_cal_zpoint_outputs.pixscale = -1.0 ;
+ hawki_cal_zpoint_outputs.dit = -1.0 ;
+ hawki_cal_zpoint_outputs.humidity = -1.0 ;
+ hawki_cal_zpoint_outputs.mean_airmass = -1.0 ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ hawki_cal_zpoint_outputs.airmass[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.zpoint[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.atx0[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.posx[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.posy[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.flux[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.peak[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.bgd[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.fwhmx[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.fwhmy[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.fwhm[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.fwhmx_as[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs.fwhmy_as[idet] = -1.0 ;
+ hawki_cal_zpoint_outputs .fwhm_as[idet] = -1.0 ;
+ }
+}
+
+int hawki_cal_zpoint_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+ const char * sval ;
+
+ par = NULL ;
+
+ /* --ra */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.ra") ;
+ hawki_cal_zpoint_config.target_ra = cpl_parameter_get_double(par) ;
+ /* --dec */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.dec") ;
+ hawki_cal_zpoint_config.target_dec = cpl_parameter_get_double(par) ;
+ /* --mag */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.mag") ;
+ hawki_cal_zpoint_config.stdstar_given_magnitude =
+ cpl_parameter_get_double(par) ;
+ /* --detect_sigma */
+ par = cpl_parameterlist_find(parlist,"hawki.hawki_cal_zpoint.detect_sigma");
+ hawki_cal_zpoint_config.detect_sigma = cpl_parameter_get_double(par) ;
+ /* --sx */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.sx") ;
+ hawki_cal_zpoint_config.sx = cpl_parameter_get_int(par) ;
+ /* --sy */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.sy") ;
+ hawki_cal_zpoint_config.sy = cpl_parameter_get_int(par) ;
+ /* --star_r */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.star_r") ;
+ hawki_cal_zpoint_config.phot_star_radius = cpl_parameter_get_double(par) ;
+ /* --bg_r1 */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.bg_r1") ;
+ hawki_cal_zpoint_config.phot_bg_r1 = cpl_parameter_get_double(par) ;
+ /* --bg_r2 */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.bg_r2") ;
+ hawki_cal_zpoint_config.phot_bg_r2 = cpl_parameter_get_double(par) ;
+ /* --xcoord */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.xcoord");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%lf,%lf,%lf,%lf",
+ hawki_cal_zpoint_config.xcoord,
+ hawki_cal_zpoint_config.xcoord+1,
+ hawki_cal_zpoint_config.xcoord+2,
+ hawki_cal_zpoint_config.xcoord+3)!=4)
+ {
+ return -1;
+ }
+ /* --ycoord */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_cal_zpoint.ycoord");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%lf,%lf,%lf,%lf",
+ hawki_cal_zpoint_config.ycoord,
+ hawki_cal_zpoint_config.ycoord+1,
+ hawki_cal_zpoint_config.ycoord+2,
+ hawki_cal_zpoint_config.ycoord+3)!=4)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int hawki_cal_zpoint_check_epoch_equinox(cpl_propertylist * plist)
+{
+ if(hawki_pfits_get_targ_epoch(plist) != 2000. ||
+ hawki_pfits_get_targ_equinox(plist) != 2000.)
+ {
+ cpl_msg_error(__func__,"Epoch and equinox must be 2000.");
+ return -1;
+ }
+ else
+ return 0;
+}
diff --git a/recipes/hawki_sci_jitter.c b/recipes/hawki_sci_jitter.c
new file mode 100644
index 0000000..c4732ba
--- /dev/null
+++ b/recipes/hawki_sci_jitter.c
@@ -0,0 +1,2207 @@
+/* $Id: hawki_sci_jitter.c,v 1.30 2011/12/22 15:27:06 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/12/22 15:27:06 $
+ * $Revision: 1.30 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <string.h>
+
+#include "irplib_utils.h"
+#include "irplib_calib.h"
+
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_saa.h"
+#include "hawki_bkg.h"
+#include "hawki_distortion.h"
+#include "hawki_properties_tel.h"
+#include "hawki_image_stats.h"
+#include "hawki_obj_det.h"
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define NEGLIG_OFF_DIFF 0.1
+#define SQR(x) ((x)*(x))
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_sci_jitter_create(cpl_plugin *) ;
+static int hawki_sci_jitter_exec(cpl_plugin *) ;
+static int hawki_sci_jitter_destroy(cpl_plugin *) ;
+static int hawki_sci_jitter(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_sci_jitter_retrieve_input_param
+(cpl_parameterlist * parlist);
+static cpl_image ** hawki_sci_jitter_reduce
+(cpl_frameset * jitters,
+ cpl_frameset * sky,
+ const char * flat,
+ const char * dark,
+ const char * bpm,
+ cpl_table ** bkg_stats);
+static int hawki_sci_jitter_sky
+(cpl_imagelist * jitters,
+ cpl_imagelist * skys,
+ cpl_table ** bkg_stats,
+ int idet);
+static int hawki_sci_jitter_sky_running
+(cpl_imagelist * in,
+ cpl_table ** bkg_stats,
+ int idet);
+static cpl_image ** hawki_sci_jitter_saa(cpl_imagelist **, cpl_bivector *,
+ double *, double *);
+static int hawki_sci_jitter_qc
+(cpl_frameset * science_frames,
+ cpl_image ** combined,
+ cpl_table ** obj_charac);
+static int hawki_sci_jitter_read_calib
+(const char * flat,
+ const char * dark,
+ const char * bpm,
+ cpl_image ** flat_image,
+ cpl_image ** dark_image,
+ cpl_image ** bpm_image,
+ int idet);
+static int hawki_sci_jitter_save
+(cpl_image ** combined,
+ cpl_image * stitched,
+ cpl_table ** objs_charac,
+ cpl_table ** raw_jitter_stats,
+ cpl_table ** bkg_stats,
+ const cpl_table * raw_obj_tel_info,
+ cpl_frameset * science_frames,
+ cpl_frameset * calib_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set);
+int hawki_sci_jitter_whole_image_algo
+(cpl_frameset * obj,
+ cpl_table ** raw_jitter_stats,
+ cpl_table * raw_obj_tel_info,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_set);
+int hawki_sci_jitter_save_stats
+(cpl_table ** raw_jitter_stats,
+ cpl_table * raw_obj_tel_info,
+ cpl_frameset * jitter_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_set);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct
+{
+ /* Inputs */
+ const char * offsets ;
+ const char * objects ;
+ int offset_max ;
+ int sky_minnb ;
+ int sky_halfw ;
+ int sky_rejmin ;
+ int sky_rejmax ;
+ int refine ;
+ int sx ;
+ int sy ;
+ int mx ;
+ int my ;
+ int borders ;
+ cpl_geom_combine comb_meth ;
+ int rej_low ;
+ int rej_high ;
+ int max_njitter;
+} hawki_sci_jitter_config;
+
+static struct
+{
+ /* Outputs */
+ double pixscale;
+ double dit;
+ double mean_airmass;
+ double iq[HAWKI_NB_DETECTORS];
+ int nbobjs[HAWKI_NB_DETECTORS];
+ double fwhm_pix[HAWKI_NB_DETECTORS];
+ double fwhm_arcsec[HAWKI_NB_DETECTORS];
+ double fwhm_mode[HAWKI_NB_DETECTORS];
+ double combined_pos_x[HAWKI_NB_DETECTORS];
+ double combined_pos_y[HAWKI_NB_DETECTORS];
+ double combined_cumoffset_x[HAWKI_NB_DETECTORS];
+ double combined_cumoffset_y[HAWKI_NB_DETECTORS];
+ int ncomb[HAWKI_NB_DETECTORS];
+} hawki_sci_jitter_output;
+
+static char hawki_sci_jitter_description[] =
+"hawki_sci_jitter -- hawki imaging jitter recipe.\n\n"
+"The input of the recipe files listed in the Set Of Frames (sof-file)\n"
+"must be tagged as:\n"
+"raw-file.fits "HAWKI_IMG_JITTER_RAW" or\n"
+"raw-file.fits "HAWKI_IMG_JITTER_SKY_RAW" or\n"
+"flat-file.fits "HAWKI_CALPRO_FLAT" or\n"
+"dark-file.fits "HAWKI_CALPRO_DARK" \n"
+"bpm-file.fits "HAWKI_CALPRO_BPM"\n"
+"distortion_x-file.fits "HAWKI_CALPRO_DISTORTION_X"\n"
+"distortion_y-file.fits "HAWKI_CALPRO_DISTORTION_Y"\n\n"
+"The recipe creates as an output:\n"
+"hawki_sci_jitter.fits ("HAWKI_CALPRO_COMBINED")\n"
+"hawki_sci_jitter_stitched.fits ("HAWKI_CALPRO_STITCHED")\n"
+"hawki_sci_jitter_stars.fits ("HAWKI_CALPRO_OBJ_PARAM"): Detected objects properties\n"
+"hawki_sci_jitter_stats.fits ("HAWKI_CALPRO_JITTER_STATS"): Stats of the individual images\n"
+"hawki_sci_jitter_bkg_stats.fits ("HAWKI_CALPRO_JITTER_BKG_STATS"): Statistics on the bkg\n\n"
+"The recipe performs the following steps:\n"
+"1) Frame statistics\n"
+"2) Basic reduction (using "HAWKI_CALPRO_FLAT" and "HAWKI_CALPRO_BPM")\n"
+"3) Background computation (the algorithm depends on parameter --sky_par) \n"
+"4) Offset refinement (uses parameters --off, --refine and --xcorr)\n"
+"5) Stacking of jitter frames (uses --comb_meth, --rej,\n"
+" --offset_max, --borders, --max_njitter)\n"
+"6) Stitching of the four detectors into one image\n"
+"7) Object detection in the stacked image\n\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_sci_jitter",
+ "Jitter recipe",
+ hawki_sci_jitter_description,
+ "Cesar Enrique Garcia",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_sci_jitter_create,
+ hawki_sci_jitter_exec,
+ hawki_sci_jitter_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --offsets */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.offsets",
+ CPL_TYPE_STRING, "offsets file", "hawki.hawki_sci_jitter", NULL) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "offsets") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --objects */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.objects",
+ CPL_TYPE_STRING, "objects file", "hawki.hawki_sci_jitter", NULL) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "objects") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --offset_max */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.offset_max",
+ CPL_TYPE_INT,
+ "Maximum offset allowed",
+ "hawki.hawki_sci_jitter",
+ 1500) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "offset_max") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --sky_par */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.sky_par",
+ CPL_TYPE_STRING,
+ "Rejection parameters for sky filtering",
+ "hawki.hawki_sci_jitter",
+ "10,7,3,3") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sky_par") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --refine */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.refine",
+ CPL_TYPE_BOOL, "refine offsets", "hawki.hawki_sci_jitter",
+ FALSE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "refine") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --xcorr */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.xcorr",
+ CPL_TYPE_STRING,
+ "Cross correlation search and measure sizes",
+ "hawki.hawki_sci_jitter",
+ "20,20,25,25") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xcorr") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --comb_meth */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.comb_meth",
+ CPL_TYPE_STRING, "union / inter / first", "hawki.hawki_sci_jitter",
+ "union") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "comb_meth") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --rej */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.rej",
+ CPL_TYPE_STRING,
+ "Low and high number of rejected values",
+ "hawki.hawki_sci_jitter",
+ "1,1") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rej") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --borders */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.borders",
+ CPL_TYPE_INT,
+ "Borders rejected",
+ "hawki.hawki_sci_jitter",
+ 4) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "borders") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --max_njitter */
+ p = cpl_parameter_new_value("hawki.hawki_sci_jitter.max_njitter",
+ CPL_TYPE_INT,
+ "Maximum numbers of jitter frames to combine",
+ "hawki.hawki_sci_jitter",
+ -1);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "max_njitter");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_sci_jitter(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ const char * flat;
+ const char * dark;
+ const char * bpm;
+ const cpl_frame * distx;
+ const cpl_frame * disty;
+ cpl_frameset * jitterframes ;
+ cpl_frameset * skyframes ;
+ cpl_frameset * science_frames;
+ cpl_frameset * calib_frames;
+ cpl_image ** combined ;
+ cpl_table ** obj_charac;
+ cpl_table ** raw_jitter_stats;
+ cpl_table ** bkg_stats;
+ cpl_table * raw_obj_tel_info;
+ cpl_image * stitched ;
+ int i;
+
+ /* Initialise */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ hawki_sci_jitter_output.iq[i] = -1.0 ;
+ hawki_sci_jitter_output.nbobjs[i] = -1 ;
+ hawki_sci_jitter_output.fwhm_pix[i] = -1.0 ;
+ hawki_sci_jitter_output.fwhm_arcsec[i] = -1.0 ;
+ hawki_sci_jitter_output.fwhm_mode[i] = -1.0 ;
+ hawki_sci_jitter_output.combined_pos_x[i] = -1.0 ;
+ hawki_sci_jitter_output.combined_pos_y[i] = -1.0 ;
+ hawki_sci_jitter_output.combined_cumoffset_x[i] = -1.0 ;
+ hawki_sci_jitter_output.combined_cumoffset_y[i] = -1.0 ;
+ }
+ hawki_sci_jitter_output.pixscale = -1.0 ;
+ hawki_sci_jitter_output.dit = -1.0 ;
+ hawki_sci_jitter_config.offsets = NULL ;
+ hawki_sci_jitter_config.objects = NULL ;
+ calib_frames = cpl_frameset_new();
+
+ /* Retrieve input parameters */
+ if(hawki_sci_jitter_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(cpl_func, "Wrong parameters");
+ cpl_frameset_delete(calib_frames);
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(cpl_func, "Cannot identify RAW and CALIB frames") ;
+ cpl_frameset_delete(calib_frames);
+ return -1 ;
+ }
+
+ /* Retrieve calibration data */
+ flat = hawki_extract_first_filename(framelist, HAWKI_CALPRO_FLAT) ;
+ dark = hawki_extract_first_filename(framelist, HAWKI_CALPRO_DARK);
+ bpm = hawki_extract_first_filename(framelist, HAWKI_CALPRO_BPM) ;
+ distx = cpl_frameset_find_const(framelist, HAWKI_CALPRO_DISTORTION_X);
+ disty = cpl_frameset_find_const(framelist, HAWKI_CALPRO_DISTORTION_Y);
+ if((distx == NULL && disty !=NULL) || (distx != NULL && disty ==NULL))
+ {
+ cpl_msg_error(cpl_func, "Both distortion in X (%s) and Y (%s) must be provided",
+ HAWKI_CALPRO_DISTORTION_X, HAWKI_CALPRO_DISTORTION_Y);
+ cpl_frameset_delete(calib_frames);
+ return -1 ;
+ }
+ if(flat)
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+ cpl_frameset_find_const(framelist, HAWKI_CALPRO_FLAT)));
+ if(dark)
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+ cpl_frameset_find_const(framelist, HAWKI_CALPRO_DARK)));
+ if(bpm)
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(
+ cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM)));
+ if(distx)
+ {
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(distx));
+ cpl_frameset_insert(calib_frames, cpl_frame_duplicate(disty));
+ }
+
+
+ /* Retrieve raw frames */
+ jitterframes = hawki_extract_frameset(framelist, HAWKI_IMG_JITTER_RAW) ;
+ if (jitterframes == NULL) {
+ cpl_msg_error(cpl_func, "Cannot find jitter frames in the input list (%s)",
+ HAWKI_IMG_JITTER_RAW);
+ cpl_frameset_delete(calib_frames);
+ return -1 ;
+ }
+ science_frames = cpl_frameset_duplicate(jitterframes);
+ skyframes = hawki_extract_frameset(framelist, HAWKI_IMG_JITTER_SKY_RAW) ;
+ if (skyframes != NULL)
+ {
+ int isky;
+ for(isky = 0; isky< cpl_frameset_get_size(skyframes); ++isky)
+ cpl_frameset_insert(science_frames,
+ cpl_frame_duplicate(cpl_frameset_get_frame(skyframes, isky)));
+ }
+
+ /* Create the statistics table */
+ raw_jitter_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ raw_jitter_stats[i] = cpl_table_new(cpl_frameset_get_size(jitterframes));
+ }
+ hawki_image_stats_initialize(raw_jitter_stats);
+ bkg_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ bkg_stats[i] = cpl_table_new(cpl_frameset_get_size(jitterframes));
+ }
+ hawki_image_stats_initialize(bkg_stats);
+
+ /* Create the telescope statistics parameters from the raw images */
+ raw_obj_tel_info = cpl_table_new(cpl_frameset_get_size(jitterframes));
+ /* Add the proper columns of the pcs table */
+ if(hawki_prop_tel_initialize(raw_obj_tel_info))
+ {
+ cpl_msg_error(cpl_func,"Could not initialize the pcs table");
+ cpl_frameset_delete(jitterframes) ;
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_table_delete(raw_jitter_stats[i]) ;
+ cpl_table_delete(bkg_stats[i]) ;
+ }
+ cpl_free(raw_jitter_stats) ;
+ cpl_free(bkg_stats) ;
+ cpl_table_delete(raw_obj_tel_info);
+ if (skyframes) cpl_frameset_delete(skyframes) ;
+ cpl_frameset_delete(calib_frames);
+ cpl_msg_indent_less() ;
+ return -1;
+ }
+
+ /* Do the algorithms that need the whole image */
+ hawki_sci_jitter_whole_image_algo(jitterframes,
+ raw_jitter_stats,
+ raw_obj_tel_info,
+ parlist,
+ framelist);
+
+ /* Apply the reduction */
+ /* Do the algorithms that can be applied to subsection of the images */
+ cpl_msg_info(cpl_func, "Apply the data combination") ;
+ cpl_msg_indent_more() ;
+ if ((combined = hawki_sci_jitter_reduce(jitterframes, skyframes, flat, dark,
+ bpm, bkg_stats)) == NULL)
+ {
+ cpl_msg_error(cpl_func, "Cannot recombine the data");
+ cpl_frameset_delete(jitterframes);
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_table_delete(raw_jitter_stats[i]) ;
+ cpl_table_delete(bkg_stats[i]) ;
+ }
+ cpl_free(raw_jitter_stats) ;
+ cpl_free(bkg_stats) ;
+ cpl_table_delete(raw_obj_tel_info);
+ if (skyframes) cpl_frameset_delete(skyframes) ;
+ cpl_frameset_delete(calib_frames);
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Compute QC parameters from the combined image */
+ cpl_msg_info(cpl_func, "Compute QC parameters from the combined images") ;
+ cpl_msg_indent_more() ;
+ obj_charac = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table*)) ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ obj_charac[i] = cpl_table_new(0);
+ }
+ if ((hawki_sci_jitter_qc(jitterframes, combined, obj_charac)) != 0)
+ {
+ cpl_msg_warning(cpl_func, "Cannot compute all parameters") ;
+ }
+ cpl_msg_indent_less();
+ cpl_frameset_delete(jitterframes);
+ if (skyframes) cpl_frameset_delete(skyframes);
+
+
+ /* Correct for the distortion */
+ if (distx && disty)
+ {
+ cpl_msg_info(cpl_func, "Applying the distortion correction") ;
+ cpl_msg_indent_more() ;
+ if (hawki_distortion_correct_alldetectors(combined, distx, disty) == -1)
+ {
+ cpl_msg_error(cpl_func, "Cannot correct the distortion") ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_image_delete(combined[i]) ;
+ cpl_free(combined) ;
+ if (obj_charac) {
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_table_delete(obj_charac[i]) ;
+ cpl_free(obj_charac);
+ }
+ cpl_table_delete(raw_obj_tel_info);
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_table_delete(raw_jitter_stats[i]);
+ cpl_table_delete(bkg_stats[i]);
+ }
+ cpl_free(raw_jitter_stats);
+ cpl_free(bkg_stats);
+ cpl_frameset_delete(calib_frames);
+ cpl_frameset_delete(science_frames);
+ cpl_msg_indent_less() ;
+ return -1;
+ }
+ cpl_msg_indent_less() ;
+ }
+
+ /* Compute the stitched image */
+ cpl_msg_info(cpl_func, "Compute the stiched image") ;
+ if ((stitched = hawki_images_stitch(combined,
+ hawki_sci_jitter_output.combined_pos_x,
+ hawki_sci_jitter_output.combined_pos_y)) == NULL)
+ {
+ cpl_msg_error(cpl_func, "Cannot stitch the images") ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_image_delete(combined[i]) ;
+ cpl_free(combined) ;
+ if (obj_charac) {
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_table_delete(obj_charac[i]) ;
+ cpl_free(obj_charac);
+ }
+ cpl_table_delete(raw_obj_tel_info);
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_table_delete(raw_jitter_stats[i]);
+ cpl_table_delete(bkg_stats[i]);
+ }
+ cpl_free(raw_jitter_stats);
+ cpl_free(bkg_stats);
+ cpl_frameset_delete(calib_frames);
+ cpl_frameset_delete(science_frames);
+ return -1;
+ }
+
+ /* Save the products */
+ cpl_msg_info(cpl_func, "Save the products") ;
+ cpl_msg_indent_more() ;
+ if (hawki_sci_jitter_save(combined, stitched, obj_charac,
+ raw_jitter_stats, bkg_stats,
+ raw_obj_tel_info,
+ science_frames,
+ calib_frames,
+ parlist, framelist) == -1)
+ cpl_msg_warning(cpl_func,"Some data could not be saved. "
+ "Check permisions or disk space");
+
+ /* Return */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_image_delete(combined[i]) ;
+ cpl_free(combined) ;
+ if (obj_charac) {
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ cpl_table_delete(obj_charac[i]) ;
+ cpl_free(obj_charac);
+ }
+ if (stitched) cpl_image_delete(stitched) ;
+ cpl_table_delete(raw_obj_tel_info);
+ for( i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_table_delete(raw_jitter_stats[i]);
+ cpl_table_delete(bkg_stats[i]);
+ }
+ cpl_free(raw_jitter_stats);
+ cpl_free(bkg_stats);
+ cpl_frameset_delete(calib_frames);
+ cpl_frameset_delete(science_frames);
+ cpl_msg_indent_less() ;
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(cpl_func,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+int hawki_sci_jitter_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+ const char * sval ;
+ par = NULL ;
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.offsets");
+ hawki_sci_jitter_config.offsets = cpl_parameter_get_string(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.objects");
+ hawki_sci_jitter_config.objects = cpl_parameter_get_string(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.offset_max");
+ hawki_sci_jitter_config.offset_max = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.sky_par");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%d,%d,%d,%d",
+ &hawki_sci_jitter_config.sky_minnb,
+ &hawki_sci_jitter_config.sky_halfw,
+ &hawki_sci_jitter_config.sky_rejmin,
+ &hawki_sci_jitter_config.sky_rejmax)!=4)
+ {
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.xcorr");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%d,%d,%d,%d",
+ &hawki_sci_jitter_config.sx,
+ &hawki_sci_jitter_config.sy,
+ &hawki_sci_jitter_config.mx,
+ &hawki_sci_jitter_config.my)!=4)
+ {
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.refine");
+ hawki_sci_jitter_config.refine = cpl_parameter_get_bool(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.comb_meth");
+ sval = cpl_parameter_get_string(par);
+ if (!strcmp(sval, "union"))
+ hawki_sci_jitter_config.comb_meth = CPL_GEOM_UNION;
+ else if (!strcmp(sval, "inter"))
+ hawki_sci_jitter_config.comb_meth = CPL_GEOM_INTERSECT;
+ else if (!strcmp(sval, "first"))
+ hawki_sci_jitter_config.comb_meth = CPL_GEOM_FIRST;
+ else
+ {
+ cpl_msg_error(cpl_func, "Invalid combine method specified");
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.borders");
+ hawki_sci_jitter_config.borders = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.rej");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%d,%d",
+ &hawki_sci_jitter_config.rej_low,
+ &hawki_sci_jitter_config.rej_high)!=2)
+ {
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_sci_jitter.max_njitter");
+ hawki_sci_jitter_config.max_njitter = cpl_parameter_get_int(par);
+ return 0;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param jitter the objects frames
+ @param sky the sky frames
+ @param flat the flat field or NULL
+ @param dark the dark or NULL
+ @param bpm the bad pixels map or NULL
+ @param bkf_stats the statistics for the background values
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_image ** hawki_sci_jitter_reduce
+(cpl_frameset * jitters,
+ cpl_frameset * sky,
+ const char * flat,
+ const char * dark,
+ const char * bpm,
+ cpl_table ** bkg_stats)
+{
+ cpl_frame * frame ;
+ cpl_propertylist * plist ;
+ cpl_image ** comb_chip ;
+ cpl_image ** combined ;
+ cpl_bivector * offsets ;
+ cpl_vector * offset_x_sort;
+ cpl_vector * offset_y_sort;
+ double * offs_est_x ;
+ double * offs_est_y ;
+ double off_0_x;
+ double off_0_y;
+ double max_x, max_y ;
+ int idet;
+ int ioff;
+
+ /* Get the header infos */
+ frame = cpl_frameset_get_frame(jitters, 0) ;
+ plist=cpl_propertylist_load(cpl_frame_get_filename(frame), 0) ;
+ hawki_sci_jitter_output.pixscale = hawki_pfits_get_pixscale(plist) ;
+ hawki_sci_jitter_output.dit = hawki_pfits_get_dit(plist) ;
+ cpl_propertylist_delete(plist) ;
+ if (cpl_error_get_code()) {
+ cpl_msg_error(cpl_func, "Missing keyword in FITS header") ;
+ return NULL ;
+ }
+
+ /* Check that DIT/NDIT and NDSAMPLES are the same for all the frames */
+ if(!hawki_utils_check_equal_double_keys(jitters, &hawki_pfits_get_dit) ||
+ !hawki_utils_check_equal_int_keys(jitters, &hawki_pfits_get_ndit)||
+ !hawki_utils_check_equal_int_keys(jitters, &hawki_pfits_get_ndsamples))
+ {
+ cpl_msg_error(__func__, "Not all input science have the same "
+ "DIT/NDIT/NDSAMPLES values");
+ cpl_msg_indent_less() ;
+ return NULL;
+ }
+
+ /* Get the offsets */
+ if ((offsets = hawki_get_header_tel_offsets(jitters)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load the offsets") ;
+ return NULL ;
+ }
+ offs_est_x = cpl_bivector_get_x_data(offsets) ;
+ offs_est_y = cpl_bivector_get_y_data(offsets) ;
+
+ /* Print the header offsets */
+ for (ioff=0 ; ioff<cpl_bivector_get_size(offsets) ; ioff++) {
+ cpl_msg_info(cpl_func, "Telescope offsets (Frame %d): %g %g", ioff+1,
+ offs_est_x[ioff], offs_est_y[ioff]) ;
+ }
+
+ /* Subtract the first offset to all offsets */
+ off_0_x = -offs_est_x[0]; // This is to get the cpl convention
+ off_0_y = -offs_est_y[0];
+ for (ioff=1 ; ioff<cpl_bivector_get_size(offsets) ; ioff++)
+ {
+ offs_est_x[ioff] -= offs_est_x[0] ;
+ offs_est_y[ioff] -= offs_est_y[0] ;
+ }
+ offs_est_x[0] = offs_est_y[0] = 0.00 ;
+
+ /* Check if the max offset is not too big */
+ /* The criteria is that for a given frame, the closest frame cannot be
+ * further than hawki_sci_jitter_config.offset_max (in both dimensions) */
+ offset_x_sort = cpl_vector_duplicate(cpl_bivector_get_x(offsets));
+ offset_y_sort = cpl_vector_duplicate(cpl_bivector_get_y(offsets));
+ cpl_vector_sort(offset_x_sort, +1);
+ cpl_vector_sort(offset_y_sort, +1);
+ for (ioff=0 ; ioff<cpl_bivector_get_size(offsets) - 1 ; ioff++)
+ {
+ double diff_x, diff_y;
+ diff_x = cpl_vector_get(offset_x_sort,ioff+1)-cpl_vector_get(offset_x_sort,ioff);
+ cpl_vector_set(offset_x_sort, ioff, diff_x);
+ diff_y = cpl_vector_get(offset_y_sort,ioff+1)-cpl_vector_get(offset_y_sort,ioff);
+ cpl_vector_set(offset_y_sort, ioff, diff_y);
+ }
+ cpl_vector_set(offset_x_sort, cpl_bivector_get_size(offsets)-1, 0.);
+ cpl_vector_set(offset_y_sort, cpl_bivector_get_size(offsets)-1, 0.);
+ max_x = cpl_vector_get_max(offset_x_sort);
+ max_y = cpl_vector_get_max(offset_y_sort);
+ cpl_vector_delete(offset_x_sort);
+ cpl_vector_delete(offset_y_sort);
+
+ if (max_x > hawki_sci_jitter_config.offset_max ||
+ max_y > hawki_sci_jitter_config.offset_max)
+ {
+ cpl_msg_error(cpl_func, "Sorry, no support for frames further than %d from its closest neighbour",
+ hawki_sci_jitter_config.offset_max) ;
+ cpl_bivector_delete(offsets);
+ return NULL ;
+ }
+
+ /* Create output object */
+ combined = cpl_malloc(HAWKI_NB_DETECTORS*sizeof(cpl_image*)) ;
+
+ /* Loop on the detectors */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_frameset * selected_jitter;
+ cpl_bivector * selected_offsets;
+ cpl_image * flat_ima = NULL;
+ cpl_image * dark_ima = NULL;
+ cpl_image * bpm_ima = NULL;
+ cpl_imagelist * in = NULL;
+ cpl_imagelist * in_sky = NULL;
+ int nrejected;
+
+ cpl_msg_info(cpl_func, "Combine chip number %d", idet+1) ;
+ cpl_msg_indent_more() ;
+
+ /* Apply frame selection based on offset values */
+ selected_jitter = cpl_frameset_duplicate(jitters);
+ selected_offsets = cpl_bivector_duplicate(offsets);
+ if(hawki_sci_jitter_config.max_njitter != -1)
+ {
+ if(hawki_sci_jitter_config.max_njitter <
+ cpl_frameset_get_size(selected_jitter))
+ {
+ while(cpl_frameset_get_size(selected_jitter) >
+ hawki_sci_jitter_config.max_njitter)
+ {
+ int irm = cpl_frameset_get_size(selected_jitter) - 1;
+ cpl_frameset_erase_frame
+ (selected_jitter,
+ cpl_frameset_get_frame(selected_jitter,irm));
+ }
+ cpl_vector_set_size(cpl_bivector_get_x(selected_offsets),
+ hawki_sci_jitter_config.max_njitter);
+ cpl_vector_set_size(cpl_bivector_get_y(selected_offsets),
+ hawki_sci_jitter_config.max_njitter);
+ }
+ }
+ hawki_sci_jitter_output.ncomb[idet] =
+ cpl_frameset_get_size(selected_jitter);
+ nrejected = cpl_frameset_get_size(selected_jitter) -
+ cpl_frameset_get_size(jitters);
+ if(nrejected != 0)
+ cpl_msg_info(cpl_func,"%d frames reject due to large offsets",
+ nrejected);
+
+
+ /* Load the input data */
+ cpl_msg_info(cpl_func, "Load the input data") ;
+ cpl_msg_indent_more() ;
+ if ((in = hawki_load_detector(selected_jitter,
+ idet+1, CPL_TYPE_FLOAT)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot load chip %d", idet+1) ;
+ cpl_free(combined) ;
+ cpl_bivector_delete(offsets) ;
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ if (sky) {
+ if ((in_sky = hawki_load_detector(sky, idet+1, CPL_TYPE_FLOAT)) == NULL)
+ {
+ cpl_msg_warning(cpl_func, "Cannot load sky for chip %d",idet+1);
+ }
+ } else in_sky = NULL ;
+ cpl_msg_indent_less() ;
+
+ /* Read the calibrations */
+ cpl_msg_info(cpl_func, "Load the calibration data") ;
+ if(hawki_sci_jitter_read_calib(flat, dark, bpm,
+ &flat_ima, &dark_ima, &bpm_ima,
+ idet) != 0)
+ {
+ cpl_msg_error(cpl_func, "Cannot read some of the calibrations");
+ cpl_imagelist_delete(in);
+ cpl_free(combined);
+ if (in_sky) cpl_imagelist_delete(in_sky);
+ cpl_bivector_delete(offsets);
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ return NULL ;
+ }
+
+ /* Apply the calibrations */
+ if (flat || dark || bpm )
+ {
+ cpl_msg_info(cpl_func, "Apply the calibrations") ;
+ cpl_msg_indent_more() ;
+ /* Basic calibration of the OBJECTS */
+ if (hawki_flat_dark_bpm_detector_calib
+ (in, flat_ima, dark_ima, bpm_ima) == -1)
+ {
+ cpl_msg_error(cpl_func, "Cannot calibrate the objects") ;
+ cpl_imagelist_delete(in) ;
+ cpl_free(combined) ;
+ if (in_sky) cpl_imagelist_delete(in_sky) ;
+ cpl_bivector_delete(offsets) ;
+ cpl_image_delete(flat_ima);
+ cpl_image_delete(dark_ima);
+ cpl_image_delete(bpm_ima);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ /* Basic calibration of the SKY */
+ if (in_sky) {
+ if (hawki_flat_dark_bpm_detector_calib
+ (in_sky, flat_ima, dark_ima, bpm_ima) == -1)
+ {
+ cpl_msg_warning(cpl_func, "Cannot calibrate the sky") ;
+ cpl_imagelist_delete(in_sky) ;
+ in_sky = NULL ;
+ }
+ }
+ cpl_msg_indent_less() ;
+ }
+ cpl_image_delete(flat_ima);
+ cpl_image_delete(dark_ima);
+ cpl_image_delete(bpm_ima);
+
+ /* Apply the sky correction */
+ cpl_msg_info(cpl_func, "Sky estimation and correction") ;
+ cpl_msg_indent_more() ;
+ if (hawki_sci_jitter_sky(in, in_sky, bkg_stats, idet) == -1)
+ {
+ cpl_msg_error(cpl_func, "Cannot estimate the sky") ;
+ cpl_imagelist_delete(in) ;
+ if (in_sky) cpl_imagelist_delete(in_sky) ;
+ cpl_free(combined) ;
+ cpl_bivector_delete(offsets) ;
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ if (in_sky) cpl_imagelist_delete(in_sky) ;
+ cpl_msg_indent_less() ;
+
+ /* Apply the shift and add */
+ cpl_msg_info(cpl_func, "Shift and stacking") ;
+ cpl_msg_indent_more() ;
+ comb_chip = hawki_sci_jitter_saa(&in, selected_offsets,
+ &(hawki_sci_jitter_output.combined_pos_x[idet]),
+ &(hawki_sci_jitter_output.combined_pos_y[idet])) ;
+ hawki_sci_jitter_output.combined_cumoffset_x[idet] =
+ hawki_sci_jitter_output.combined_pos_x[idet] - off_0_x;
+ hawki_sci_jitter_output.combined_cumoffset_y[idet] =
+ hawki_sci_jitter_output.combined_pos_y[idet] - off_0_y;
+ if (comb_chip == NULL) {
+ cpl_msg_error(cpl_func, "Cannot apply the shift and add") ;
+ cpl_imagelist_delete(in) ;
+ cpl_free(combined) ;
+ cpl_bivector_delete(offsets) ;
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ cpl_imagelist_delete(in) ;
+ cpl_msg_indent_less() ;
+
+ /* Put the results in the image list */
+ combined[idet] = comb_chip[0] ;
+ cpl_image_delete(comb_chip[1]) ;
+ cpl_free(comb_chip) ;
+ cpl_msg_indent_less() ;
+
+ /* Free */
+ cpl_frameset_delete(selected_jitter);
+ cpl_bivector_delete(selected_offsets);
+ }
+ cpl_bivector_delete(offsets) ;
+
+ return combined ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Estimate the sky signal and correct the images.
+ @param objs the images with objects
+ @param skys the sky images or NULL
+ @return the background values in a vector or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_sky
+(cpl_imagelist * objs,
+ cpl_imagelist * skys,
+ cpl_table ** bkg_stats,
+ int idet)
+{
+ cpl_image * sky ;
+ int nframes;
+ double median ;
+ cpl_image * cur_ima ;
+ int i ;
+
+ /* Initialise */
+ nframes = cpl_imagelist_get_size(objs) ;
+
+ /* Compute the sky frame */
+ if (skys != NULL) {
+ cpl_msg_info(cpl_func, "Median of sky images") ;
+ /* Use sky images */
+ if ((sky = cpl_imagelist_collapse_median_create(skys)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot compute the median of sky images") ;
+ return -1;
+ }
+
+ /* Statistics on the background */
+ if(bkg_stats != NULL)
+ {
+ cpl_table_set_size(bkg_stats[idet], 1);
+ hawki_image_stats_fill_from_image
+ (bkg_stats, sky,
+ 1,
+ 1,
+ cpl_image_get_size_x(sky),
+ cpl_image_get_size_y(sky),
+ idet, 0);
+ }
+
+ /* Correct the objects images */
+ if (cpl_imagelist_subtract_image(objs, sky) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot corr. the obj images from the sky");
+ cpl_image_delete(sky) ;
+ return -1;
+ }
+ cpl_image_delete(sky) ;
+ /* Normalise the object planes */
+ for (i=0 ; i<nframes ; i++) {
+ cur_ima = cpl_imagelist_get(objs, i) ;
+ median = cpl_image_get_median(cur_ima) ;
+ cpl_image_subtract_scalar(cur_ima, median) ;
+ }
+ } else if (hawki_sci_jitter_config.sky_minnb > nframes) {
+ cpl_msg_info(cpl_func, "Median of object images") ;
+ /* Use objs images */
+ if ((sky = cpl_imagelist_collapse_median_create(objs)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot compute the median of obj images") ;
+ return -1;
+ }
+
+ /* Statistics on the background */
+ if(bkg_stats != NULL)
+ {
+ cpl_table_set_size(bkg_stats[idet], 1);
+ hawki_image_stats_fill_from_image
+ (bkg_stats, sky,
+ 1,
+ 1,
+ cpl_image_get_size_x(sky),
+ cpl_image_get_size_y(sky),
+ idet, 0);
+ }
+
+ /* Correct the objects images */
+ if (cpl_imagelist_subtract_image(objs, sky) != CPL_ERROR_NONE) {
+ cpl_msg_error(cpl_func, "Cannot corr. the obj images from the sky");
+ cpl_image_delete(sky) ;
+ return -1;
+ }
+ /* Normalise the object planes */
+ for (i=0 ; i<nframes ; i++) {
+ cur_ima = cpl_imagelist_get(objs, i) ;
+ median = cpl_image_get_median(cur_ima) ;
+ cpl_image_subtract_scalar(cur_ima, median) ;
+ }
+ /* Delete sky image */
+ cpl_image_delete(sky) ;
+ } else {
+ cpl_msg_info(cpl_func, "Computing running median on jitter images") ;
+ /* Use objects images */
+ if (hawki_sci_jitter_sky_running(objs, bkg_stats, idet) == -1)
+ {
+ cpl_msg_error(cpl_func,
+ "Cannot apply the running median");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the running filter to subtract the sky
+ @param in the images to correct
+ @return the vector containing the background values or NULL in error case
+
+ This function performs a 3d rejection filter on the input cube.
+ Each time line is extracted on +/-halfw. On this line of sight, all
+ pixels are first normalized by subtracting the median value of the
+ plane they belong to. The central, highest and lowest values are then
+ removed and the rest is averaged to yield a value which is subtracted
+ from the initial input pixel.
+
+ The background array is returned.
+ The array will contain the average value which has been subtracted
+ to pixels in each plane. It is usually a good indicator of the
+ average subtracted background value if you use this filter to subtract
+ an infrared sky background.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_sky_running
+(cpl_imagelist * in,
+ cpl_table ** bkg_stats,
+ int idet)
+{
+ int rejmin, rejmax, halfw;
+ cpl_imagelist * result_buffer;
+ int ni, nx, ny;
+ cpl_vector * medians;
+ cpl_image * cur_ima;
+ cpl_image * tmp_ima;
+ double one_med;
+ int i, k;
+ int first_buffered = 0;
+ int next_not_to_be_used;
+
+ /* Test entries */
+ if (in==NULL) return -1;
+
+ /* Initialise */
+ rejmin = hawki_sci_jitter_config.sky_rejmin ;
+ rejmax = hawki_sci_jitter_config.sky_rejmax ;
+ halfw = hawki_sci_jitter_config.sky_halfw ;
+ ni = cpl_imagelist_get_size(in) ;
+ cur_ima = cpl_imagelist_get(in, 0) ;
+ nx = cpl_image_get_size_x(cur_ima) ;
+ ny = cpl_image_get_size_y(cur_ima) ;
+
+ /* Tests on validity of rejection parameters */
+ if (((rejmin+rejmax)>=halfw) || (halfw<1) || (rejmin<0) || (rejmax<0)) {
+ cpl_msg_error(cpl_func, "cannot run filter with rej parms %d (%d-%d)",
+ halfw, rejmin, rejmax);
+ return -1;
+ }
+ /* Pre-compute median value in each plane */
+ medians = cpl_vector_new(ni) ;
+ for (i=0 ; i<ni ; i++) {
+ cur_ima = cpl_imagelist_get(in, i) ;
+ cpl_vector_set(medians, i, cpl_image_get_median(cur_ima)) ;
+ }
+ /* Allocate output cube */
+ result_buffer = cpl_imagelist_new() ;
+
+ /* Allocate output bg stats */
+ cpl_table_set_size(bkg_stats[idet], ni);
+
+ /* Main loop over input planes */
+ for (k=0 ; k<ni ; k++)
+ {
+ cpl_image * bkg;
+
+ /* Create the background image, to later compute stats */
+ bkg = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+
+ hawki_bkg_from_running_mean_detector
+ (in, medians, k, halfw, rejmin, rejmax, bkg);
+
+ /* Subtract the background from the current image */
+ tmp_ima = cpl_image_subtract_create(cpl_imagelist_get(in, k), bkg);
+
+ /* Statistics on the background */
+ if(bkg_stats != NULL)
+ {
+ hawki_image_stats_fill_from_image
+ (bkg_stats, bkg,
+ 1, 1, nx, ny,
+ idet, k);
+ }
+ cpl_image_delete(bkg);
+
+ /* Place the new image in a result buffer */
+ cpl_imagelist_set(result_buffer, tmp_ima,
+ cpl_imagelist_get_size(result_buffer));
+
+ /* Empty the buffer as much as possible */
+ next_not_to_be_used = k - halfw;
+ while(next_not_to_be_used >= first_buffered)
+ {
+ cpl_imagelist_set(in, cpl_imagelist_unset(result_buffer, 0),
+ first_buffered);
+ first_buffered++;
+ }
+ }
+ /* Empty the buffer finally */
+ next_not_to_be_used = ni - 1;
+ while(next_not_to_be_used >= first_buffered)
+ {
+ cpl_imagelist_set(in, cpl_imagelist_unset(result_buffer, 0),
+ first_buffered);
+ first_buffered++;
+ }
+ cpl_imagelist_delete(result_buffer);
+ cpl_vector_delete(medians);
+
+ /* Subtract median from each frame */
+ for (i=0 ; i<ni ; i++) {
+ cur_ima = cpl_imagelist_get(in, i);
+ one_med = cpl_image_get_median(cur_ima) ;
+ cpl_image_subtract_scalar(cur_ima, one_med) ;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the shift and add in jitter mode
+ @param in the images to stack
+ @param offsets the list of offsets in x and y
+ @param pos_x the x position of the first image in the combined
+ @param pos_y the y position of the first image in the combined
+ @return the combined image and the contribution map or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_image ** hawki_sci_jitter_saa(
+ cpl_imagelist ** in,
+ cpl_bivector * offsets,
+ double * pos_x,
+ double * pos_y)
+{
+ cpl_bivector * offs_est;
+ cpl_bivector * offs_used;
+ cpl_bivector * objs ;
+ cpl_image ** combined ;
+ int nfiles, ngood, nima, nx, ny ;
+ int i;
+
+ /* Check entries */
+ if (pos_x == NULL || pos_y == NULL) return NULL ;
+ if (offsets == NULL) return NULL ;
+
+ /* Get the number of images */
+ nfiles = cpl_imagelist_get_size(*in) ;
+ if (cpl_bivector_get_size(offsets) != nfiles) {
+ cpl_msg_error(cpl_func, "Invalid input objects sizes") ;
+ return NULL ;
+ }
+
+ /* Get the offsets estimation of each input file pair */
+ cpl_msg_info(cpl_func, "Get the offsets estimation") ;
+ offs_est = NULL ;
+ if (hawki_sci_jitter_config.offsets &&
+ hawki_sci_jitter_config.offsets[0] != (char)0) {
+ /* A file has been provided on the command line */
+ offs_est = cpl_bivector_read((char*)hawki_sci_jitter_config.offsets);
+ if ((offs_est==NULL)||(cpl_bivector_get_size(offs_est)!=nfiles)) {
+ cpl_msg_error(cpl_func, "Cannot get offsets from %s",
+ hawki_sci_jitter_config.offsets) ;
+ return NULL ;
+ }
+ } else {
+ /* Use the offsets from the header */
+ offs_est = cpl_bivector_duplicate(offsets) ;
+ cpl_vector_multiply_scalar(cpl_bivector_get_x(offs_est), -1.0) ;
+ cpl_vector_multiply_scalar(cpl_bivector_get_y(offs_est), -1.0) ;
+ }
+
+ /* Read the provided objects file if provided */
+ objs = NULL ;
+ if (hawki_sci_jitter_config.refine &&
+ hawki_sci_jitter_config.objects &&
+ hawki_sci_jitter_config.objects[0] != (char)0) {
+ cpl_msg_info(cpl_func, "Get the user provided correlation objects") ;
+ /* A file has been provided on the command line */
+ objs = cpl_bivector_read((char*)hawki_sci_jitter_config.objects) ;
+ if (objs==NULL) {
+ cpl_msg_error(cpl_func, "Cannot get objects from %s",
+ hawki_sci_jitter_config.objects) ;
+ cpl_bivector_delete(offs_est) ;
+ return NULL ;
+ }
+ }
+
+ /* Get a correlation point from the difference of the first images */
+ if (hawki_sci_jitter_config.refine && objs == NULL) {
+ cpl_apertures * aperts;
+ cpl_image * detect_image;
+ cpl_vector * thresh_vect;
+ double * objs_x ;
+ double * objs_y ;
+ cpl_msg_info(cpl_func, "Get a cross-correlation point") ;
+ thresh_vect = cpl_vector_new(4) ;
+ cpl_vector_set(thresh_vect, 0, 5.0) ;
+ cpl_vector_set(thresh_vect, 1, 2.0) ;
+ cpl_vector_set(thresh_vect, 2, 1.0) ;
+ cpl_vector_set(thresh_vect, 3, 0.5) ;
+ detect_image = cpl_imagelist_get(*in, 0);
+ if ((aperts = cpl_apertures_extract_window(detect_image, thresh_vect,
+ 400, 400, 1600, 1600, NULL)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot find any cross-correlation point") ;
+ cpl_bivector_delete(offs_est) ;
+ cpl_vector_delete(thresh_vect) ;
+ return NULL ;
+ }
+ cpl_vector_delete(thresh_vect) ;
+ cpl_apertures_sort_by_npix(aperts) ;
+ objs = cpl_bivector_new(1) ;
+ objs_x = cpl_bivector_get_x_data(objs) ;
+ objs_y = cpl_bivector_get_y_data(objs) ;
+ objs_x[0] = cpl_apertures_get_pos_x(aperts, 1) ;
+ objs_y[0] = cpl_apertures_get_pos_y(aperts, 1) ;
+ cpl_apertures_delete(aperts) ;
+ if (objs == NULL) {
+ cpl_msg_error(cpl_func, "Cannot find any cross-correlation point") ;
+ cpl_bivector_delete(offs_est) ;
+ return NULL ;
+ }
+ cpl_msg_info(cpl_func,
+ "Correlation point: %g %g\n", objs_x[0], objs_y[0]);
+ }
+
+ /* Refine the offsets */
+ if (hawki_sci_jitter_config.refine) {
+ cpl_bivector * offs_refined;
+ double * offs_refined_x;
+ double * offs_refined_y;
+ double * offs_est_x;
+ double * offs_est_y;
+ cpl_vector * correl ;
+ double * correl_data ;
+ cpl_msg_info(cpl_func, "Refine the offsets");
+ cpl_msg_indent_more() ;
+ nima = cpl_imagelist_get_size(*in) ;
+ correl = cpl_vector_new(nima) ;
+ if ((offs_refined = cpl_geom_img_offset_fine(*in, offs_est, objs,
+ hawki_sci_jitter_config.sx,
+ hawki_sci_jitter_config.sy,
+ hawki_sci_jitter_config.mx,
+ hawki_sci_jitter_config.my,
+ correl)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot refine the offsets");
+ cpl_bivector_delete(offs_est) ;
+ if (objs != NULL) cpl_bivector_delete(objs) ;
+ cpl_vector_delete(correl) ;
+ return NULL ;
+ }
+ if (objs != NULL) cpl_bivector_delete(objs) ;
+
+ /* Display the results */
+ offs_est_x = cpl_bivector_get_x_data(offs_est);
+ offs_est_y = cpl_bivector_get_y_data(offs_est);
+ offs_refined_x = cpl_bivector_get_x_data(offs_refined);
+ offs_refined_y = cpl_bivector_get_y_data(offs_refined) ;
+ correl_data = cpl_vector_get_data(correl) ;
+ cpl_msg_info(cpl_func, "Refined offsets [correlation factor]") ;
+ ngood = 0 ;
+ for (i=0 ; i<nima ; i++) {
+ cpl_msg_info(cpl_func, "#%02d: %8.2f %8.2f [%12.2f]",
+ i+1, offs_refined_x[i], offs_refined_y[i], correl_data[i]);
+ if (correl_data[i] > -0.5) ngood++ ;
+ }
+ if (ngood == 0) {
+ cpl_msg_error(cpl_func, "No frame correctly correlated") ;
+ cpl_bivector_delete(offs_est);
+ cpl_bivector_delete(offs_refined);
+ cpl_vector_delete(correl);
+ return NULL ;
+ }
+ cpl_msg_indent_less();
+
+ /* Replace bad correlated images with the nominal offsets */
+ cpl_msg_info(cpl_func, "Using nominal offsets for badly "
+ "correlated images (%d out of %d)", nima-ngood, nima);
+ for (i=0 ; i<nima ; i++) {
+ if (correl_data[i] < -0.5) {
+ offs_refined_x[i] = offs_est_x[i];
+ offs_refined_y[i] = offs_est_y[i];
+ }
+ }
+ offs_used = cpl_bivector_duplicate(offs_refined);
+ cpl_bivector_delete(offs_est);
+ cpl_bivector_delete(offs_refined);
+ cpl_vector_delete(correl);
+ }
+ else
+ {
+ offs_used = cpl_bivector_duplicate(offs_est);
+ cpl_bivector_delete(offs_est);
+ }
+
+ /* Discard the pixels on the sides */
+ if (hawki_sci_jitter_config.borders > 0) {
+ cpl_imagelist * in_ext ;
+ cpl_image * tmp1 ;
+ cpl_image * tmp2 ;
+ nx = cpl_image_get_size_x(cpl_imagelist_get(*in, 0)) ;
+ ny = cpl_image_get_size_y(cpl_imagelist_get(*in, 0)) ;
+ in_ext = cpl_imagelist_new() ;
+ while(cpl_imagelist_get_size(*in) > 0)
+ {
+ tmp1 = cpl_imagelist_unset(*in, 0);
+ tmp2 = cpl_image_extract(tmp1,
+ hawki_sci_jitter_config.borders+1,
+ hawki_sci_jitter_config.borders+1,
+ nx-hawki_sci_jitter_config.borders,
+ ny-hawki_sci_jitter_config.borders) ;
+ cpl_image_delete(tmp1);
+ cpl_imagelist_set(in_ext, tmp2, cpl_imagelist_get_size(in_ext)) ;
+ }
+ cpl_imagelist_delete(*in) ;
+ *in = in_ext ;
+ }
+
+ /* Apply the shift & add */
+ cpl_msg_info(cpl_func, "Recombine the images set") ;
+ cpl_msg_indent_more() ;
+ if ((combined=cpl_geom_img_offset_saa(*in, offs_used,
+ CPL_KERNEL_DEFAULT,
+ hawki_sci_jitter_config.rej_low,
+ hawki_sci_jitter_config.rej_high,
+ hawki_sci_jitter_config.comb_meth,
+ pos_x, pos_y)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot apply the shift and add") ;
+ cpl_bivector_delete(offs_used) ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ cpl_msg_indent_less() ;
+ *pos_x -= hawki_sci_jitter_config.borders ;
+ *pos_y -= hawki_sci_jitter_config.borders ;
+
+ /* Free and return */
+ cpl_bivector_delete(offs_used) ;
+ return combined ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute some QC parameters from the combined image
+ @param combined the combined image produced
+ @param chip the chip number (start from 0)
+ @return a newly allocated table with the stars stats or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_qc
+(cpl_frameset * science_frames,
+ cpl_image ** combined_images,
+ cpl_table ** obj_charac)
+{
+ cpl_vector * thresh_vec ;
+ cpl_apertures * aperts ;
+ int nb_objs ;
+ double angle ;
+ double * fwhms_x ;
+ double * fwhms_y ;
+ cpl_bivector * iqe ;
+ int nb_good ;
+ cpl_vector * fwhms_good ;
+ double * fwhms_good_data ;
+ double f_min, f_max, fr, fx, fy ;
+ int chip;
+ int iobj;
+ int j;
+
+ /* Initialise */
+ double seeing_min_arcsec = 0.1 ;
+ double seeing_max_arcsec = 5.0 ;
+ double seeing_fwhm_var = 0.2 ;
+
+ /* Check entries */
+ if (combined_images == NULL) return -1 ;
+ if (obj_charac == NULL) return -1 ;
+
+ /* Create the vector for the detection thresholds */
+ thresh_vec = cpl_vector_new(11) ;
+ cpl_vector_set(thresh_vec, 0, 100.0) ;
+ cpl_vector_set(thresh_vec, 0, 90.0) ;
+ cpl_vector_set(thresh_vec, 0, 80.0) ;
+ cpl_vector_set(thresh_vec, 0, 70.0) ;
+ cpl_vector_set(thresh_vec, 0, 60.0) ;
+ cpl_vector_set(thresh_vec, 0, 50.0) ;
+ cpl_vector_set(thresh_vec, 1, 40.0) ;
+ cpl_vector_set(thresh_vec, 1, 30.0) ;
+ cpl_vector_set(thresh_vec, 1, 20.0) ;
+ cpl_vector_set(thresh_vec, 1, 10.0) ;
+ cpl_vector_set(thresh_vec, 2, 5.0) ;
+
+ /* Get the mean airmass */
+ hawki_sci_jitter_output.mean_airmass =
+ hawki_get_mean_airmass(science_frames);;
+
+ /* Loop on the HAWK-I detectors */
+ for (chip=0 ; chip<HAWKI_NB_DETECTORS ; chip++)
+ {
+ /* Check entries */
+ if (combined_images[chip] == NULL) return -1 ;
+ if (obj_charac[chip] == NULL) return -1 ;
+
+ /* Detect apertures */
+ if ((aperts = cpl_apertures_extract
+ (combined_images[chip], thresh_vec, NULL)) == NULL) {
+ cpl_msg_warning(cpl_func, "Cannot detect any aperture on chip %d",
+ chip+1) ;
+ continue;
+ }
+
+ /* Number of detected objects */
+ nb_objs = cpl_apertures_get_size(aperts);
+ cpl_msg_info(cpl_func, "%d objects detected on chip %d",nb_objs,chip+1);
+ hawki_sci_jitter_output.nbobjs[chip] = nb_objs ;
+ fwhms_x = cpl_malloc(nb_objs * sizeof(double)) ;
+ fwhms_y = cpl_malloc(nb_objs * sizeof(double)) ;
+
+ /* Initialize the output table */
+ cpl_table_set_size(obj_charac[chip], nb_objs);
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_POSX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSX,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_POSY, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSY,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_ANGLE,"grad");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MAJAX,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MINAX,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, CPL_TYPE_DOUBLE);
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_FLUX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FLUX,"ADU");
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ /* Fill with the already known information */
+ cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSX, iobj,
+ cpl_apertures_get_centroid_x(aperts, iobj+1));
+ cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSY, iobj,
+ cpl_apertures_get_centroid_y(aperts, iobj+1));
+ cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_FLUX, iobj,
+ cpl_apertures_get_flux(aperts, iobj+1)) ;
+ /* Compute the FWHM informations */
+ if ((iqe = cpl_image_iqe(combined_images[chip],
+ (int)cpl_apertures_get_centroid_x(aperts, iobj+1) - 10,
+ (int)cpl_apertures_get_centroid_y(aperts, iobj+1) - 10,
+ (int)cpl_apertures_get_centroid_x(aperts, iobj+1) + 10,
+ (int)cpl_apertures_get_centroid_y(aperts, iobj+1) + 10))==NULL)
+ {
+ cpl_error_reset() ;
+ cpl_msg_debug(cpl_func, "Cannot get FWHM for obj at pos %g %g",
+ cpl_apertures_get_centroid_x(aperts, iobj+1),
+ cpl_apertures_get_centroid_y(aperts, iobj+1)) ;
+ fwhms_x[iobj] = -1.0 ;
+ fwhms_y[iobj] = -1.0 ;
+ angle = 0.0 ;
+ }
+ else
+ {
+ fwhms_x[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 2) ;
+ fwhms_y[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 3) ;
+ angle = cpl_vector_get(cpl_bivector_get_x(iqe), 4) ;
+ cpl_bivector_delete(iqe) ;
+ cpl_msg_debug(cpl_func,
+ "FWHM for obj at pos %g %g: %g x %g (%g)",
+ cpl_apertures_get_centroid_x(aperts, iobj+1),
+ cpl_apertures_get_centroid_y(aperts, iobj+1),
+ fwhms_x[iobj], fwhms_y[iobj], angle) ;
+ }
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, iobj, angle) ;
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, iobj,
+ fwhms_x[iobj]);
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, iobj,
+ fwhms_y[iobj]);
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, iobj,
+ 1 - fwhms_y[iobj] / fwhms_x[iobj]);
+ }
+ cpl_apertures_delete(aperts) ;
+
+ /* Get the number of good values */
+ nb_good = 0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ if ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0)) nb_good++ ;
+ }
+ if (nb_good == 0)
+ {
+ cpl_msg_warning(cpl_func, "No objects to compute FWHM on chip %d",
+ chip+1);
+ cpl_free(fwhms_x) ;
+ cpl_free(fwhms_y) ;
+ continue;
+ }
+
+ /* Get the good values */
+ fwhms_good = cpl_vector_new(nb_good) ;
+ fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+ j=0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ if ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0))
+ {
+ fwhms_good_data[j] = (fwhms_x[iobj]+fwhms_y[iobj])/2.0 ;
+ j++ ;
+ }
+ }
+
+ /* Compute the fwhm */
+ if (nb_good < 3)
+ {
+ /* Too few values to compute the median */
+ hawki_sci_jitter_output.fwhm_pix[chip] = fwhms_good_data[0] ;
+ }
+ else
+ {
+ /* Compute the median */
+ hawki_sci_jitter_output.fwhm_pix[chip] =
+ cpl_vector_get_median_const(fwhms_good) ;
+ }
+ hawki_sci_jitter_output.fwhm_arcsec[chip] =
+ hawki_sci_jitter_output.fwhm_pix[chip] *
+ hawki_sci_jitter_output.pixscale ;
+
+ /* Compute the mode of the FWHMs */
+ if (nb_good > 5)
+ {
+ hawki_sci_jitter_output.fwhm_mode[chip] =
+ hawki_vector_get_mode(fwhms_good);
+ hawki_sci_jitter_output.fwhm_mode[chip] *=
+ hawki_sci_jitter_output.pixscale ;
+ }
+ cpl_vector_delete(fwhms_good) ;
+
+ /* IQ is the median of the (fwhm_x+fwhm_y/2) of the good stars */
+ /* Compute f_min and f_max */
+ f_min = seeing_min_arcsec / hawki_sci_jitter_output.pixscale ;
+ f_max = seeing_max_arcsec / hawki_sci_jitter_output.pixscale ;
+
+ /* Get the number of good values */
+ nb_good = 0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ fx = fwhms_x[iobj] ;
+ fy = fwhms_y[iobj] ;
+ fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+ if ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+ (fr < seeing_fwhm_var)) nb_good++ ;
+ }
+ if (nb_good == 0)
+ {
+ cpl_msg_warning(cpl_func, "No objects to compute IQ on chip %d",
+ chip+1);
+ cpl_free(fwhms_x) ;
+ cpl_free(fwhms_y) ;
+ continue;
+ }
+
+ /* Get the good values */
+ fwhms_good = cpl_vector_new(nb_good) ;
+ fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+ j=0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ fx = fwhms_x[iobj] ;
+ fy = fwhms_y[iobj] ;
+ fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+ if ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+ (fr < seeing_fwhm_var))
+ {
+ fwhms_good_data[j] = (fx + fy)/2.0 ;
+ j++ ;
+ }
+ }
+ cpl_free(fwhms_x) ;
+ cpl_free(fwhms_y) ;
+
+ /* Compute the fwhm */
+ if (nb_good < 3)
+ {
+ /* Too few values to compute the median */
+ hawki_sci_jitter_output.iq[chip] = fwhms_good_data[0] ;
+ }
+ else
+ {
+ /* Compute the median */
+ hawki_sci_jitter_output.iq[chip] =
+ cpl_vector_get_median_const(fwhms_good) ;
+ }
+ cpl_vector_delete(fwhms_good) ;
+ hawki_sci_jitter_output.iq[chip] *= hawki_sci_jitter_output.pixscale ;
+ }
+
+ /* Cleanup */
+ cpl_vector_delete(thresh_vec) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Reads into memory the calibration files
+ @param flat filename for the flat
+ @param dark filename for the dark
+ @param bpm filename for the bpm
+ @param flat_ima the flat image for detector idet
+ @param dark_ima the dark image for detector idet
+ @param bpm_ima the bpm image for detector idet
+ @param chip the chip number (start from 0)
+ @return a newly allocated table with the stars stats or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_read_calib
+(const char * flat,
+ const char * dark,
+ const char * bpm,
+ cpl_image ** flat_image,
+ cpl_image ** dark_image,
+ cpl_image ** bpm_image,
+ int idet)
+{
+ const char * reffile;
+ int ext_nb;
+
+ if(flat == NULL && dark == NULL && bpm == NULL)
+ return 0;
+ if(*flat_image != NULL || *dark_image != NULL || *bpm_image != NULL)
+ return 0;
+
+ /* Get the extension number for this detector */
+ if(flat != NULL)
+ reffile = flat;
+ else if(dark != NULL)
+ reffile = dark;
+ else
+ reffile = bpm;
+
+ /* Guess which is the extension to read */
+ if ((ext_nb = hawki_get_ext_from_detector(reffile, idet + 1)) == -1) {
+ cpl_msg_error(cpl_func, "Cannot get the extension with detector %d",
+ idet + 1);
+ return -1;
+ }
+
+ /* Load the dark image */
+ if(dark != NULL)
+ *dark_image = cpl_image_load(dark, CPL_TYPE_FLOAT, 0, ext_nb);
+ /* Load the flat image */
+ if(flat != NULL)
+ *flat_image = cpl_image_load(flat, CPL_TYPE_FLOAT, 0, ext_nb);
+ /* Load the bpm image */
+ if(bpm != NULL)
+ *bpm_image = cpl_image_load(bpm, CPL_TYPE_FLOAT, 0, ext_nb);
+
+ /* Multiply the dark image by the science exposure time */
+ if(dark != NULL)
+ cpl_image_multiply_scalar(*dark_image, hawki_sci_jitter_output.dit);
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the jitter recipe products on disk
+ @param combined the combined imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_sci_jitter_save
+(cpl_image ** combined,
+ cpl_image * stitched,
+ cpl_table ** obj_charac,
+ cpl_table ** raw_jitter_stats,
+ cpl_table ** bkg_stats,
+ const cpl_table * raw_obj_tel_info,
+ cpl_frameset * science_frames,
+ cpl_frameset * calib_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set)
+{
+ cpl_propertylist * plist ;
+ double pscale, dit, bg_mean, bg_stdev, bg_instmag ;
+ cpl_propertylist ** qclists ;
+ const cpl_frame * ref_frame ;
+ cpl_frameset * used_frames;
+ cpl_propertylist * wcslist ;
+ cpl_propertylist * telstats;
+ cpl_propertylist * inputlist ;
+ double crpix1, crpix2 ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_sci_jitter" ;
+ int i;
+ int ext_chip_1;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Initialise */
+ pscale = hawki_sci_jitter_output.pixscale;
+ dit = hawki_sci_jitter_output.dit;
+
+ /* Get reference frame */
+ ref_frame = irplib_frameset_get_first_from_group(set, CPL_FRAME_GROUP_RAW);
+
+ /* Get the used frames */
+ used_frames = cpl_frameset_duplicate(science_frames);
+ for(i = 0; i< cpl_frameset_get_size(calib_frames); ++i)
+ cpl_frameset_insert(used_frames,
+ cpl_frame_duplicate(cpl_frameset_get_frame(calib_frames, i)));
+
+ /* Create the telescope data statistics */
+ telstats = cpl_propertylist_new();
+ hawki_compute_prop_tel_qc_stats(raw_obj_tel_info, telstats);
+
+ /* Create the QC lists */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector(cpl_frame_get_filename(ref_frame), i+1);
+
+ /* Handle WCS keys */
+ wcslist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb, HAWKI_HEADER_WCS, 0);
+ qclists[i] = cpl_propertylist_new() ;
+
+ /* Compute bg_instmag */
+ bg_mean = cpl_table_get_column_mean(bkg_stats[i], HAWKI_COL_STAT_MEAN);
+ if (cpl_table_get_nrow(bkg_stats[i]) < 2) bg_stdev = 0 ;
+ else bg_stdev = cpl_table_get_column_stdev
+ (bkg_stats[i], HAWKI_COL_STAT_MEAN);
+ if(bg_mean >= 0)
+ bg_instmag = -2.5 * log10(bg_mean/(pscale*pscale*dit));
+ else
+ bg_instmag = 0;
+
+ /* Fill the QC */
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC BACKGD MEAN", bg_mean) ;
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC BACKGD STDEV", bg_stdev);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC BACKGD INSTMAG", bg_instmag) ;
+ cpl_propertylist_append_int
+ (qclists[i], "ESO QC NBOBJS", hawki_sci_jitter_output.nbobjs[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC IQ", hawki_sci_jitter_output.iq[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC IQ DIFF AMBI",
+ hawki_sci_jitter_output.iq[i] - cpl_propertylist_get_double
+ (telstats, "ESO QC TEL AMBI FWHM MEAN"));
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC IQ DIFF TEL",
+ hawki_sci_jitter_output.iq[i] - cpl_propertylist_get_double
+ (telstats, "ESO QC TEL IA FWHM MEAN"));
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC FWHM PIX",
+ hawki_sci_jitter_output.fwhm_pix[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC FWHM ARCSEC",
+ hawki_sci_jitter_output.fwhm_arcsec[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC FWHM MODE",
+ hawki_sci_jitter_output.fwhm_mode[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC COMBINED POSX",
+ hawki_sci_jitter_output.combined_pos_x[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC COMBINED POSY",
+ hawki_sci_jitter_output.combined_pos_y[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC COMBINED CUMOFFSETX",
+ hawki_sci_jitter_output.combined_cumoffset_x[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC COMBINED CUMOFFSETY",
+ hawki_sci_jitter_output.combined_cumoffset_y[i]);
+ cpl_propertylist_append_int
+ (qclists[i], "ESO QC DATANCOM",hawki_sci_jitter_output.ncomb[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC AIRMASS MEAN",
+ hawki_sci_jitter_output.mean_airmass);
+
+ /* Update WCS and write them */
+ crpix1 = cpl_propertylist_get_double(wcslist, "CRPIX1");
+ crpix1 += hawki_sci_jitter_output.combined_pos_x[i];
+ cpl_propertylist_update_double(wcslist, "CRPIX1", crpix1) ;
+ crpix2 = cpl_propertylist_get_double(wcslist, "CRPIX2");
+ crpix2 += hawki_sci_jitter_output.combined_pos_y[i] ;
+ cpl_propertylist_update_double(wcslist, "CRPIX2", crpix2) ;
+ cpl_propertylist_copy_property_regexp
+ (qclists[i], wcslist, HAWKI_HEADER_WCS, 0) ;
+ cpl_propertylist_delete(wcslist);
+
+ /* Propagate some keywords from input raw frame extensions */
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0) ;
+ cpl_propertylist_append(qclists[i], inputlist);
+ cpl_propertylist_delete(inputlist) ;
+ }
+
+ /* Statistics of the raw images in the QC */
+ hawki_image_stats_stats(raw_jitter_stats, qclists);
+
+ /* Statistics of the detected objects in the QC */
+ hawki_obj_prop_stats(obj_charac, qclists);
+
+ /* Write the combined image */
+ hawki_images_save(set,
+ parlist,
+ used_frames,
+ (const cpl_image **)combined,
+ recipe_name,
+ HAWKI_CALPRO_COMBINED,
+ HAWKI_PROTYPE_COMBINED,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ "hawki_sci_jitter.fits");
+
+ /* Erase the WCS */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ cpl_propertylist_erase_regexp(qclists[i], HAWKI_HEADER_WCS, 0) ;
+ }
+
+ /* Create a propertylist for PRO.x */
+ plist = cpl_propertylist_new();
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE,
+ HAWKI_PROTYPE_STITCHED) ;
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG,
+ HAWKI_CALPRO_STITCHED) ;
+ /* Handle WCS keys */
+ ext_chip_1 = 1;
+ wcslist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_chip_1, HAWKI_HEADER_WCS, 0);
+ /* Update WCS and write them */
+ crpix1 = cpl_propertylist_get_double(wcslist, "CRPIX1");
+ crpix1 += hawki_sci_jitter_output.combined_pos_x[0];
+ cpl_propertylist_update_double(wcslist, "CRPIX1", crpix1) ;
+ crpix2 = cpl_propertylist_get_double(wcslist, "CRPIX2");
+ crpix2 += hawki_sci_jitter_output.combined_pos_y[0] ;
+ cpl_propertylist_update_double(wcslist, "CRPIX2", crpix2) ;
+ cpl_propertylist_append(plist, wcslist);
+ cpl_propertylist_delete(wcslist) ;
+ /* Write the stitched image */
+ cpl_dfs_save_image(set,
+ NULL,
+ parlist,
+ used_frames,
+ NULL,
+ stitched,
+ CPL_BPP_IEEE_FLOAT,
+ recipe_name,
+ plist,
+ NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ "hawki_sci_jitter_stitched.fits");
+ cpl_propertylist_delete(plist);
+
+ /* Write the FITS table with the objects statistics */
+ if (obj_charac)
+ {
+ hawki_tables_save(set,
+ parlist,
+ used_frames,
+ (const cpl_table **)obj_charac,
+ recipe_name,
+ HAWKI_CALPRO_OBJ_PARAM,
+ HAWKI_PROTYPE_OBJ_PARAM,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ "hawki_sci_jitter_stars.fits");
+ }
+
+ /* Write the table with the background statistics */
+ hawki_tables_save(set,
+ parlist,
+ used_frames,
+ (const cpl_table **)bkg_stats,
+ recipe_name,
+ HAWKI_CALPRO_JITTER_BKG_STATS,
+ HAWKI_PROTYPE_JITTER_BKG_STATS,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ "hawki_sci_jitter_bkg_stats.fits");
+
+ /* Free and return */
+ cpl_frameset_delete(used_frames);
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ cpl_propertylist_delete(qclists[i]) ;
+ }
+ cpl_propertylist_delete(telstats) ;
+ cpl_free(qclists) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
+
+int hawki_sci_jitter_whole_image_algo
+(cpl_frameset * obj,
+ cpl_table ** raw_jitter_stats,
+ cpl_table * raw_obj_tel_info,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_set)
+{
+ int nframes;
+ int iframe;
+
+
+ nframes = cpl_frameset_get_size(obj);
+ for( iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ /* Local storage variables */
+ cpl_frame * this_target_frame;
+ cpl_propertylist * this_properties;
+
+ /* Computing statistics for this frame */
+ cpl_msg_info(cpl_func, "Getting statistics for image %d", iframe + 1);
+ this_target_frame = cpl_frameset_get_frame(obj, iframe);
+ hawki_image_stats_fill_from_frame
+ (raw_jitter_stats, this_target_frame, iframe);
+
+ /* Compute the telescope pcs statistics */
+ this_properties = cpl_propertylist_load
+ (cpl_frame_get_filename(this_target_frame), 0);
+ if(this_properties == NULL)
+ {
+ cpl_msg_error(cpl_func,"Could not read the header of object frame");
+ return -1;
+ }
+ if(hawki_extract_prop_tel_qc(this_properties, raw_obj_tel_info, iframe))
+ {
+ cpl_msg_warning(cpl_func,"Some telescope properties could not be "
+ "read for image %d", iframe+1);
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ }
+ cpl_propertylist_delete(this_properties);
+ }
+
+ /* Saving the already computed products */
+ cpl_msg_info(cpl_func, "Saving image statistics");
+ if(hawki_sci_jitter_save_stats(raw_jitter_stats, raw_obj_tel_info,
+ obj,
+ parlist, recipe_set) != 0)
+ cpl_msg_warning(cpl_func,"Some data could not be saved. "
+ "Check permisions or disk space");
+
+
+ /* Free and return */
+ return 0;
+}
+
+int hawki_sci_jitter_save_stats
+(cpl_table ** raw_jitter_stats,
+ cpl_table * raw_obj_tel_info,
+ cpl_frameset * jitter_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_set)
+{
+ int idet;
+ const cpl_frame * ref_frame;
+ cpl_propertylist ** qcstats;
+ cpl_propertylist * telstats;
+ const char * recipe_name = "hawki_sci_jitter" ;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Statistics of the raw images in the QC */
+ qcstats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*));
+ /* Create the QC lists */
+ ref_frame = irplib_frameset_get_first_from_group
+ (recipe_set, CPL_FRAME_GROUP_RAW);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ int ext_nb;
+ cpl_propertylist * reflist;
+
+ qcstats[idet] = cpl_propertylist_new();
+ /* Propagate some keywords from input raw frame extensions */
+ ext_nb =
+ hawki_get_ext_from_detector(cpl_frame_get_filename(ref_frame), idet+1);
+ reflist = cpl_propertylist_load_regexp
+ (cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0) ;
+ cpl_propertylist_append(qcstats[idet], reflist);
+ cpl_propertylist_delete(reflist);
+ }
+ hawki_image_stats_stats(raw_jitter_stats, qcstats);
+ /* Write the table with the raw jitter objects statistics */
+ hawki_tables_save(recipe_set,
+ parlist,
+ jitter_frames,
+ (const cpl_table **)raw_jitter_stats,
+ recipe_name,
+ HAWKI_CALPRO_JITTER_STATS,
+ HAWKI_PROTYPE_JITTER_STATS,
+ NULL,
+ (const cpl_propertylist**)qcstats,
+ "hawki_sci_jitter_stats.fits");
+ /* Free qcstats */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_propertylist_delete(qcstats[idet]);
+
+ /* Write the FITS table with the raw telescope data */
+ telstats = cpl_propertylist_new();
+ cpl_propertylist_append_string(telstats, CPL_DFS_PRO_TYPE,
+ HAWKI_PROTYPE_SCIENCE_PCS);
+ cpl_propertylist_append_string(telstats, CPL_DFS_PRO_CATG,
+ HAWKI_CALPRO_SCIENCE_PCS);
+ hawki_compute_prop_tel_qc_stats(raw_obj_tel_info, telstats);
+ if(cpl_dfs_save_table(recipe_set,
+ NULL,
+ parlist,
+ jitter_frames,
+ NULL,
+ raw_obj_tel_info,
+ NULL,
+ recipe_name,
+ telstats,
+ NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ "hawki_sci_jitter_pcs.fits") != CPL_ERROR_NONE)
+ cpl_msg_error(cpl_func,"Cannot save PCS table");
+
+ /* Free and return */
+ cpl_propertylist_delete(telstats);
+ cpl_free(qcstats);
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/recipes/hawki_step_apply_dist.c b/recipes/hawki_step_apply_dist.c
new file mode 100644
index 0000000..57314e3
--- /dev/null
+++ b/recipes/hawki_step_apply_dist.c
@@ -0,0 +1,517 @@
+/* $Id: hawki_step_apply_dist.c,v 1.10 2011/03/09 10:48:38 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/03/09 10:48:38 $
+ * $Revision: 1.10 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_utils.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_distortion.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_apply_dist_create(cpl_plugin *) ;
+static int hawki_step_apply_dist_exec(cpl_plugin *) ;
+static int hawki_step_apply_dist_destroy(cpl_plugin *) ;
+static int hawki_step_apply_dist(cpl_parameterlist *, cpl_frameset *) ;
+static int hawki_step_apply_dist_save
+(cpl_imagelist * images,
+ int iserie,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * used_frameset,
+ cpl_frameset * recipe_frameset);
+
+int hawki_step_apply_dist_compute_and_save
+(cpl_frameset * objects,
+ cpl_frameset * distortion_x,
+ cpl_frameset * distortion_y,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_frameset);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_apply_dist_description[] =
+"hawki_step_apply_dist -- Distortion correction utility\n"
+"This recipe accepts three types of frames:\n"
+"object.fits Images to correct (PRO.CATG = "HAWKI_CALPRO_BKG_SUBTRACTED")\n"
+"distmap_x.fits The image with the distortion in X.\n"
+" (PRO CATG = "HAWKI_CALPRO_DISTORTION_X")\n"
+"distmap_y.fits The image with the distortion in Y.\n"
+" (PRO CATG = "HAWKI_CALPRO_DISTORTION_Y")\n"
+"\n"
+"This recipe produces:\n"
+"hawki_step_apply_dist.fits: the corrected image.\n"
+" (PRO CATG = "HAWKI_CALPRO_DIST_CORRECTED")\n" ;
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok, -1 otherwise
+
+ Create the recipe instance and make it available to the application using the
+ interface. This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe ) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_apply_dist",
+ "Distortion correction utility",
+ hawki_step_apply_dist_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_apply_dist_create,
+ hawki_step_apply_dist_exec,
+ hawki_step_apply_dist_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Defining the command-line/configuration parameters for the recipe.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_apply_dist_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Check that the plugin is part of a valid recipe */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_apply_dist_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_apply_dist(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_apply_dist_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Interpret the command line options and execute the data processing
+ @param parlist the parameters list
+ @param frameset the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_apply_dist(
+ cpl_parameterlist * parlist,
+ cpl_frameset * frameset)
+{
+ cpl_frameset * objframes;
+ cpl_frameset * distortion_x;
+ cpl_frameset * distortion_y;
+
+ /* Retrieve input parameters */
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(frameset)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Identifying objects frames */
+ cpl_msg_info(__func__, "Identifying objects");
+ objframes = hawki_extract_frameset
+ (frameset, HAWKI_CALPRO_BKG_SUBTRACTED);
+ if (objframes == NULL)
+ {
+ cpl_msg_error(__func__, "No object frames provided (%s)",
+ HAWKI_CALPRO_BKG_SUBTRACTED);
+ return -1 ;
+ }
+
+ /* Identifying distortion frames */
+ cpl_msg_info(__func__, "Identifying distortion maps");
+ distortion_x = hawki_extract_frameset
+ (frameset, HAWKI_CALPRO_DISTORTION_X);
+ distortion_y = hawki_extract_frameset
+ (frameset, HAWKI_CALPRO_DISTORTION_Y);
+ if(cpl_frameset_get_size(distortion_x) != 1 &&
+ cpl_frameset_get_size(distortion_y) != 1 )
+ {
+ cpl_msg_error(__func__, "One X-distortion frame and one Y-distortion "
+ "must be provided (%s, %s)",
+ HAWKI_CALPRO_DISTORTION_X, HAWKI_CALPRO_DISTORTION_Y);
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(distortion_x);
+ cpl_frameset_delete(distortion_y);
+ return -1 ;
+ }
+
+ /* Apply the correction and save */
+ if(hawki_step_apply_dist_compute_and_save
+ (objframes, distortion_x, distortion_y, parlist, frameset) == -1)
+ {
+ cpl_msg_error(__func__,"Could not correct the frames");
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(distortion_x);
+ cpl_frameset_delete(distortion_y);
+ return -1;
+ }
+
+ /* Free and return */
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(distortion_x);
+ cpl_frameset_delete(distortion_y);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the distortion and save the resulting object frames
+ @param objects the frames which contain the objects
+ @param distortion the frame with the distortion map
+ @param parlist the recipe parlist (for saving function)
+ @param recipe_frameset the recipe frameset (for saving function)
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+int hawki_step_apply_dist_compute_and_save
+(cpl_frameset * objects,
+ cpl_frameset * distortion_x,
+ cpl_frameset * distortion_y,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_frameset)
+{
+ const cpl_frame * distframe_x;
+ const cpl_frame * distframe_y;
+ cpl_image ** dist_x;
+ cpl_image ** dist_y;
+ cpl_image * first_image;
+ int nx;
+ int ny;
+ int iframe;
+ int nframes;
+ int idet;
+ int jdet;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Get the distortion filename and distortion maps */
+ cpl_msg_info(__func__,"Creating the distortion maps");
+ distframe_x = cpl_frameset_get_first_const(distortion_x);
+ distframe_y = cpl_frameset_get_first_const(distortion_y);
+ first_image = hawki_load_image(objects, 0, 1, CPL_TYPE_FLOAT);
+ nx = cpl_image_get_size_x(first_image);
+ ny = cpl_image_get_size_y(first_image);
+ cpl_image_delete(first_image);
+ dist_x = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_image *));
+ dist_y = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_image *));
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ hawki_distortion * distortion;
+ dist_x[idet] = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+ dist_y[idet] = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE) ;
+
+ /* Load the distortion */
+ if ((distortion = hawki_distortion_load
+ (distframe_x, distframe_y , idet+1)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the distortion for chip %d: %s",
+ idet+1, cpl_error_get_message());
+ for (jdet=0 ; jdet<=idet; jdet++)
+ {
+ cpl_image_delete(dist_x[jdet]);
+ cpl_image_delete(dist_y[jdet]);
+ }
+ cpl_free(dist_x);
+ cpl_free(dist_y);
+ return -1 ;
+ }
+ if (hawki_distortion_create_maps_detector
+ (distortion, dist_x[idet], dist_y[idet]))
+ {
+ cpl_msg_error(__func__, "Cannot create the distortion maps") ;
+ for (jdet=0 ; jdet<=idet; jdet++)
+ {
+ cpl_image_delete(dist_x[jdet]);
+ cpl_image_delete(dist_y[jdet]);
+ }
+ cpl_free(dist_x);
+ cpl_free(dist_y);
+ hawki_distortion_delete(distortion);
+ return -1;
+ }
+ hawki_distortion_delete(distortion);
+ }
+
+ /* Loop on frames */
+ nframes = cpl_frameset_get_size(objects);
+ cpl_msg_info(__func__,"Number of frames to process: %d", nframes);
+ cpl_msg_indent_more();
+ for(iframe = 0 ; iframe < nframes; ++iframe)
+ {
+ cpl_imagelist * object_images;
+ cpl_frame * this_frame;
+ cpl_frameset * used_frameset;
+
+ /* Msg */
+ cpl_msg_info(__func__,"Correcting distortion in frame %d",iframe+1);
+
+ /* Load the HAWKI images */
+ this_frame = cpl_frameset_get_frame(objects, iframe);
+ if((object_images = hawki_load_frame(this_frame, CPL_TYPE_FLOAT)) == NULL)
+ {
+ cpl_msg_error(__func__,"Could not load input object images");
+ cpl_msg_indent_less();
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_image_delete(dist_x[idet]);
+ cpl_image_delete(dist_y[idet]);
+ }
+ cpl_free(dist_x);
+ cpl_free(dist_y);
+ return -1;
+ }
+
+ /* Apply the correction on the current image */
+ if (hawki_distortion_apply_maps(object_images, dist_x, dist_y) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot correct distortion") ;
+ cpl_msg_indent_less();
+ cpl_imagelist_delete(object_images);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_image_delete(dist_x[idet]);
+ cpl_image_delete(dist_y[idet]);
+ }
+ cpl_free(dist_x);
+ cpl_free(dist_y);
+ return -1 ;
+ }
+
+ /* Set the used frameset */
+ used_frameset = cpl_frameset_new();
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(this_frame));
+ cpl_frameset_insert
+ (used_frameset,cpl_frame_duplicate
+ (cpl_frameset_get_first_const((distortion_x))));
+ cpl_frameset_insert
+ (used_frameset,cpl_frame_duplicate
+ (cpl_frameset_get_first_const((distortion_y))));
+
+ /* Save the corrected image */
+ if (hawki_step_apply_dist_save
+ (object_images, iframe,
+ parlist, used_frameset, recipe_frameset) == -1)
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ }
+
+ /* Free resources */
+ cpl_frameset_delete(used_frameset);
+ cpl_imagelist_delete(object_images);
+
+ }
+ cpl_msg_indent_less();
+
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_image_delete(dist_x[idet]);
+ cpl_image_delete(dist_y[idet]);
+ }
+ cpl_free(dist_x);
+ cpl_free(dist_y);
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_warning(__func__,"Probably some data could not be saved. "
+ "Check permisions or disk space");
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the products on disk
+ @param in the imagelist to save
+ @param parlist the input list of parameters
+ @param used_frameset the frameset used to correct this image
+ @param recipe_frameset the recipe input frameset
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_apply_dist_save
+(cpl_imagelist * images,
+ int iserie,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * used_frameset,
+ cpl_frameset * recipe_frameset)
+{
+ const cpl_frame * raw_reference;
+ cpl_propertylist ** extproplists;
+ char filename[256] ;
+ cpl_propertylist * inputlist ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_step_apply_dist";
+ int idet;
+
+ /* Get the reference frame (the raw frame) */
+ raw_reference = irplib_frameset_get_first_from_group
+ (used_frameset, CPL_FRAME_GROUP_RAW);
+
+ /* Create the prop lists */
+ cpl_msg_indent_more();
+ extproplists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*));
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(raw_reference), idet+1);
+
+ /* Allocate this property list */
+ extproplists[idet] = cpl_propertylist_new();
+
+ /* Propagate some keywords from input raw frame extensions */
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+ cpl_propertylist_append(extproplists[idet], inputlist);
+ cpl_propertylist_delete(inputlist);
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), ext_nb,
+ HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_append(extproplists[idet], inputlist);
+ cpl_propertylist_delete(inputlist);
+ }
+
+ /* Write the image */
+ snprintf(filename, 256, "hawki_step_apply_dist_%03d.fits", iserie+1);
+ if(hawki_imagelist_save
+ (recipe_frameset,
+ recipe_parlist,
+ used_frameset,
+ images,
+ recipe_name,
+ HAWKI_CALPRO_DIST_CORRECTED,
+ HAWKI_PROTYPE_DIST_CORRECTED,
+ NULL,
+ (const cpl_propertylist**)extproplists,
+ filename) != 0)
+ {
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_propertylist_delete(extproplists[idet]) ;
+ cpl_free(extproplists) ;
+ cpl_msg_indent_less();
+ return -1;
+ }
+
+ /* Free and return */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_propertylist_delete(extproplists[idet]) ;
+ }
+ cpl_free(extproplists) ;
+ cpl_msg_indent_less();
+ return 0;
+}
+
diff --git a/recipes/hawki_step_basic_calib.c b/recipes/hawki_step_basic_calib.c
new file mode 100644
index 0000000..d4b3375
--- /dev/null
+++ b/recipes/hawki_step_basic_calib.c
@@ -0,0 +1,579 @@
+/* $Id: hawki_step_basic_calib.c,v 1.13 2011/01/31 11:03:23 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/01/31 11:03:23 $
+ * $Revision: 1.13 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define NEGLIG_OFF_DIFF 0.1
+#define SQR(x) ((x)*(x))
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_basic_calib_create(cpl_plugin *) ;
+static int hawki_step_basic_calib_exec(cpl_plugin *) ;
+static int hawki_step_basic_calib_destroy(cpl_plugin *) ;
+static int hawki_step_basic_calib(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_step_basic_calib_applycal_qc_save
+(cpl_frameset * raw_target,
+ const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm,
+ const char * filename_postfix,
+ const char * procat,
+ const char * protype,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+static void hawki_step_basic_calib_qc(void);
+static int hawki_step_basic_calib_save
+(cpl_imagelist * reduced,
+ const char * filename_postfix,
+ const char * procat,
+ const char * protype,
+ int iserie,
+ cpl_frameset * used_frameset,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_basic_calib_description[] =
+"hawki_step_basic_calib -- hawki basic reduction utility (flat, dark).\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"raw-file.fits "HAWKI_IMG_JITTER_RAW" or\n"
+"raw-file.fits "HAWKI_IMG_JITTER_SKY_RAW" \n"
+"flat-file.fits "HAWKI_CALPRO_FLAT" \n"
+"dark-file.fits "HAWKI_CALPRO_DARK" \n"
+"bpm-file.fits "HAWKI_CALPRO_BPM" \n";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_basic_calib",
+ "Basic reduction recipe",
+ hawki_step_basic_calib_description,
+ "Cesar Enrique Garcia Dabo",
+ "cgarcia at eso.org",
+ hawki_get_license(),
+ hawki_step_basic_calib_create,
+ hawki_step_basic_calib_exec,
+ hawki_step_basic_calib_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_basic_calib_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ /* cpl_parameter * p ; */
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+
+ /* Fill the parameters list */
+ /* None.. */
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_basic_calib_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_basic_calib(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_basic_calib_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_basic_calib(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ const cpl_frame * flat;
+ const cpl_frame * dark;
+ const cpl_frame * bpm;
+ cpl_frameset * objframes ;
+ cpl_frameset * skyframes ;
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve calibration data */
+ cpl_msg_info(__func__, "Identifying calibration data");
+ flat = cpl_frameset_find_const(framelist, HAWKI_CALPRO_FLAT);
+ dark = cpl_frameset_find_const(framelist, HAWKI_CALPRO_DARK);
+ bpm = cpl_frameset_find_const(framelist, HAWKI_CALPRO_BPM);
+ if (flat == NULL && dark == NULL && bpm == NULL)
+ {
+ cpl_msg_error(__func__, "No calibration data provided (%s and/or %s and/or %s)",
+ HAWKI_CALPRO_FLAT, HAWKI_CALPRO_DARK, HAWKI_CALPRO_BPM);
+ return -1 ;
+ }
+
+ /* Retrieve raw frames */
+ cpl_msg_info(__func__, "Identifying objects and sky data");
+ objframes = hawki_extract_frameset(framelist, HAWKI_IMG_JITTER_RAW) ;
+ /* Retrieve sky frames */
+ skyframes = hawki_extract_frameset(framelist, HAWKI_IMG_JITTER_SKY_RAW) ;
+ if (objframes == NULL && skyframes == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find objs (%s) or sky frames (%s) in the input list",
+ HAWKI_IMG_JITTER_RAW, HAWKI_IMG_JITTER_SKY_RAW);
+ return -1 ;
+ }
+
+ /* Applying the calibrations, QC and saving the results */
+ if (objframes != NULL)
+ {
+ const char * procat = HAWKI_CALPRO_BASICCALIBRATED;
+ const char * protype = HAWKI_PROTYPE_BASICCALIBRATED;
+ cpl_msg_info(__func__, "Apply the basic reduction to object frames");
+ hawki_step_basic_calib_applycal_qc_save
+ (objframes, flat, dark, bpm, "obj", procat, protype,
+ parlist, framelist);
+ cpl_frameset_delete(objframes);
+ }
+ if (skyframes != NULL)
+ {
+ const char * procat = HAWKI_CALPRO_SKY_BASICCALIBRATED;
+ const char * protype = HAWKI_PROTYPE_SKY_BASICCALIBRATED;
+ cpl_msg_info(__func__, "Apply the basic reduction to sky frames");
+ hawki_step_basic_calib_applycal_qc_save
+ (skyframes, flat, dark, bpm, "sky", procat, protype,
+ parlist, framelist);
+ cpl_frameset_delete(skyframes);
+ }
+
+ /* return */
+ if (cpl_error_get_code()) return -1 ;
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param obj the objects frames
+ @param obj the sky frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @param skybg the computed sky background values
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_basic_calib_applycal_qc_save
+(cpl_frameset * raw_target,
+ const cpl_frame * flat,
+ const cpl_frame * dark,
+ const cpl_frame * bpm,
+ const char * filename_postfix,
+ const char * procat,
+ const char * protype,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ cpl_imagelist * flat_images;
+ cpl_imagelist * dark_images;
+ cpl_imagelist * bpm_images;
+ cpl_frameset * calib_frameset;
+ cpl_propertylist * plist ;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ double science_dit;
+ int iframe;
+ int ntarget;
+
+ /* Initializing the pointers */
+ flat_images = NULL;
+ dark_images = NULL;
+ bpm_images = NULL;
+
+ /* Indentation */
+ cpl_msg_indent_more();
+
+ /* Initializating the calibration frameset */
+ calib_frameset = cpl_frameset_new();
+
+ /* Loading the calibration files */
+ cpl_msg_info(__func__, "Loading the calibration data") ;
+ if(flat != NULL)
+ {
+ flat_images = hawki_load_frame(flat, CPL_TYPE_FLOAT);
+ if(flat_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading flat") ;
+ cpl_frameset_delete(calib_frameset);
+ return -1;
+ }
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(flat));
+ }
+ if(dark != NULL)
+ {
+ dark_images = hawki_load_frame(dark, CPL_TYPE_FLOAT);
+ if(dark_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading dark") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_frameset_delete(calib_frameset);
+ return -1;
+ }
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(dark));
+ }
+ if(bpm != NULL)
+ {
+ bpm_images = hawki_load_frame(bpm, CPL_TYPE_INT);
+ if(bpm_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading bpm") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_frameset_delete(calib_frameset);
+ return -1;
+ }
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(bpm));
+ }
+
+ /* Multiply the dark image by the science exposure time */
+ if(dark != NULL)
+ {
+ if ((plist=cpl_propertylist_load
+ (cpl_frame_get_filename
+ (cpl_frameset_get_first_const(raw_target)), 0)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot get header from frame");
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_frameset_delete(calib_frameset);
+ return -1 ;
+ }
+ science_dit = hawki_pfits_get_dit(plist);
+ cpl_imagelist_multiply_scalar(dark_images, science_dit);
+ cpl_propertylist_delete(plist);
+ }
+
+ /* Loop on the number of frames */
+ ntarget = cpl_frameset_get_size(raw_target);
+ cpl_msg_info(__func__, "Looping the science frames: %d frames", ntarget);
+ for( iframe = 0 ; iframe < ntarget ; ++iframe)
+ {
+ /* Local storage variables */
+ cpl_frame * target_frame;
+ cpl_imagelist * target_images;
+ cpl_frameset * used_frameset;
+ target_images = NULL;
+
+ /* Loading the target */
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__, "Loading frame %d", iframe+1) ;
+ target_frame = cpl_frameset_get_frame(raw_target, iframe);
+ if(target_frame != NULL)
+ target_images = hawki_load_frame(target_frame, CPL_TYPE_FLOAT);
+ if(target_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading frame") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ return -1;
+ }
+ /* Creating the used frameset */
+ used_frameset = cpl_frameset_duplicate(calib_frameset);
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(target_frame));
+
+ /* TODO: Creating the variance array */
+ /* cpl_create_variance_image(); */
+
+ /* Applying the calibrations */
+ cpl_msg_info(__func__, "Calibrating frame") ;
+ if (hawki_flat_dark_bpm_imglist_calib
+ (target_images, flat_images, dark_images, bpm_images) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot calibrate frame") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_imagelist_delete(target_images);
+ cpl_frameset_delete(used_frameset);
+ cpl_frameset_delete(calib_frameset);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+
+ /* Compute quality control */
+ hawki_step_basic_calib_qc();
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Save the products") ;
+ if (hawki_step_basic_calib_save
+ (target_images, filename_postfix, procat, protype, iframe,
+ used_frameset, recipe_parlist,
+ recipe_framelist) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot save the products") ;
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_imagelist_delete(target_images);
+ cpl_frameset_delete(used_frameset);
+ cpl_frameset_delete(calib_frameset);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+
+ /* Delete the target and the used frameset */
+ cpl_imagelist_delete(target_images);
+ cpl_frameset_delete(used_frameset);
+ cpl_msg_indent_less();
+ }
+
+ cpl_msg_indent_less();
+ /* Delete the calibration files */
+ cpl_imagelist_delete(flat_images);
+ cpl_imagelist_delete(dark_images);
+ cpl_imagelist_delete(bpm_images);
+ cpl_frameset_delete(calib_frameset);
+
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_warning(__func__,"Probably some data could not be saved. "
+ "Check permisions or disk space");
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return 1;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute some QC parameters from the combined image
+ @param combined the combined image produced
+ @param chip the chip number (start from 0)
+ @return a newly allocated table with the stars stats or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static void hawki_step_basic_calib_qc(void)
+{
+ /* Compute QC parameters from the combined image */
+ //cpl_msg_info(__func__, "Compute QC parameters from the reduced images") ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the basic calibrated products on disk
+ @param reduced the basic calibrated imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param mean_sky_bg the vectors with the sky background values or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_basic_calib_save
+(cpl_imagelist * reduced,
+ const char * filename_postfix,
+ const char * procat,
+ const char * protype,
+ int iserie,
+ cpl_frameset * used_frameset,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ const cpl_frame * raw_reference;
+ cpl_propertylist * proplist;
+ cpl_propertylist ** extproplists;
+ char filename[256];
+ cpl_propertylist * inputlist ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_step_basic_calib";
+ int i;
+
+ /* Get the reference frame (the raw frame) */
+ raw_reference = irplib_frameset_get_first_from_group
+ (used_frameset, CPL_FRAME_GROUP_RAW);
+
+ /* Create the prop lists */
+ cpl_msg_indent_more();
+ proplist = cpl_propertylist_new();
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), 0,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+ cpl_propertylist_append(proplist, inputlist);
+ cpl_propertylist_delete(inputlist);
+ extproplists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*));
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(raw_reference), i+1);
+
+ /* Allocate this pro perty list */
+ extproplists[i] = cpl_propertylist_new();
+
+ /* Propagate some keywords from input raw frame extensions */
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+ cpl_propertylist_append(extproplists[i], inputlist);
+ cpl_propertylist_delete(inputlist);
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), ext_nb,
+ HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_append(extproplists[i], inputlist);
+ cpl_propertylist_delete(inputlist);
+ }
+
+ /* Write the image */
+ snprintf(filename, 256, "hawki_step_basic_calib_%s%03d.fits",
+ filename_postfix, iserie+1);
+ hawki_imagelist_save(recipe_framelist,
+ recipe_parlist,
+ used_frameset,
+ reduced,
+ recipe_name,
+ procat,
+ protype,
+ (const cpl_propertylist*)proplist,
+ (const cpl_propertylist**)extproplists,
+ filename);
+
+ /* Free and return */
+ cpl_msg_indent_less();
+ cpl_propertylist_delete(proplist) ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_propertylist_delete(extproplists[i]) ;
+ }
+ cpl_free(extproplists) ;
+ return 0;
+}
diff --git a/recipes/hawki_step_combine.c b/recipes/hawki_step_combine.c
new file mode 100644
index 0000000..f315c5a
--- /dev/null
+++ b/recipes/hawki_step_combine.c
@@ -0,0 +1,1017 @@
+/* $Id: hawki_step_combine.c,v 1.24 2012/04/23 10:04:04 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/04/23 10:04:04 $
+ * $Revision: 1.24 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <string.h>
+
+#include "irplib_utils.h"
+#include "irplib_calib.h"
+
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_saa.h"
+#include "hawki_bkg.h"
+#include "hawki_distortion.h"
+#include "hawki_properties_tel.h"
+#include "hawki_image_stats.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_combine_create(cpl_plugin *) ;
+static int hawki_step_combine_exec(cpl_plugin *) ;
+static int hawki_step_combine_destroy(cpl_plugin *) ;
+static int hawki_step_combine(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_step_combine_retrieve_input_param
+(cpl_parameterlist * parlist);
+static cpl_image ** hawki_step_combine_apply_comb
+(cpl_frameset * obj,
+ cpl_frameset * offsets,
+ cpl_frameset * bpm,
+ cpl_frameset * bkg_bpm_frames);
+static cpl_image ** hawki_step_combine_chip
+(cpl_imagelist * in,
+ cpl_bivector * offsets,
+ double * pos_x,
+ double * pos_y);
+static int hawki_step_combine_interpolate_badpix
+(cpl_image * image);
+static int hawki_step_combine_save
+(cpl_image ** combined,
+ cpl_image ** contrib_map,
+ cpl_frameset * used_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_frameset);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct
+{
+ /* Inputs */
+ int offset_max ;
+ int borders ;
+ cpl_geom_combine comb_meth ;
+ int rej_low;
+ int rej_high;
+ cpl_kernel resamp_kernel;
+} hawki_step_combine_config;
+
+static struct
+{
+ /* Outputs */
+ double mean_airmass;
+ double combined_pos_x[HAWKI_NB_DETECTORS];
+ double combined_pos_y[HAWKI_NB_DETECTORS];
+ double combined_cumoffset_x[HAWKI_NB_DETECTORS];
+ double combined_cumoffset_y[HAWKI_NB_DETECTORS];
+} hawki_step_combine_output;
+
+static char hawki_step_combine_description[] =
+"hawki_step_combine -- hawki combine jitter images.\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"science-file.fits "HAWKI_CALPRO_DIST_CORRECTED" or\n"
+"science-file.fits "HAWKI_CALPRO_BKG_SUBTRACTED" or\n"
+"bpm-file.fits "HAWKI_CALPRO_BPM" (optional) \n"
+"bkg_bpm-file.fits "HAWKI_CALPRO_BKGBPM" (optional) \n"
+"offsets-file.fits "HAWKI_CALPRO_OFFSETS" (optional) \n"
+"The recipe creates as an output:\n"
+"hawki_step_combine.fits ("HAWKI_CALPRO_COMBINED"): \n"
+"The recipe does the following steps:\n"
+"-Allocate an image with the proper combined size \n"
+" (depends on parameters --comb_meth and --borders)\n"
+"-Retrieve the offsets either from the offsets-file.fits or from the header\n"
+"-For each combined pixel, the contribution of each individual frame \n"
+" is added using a resampling kernel. If any of the pixels involved in\n"
+" the resampling is a bad pixel (defined in bpm-file.fits), it is not\n"
+" taken into account.\n"
+" With the remaining pixels a minmax rejection is performed\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_combine",
+ "Jitter image combination recipe",
+ hawki_step_combine_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_combine_create,
+ hawki_step_combine_exec,
+ hawki_step_combine_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_combine_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --offset_max */
+ p = cpl_parameter_new_value("hawki.hawki_step_combine.offset_max",
+ CPL_TYPE_INT,
+ "Maximum offset allowed",
+ "hawki.hawki_step_combine",
+ 1500) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "offset_max") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --comb_meth */
+ p = cpl_parameter_new_value("hawki.hawki_step_combine.comb_meth",
+ CPL_TYPE_STRING,
+ "Final size of combination (union / inter / first)",
+ "hawki.hawki_step_combine",
+ "union") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "comb_meth") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --rej */
+ p = cpl_parameter_new_value("hawki.hawki_step_combine.rej",
+ CPL_TYPE_STRING,
+ "Low and high number of rejected values",
+ "hawki.hawki_step_combine",
+ "1,1") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rej") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --borders */
+ p = cpl_parameter_new_value("hawki.hawki_step_combine.borders",
+ CPL_TYPE_INT,
+ "Border pixels trimmed",
+ "hawki.hawki_step_combine",
+ 4) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "borders") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --resamp_kernel */
+ p = cpl_parameter_new_value("hawki.hawki_step_combine.resamp_kernel",
+ CPL_TYPE_STRING,
+ "Resampling kernel (default/tanh/sinc/sinc2/lanczos/hamming/hann)",
+ "hawki.hawki_step_combine",
+ "default") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "resamp_kernel") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_combine_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_combine(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_combine_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_combine(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * objframes ;
+ cpl_frameset * offsets;
+ cpl_frameset * bpm;
+ cpl_frameset * bpmbkg;
+ cpl_frameset * used_frames;
+ cpl_image ** combined_contrib;
+ cpl_image ** combined;
+ cpl_image ** contrib_map;
+ int idet;
+
+ /* Retrieve input parameters */
+ if(hawki_step_combine_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve raw frames */
+ objframes = hawki_extract_frameset(framelist, HAWKI_CALPRO_DIST_CORRECTED);
+ if (objframes == NULL)
+ {
+ objframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_BKG_SUBTRACTED);
+ if (objframes == NULL)
+ {
+ cpl_msg_error(__func__,"Cannot find objs frames in the input list (%s or %s)",
+ HAWKI_CALPRO_DIST_CORRECTED, HAWKI_CALPRO_BKG_SUBTRACTED);
+ return -1 ;
+ }
+ }
+ used_frames = cpl_frameset_duplicate(objframes);
+
+ /* Retrieve the refined offsets, if provided */
+ offsets = hawki_extract_frameset(framelist, HAWKI_CALPRO_OFFSETS);
+ if(offsets)
+ cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+ cpl_frameset_get_first(offsets)));
+
+ /* Retrieve the general bad pixel mask, if provided */
+ bpm = hawki_extract_frameset(framelist, HAWKI_CALPRO_BPM);
+ if(bpm)
+ cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+ cpl_frameset_get_first(bpm)));
+
+ /* Retrieve the background bad pixel masks, if provided */
+ bpmbkg = hawki_extract_frameset(framelist, HAWKI_CALPRO_BKGBPM);
+ if(bpmbkg)
+ {
+ int iframe;
+ for(iframe=0; iframe < cpl_frameset_get_size(bpmbkg); iframe++)
+ cpl_frameset_insert(used_frames, cpl_frame_duplicate(
+ cpl_frameset_get_frame(bpmbkg,iframe)));
+ if(cpl_frameset_get_size(bpmbkg) != cpl_frameset_get_size(objframes))
+ {
+ cpl_msg_error(__func__,"Incompatible number of science and bad bkg"
+ " images.");
+ cpl_msg_error(__func__,"Supply as many bad bkg images as objects");
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(used_frames);
+ cpl_frameset_delete(offsets);
+ cpl_frameset_delete(bpm);
+ cpl_frameset_delete(bpmbkg);
+ return -1;
+ }
+ }
+
+ /* Apply the combination */
+ cpl_msg_info(__func__, "Apply the data recombination");
+ cpl_msg_indent_more() ;
+ if ((combined_contrib = hawki_step_combine_apply_comb
+ (objframes, offsets, bpm, bpmbkg)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot combine the data");
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(used_frames);
+ if(offsets != NULL)
+ cpl_frameset_delete(offsets);
+ if(bpm != NULL)
+ cpl_frameset_delete(bpm);
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+
+ /* Get both the combination and the contribution map */
+ combined = combined_contrib;
+ contrib_map = combined_contrib + HAWKI_NB_DETECTORS;
+ cpl_msg_indent_less() ;
+ cpl_frameset_delete(objframes);
+ if(offsets != NULL)
+ cpl_frameset_delete(offsets);
+ if(bpm != NULL)
+ cpl_frameset_delete(bpm);
+ if(bpmbkg != NULL)
+ cpl_frameset_delete(bpmbkg);
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Save the products") ;
+ cpl_msg_indent_more() ;
+ if (hawki_step_combine_save(combined, contrib_map,
+ used_frames, parlist, framelist) != 0)
+ {
+ cpl_msg_warning(__func__, "Some error happened saving the data. "
+ "Check permisions or disk space") ;
+ for(idet=0; idet< 2 * HAWKI_NB_DETECTORS; ++idet)
+ cpl_image_delete(combined_contrib[idet]);
+ cpl_frameset_delete(used_frames);
+ cpl_free(combined_contrib);
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Return */
+ for(idet=0; idet< 2 * HAWKI_NB_DETECTORS; ++idet)
+ cpl_image_delete(combined_contrib[idet]);
+ cpl_free(combined_contrib);
+ cpl_frameset_delete(used_frames);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+int hawki_step_combine_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+ const char * sval ;
+ par = NULL ;
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_step_combine.offset_max");
+ hawki_step_combine_config.offset_max = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_step_combine.comb_meth");
+ sval = cpl_parameter_get_string(par);
+ if (!strcmp(sval, "union"))
+ hawki_step_combine_config.comb_meth = CPL_GEOM_UNION;
+ else if (!strcmp(sval, "inter"))
+ hawki_step_combine_config.comb_meth = CPL_GEOM_INTERSECT;
+ else if (!strcmp(sval, "first"))
+ hawki_step_combine_config.comb_meth = CPL_GEOM_FIRST;
+ else
+ {
+ cpl_msg_error(__func__, "Invalid combine method specified");
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_step_combine.borders");
+ hawki_step_combine_config.borders = cpl_parameter_get_int(par);
+ if(hawki_step_combine_config.borders < 0 )
+ {
+ cpl_msg_error(__func__, "Borders cannot be less than zero");
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_step_combine.rej");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%d,%d",
+ &hawki_step_combine_config.rej_low,
+ &hawki_step_combine_config.rej_high)!=2)
+ {
+ return -1;
+ }
+ par = cpl_parameterlist_find(parlist,
+ "hawki.hawki_step_combine.resamp_kernel");
+ sval = cpl_parameter_get_string(par);
+ if (!strcmp(sval, "tanh"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_TANH;
+ else if (!strcmp(sval, "sinc"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_SINC;
+ else if (!strcmp(sval, "sinc2"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_SINC2;
+ else if (!strcmp(sval, "lanczos"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_LANCZOS;
+ else if (!strcmp(sval, "hamming"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_HAMMING;
+ else if (!strcmp(sval, "hann"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_HANN;
+ else if (!strcmp(sval, "default"))
+ hawki_step_combine_config.resamp_kernel = CPL_KERNEL_DEFAULT;
+ else
+ {
+ cpl_msg_error(__func__, "Invalid resampling kernel specified");
+ return -1;
+ }
+
+ return 0;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param obj the objects frames
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_image ** hawki_step_combine_apply_comb
+(cpl_frameset * obj,
+ cpl_frameset * offsets_frames,
+ cpl_frameset * bpm_frame,
+ cpl_frameset * bkg_bpm_frames)
+{
+ cpl_image ** combined_contrib;
+ cpl_bivector ** offsets;
+ cpl_mask * bpm_masks[HAWKI_NB_DETECTORS];
+ int idet;
+ int ioff;
+
+ if(offsets_frames == NULL)
+ {
+ cpl_bivector * offsets_single_chip;
+ if ((offsets_single_chip = hawki_get_header_tel_offsets(obj)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the header offsets");
+ return NULL;
+ }
+ offsets = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_bivector *));
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ offsets[idet] = cpl_bivector_duplicate(offsets_single_chip);
+ cpl_bivector_delete(offsets_single_chip);
+ }
+ else
+ {
+ offsets = hawki_load_refined_offsets
+ (cpl_frameset_get_first(offsets_frames));
+ if(offsets == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the refined offsets");
+ return NULL;
+ }
+ }
+ /* Get the oposite offsets. This is to change from
+ * telescope convention to cpl convention
+ * WARNING: It may appear that the img_jitter function
+ * does not apply the multiplication by -1, but it really does it in
+ * hawki_img_jitter_saa instead of when it reads the offsets */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_vector_multiply_scalar(cpl_bivector_get_x(offsets[idet]), -1.0);
+ cpl_vector_multiply_scalar(cpl_bivector_get_y(offsets[idet]), -1.0);
+ }
+
+ /* Load the bpm */
+ if(bpm_frame != NULL)
+ {
+ cpl_imagelist * bpm_images = NULL;
+ bpm_images = hawki_load_frame
+ (cpl_frameset_get_first(bpm_frame), CPL_TYPE_INT);
+ if(bpm_images == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the bad pixel mask");
+ return NULL;
+ }
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ bpm_masks[idet] = cpl_mask_threshold_image_create
+ (cpl_imagelist_get(bpm_images, idet), 0.5, 1.5);
+ }
+ cpl_imagelist_delete(bpm_images);
+ }
+
+ /* Create output object */
+ combined_contrib = cpl_malloc(2 * HAWKI_NB_DETECTORS * sizeof(cpl_image *));
+
+ /* Loop on the detectors */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_imagelist * in ;
+ cpl_imagelist * bpm_bkg_im = NULL;
+ cpl_image ** comb_contrib_chip ;
+ double * offs_est_x ;
+ double * offs_est_y ;
+ double max_x, max_y ;
+ double off_0_x;
+ double off_0_y;
+ int jdet;
+ int iframe;
+
+ cpl_msg_info(__func__, "Combine chip number %d", idet+1) ;
+ cpl_msg_indent_more() ;
+
+ /* Print the offsets */
+ offs_est_x = cpl_bivector_get_x_data(offsets[idet]) ;
+ offs_est_y = cpl_bivector_get_y_data(offsets[idet]) ;
+ for (ioff=0 ; ioff<cpl_bivector_get_size(offsets[idet]) ; ioff++) {
+ cpl_msg_info(__func__,"Telescope offsets (Frame %d): %g %g", ioff+1,
+ -offs_est_x[ioff], -offs_est_y[ioff]) ;
+ }
+
+ /* Subtract the first offset to all offsets */
+ max_x = max_y = 0.0 ;
+ off_0_x = offs_est_x[0];
+ off_0_y = offs_est_y[0];
+ for (ioff=1 ; ioff<cpl_bivector_get_size(offsets[idet]) ; ioff++)
+ {
+ offs_est_x[ioff] -= offs_est_x[0] ;
+ offs_est_y[ioff] -= offs_est_y[0] ;
+ if (fabs(offs_est_x[ioff]) > max_x) max_x = fabs(offs_est_x[ioff]);
+ if (fabs(offs_est_y[ioff]) > max_y) max_y = fabs(offs_est_y[ioff]);
+ }
+ offs_est_x[0] = offs_est_y[0] = 0.00 ;
+
+ /* Check if the max offset is not too big */
+ if (max_x > hawki_step_combine_config.offset_max ||
+ max_y > hawki_step_combine_config.offset_max)
+ {
+ cpl_msg_error(__func__,"Sorry, no support for offsets larger than %d",
+ hawki_step_combine_config.offset_max);
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(offsets[idet]);
+ if(bpm_frame != NULL)
+ cpl_mask_delete(bpm_masks[idet]);
+ }
+ for(jdet = 0; jdet < idet; ++jdet)
+ {
+ cpl_image_delete(combined_contrib[idet]);
+ cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+ }
+ cpl_free(combined_contrib);
+ return NULL ;
+ }
+
+ /* Load the input data */
+ cpl_msg_info(__func__, "Load the input data") ;
+ cpl_msg_indent_more();
+ if ((in = hawki_load_detector(obj, idet+1, CPL_TYPE_FLOAT)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load chip %d",idet+1);
+ //TODO: there is probably a memory leak here. It should be checked.
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(offsets[idet]);
+ if(bpm_frame != NULL)
+ cpl_mask_delete(bpm_masks[idet]);
+ }
+ for(jdet = 0; jdet < idet; ++jdet)
+ {
+ cpl_image_delete(combined_contrib[idet]);
+ cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+ }
+ cpl_free(combined_contrib);
+ cpl_free(offsets);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+
+ /* Load the bad bkg images */
+ if(bkg_bpm_frames != NULL)
+ {
+ cpl_msg_info(__func__, "Load the bad bkg images");
+ cpl_msg_indent_more() ;
+ if ((bpm_bkg_im = hawki_load_detector(bkg_bpm_frames, idet+1,
+ CPL_TYPE_FLOAT)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load chip %d",idet+1);
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(offsets[idet]);
+ if(bpm_frame != NULL)
+ cpl_mask_delete(bpm_masks[idet]);
+ }
+ for(jdet = 0; jdet < idet; ++jdet)
+ {
+ cpl_image_delete(combined_contrib[idet]);
+ cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+ }
+ cpl_free(combined_contrib);
+ cpl_imagelist_delete(in);
+ cpl_free(offsets);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+ cpl_msg_indent_less() ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Add the general bpm or background bpms in case they were specified */
+ if(bpm_frame != NULL || bkg_bpm_frames != NULL)
+ {
+ for(iframe = 0 ; iframe <cpl_imagelist_get_size(in) ; ++iframe)
+ {
+ cpl_mask * final_mask;
+ cpl_image * target_image = cpl_imagelist_get(in, iframe);
+ final_mask = cpl_mask_new(cpl_image_get_size_x(target_image),
+ cpl_image_get_size_y(target_image));
+ //Add the common bpm
+ if(bpm_frame != NULL)
+ cpl_mask_or(final_mask, bpm_masks[idet]);
+ //Add the background mask if provided
+ if(bkg_bpm_frames != NULL)
+ {
+ cpl_mask * bpm_bkg_mask =
+ cpl_mask_threshold_image_create
+ (cpl_imagelist_get(bpm_bkg_im, iframe), 0.5, FLT_MAX);
+ cpl_mask_or(final_mask, bpm_bkg_mask);
+ cpl_mask_delete(bpm_bkg_mask);
+ }
+ cpl_image_reject_from_mask(target_image, final_mask);
+ cpl_mask_delete(final_mask);
+ }
+ }
+
+ if(bkg_bpm_frames != NULL)
+ cpl_imagelist_delete(bpm_bkg_im);
+
+ /* Apply the shift and add */
+ cpl_msg_info(__func__, "Shift and add") ;
+ cpl_msg_indent_more() ;
+ comb_contrib_chip = hawki_step_combine_chip(in, offsets[idet],
+ &(hawki_step_combine_output.combined_pos_x[idet]),
+ &(hawki_step_combine_output.combined_pos_y[idet])) ;
+ if (comb_contrib_chip == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot apply the shift and add") ;
+ cpl_imagelist_delete(in) ;
+ for(jdet = 0; jdet < HAWKI_NB_DETECTORS; ++jdet)
+ cpl_bivector_delete(offsets[jdet]);
+ {
+ cpl_image_delete(combined_contrib[idet]);
+ cpl_image_delete(combined_contrib[idet+HAWKI_NB_DETECTORS]);
+ }
+ cpl_free(combined_contrib);
+ cpl_free(offsets);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return NULL ;
+ }
+
+ /* The cumoffset have the opposite criteria as cpl */
+ hawki_step_combine_output.combined_cumoffset_x[idet] =
+ hawki_step_combine_output.combined_pos_x[idet] - off_0_x;
+ hawki_step_combine_output.combined_cumoffset_y[idet] =
+ hawki_step_combine_output.combined_pos_y[idet] - off_0_y;
+ cpl_imagelist_delete(in) ;
+ cpl_msg_indent_less() ;
+
+ /* Interpolate bad pixels */
+ hawki_step_combine_interpolate_badpix(comb_contrib_chip[0]);
+
+ /* Put the results in the image list */
+ combined_contrib[idet] = comb_contrib_chip[0];
+ combined_contrib[idet+HAWKI_NB_DETECTORS] = comb_contrib_chip[1];
+ cpl_free(comb_contrib_chip);
+ cpl_msg_indent_less() ;
+ }
+
+ /* Compute the mean airmass */
+ hawki_step_combine_output.mean_airmass = hawki_get_mean_airmass(obj);
+
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(offsets[idet]);
+ if(bpm_frame != NULL)
+ cpl_mask_delete(bpm_masks[idet]);
+ }
+ cpl_free(offsets);
+ return combined_contrib;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Apply the shift and add in jitter mode
+ @param in the images stack to combine
+ @param offsets the list of offsets in x and y
+ @param pos_x the x position of the first image in the combined
+ @param pos_y the y position of the first image in the combined
+ @return the combined image or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_image ** hawki_step_combine_chip(
+ cpl_imagelist * in,
+ cpl_bivector * offsets,
+ double * pos_x,
+ double * pos_y)
+{
+ cpl_image ** combined_contrib;
+ cpl_imagelist * in_ext ;
+ cpl_image * tmp1 ;
+ cpl_image * tmp2 ;
+ int nfiles, nx, ny ;
+ int i;
+
+ /* Check entries */
+ if (pos_x == NULL || pos_y == NULL) return NULL ;
+ if (offsets == NULL) return NULL ;
+
+ /* Get the number of images */
+ nfiles = cpl_imagelist_get_size(in) ;
+ if (cpl_bivector_get_size(offsets) != nfiles) {
+ cpl_msg_error(__func__, "Number of refined offsets in table """
+ "is different than number of frames to combine");
+ return NULL ;
+ }
+
+ /* Discard the pixels on the sides */
+ if (hawki_step_combine_config.borders > 0) {
+ nx = cpl_image_get_size_x(cpl_imagelist_get(in, 0)) ;
+ ny = cpl_image_get_size_y(cpl_imagelist_get(in, 0)) ;
+ in_ext = cpl_imagelist_new() ;
+ for (i=0 ; i<cpl_imagelist_get_size(in) ; i++) {
+ tmp1 = cpl_imagelist_get(in, i) ;
+ tmp2 = cpl_image_extract(tmp1,
+ hawki_step_combine_config.borders+1,
+ hawki_step_combine_config.borders+1,
+ nx-hawki_step_combine_config.borders,
+ ny-hawki_step_combine_config.borders) ;
+ cpl_imagelist_set(in_ext, tmp2, i) ;
+ }
+ }
+ else
+ {
+ in_ext = cpl_imagelist_duplicate(in);
+ }
+
+ /* Apply the shift & add */
+ cpl_msg_info(__func__, "Recombine the images set") ;
+ cpl_msg_indent_more() ;
+ if ((combined_contrib=cpl_geom_img_offset_saa(in_ext, offsets,
+ hawki_step_combine_config.resamp_kernel,
+ hawki_step_combine_config.rej_low,
+ hawki_step_combine_config.rej_high,
+ hawki_step_combine_config.comb_meth,
+ pos_x, pos_y)) == NULL) {
+ cpl_msg_error(cpl_func, "Cannot apply the shift and add") ;
+ cpl_msg_indent_less();
+ return NULL;
+ }
+ cpl_msg_indent_less();
+ *pos_x -= hawki_step_combine_config.borders;
+ *pos_y -= hawki_step_combine_config.borders;
+
+ /* Free and return */
+ cpl_imagelist_delete(in_ext);
+ return combined_contrib;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Interpolate the pixels in the bad pixel mask
+ @param image the image to interpolate
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_combine_interpolate_badpix
+(cpl_image * image)
+{
+ int nbadpixels = cpl_image_count_rejected(image);
+ if(nbadpixels !=0)
+ cpl_msg_info(__func__,"Number of pixels with no combined value available: %d ",
+ nbadpixels);
+ if(cpl_image_count_rejected(image) > 0)
+ {
+ //I use this even if DFS08929 is still not solved
+ cpl_detector_interpolate_rejected(image);
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the jitter recipe products on disk
+ @param combined the combined imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_combine_save
+(cpl_image ** combined,
+ cpl_image ** contrib_map,
+ cpl_frameset * used_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_frameset)
+{
+ cpl_propertylist ** extproplists ;
+ const cpl_frame * ref_frame ;
+ cpl_propertylist * wcslist ;
+ cpl_propertylist * inputlist ;
+ double crpix1, crpix2 ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_step_combine" ;
+ int idet;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Get a reference frame for the WCS keys */
+ ref_frame = irplib_frameset_get_first_from_group
+ (recipe_frameset, CPL_FRAME_GROUP_RAW) ;
+
+ if(ref_frame == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot get a reference frame");
+ return -1;
+ }
+
+ /* Create the QC lists */
+ extproplists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+
+ /* Initialize qclists */
+ extproplists[idet] = cpl_propertylist_new() ;
+
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector(cpl_frame_get_filename(ref_frame), idet+1);
+
+ /* Handle WCS keys */
+ wcslist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb, HAWKI_HEADER_WCS, 0);
+
+ /* Update WCS and write them */
+ crpix1 = cpl_propertylist_get_double(wcslist, "CRPIX1");
+ crpix1 += hawki_step_combine_output.combined_pos_x[idet];
+ cpl_propertylist_update_double(wcslist, "CRPIX1", crpix1) ;
+ crpix2 = cpl_propertylist_get_double(wcslist, "CRPIX2");
+ crpix2 += hawki_step_combine_output.combined_pos_y[idet] ;
+ cpl_propertylist_update_double(wcslist, "CRPIX2", crpix2) ;
+ cpl_propertylist_copy_property_regexp
+ (extproplists[idet], wcslist, HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_delete(wcslist) ;
+
+ /* Keywords for the relative position of the combined image */
+ cpl_propertylist_append_double
+ (extproplists[idet], "ESO QC COMBINED CUMOFFSETX",
+ hawki_step_combine_output.combined_cumoffset_x[idet]);
+ cpl_propertylist_append_double
+ (extproplists[idet], "ESO QC COMBINED CUMOFFSETY",
+ hawki_step_combine_output.combined_cumoffset_y[idet]);
+ cpl_propertylist_append_double
+ (extproplists[idet], "ESO QC COMBINED POSX",
+ hawki_step_combine_output.combined_pos_x[idet]);
+ cpl_propertylist_append_double
+ (extproplists[idet], "ESO QC COMBINED POSY",
+ hawki_step_combine_output.combined_pos_y[idet]);
+ cpl_propertylist_append_double
+ (extproplists[idet], "ESO QC AIRMASS MEAN",
+ hawki_step_combine_output.mean_airmass);
+
+ /* Propagate some keywords from input raw frame extensions */
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0) ;
+ cpl_propertylist_append(extproplists[idet], inputlist);
+ cpl_propertylist_delete(inputlist) ;
+ }
+
+ /* Write the combined image */
+ if(hawki_images_save(recipe_frameset,
+ parlist,
+ used_frames,
+ (const cpl_image **)combined,
+ recipe_name,
+ HAWKI_CALPRO_COMBINED,
+ HAWKI_PROTYPE_COMBINED,
+ NULL,
+ (const cpl_propertylist**)extproplists,
+ "hawki_step_combine.fits") != 0)
+ {
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_propertylist_delete(extproplists[idet]) ;
+ }
+ cpl_free(extproplists) ;
+ return -1;
+ }
+
+ /* Write the contrib map */
+ if(hawki_images_save(recipe_frameset,
+ parlist,
+ used_frames,
+ (const cpl_image **)contrib_map,
+ recipe_name,
+ HAWKI_CALPRO_COMB_CONTRIB_MAP,
+ HAWKI_PROTYPE_COMB_CONTRIB_MAP,
+ NULL,
+ (const cpl_propertylist**)extproplists,
+ "hawki_step_combine_contrib_map.fits") != 0)
+ {
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_propertylist_delete(extproplists[idet]);
+ }
+ cpl_free(extproplists) ;
+ return -1;
+ }
+
+ /* Free and return */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_propertylist_delete(extproplists[idet]) ;
+ }
+ cpl_free(extproplists) ;
+
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/recipes/hawki_step_compute_bkg.c b/recipes/hawki_step_compute_bkg.c
new file mode 100644
index 0000000..4e77b87
--- /dev/null
+++ b/recipes/hawki_step_compute_bkg.c
@@ -0,0 +1,1224 @@
+/* $Id: hawki_step_compute_bkg.c,v 1.17 2011/10/24 10:42:43 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2008 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: cgarcia $
+ * $Date: 2011/10/24 10:42:43 $
+ * $Revision: 1.17 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_utils.h"
+#include "hawki_distortion.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_bkg.h"
+#include "hawki_calib.h"
+
+/*-----------------------------------------------------------------------------
+ Structs
+ -----------------------------------------------------------------------------*/
+
+static struct
+{
+ /* Configuration values */
+ int nmin_comb;
+ int nhalf_window;
+ int rejlow;
+ int rejhigh;
+
+} hawki_step_compute_bkg_config;
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_compute_bkg_create(cpl_plugin *) ;
+static int hawki_step_compute_bkg_exec(cpl_plugin *) ;
+static int hawki_step_compute_bkg_destroy(cpl_plugin *) ;
+static int hawki_step_compute_bkg(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_step_compute_bkg_from_objects_qc_save
+(cpl_frameset * objframes,
+ cpl_frameset * maskframes,
+ cpl_frameset * offsetsframes,
+ cpl_frameset * x_distortionframes,
+ cpl_frameset * y_distortionframes,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_framelist);
+static int hawki_step_compute_bkg_from_objects_median_save
+(cpl_frameset * objframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+static int hawki_step_compute_bkg_from_sky_median_save
+(cpl_frameset * skyframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+static int hawki_step_compute_bkg_interpolate_badpix
+(cpl_image * image);
+static int hawki_step_compute_bkg_from_objects_running_median_save
+(cpl_frameset * objframes,
+ cpl_frameset * maskframes,
+ cpl_frameset * offsetframes,
+ cpl_frameset * x_distortionframes,
+ cpl_frameset * y_distortionframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+static int hawki_step_compute_bkg_from_running_median_nonmasked_save
+(const cpl_frameset * objframes,
+ int nhalf_window,
+ int rejlow,
+ int rejhigh,
+ cpl_frameset * recipe_framelist,
+ cpl_parameterlist * recipe_parlist);
+static int hawki_step_compute_bkg_from_running_median_masked_save
+(const cpl_frameset * objframes,
+ cpl_frame * maskframe,
+ cpl_bivector ** offsets,
+ cpl_frame * x_distortionframe,
+ cpl_frame * y_distortionframe,
+ int nhalf_window,
+ int rejlow,
+ int rejhigh,
+ cpl_frameset * recipe_framelist,
+ cpl_parameterlist * recipe_parlist);
+
+
+int hawki_step_compute_bkg_retrieve_input_param
+(cpl_parameterlist * parlist);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_compute_bkg_description[] =
+"hawki_step_compute_bkg -- hawki background computation utility.\n"
+"This recipe will create the associated background images\n"
+"for a given set of object images. If there are sky images, these will\n"
+"be used to compute the background, otherwise, the background is computed\n"
+"using a running mean on the object images. An optional mask can be supplied\n"
+"for the running mean.\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"obj_basic_cal-file.fits "HAWKI_CALPRO_BASICCALIBRATED" or\n"
+"sky_basic_cal-file.fits "HAWKI_CALPRO_SKY_BASICCALIBRATED" \n"
+"and optionally for object masking:\n"
+"object_mask-file.fits "HAWKI_CALPRO_OBJ_MASK" \n"
+"offsets.fits "HAWKI_CALPRO_OFFSETS" \n"
+"distortion_x.fits "HAWKI_CALPRO_DISTORTION_X" \n"
+"distortion_y.fits "HAWKI_CALPRO_DISTORTION_Y" \n";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_compute_bkg",
+ "Background computing utility",
+ hawki_step_compute_bkg_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_compute_bkg_create,
+ hawki_step_compute_bkg_exec,
+ hawki_step_compute_bkg_destroy);
+
+ cpl_pluginlist_append(list, plugin);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe;
+ cpl_parameter * p;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --nmin_comb */
+ p = cpl_parameter_new_value
+ ("hawki.hawki_step_compute_bkg.nmin_comb",
+ CPL_TYPE_INT,
+ "Minimum number of jitter frames to use the running median",
+ "hawki.hawki_step_compute_bkg",
+ 10) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nmin_comb") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --nhalf_window */
+ p = cpl_parameter_new_value
+ ("hawki.hawki_step_compute_bkg.nhalf_window",
+ CPL_TYPE_INT,
+ "Number of images at both sides of the current ima to use for bkg in running median",
+ "hawki.hawki_step_compute_bkg",
+ 7);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nhalf_window") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --rejlow */
+ p = cpl_parameter_new_value
+ ("hawki.hawki_step_compute_bkg.rejlow",
+ CPL_TYPE_INT,
+ "The number of frames with low level to reject",
+ "hawki.hawki_step_compute_bkg",
+ 2) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rejlow") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --rejhigh */
+ p = cpl_parameter_new_value
+ ("hawki.hawki_step_compute_bkg.rejhigh",
+ CPL_TYPE_INT,
+ "The number of frames with high level to reject",
+ "hawki.hawki_step_compute_bkg",
+ 2) ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rejhigh") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_compute_bkg(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * objframes = NULL;
+ cpl_frameset * skyframes;
+ cpl_frameset * maskframes;
+ cpl_frameset * x_distortionframes;
+ cpl_frameset * y_distortionframes;
+ cpl_frameset * offsetsframes = NULL;
+
+ /* Get the recipe parameters */
+ hawki_step_compute_bkg_retrieve_input_param(parlist);
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist))
+ {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Identifying objects and sky data frames */
+ cpl_msg_info(__func__, "Identifying objects and sky data");
+ objframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_BASICCALIBRATED);
+ skyframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_SKY_BASICCALIBRATED);
+ if (objframes == NULL && skyframes == NULL)
+ {
+ cpl_msg_error(__func__, "No object (%s) or sky (%s) frames provided",
+ HAWKI_CALPRO_BASICCALIBRATED, HAWKI_CALPRO_SKY_BASICCALIBRATED);
+ return -1 ;
+ }
+
+ /* Retrieve the mask */
+ maskframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_OBJ_MASK);
+ if(maskframes != NULL)
+ {
+ offsetsframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_OFFSETS);
+ x_distortionframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_DISTORTION_X);
+ y_distortionframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_DISTORTION_Y);
+ if((x_distortionframes == NULL && y_distortionframes != NULL) ||
+ (x_distortionframes != NULL && y_distortionframes == NULL))
+ {
+ cpl_msg_error(__func__, "One X-distortion frame (%s) and one Y-distortion (%s)"
+ "must be provided", HAWKI_CALPRO_DISTORTION_X, HAWKI_CALPRO_DISTORTION_Y);
+ cpl_frameset_delete(skyframes);
+ cpl_frameset_delete(maskframes);
+ cpl_frameset_delete(x_distortionframes);
+ cpl_frameset_delete(y_distortionframes);
+ return -1 ;
+ }
+ }
+
+ /* Compute the background */
+ if(skyframes == NULL)
+ hawki_step_compute_bkg_from_objects_qc_save
+ (objframes,
+ maskframes, offsetsframes, x_distortionframes, y_distortionframes,
+ parlist, framelist);
+ else
+ hawki_step_compute_bkg_from_sky_median_save
+ (skyframes,
+ parlist, framelist);
+
+ /* Free resources */
+ if(skyframes != NULL)
+ cpl_frameset_delete(skyframes);
+ if(objframes != NULL)
+ cpl_frameset_delete(objframes);
+ if(maskframes != NULL)
+ {
+ cpl_frameset_delete(maskframes);
+ if(x_distortionframes != NULL)
+ cpl_frameset_delete(x_distortionframes);
+ if(y_distortionframes != NULL)
+ cpl_frameset_delete(y_distortionframes);
+ if(offsetsframes != NULL)
+ cpl_frameset_delete(offsetsframes);
+ }
+
+ /* return */
+ if (cpl_error_get_code()) return -1 ;
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function will compute the background from the object frames
+ @param obj the objects frames
+ @return 0 if everything is ok
+
+ The function will use the mean of the objects if there are few of them
+ or the running mean if there are enough objects.
+ It will also compute the QC parameters and will store the results to disk.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_from_objects_qc_save
+(cpl_frameset * objframes,
+ cpl_frameset * maskframes,
+ cpl_frameset * offsetsframes,
+ cpl_frameset * x_distortionframes,
+ cpl_frameset * y_distortionframes,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_framelist)
+{
+ int nobjs;
+
+ /* Select the algorithm based on the number of frames */
+ nobjs = cpl_frameset_get_size(objframes);
+ cpl_msg_info(__func__,"Number of object frames: %d",nobjs);
+ if (hawki_step_compute_bkg_config.nmin_comb > nobjs)
+ {
+ /* TODO: Support for masks in this case?? */
+ cpl_msg_info(__func__,
+ "Number of obj frames min required for running median");
+ cpl_msg_info(__func__, "Using simple median of object images");
+ hawki_step_compute_bkg_from_objects_median_save
+ (objframes, parlist, recipe_framelist);
+ }
+ else
+ {
+ cpl_msg_info(__func__, "Using running median of object images");
+ hawki_step_compute_bkg_from_objects_running_median_save
+ (objframes, maskframes, offsetsframes,
+ x_distortionframes, y_distortionframes,
+ parlist, recipe_framelist);
+ }
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function will use a simple median algotihm to compute the
+ background from the object frames
+ @param objframes the objects frames
+ @return 0 if everything is ok
+
+ This function computes simply the median of the object images to compute
+ a background suitable to be subtracted to the object images afterwards.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_from_objects_median_save
+(cpl_frameset * objframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ cpl_imagelist * bkg;
+ const char * recipe_name = "hawki_step_compute_bkg";
+
+
+ /* Logging */
+ cpl_msg_info(__func__,"Computing background from median of object images");
+
+ /* Allocating for the background image */
+ bkg = cpl_imagelist_new();
+
+ /* Computing the background */
+ if(hawki_bkg_from_objects_median(objframes, bkg) != 0)
+ {
+ cpl_msg_error(__func__,"Could not compute the median of objects");
+ cpl_imagelist_delete(bkg);
+ return -1;
+ }
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Saving the products") ;
+ if(hawki_imagelist_save(recipe_framelist,
+ recipe_parlist,
+ objframes,
+ (const cpl_imagelist *)bkg,
+ recipe_name,
+ HAWKI_CALPRO_BKGIMAGE,
+ HAWKI_PROTYPE_BKGIMAGE,
+ NULL,
+ NULL,
+ "hawki_step_compute_bkg_01.fits") != CPL_ERROR_NONE)
+ {
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space");
+ }
+
+ /* Free and return */
+ cpl_imagelist_delete(bkg);
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function will use a simple median algotihm to compute the
+ background from the sky frames
+ @param obj the objects frames
+ @return 0 if everything is ok
+
+ This function computes simply the median of the sky images to compute
+ a background suitable to be subtracted to the object images afterwards.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_from_sky_median_save
+(cpl_frameset * skyframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ cpl_imagelist * bkg;
+ const char * recipe_name = "hawki_step_compute_bkg";
+
+ /* Logging */
+ cpl_msg_info(__func__,"Computing background from sky images");
+
+ /* Allocating for the background image */
+ bkg = cpl_imagelist_new();
+
+ /* Computing the background */
+ if(hawki_bkg_from_sky_median(skyframes, bkg)!= 0)
+ {
+ cpl_msg_error(__func__,"Could not compute the median of sky images");
+ cpl_imagelist_delete(bkg);
+ return -1;
+ }
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Saving the products") ;
+ if(hawki_imagelist_save(recipe_framelist,
+ recipe_parlist,
+ skyframes,
+ (const cpl_imagelist *)bkg,
+ recipe_name,
+ HAWKI_CALPRO_BKGIMAGE,
+ HAWKI_PROTYPE_BKGIMAGE,
+ NULL,
+ NULL,
+ "hawki_step_compute_bkg_01.fits") != CPL_ERROR_NONE)
+ {
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space");
+ }
+
+ /* Free and return */
+ cpl_imagelist_delete(bkg);
+ return 0;
+}
+
+static int hawki_step_compute_bkg_from_objects_running_median_save
+(cpl_frameset * objframes,
+ cpl_frameset * maskframes,
+ cpl_frameset * offsetframes,
+ cpl_frameset * x_distortionframes,
+ cpl_frameset * y_distortionframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+
+ /* Logging */
+ cpl_msg_info(__func__,"Computing background from running mean of objects");
+ cpl_msg_indent_more();
+
+ /* Actually calling the functions that computes all the background */
+ if(maskframes == NULL)
+ {
+ cpl_msg_info(__func__,"Not using masked objects");
+ if(hawki_step_compute_bkg_from_running_median_nonmasked_save
+ (objframes,
+ hawki_step_compute_bkg_config.nhalf_window,
+ hawki_step_compute_bkg_config.rejlow,
+ hawki_step_compute_bkg_config.rejhigh,
+ recipe_framelist,
+ recipe_parlist) !=0)
+ {
+ cpl_msg_error(__func__,"Could not compute objects running median");
+ return -1;
+ }
+ }
+ else
+ {
+ cpl_frame * maskframe;
+ cpl_bivector ** offsets; /* Detector order */
+ cpl_frame * x_distortionframe;
+ cpl_frame * y_distortionframe;
+ int idet;
+
+ cpl_msg_info(__func__,"Using masked objects");
+
+ maskframe = cpl_frameset_get_first(maskframes);
+ if(x_distortionframes == NULL && y_distortionframes == NULL )
+ {
+ x_distortionframe = NULL;
+ y_distortionframe = NULL;
+ }
+ else
+ {
+ x_distortionframe = cpl_frameset_get_first(x_distortionframes);
+ y_distortionframe = cpl_frameset_get_first(y_distortionframes);
+ }
+
+ /* Get the offsets */
+ if(offsetframes == NULL)
+ {
+ cpl_bivector * offsets_all_chips;
+
+ cpl_msg_info(__func__,"Using header nominal offsets");
+ offsets_all_chips = hawki_get_header_tel_offsets(objframes);
+ if (offsets_all_chips == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the header offsets");
+ return -1;
+ }
+ offsets = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_bivector *));
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ offsets[idet] = cpl_bivector_duplicate(offsets_all_chips);
+ /* Get the oposite offsets. This is to change from
+ * telescope convention to cpl convention */
+ cpl_vector_multiply_scalar
+ (cpl_bivector_get_x(offsets[idet]), -1.0);
+ cpl_vector_multiply_scalar
+ (cpl_bivector_get_y(offsets[idet]), -1.0);
+ }
+ cpl_bivector_delete(offsets_all_chips);
+ }
+ else
+ {
+ cpl_msg_info(__func__,"Using refined offsets");
+ offsets = hawki_load_refined_offsets
+ (cpl_frameset_get_first(offsetframes));
+ if(offsets == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the refined offsets");
+ return -1;
+ }
+ }
+
+ if(hawki_step_compute_bkg_from_running_median_masked_save
+ (objframes,
+ maskframe,
+ offsets,
+ x_distortionframe,
+ y_distortionframe,
+ hawki_step_compute_bkg_config.nhalf_window,
+ hawki_step_compute_bkg_config.rejlow,
+ hawki_step_compute_bkg_config.rejhigh,
+ recipe_framelist,
+ recipe_parlist) !=0)
+ {
+ cpl_msg_error(__func__,"Could not compute objects running median");
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_bivector_delete(offsets[idet]);
+ cpl_free(offsets);
+ cpl_msg_indent_less();
+ return -1;
+ }
+
+ /* Free */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_bivector_delete(offsets[idet]);
+ cpl_free(offsets);
+ }
+ cpl_msg_indent_less();
+
+
+ /* Freeing and exit */
+ return 0;
+}
+
+int hawki_step_compute_bkg_from_running_median_nonmasked_save
+(const cpl_frameset * objframes,
+ int nhalf_window,
+ int rejlow,
+ int rejhigh,
+ cpl_frameset * recipe_framelist,
+ cpl_parameterlist * recipe_parlist)
+{
+ int iext;
+ int iobj;
+ int nobj;
+ const char * recipe_name = "hawki_step_compute_bkg";
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Preparing the files to save */
+ cpl_msg_info(__func__,"Preparing the output files");
+ nobj = cpl_frameset_get_size(objframes);
+ for (iobj=0 ; iobj<nobj ; ++iobj)
+ {
+ cpl_frameset * used_frameset;
+ const cpl_frame * target_frame;
+ char filename[256];
+ snprintf(filename, 256, "hawki_step_compute_bkg_%03d.fits", iobj + 1);
+ target_frame = cpl_frameset_get_frame_const(objframes, iobj);
+ used_frameset = cpl_frameset_new();
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(target_frame));
+ hawki_main_header_save(recipe_framelist,
+ recipe_parlist,
+ used_frameset,
+ recipe_name,
+ HAWKI_CALPRO_BKGIMAGE,
+ HAWKI_PROTYPE_BKGIMAGE,
+ NULL,
+ filename);
+ snprintf(filename, 256, "hawki_step_compute_bkg_bpm_%03d.fits", iobj + 1);
+ hawki_main_header_save(recipe_framelist,
+ recipe_parlist,
+ used_frameset,
+ recipe_name,
+ HAWKI_CALPRO_BKGBPM,
+ HAWKI_PROTYPE_BKGBPM,
+ NULL,
+ filename);
+ cpl_frameset_delete(used_frameset);
+ }
+
+ /* Loop on extensions */
+ cpl_msg_indent_more();
+ for(iext = 0; iext < HAWKI_NB_DETECTORS; ++iext)
+ {
+ cpl_imagelist * img_serie;
+ cpl_vector * medians;
+
+ /* Info message */
+ cpl_msg_info(__func__,"Working on extension %d", iext + 1);
+
+ /* Loading the object frame */
+ img_serie = hawki_load_extensions(objframes, iext + 1, CPL_TYPE_FLOAT);
+ if(img_serie== NULL)
+ {
+ cpl_msg_error(__func__, "Error reading object image") ;
+ return -1;
+ }
+
+ /* Pre-compute median value in each plane */
+ medians = cpl_vector_new(nobj);
+ for (iobj=0 ; iobj<nobj ; iobj++)
+ {
+ cpl_vector_set
+ (medians,
+ iobj,
+ cpl_image_get_median(cpl_imagelist_get(img_serie, iobj))) ;
+ }
+
+ cpl_msg_indent_more();
+ for(iobj = 0 ; iobj < nobj ; ++iobj)
+ {
+ int nx;
+ int ny;
+ cpl_image * this_bkg_image;
+ cpl_image * this_bkg_image_mask;
+ char filename[256];
+
+ /* Info message */
+ cpl_msg_info(__func__,"Computing bkg for image %d", iobj + 1);
+
+ /* Creates the background image */
+ nx = cpl_image_get_size_x(cpl_imagelist_get(img_serie, 0));
+ ny = cpl_image_get_size_y(cpl_imagelist_get(img_serie, 0));
+ this_bkg_image = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+
+ /* Actually computing the running mean */
+ if(hawki_bkg_from_running_mean_detector
+ (img_serie,
+ medians,
+ iobj,
+ nhalf_window,
+ rejlow,
+ rejhigh,
+ this_bkg_image) != 0)
+ {
+ cpl_msg_error(__func__, "Cannot compute bkg");
+ cpl_vector_delete(medians);
+ cpl_imagelist_delete(img_serie);
+ cpl_image_delete(this_bkg_image);
+ return -1;
+ }
+
+ /* Save the extension bad pixel mask */
+ this_bkg_image_mask =
+ cpl_image_new_from_mask(cpl_image_get_bpm(this_bkg_image));
+ snprintf(filename, 256, "hawki_step_compute_bkg_bpm_%03d.fits",iobj +1);
+ hawki_image_ext_save
+ (objframes,
+ this_bkg_image_mask,
+ iext + 1,
+ NULL,
+ filename);
+
+ /* Interpolate bad pixels */
+ hawki_step_compute_bkg_interpolate_badpix(this_bkg_image);
+
+ /* Save this extension */
+ snprintf(filename, 256, "hawki_step_compute_bkg_%03d.fits",iobj +1);
+ hawki_image_ext_save
+ (objframes,
+ this_bkg_image,
+ iext + 1,
+ NULL,
+ filename);
+
+ /* Free */
+ cpl_image_delete(this_bkg_image);
+ cpl_image_delete(this_bkg_image_mask);
+ }
+ cpl_msg_indent_less();
+
+ /* Freeing */
+ cpl_vector_delete(medians);
+ cpl_imagelist_delete(img_serie);
+ }
+ cpl_msg_indent_less();
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_warning(__func__,"Probably some data could not be saved. "
+ "Check permisions or disk space");
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return 1;
+ }
+ return 0;
+}
+
+int hawki_step_compute_bkg_from_running_median_masked_save
+(const cpl_frameset * objframes,
+ cpl_frame * maskframe,
+ cpl_bivector ** offsets,
+ cpl_frame * x_distortionframe,
+ cpl_frame * y_distortionframe,
+ int nhalf_window,
+ int rejlow,
+ int rejhigh,
+ cpl_frameset * recipe_framelist,
+ cpl_parameterlist * recipe_parlist)
+{
+ int iext; /* 0 to HAWKI_NB_DETECTORS-1 */
+ int idet; /* 1 to HAWKI_NB_DETECTORS */
+ int iobj; /* 0 to obj-1 */
+ int nobj;
+ const char * recipe_name = "hawki_step_compute_bkg";
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+ cpl_frameset * calib_frameset;
+
+
+ //Add all the used frames
+ calib_frameset = cpl_frameset_new();
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(maskframe));
+ if(x_distortionframe != NULL)
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(x_distortionframe));
+ if(y_distortionframe != NULL)
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(y_distortionframe));
+
+ /* Preparing the files to save */
+ cpl_msg_info(__func__,"Preparing the final files");
+ nobj = cpl_frameset_get_size(objframes);
+ for (iobj=0 ; iobj<nobj ; ++iobj)
+ {
+ cpl_frameset * used_frameset;
+ const cpl_frame * target_frame;
+ char filename[256];
+ snprintf(filename, 256, "hawki_step_compute_bkg_%03d.fits", iobj + 1);
+ target_frame = cpl_frameset_get_frame_const(objframes, iobj);
+ used_frameset = cpl_frameset_duplicate(calib_frameset);
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(target_frame));
+ cpl_frameset_insert(calib_frameset, cpl_frame_duplicate(maskframe));
+ hawki_main_header_save(recipe_framelist,
+ recipe_parlist,
+ used_frameset,
+ recipe_name,
+ HAWKI_CALPRO_BKGIMAGE,
+ HAWKI_PROTYPE_BKGIMAGE,
+ NULL,
+ filename);
+ snprintf(filename, 256, "hawki_step_compute_bkg_bpm_%03d.fits", iobj + 1);
+ hawki_main_header_save(recipe_framelist,
+ recipe_parlist,
+ used_frameset,
+ recipe_name,
+ HAWKI_CALPRO_BKGBPM,
+ HAWKI_PROTYPE_BKGBPM,
+ NULL,
+ filename);
+ cpl_frameset_delete(used_frameset);
+ }
+ cpl_frameset_delete(calib_frameset);
+
+ /* Loop on extensions */
+ cpl_msg_indent_more();
+ for(iext = 0; iext < HAWKI_NB_DETECTORS; ++iext)
+ {
+ cpl_imagelist * img_serie;
+ cpl_vector * medians;
+ cpl_image * mask;
+ hawki_distortion * inv_distortion = NULL;
+ cpl_propertylist * prop_list;
+ cpl_image * dist_x = NULL;
+ cpl_image * dist_y = NULL;
+ double mask_off_x;
+ double mask_off_y;
+
+ cpl_msg_info(__func__,"Working on extension %d", iext + 1);
+ cpl_msg_indent_more();
+
+ /* Loading the object frames */
+ img_serie = hawki_load_extensions(objframes, iext + 1, CPL_TYPE_FLOAT);
+ if(img_serie== NULL)
+ {
+ cpl_msg_error(__func__, "Error reading object image") ;
+ cpl_msg_indent_less();
+ return -1;
+ }
+ nobj = cpl_imagelist_get_size(img_serie);
+
+ /* Loading the mask frame */
+ mask = hawki_load_frame_extension(maskframe, iext + 1, CPL_TYPE_FLOAT);
+ if(mask == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading mask image");
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ return -1;
+ }
+ idet =
+ hawki_get_detector_from_ext(cpl_frame_get_filename(maskframe), iext+1);
+ prop_list =
+ cpl_propertylist_load(cpl_frame_get_filename(maskframe), iext + 1);
+ mask_off_x = hawki_pfits_get_comb_cumoffsetx(prop_list);
+ mask_off_y = hawki_pfits_get_comb_cumoffsety(prop_list);
+ /* Change the offsets to cpl convention */
+ mask_off_x *= -1;
+ mask_off_y *= -1;
+ if(!cpl_errorstate_is_equal(CPL_ERROR_NONE))
+ {
+ cpl_msg_error(__func__,"Could not get the offsets from mask file.\n"
+ "Keywords %s are missing","ESO QC COMBINED CUMOFFSET{X,Y}");
+ cpl_imagelist_delete(img_serie);
+ cpl_image_delete(mask);
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ cpl_propertylist_delete(prop_list);
+ return -1;
+ }
+ cpl_msg_info(__func__,"Mask offsets: %f %f", mask_off_x, mask_off_y);
+
+ if(x_distortionframe != NULL && y_distortionframe != NULL)
+ {
+ int nx;
+ int ny;
+
+ /* Load the distortion */
+ if ((inv_distortion = hawki_distortion_load
+ (x_distortionframe, y_distortionframe, idet)) == NULL)
+ {
+ cpl_imagelist_delete(img_serie);
+ cpl_propertylist_delete(prop_list);
+ cpl_image_delete(mask);
+ cpl_msg_error(__func__,
+ "Cannot load distortion for chip %d",idet);
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ return -1 ;
+ }
+ /* Multiply distortion by -1, to get the inverse distortion */
+ cpl_image_multiply_scalar(inv_distortion->dist_x, -1.);
+ cpl_image_multiply_scalar(inv_distortion->dist_y, -1.);
+ /* Create the distortion maps */
+ nx = cpl_image_get_size_x(mask);
+ ny = cpl_image_get_size_y(mask);
+ dist_x = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+ dist_y = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);
+ if (hawki_distortion_create_maps_detector
+ (inv_distortion, dist_x, dist_y))
+ {
+ cpl_msg_error(__func__, "Cannot create the distortion maps") ;
+ cpl_imagelist_delete(img_serie);
+ cpl_propertylist_delete(prop_list);
+ cpl_image_delete(mask);
+ cpl_image_delete(dist_x);
+ cpl_image_delete(dist_y);
+ hawki_distortion_delete(inv_distortion);
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ return -1;
+ }
+
+ }
+
+ /* Creating a different mask for each object, using the offsets
+ * and the distortion (if applies) */
+ cpl_msg_info(__func__,"Constructing the masks");
+ for (iobj=0 ; iobj<nobj ; iobj++)
+ {
+ cpl_image * mask_shifted;
+ cpl_image * mask_trim;
+ cpl_mask * mask_final;
+ cpl_image * target_image;
+ cpl_vector * off_x;
+ cpl_vector * off_y;
+
+ /* Retrieve the offsets. Warning, it is in chip order */
+ off_x = cpl_bivector_get_x(offsets[idet-1]);
+ off_y = cpl_bivector_get_y(offsets[idet-1]);
+
+ target_image = cpl_imagelist_get(img_serie, iobj);
+ mask_shifted = cpl_image_duplicate(mask);
+ cpl_image_shift(mask_shifted,
+ -(int)(cpl_vector_get(off_x, iobj) - mask_off_x),
+ -(int)(cpl_vector_get(off_y, iobj) - mask_off_y));
+ if(x_distortionframe != NULL && y_distortionframe != NULL)
+ {
+ cpl_image * mask_distcorr;
+
+ /* Dedistort the mask */
+ mask_distcorr = hawki_distortion_correct_detector
+ (mask_shifted, dist_x, dist_y);
+ if(mask_distcorr == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot correct the distortion") ;
+ cpl_image_delete(dist_x);
+ cpl_image_delete(dist_y);
+ cpl_image_delete(mask_shifted);
+ cpl_imagelist_delete(img_serie);
+ cpl_image_delete(mask);
+ cpl_propertylist_delete(prop_list);
+ hawki_distortion_delete(inv_distortion);
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ return -1 ;
+ }
+ mask_trim = cpl_image_extract
+ (mask_distcorr, 1, 1,
+ cpl_image_get_size_x(target_image),
+ cpl_image_get_size_y(target_image));
+ cpl_image_delete(mask_distcorr);
+ }
+ else
+ {
+ mask_trim = cpl_image_extract
+ (mask_shifted, 1, 1,
+ cpl_image_get_size_x(target_image),
+ cpl_image_get_size_y(target_image));
+ }
+ mask_final =
+ cpl_mask_threshold_image_create(mask_trim, 0.5, FLT_MAX);
+ /* TODO: Add the current bpm to this mask? */
+ cpl_image_reject_from_mask
+ (target_image, mask_final);
+ cpl_image_delete(mask_shifted);
+ cpl_image_delete(mask_trim);
+ cpl_mask_delete(mask_final);
+ }
+
+ /* Pre-compute median value in each plane */
+ cpl_msg_info(__func__,"Computing the medians");
+ medians = cpl_vector_new(nobj);
+ for (iobj=0 ; iobj<nobj ; iobj++)
+ {
+ cpl_vector_set
+ (medians,
+ iobj,
+ cpl_image_get_median(cpl_imagelist_get(img_serie, iobj))) ;
+ }
+
+ /* Object loop to get the bkg */
+ cpl_msg_info(__func__,"Computing backgrounds");
+ cpl_msg_indent_more();
+ for(iobj = 0 ; iobj < nobj ; ++iobj)
+ {
+ int nx;
+ int ny;
+ cpl_image * this_bkg_image;
+ cpl_image * this_bkg_image_mask;
+ char filename[256];
+
+ /* Creates the background image */
+ cpl_msg_info(__func__,"Computing bkg for image %d", iobj + 1);
+ nx = cpl_image_get_size_x(cpl_imagelist_get(img_serie, 0));
+ ny = cpl_image_get_size_y(cpl_imagelist_get(img_serie, 0));
+ this_bkg_image = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+
+ /* Actually computing the running mean */
+ if(hawki_bkg_from_running_mean_detector
+ (img_serie,
+ medians,
+ iobj,
+ nhalf_window,
+ rejlow,
+ rejhigh,
+ this_bkg_image) != 0)
+ {
+ cpl_msg_error(__func__, "Cannot compute bkg");
+ cpl_image_delete(this_bkg_image);
+ cpl_vector_delete(medians);
+ cpl_imagelist_delete(img_serie);
+ cpl_image_delete(mask);
+ cpl_propertylist_delete(prop_list);
+ if(x_distortionframe != NULL && y_distortionframe != NULL)
+ {
+ hawki_distortion_delete(inv_distortion);
+ cpl_image_delete(dist_x);
+ cpl_image_delete(dist_y);
+ }
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+ return -1;
+ }
+
+ /* Save the extension bad pixel mask */
+ this_bkg_image_mask =
+ cpl_image_new_from_mask(cpl_image_get_bpm(this_bkg_image));
+ snprintf(filename, 256, "hawki_step_compute_bkg_bpm_%03d.fits",iobj +1);
+ hawki_image_ext_save
+ (objframes,
+ this_bkg_image_mask,
+ iext + 1,
+ NULL,
+ filename);
+
+ /* Interpolate bad pixels */
+ hawki_step_compute_bkg_interpolate_badpix(this_bkg_image);
+
+ /* Save this extension */
+ snprintf(filename, 256, "hawki_step_compute_bkg_%03d.fits",iobj +1);
+ hawki_image_ext_save
+ (objframes,
+ this_bkg_image,
+ iext + 1,
+ NULL,
+ filename);
+
+ /* Free */
+ cpl_image_delete(this_bkg_image);
+ cpl_image_delete(this_bkg_image_mask);
+ }
+ cpl_msg_indent_less();
+
+ /* Freeing */
+ cpl_vector_delete(medians);
+ cpl_imagelist_delete(img_serie);
+ cpl_image_delete(mask);
+ cpl_propertylist_delete(prop_list);
+ if(x_distortionframe != NULL && y_distortionframe != NULL)
+ {
+ hawki_distortion_delete(inv_distortion);
+ cpl_image_delete(dist_x);
+ cpl_image_delete(dist_y);
+ }
+ cpl_msg_indent_less();
+ }
+ cpl_msg_indent_less();
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_warning(__func__,"Probably some data could not be saved. "
+ "Check permissions or disk space");
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return 1;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Interpolate the pixels in the bad pixel mask
+ @param image the image to interpolate
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_compute_bkg_interpolate_badpix
+(cpl_image * image)
+{
+ int nbadpixels = cpl_image_count_rejected(image);
+ if(nbadpixels !=0)
+ cpl_msg_info(__func__,"Number of pixels with no background available: %d ",
+ nbadpixels);
+ if(cpl_image_count_rejected(image) > 0)
+ {
+ int ipix,npix;
+ double median = cpl_image_get_median(image);
+ const cpl_binary * bpm = cpl_mask_get_data_const
+ (cpl_image_get_bpm(image));
+ float * image_p = (float*)cpl_image_get_data(image);
+ cpl_msg_warning(__func__,"Substituting pixels with no bkg with median of image %f",median);
+ npix = cpl_image_get_size_x(image) * cpl_image_get_size_y(image);
+ for(ipix = 0; ipix < npix; ipix++)
+ {
+ if (bpm[ipix])
+ {
+ image_p[ipix] = median;
+ }
+ }
+ //This cannot be used until DFS08929 is solved
+ //cpl_detector_interpolate_rejected(image);
+ }
+ return 0;
+}
+
+int hawki_step_compute_bkg_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+
+ par = NULL ;
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_compute_bkg.nmin_comb");
+ hawki_step_compute_bkg_config.nmin_comb = cpl_parameter_get_int(par);
+
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_compute_bkg.nhalf_window");
+ hawki_step_compute_bkg_config.nhalf_window = cpl_parameter_get_int(par);
+
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_compute_bkg.rejlow");
+ hawki_step_compute_bkg_config.rejlow = cpl_parameter_get_int(par);
+
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_compute_bkg.rejhigh");
+ hawki_step_compute_bkg_config.rejhigh = cpl_parameter_get_int(par);
+
+ return 0;
+}
diff --git a/recipes/hawki_step_detect_obj.c b/recipes/hawki_step_detect_obj.c
new file mode 100644
index 0000000..7f50e18
--- /dev/null
+++ b/recipes/hawki_step_detect_obj.c
@@ -0,0 +1,970 @@
+/* $Id: hawki_step_detect_obj.c,v 1.26 2012/05/03 10:43:22 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/05/03 10:43:22 $
+ * $Revision: 1.26 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <string.h>
+
+#include "irplib_utils.h"
+#include "irplib_calib.h"
+
+#include "hawki_utils.h"
+#include "hawki_obj_det.h"
+#include "hawki_mask.h"
+#include "hawki_image_stats.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_detect_obj_create(cpl_plugin *) ;
+static int hawki_step_detect_obj_exec(cpl_plugin *) ;
+static int hawki_step_detect_obj_destroy(cpl_plugin *) ;
+static int hawki_step_detect_obj(cpl_parameterlist *, cpl_frameset *) ;
+
+static void hawki_step_detect_obj_init_output(void);
+static void hawki_step_detect_obj_get_pscale
+(cpl_frameset * combframes);
+static int hawki_step_detect_obj_retrieve_input_param
+(cpl_parameterlist * parlist);
+static cpl_apertures ** hawki_step_detect_obj_mask_and_apertures
+(cpl_frameset * combframes,
+ cpl_image ** mask_image,
+ cpl_image ** comb_image);
+static int hawki_step_detect_obj_aper_params
+(cpl_image ** combined_images,
+ cpl_apertures ** apertures,
+ cpl_table ** obj_charac);
+static int hawki_step_detect_obj_save
+(cpl_image ** mask_images,
+ cpl_table ** obj_charac,
+ cpl_propertylist ** obj_stats,
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct
+{
+ /* Inputs */
+ double sigma_det;
+ int growing_radius;
+} hawki_step_detect_obj_config;
+
+static struct
+{
+ /* Outputs */
+ double pixscale;
+ double iq[HAWKI_NB_DETECTORS] ;
+ int nbobjs[HAWKI_NB_DETECTORS] ;
+ double fwhm_pix[HAWKI_NB_DETECTORS] ;
+ double fwhm_arcsec[HAWKI_NB_DETECTORS] ;
+ double fwhm_mode[HAWKI_NB_DETECTORS] ;
+ double pos_x[HAWKI_NB_DETECTORS] ;
+ double pos_y[HAWKI_NB_DETECTORS] ;
+} hawki_step_detect_obj_output;
+
+static char hawki_step_detect_obj_description[] =
+"hawki_step_detect_obj -- hawki detect objects recipe.\n"
+"This recipe detects objects from the combined image creating a mask\n"
+"and a list of object properties\n"
+"The input of the recipe files listed in the Set Of Frames (sof-file)\n"
+"must be tagged as:\n"
+"combined.fits "HAWKI_CALPRO_COMBINED"\n"
+"The recipe creates as an output:\n"
+"hawki_step_detect_obj_mask.fits ("HAWKI_CALPRO_OBJ_MASK"): A mask with 1 where the objects are present and 0 elsewhere\n"
+"hawki_step_detect_obj_stars.fits ("HAWKI_CALPRO_OBJ_PARAM"): A table with the detected objects characteristics\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_detect_obj",
+ "Object detection recipe",
+ hawki_step_detect_obj_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_detect_obj_create,
+ hawki_step_detect_obj_exec,
+ hawki_step_detect_obj_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_detect_obj_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --sigma_det */
+ p = cpl_parameter_new_value("hawki.hawki_step_detect_obj.sigma_det",
+ CPL_TYPE_DOUBLE, "detection level",
+ "hawki.hawki_step_detect_obj", 6.);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma_det");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --growing_radius */
+ p = cpl_parameter_new_value("hawki.hawki_step_detect_obj.growing_radius",
+ CPL_TYPE_INT,
+ "radius of convolution kernel to apply to objects",
+ "hawki.hawki_step_detect_obj", 5);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "growing_radius");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_detect_obj_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_detect_obj(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_detect_obj_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_detect_obj(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * combframes;
+ cpl_image ** mask_image;
+ cpl_image ** comb_image;
+ cpl_apertures ** apertures;
+ cpl_table ** obj_charac;
+ cpl_propertylist ** obj_stats;
+ int idet;
+
+ /* Initialise */
+ hawki_step_detect_obj_init_output();
+
+ /* Retrieve input parameters */
+ if(hawki_step_detect_obj_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve raw frames */
+ combframes = hawki_extract_frameset(framelist, HAWKI_CALPRO_COMBINED) ;
+ if (combframes == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find combined images in the input (%s)",
+ HAWKI_CALPRO_COMBINED);
+ return -1 ;
+ }
+ if (cpl_frameset_get_size(combframes) != 1)
+ {
+ cpl_msg_error(__func__, "Only one combined image must be provided");
+ return -1 ;
+ }
+
+ /* Get info from the headers */
+ hawki_step_detect_obj_get_pscale(combframes);
+
+ /* Get the mask with the points above the background
+ * and the associated apertures*/
+ cpl_msg_info(__func__, "Getting the object masks") ;
+ mask_image = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_image *));
+ comb_image = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_image *));
+ apertures = hawki_step_detect_obj_mask_and_apertures
+ (combframes, mask_image, comb_image);
+ if(apertures == NULL)
+ {
+ cpl_msg_error(__func__,"Could not detect objects in image");
+ cpl_frameset_delete(combframes);
+ cpl_free(mask_image);
+ cpl_free(comb_image);
+ return -1;
+ }
+
+ /* Get object characterizations and statistics */
+ cpl_msg_info(__func__, "Getting object parameters") ;
+ obj_charac = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *)) ;
+ obj_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist *));
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ obj_charac[idet] = cpl_table_new
+ (cpl_apertures_get_size(apertures[idet]));
+ obj_stats[idet] = cpl_propertylist_new();
+ }
+ hawki_step_detect_obj_aper_params(comb_image, apertures, obj_charac);
+
+ /* Statistics of the detected objects in the QC */
+ hawki_obj_prop_stats(obj_charac, obj_stats);
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Save the products") ;
+ if (hawki_step_detect_obj_save(mask_image, obj_charac, obj_stats,
+ parlist, framelist) == -1)
+ {
+ cpl_msg_warning(__func__, "Some data could not be saved. "
+ "Check permisions or disk space") ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_table_delete(obj_charac[idet]);
+ cpl_propertylist_delete(obj_stats[idet]);
+ cpl_apertures_delete(apertures[idet]);
+ }
+ cpl_free(apertures);
+ cpl_free(obj_charac);
+ cpl_free(obj_stats);
+ cpl_frameset_delete(combframes);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_image_delete(mask_image[idet]);
+ cpl_image_delete(comb_image[idet]);
+ }
+ cpl_free(mask_image);
+ cpl_free(comb_image);
+ return -1 ;
+ }
+
+ /* Return */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_table_delete(obj_charac[idet]);
+ cpl_propertylist_delete(obj_stats[idet]);
+ cpl_apertures_delete(apertures[idet]);
+ cpl_image_delete(mask_image[idet]);
+ cpl_image_delete(comb_image[idet]);
+ }
+ cpl_free(apertures);
+ cpl_free(obj_charac);
+ cpl_free(obj_stats);
+ cpl_frameset_delete(combframes);
+ cpl_free(mask_image);
+ cpl_free(comb_image);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+int hawki_step_detect_obj_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+
+ par = NULL ;
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_detect_obj.sigma_det");
+ hawki_step_detect_obj_config.sigma_det = cpl_parameter_get_double(par);
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_detect_obj.growing_radius");
+ hawki_step_detect_obj_config.growing_radius = cpl_parameter_get_int(par);
+ if(hawki_step_detect_obj_config.growing_radius > 100)
+ {
+ cpl_msg_error(__func__,"The maximum radius allowed is 100");
+ return -1;
+ }
+ if(hawki_step_detect_obj_config.sigma_det <= 0 )
+ {
+ cpl_msg_error(__func__,"Detection sigma has to be greater than 0");
+ return -1;
+ }
+
+ return 0;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function creates a mask with the objects above the background
+ @param obj the objects frames
+ @param obj the sky frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @param skybg the computed sky background values
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_apertures ** hawki_step_detect_obj_mask_and_apertures
+(cpl_frameset * combframes,
+ cpl_image ** mask_image,
+ cpl_image ** comb_image)
+{
+ cpl_apertures ** apertures;
+ int idet;
+
+ /* Create output object */
+ apertures = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_apertures *));
+
+ /* Loop on the detectors */
+ cpl_msg_indent_more();
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_image * chip_image;
+ cpl_image * chip_image_sort;
+ cpl_mask * object_mask;
+ cpl_mask * kernel_op;
+ cpl_matrix * kernel;
+ cpl_image * labels;
+ cpl_size nobj;
+ double bkg_level;
+ double bkg_noise;
+ double threshold;
+ int kernel_size;
+ int ix;
+ int iy;
+
+ cpl_msg_info(__func__, "Detecting objects on chip number %d", idet+1) ;
+ cpl_msg_indent_more();
+
+ /* Load the input data */
+ cpl_msg_info(__func__, "Load the input data") ;
+ chip_image = hawki_load_image(combframes, 0, idet+1, CPL_TYPE_FLOAT);
+ if (chip_image == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load chip %d", idet+1) ;
+ cpl_msg_indent_less() ;
+ cpl_free(apertures);
+ return NULL ;
+ }
+
+ /* Subtract the median of the frame first */
+ chip_image_sort = cpl_image_duplicate(chip_image);
+ bkg_level = cpl_image_get_median(chip_image);
+ bkg_noise = hawki_image_float_get_sigma_from_quartile(chip_image_sort);
+ cpl_image_delete(chip_image_sort);
+ threshold = bkg_level + hawki_step_detect_obj_config.sigma_det * bkg_noise;
+ cpl_msg_info(__func__, "Background: %f",bkg_level);
+ cpl_msg_info(__func__, "Background noise: %f",bkg_noise);
+
+ /* Create the mask */
+ cpl_msg_info(__func__, "Mask creation with threshold: %f",threshold);
+ object_mask = cpl_mask_threshold_image_create
+ (chip_image, threshold, DBL_MAX);
+
+ /* Apply a morphological opening to remove single pixel detections */
+ cpl_msg_info(__func__, "Removing single pixel detections");
+ kernel_op = cpl_mask_new(3, 3);
+ cpl_mask_not(kernel_op);
+ if (cpl_mask_filter(object_mask, object_mask, kernel_op,
+ CPL_FILTER_OPENING,
+ CPL_BORDER_ZERO) != CPL_ERROR_NONE)
+ {
+ cpl_mask_delete(object_mask);
+ cpl_mask_delete(kernel_op);
+ return NULL;
+ }
+ cpl_mask_delete(kernel_op);
+
+ /* Apply dilation to the mask */
+ if(hawki_step_detect_obj_config.growing_radius>0)
+ {
+ cpl_msg_info(__func__, "Growing the mask with radius %d",
+ hawki_step_detect_obj_config.growing_radius);
+ kernel_size = hawki_step_detect_obj_config.growing_radius*2+1;
+ kernel = cpl_matrix_new(kernel_size, kernel_size);
+ for(ix=0;ix<kernel_size;++ix)
+ for(iy=0;iy<kernel_size;++iy)
+ {
+ double xpos = ix+0.5-kernel_size/2.;
+ double ypos = iy+0.5-kernel_size/2.;
+ double kernel_func = 1-sqrt(xpos*xpos+ypos*ypos)/
+ hawki_step_detect_obj_config.growing_radius;
+ if(kernel_func<0)
+ kernel_func = 0;
+ cpl_matrix_set(kernel, ix, iy, kernel_func);
+ }
+ if (hawki_mask_convolve(object_mask, kernel) != CPL_ERROR_NONE) {
+ cpl_mask_delete(object_mask) ;
+ cpl_matrix_delete(kernel) ;
+ return NULL;
+ }
+ cpl_matrix_delete(kernel);
+ }
+
+ /* Put the mask and the chip image in the imagelist */
+ mask_image[idet] = cpl_image_new_from_mask(object_mask);
+ comb_image[idet] = chip_image;
+
+ /* Labelise the different detected apertures */
+ cpl_msg_info(__func__, "Labelise mask") ;
+ labels = cpl_image_labelise_mask_create(object_mask, &nobj);
+ if (labels == NULL)
+ {
+ int jdet;
+ cpl_free(apertures);
+ cpl_mask_delete(object_mask);
+ for (jdet=0 ; jdet<idet + 1 ; jdet++)
+ {
+ cpl_image_delete(mask_image[jdet]);
+ cpl_image_delete(comb_image[jdet]);
+ }
+ }
+ cpl_msg_info(__func__, "Number of objects detected: %"CPL_SIZE_FORMAT,
+ nobj) ;
+
+ /* Create the detected apertures list */
+ cpl_msg_info(__func__, "Create apertures") ;
+ apertures[idet] = cpl_apertures_new_from_image(chip_image, labels);
+ if (apertures[idet] == NULL)
+ {
+ int jdet;
+ cpl_free(apertures);
+ cpl_mask_delete(object_mask);
+ for (jdet=0 ; jdet<idet + 1 ; jdet++)
+ {
+ cpl_image_delete(mask_image[jdet]);
+ cpl_image_delete(comb_image[jdet]);
+ }
+ return NULL;
+ }
+
+ /* Free */
+ cpl_mask_delete(object_mask);
+ cpl_image_delete(labels);
+ cpl_msg_indent_less();
+ }
+
+ /* Free and return */
+ cpl_msg_indent_less();
+ return apertures;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute some QC parameters from the combined image
+ @param combined the combined image produced
+ @param chip the chip number (start from 0)
+ @return a newly allocated table with the stars stats or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_detect_obj_aper_params
+(cpl_image ** combined_images,
+ cpl_apertures ** apertures,
+ cpl_table ** obj_charac)
+{
+ int nb_objs ;
+ double angle ;
+ double * fwhms_x ;
+ double * fwhms_y ;
+ cpl_bivector * iqe ;
+ int nb_good ;
+ cpl_vector * fwhms_good ;
+ double * fwhms_good_data ;
+ double f_min, f_max, fr, fx, fy ;
+ int chip;
+ int iobj;
+ int j;
+
+ /* Initialise */
+ double seeing_min_arcsec = 0.1 ;
+ double seeing_max_arcsec = 5.0 ;
+ double seeing_fwhm_var = 0.2 ;
+
+ /* Check entries */
+ if (combined_images == NULL) return -1 ;
+ if (obj_charac == NULL) return -1 ;
+
+ /* Loop on the HAWK-I detectors */
+ cpl_msg_indent_more();
+ for (chip=0 ; chip<HAWKI_NB_DETECTORS ; chip++)
+ {
+
+ /* Number of detected objects */
+ nb_objs = cpl_apertures_get_size(apertures[chip]);
+ cpl_msg_info(__func__, "%d objects detected on chip %d",nb_objs,chip+1);
+ hawki_step_detect_obj_output.nbobjs[chip] = nb_objs ;
+ fwhms_x = cpl_malloc(nb_objs * sizeof(double)) ;
+ fwhms_y = cpl_malloc(nb_objs * sizeof(double)) ;
+
+ /* Initialize the output table */
+ cpl_table_set_size(obj_charac[chip], nb_objs);
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_POSX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSX,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_POSY, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_POSY,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_ANGLE,"grad");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MAJAX,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FWHM_MINAX,"pix");
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, CPL_TYPE_DOUBLE);
+ cpl_table_new_column
+ (obj_charac[chip], HAWKI_COL_OBJ_FLUX, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(obj_charac[chip],HAWKI_COL_OBJ_FLUX,"ADU");
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ /* Fill with the already known information */
+ cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSX, iobj,
+ cpl_apertures_get_centroid_x(apertures[chip],
+ iobj+1));
+ cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_POSY, iobj,
+ cpl_apertures_get_centroid_y(apertures[chip],
+ iobj+1));
+ cpl_table_set_double(obj_charac[chip], HAWKI_COL_OBJ_FLUX, iobj,
+ cpl_apertures_get_flux(apertures[chip],
+ iobj+1));
+ /* Compute the FWHM informations */
+ iqe = cpl_image_iqe(combined_images[chip],
+ (int)cpl_apertures_get_centroid_x(apertures[chip], iobj+1)- 10,
+ (int)cpl_apertures_get_centroid_y(apertures[chip], iobj+1)- 10,
+ (int)cpl_apertures_get_centroid_x(apertures[chip], iobj+1)+ 10,
+ (int)cpl_apertures_get_centroid_y(apertures[chip], iobj+1)+ 10);
+ if (iqe == NULL)
+ {
+ cpl_error_reset() ;
+ cpl_msg_debug(__func__, "Cannot get FWHM for obj at pos %g %g",
+ cpl_apertures_get_centroid_x(apertures[chip],
+ iobj+1),
+ cpl_apertures_get_centroid_y(apertures[chip],
+ iobj+1)) ;
+ fwhms_x[iobj] = -1.0 ;
+ fwhms_y[iobj] = -1.0 ;
+ angle = 0.0 ;
+ }
+ else
+ {
+ fwhms_x[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 2) ;
+ fwhms_y[iobj] = cpl_vector_get(cpl_bivector_get_x(iqe), 3) ;
+ angle = cpl_vector_get(cpl_bivector_get_x(iqe), 4) ;
+ cpl_bivector_delete(iqe) ;
+ cpl_msg_debug(__func__,
+ "FWHM for obj at pos %g %g: %g x %g (%g)",
+ cpl_apertures_get_centroid_x(apertures[chip],
+ iobj+1),
+ cpl_apertures_get_centroid_y(apertures[chip],
+ iobj+1),
+ fwhms_x[iobj], fwhms_y[iobj], angle) ;
+ }
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_ANGLE, iobj, angle) ;
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MAJAX, iobj,
+ fwhms_x[iobj]);
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_FWHM_MINAX, iobj,
+ fwhms_y[iobj]);
+ cpl_table_set_double
+ (obj_charac[chip], HAWKI_COL_OBJ_ELLIP, iobj,
+ 1 - fwhms_y[iobj] / fwhms_x[iobj]);
+ }
+
+ /* Get the number of good values */
+ nb_good = 0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ if ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0)) nb_good++ ;
+ }
+ if (nb_good == 0)
+ {
+ cpl_msg_warning
+ (__func__, "No objects to compute mean FWHM on chip %d",chip+1);
+ cpl_free(fwhms_x) ;
+ cpl_free(fwhms_y) ;
+ continue;
+ }
+
+ /* Get the good values */
+ fwhms_good = cpl_vector_new(nb_good) ;
+ fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+ j=0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ if ((fwhms_x[iobj] > 0.0) && (fwhms_y[iobj] > 0.0))
+ {
+ fwhms_good_data[j] = (fwhms_x[iobj]+fwhms_y[iobj])/2.0 ;
+ j++ ;
+ }
+ }
+
+ /* Compute the fwhm */
+ if (nb_good < 3)
+ {
+ /* Too few values to compute the median */
+ hawki_step_detect_obj_output.fwhm_pix[chip] = fwhms_good_data[0] ;
+ cpl_msg_warning
+ (__func__, "Fewer than 3 objects, using the first object FWHM");
+ }
+ else
+ {
+ /* Compute the median */
+ hawki_step_detect_obj_output.fwhm_pix[chip] =
+ cpl_vector_get_median_const(fwhms_good);
+ }
+ hawki_step_detect_obj_output.fwhm_arcsec[chip] =
+ hawki_step_detect_obj_output.fwhm_pix[chip] *
+ hawki_step_detect_obj_output.pixscale ;
+
+ /* Compute the mode of the FWHMs */
+ if (nb_good > 5)
+ {
+ hawki_step_detect_obj_output.fwhm_mode[chip] =
+ hawki_vector_get_mode(fwhms_good);
+ hawki_step_detect_obj_output.fwhm_mode[chip] *=
+ hawki_step_detect_obj_output.pixscale;
+ }
+ cpl_vector_delete(fwhms_good);
+
+ /* IQ is the median of the (fwhm_x+fwhm_y/2) of the good stars */
+ /* Compute f_min and f_max */
+ f_min = seeing_min_arcsec / hawki_step_detect_obj_output.pixscale;
+ f_max = seeing_max_arcsec / hawki_step_detect_obj_output.pixscale;
+
+ /* Get the number of good values */
+ nb_good = 0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ fx = fwhms_x[iobj] ;
+ fy = fwhms_y[iobj] ;
+ fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+ if ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+ (fr < seeing_fwhm_var)) nb_good++ ;
+ }
+ if (nb_good == 0)
+ {
+ cpl_msg_warning(__func__, "No objects to compute IQ on chip %d",
+ chip+1);
+ cpl_free(fwhms_x) ;
+ cpl_free(fwhms_y) ;
+ continue;
+ }
+
+ /* Get the good values */
+ fwhms_good = cpl_vector_new(nb_good) ;
+ fwhms_good_data = cpl_vector_get_data(fwhms_good) ;
+ j=0 ;
+ for (iobj=0 ; iobj<nb_objs ; iobj++)
+ {
+ fx = fwhms_x[iobj] ;
+ fy = fwhms_y[iobj] ;
+ fr = 2.0 * fabs(fx-fy) / (fx+fy) ;
+ if ((fx > f_min) && (fx < f_max) && (fy > f_min) && (fy < f_max) &&
+ (fr < seeing_fwhm_var))
+ {
+ fwhms_good_data[j] = (fx + fy)/2.0 ;
+ j++ ;
+ }
+ }
+ cpl_free(fwhms_x) ;
+ cpl_free(fwhms_y) ;
+
+ /* Compute the fwhm */
+ if (nb_good < 3)
+ {
+ /* Too few values to compute the median */
+ hawki_step_detect_obj_output.iq[chip] = fwhms_good_data[0] ;
+ }
+ else
+ {
+ /* Compute the median */
+ hawki_step_detect_obj_output.iq[chip] =
+ cpl_vector_get_median_const(fwhms_good) ;
+ }
+ cpl_vector_delete(fwhms_good);
+ hawki_step_detect_obj_output.iq[chip] *=
+ hawki_step_detect_obj_output.pixscale;
+ }
+ cpl_msg_indent_less();
+
+ return 0;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the jitter recipe products on disk
+ @param combined the combined imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_detect_obj_save
+(cpl_image ** mask_images,
+ cpl_table ** obj_charac,
+ cpl_propertylist ** obj_stats,
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ const cpl_frame * ref_frame ;
+ cpl_propertylist ** qclists;
+ int ext_nb ;
+ const char * recipe_name = "hawki_step_detect_obj" ;
+ int i;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+
+ /* Load the WCS keys */
+ ref_frame = irplib_frameset_get_first_from_group
+ (framelist, CPL_FRAME_GROUP_RAW);
+
+ /* Create the QC lists */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++)
+ {
+ cpl_propertylist * inputlist;
+ cpl_propertylist * offsetlist;
+ cpl_propertylist * wcslist;
+
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector(cpl_frame_get_filename(ref_frame), i+1);
+ qclists[i] = cpl_propertylist_new() ;
+
+ /* Fill the QC */
+ cpl_propertylist_append_int
+ (qclists[i], "ESO QC NBOBJS",
+ hawki_step_detect_obj_output.nbobjs[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC IQ", hawki_step_detect_obj_output.iq[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC FWHM PIX",
+ hawki_step_detect_obj_output.fwhm_pix[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC FWHM ARCSEC",
+ hawki_step_detect_obj_output.fwhm_arcsec[i]);
+ cpl_propertylist_append_double
+ (qclists[i], "ESO QC FWHM MODE",
+ hawki_step_detect_obj_output.fwhm_mode[i]);
+
+ /* Propagate some keywords from input raw frame extensions */
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+ offsetlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_COMB_OFFSETS, 0);
+ wcslist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(ref_frame), ext_nb,
+ HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_append(qclists[i], inputlist);
+ cpl_propertylist_append(qclists[i], offsetlist);
+ cpl_propertylist_append(qclists[i], wcslist);
+ cpl_propertylist_delete(inputlist);
+ cpl_propertylist_delete(offsetlist);
+ cpl_propertylist_delete(wcslist);
+
+ /* Add the object statistics keywords */
+ cpl_propertylist_append(qclists[i], obj_stats[i]);
+ }
+
+
+ /* Write the object mask */
+ hawki_images_save(framelist,
+ parlist,
+ framelist,
+ (const cpl_image**)mask_images,
+ recipe_name,
+ HAWKI_CALPRO_OBJ_MASK,
+ HAWKI_PROTYPE_OBJ_MASK,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ "hawki_step_detect_obj_mask.fits") ;
+
+ /* Write the FITS table with the objects statistics */
+ hawki_tables_save(framelist,
+ parlist,
+ framelist,
+ (const cpl_table **)obj_charac,
+ recipe_name,
+ HAWKI_CALPRO_OBJ_PARAM,
+ HAWKI_PROTYPE_OBJ_PARAM,
+ NULL,
+ (const cpl_propertylist**)qclists,
+ "hawki_step_detect_obj_stars.fits") ;
+
+
+ /* Free and return */
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ cpl_propertylist_delete(qclists[i]) ;
+ }
+ cpl_free(qclists) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
+
+static void hawki_step_detect_obj_init_output(void)
+{
+ int idet;
+
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ hawki_step_detect_obj_output.iq[idet] = -1.0 ;
+ hawki_step_detect_obj_output.nbobjs[idet] = -1 ;
+ hawki_step_detect_obj_output.fwhm_pix[idet] = -1.0 ;
+ hawki_step_detect_obj_output.fwhm_arcsec[idet] = -1.0 ;
+ hawki_step_detect_obj_output.fwhm_mode[idet] = -1.0 ;
+ hawki_step_detect_obj_output.pos_x[idet] = -1.0 ;
+ hawki_step_detect_obj_output.pos_y[idet] = -1.0 ;
+ }
+ hawki_step_detect_obj_output.pixscale = -1.0;
+}
+
+static void hawki_step_detect_obj_get_pscale
+(cpl_frameset * combframes)
+{
+ cpl_propertylist * plist;
+ cpl_frame * firstframe;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Get the header infos */
+ firstframe = cpl_frameset_get_frame(combframes, 0) ;
+ plist=cpl_propertylist_load(cpl_frame_get_filename(firstframe), 0) ;
+ hawki_step_detect_obj_output.pixscale = hawki_pfits_get_pixscale(plist);
+ cpl_propertylist_delete(plist) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_error(__func__, "Missing PIXSCALE keyword in FITS header") ;
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return;
+ }
+}
+
diff --git a/recipes/hawki_step_photom_2mass.c b/recipes/hawki_step_photom_2mass.c
new file mode 100644
index 0000000..ef54261
--- /dev/null
+++ b/recipes/hawki_step_photom_2mass.c
@@ -0,0 +1,973 @@
+/* $Id: hawki_step_photom_2mass.c,v 1.17 2012/04/23 10:08:45 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2012/04/23 10:08:45 $
+ * $Revision: 1.17 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <string.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_alloc.h"
+#include "hawki_utils.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "irplib_cat.h"
+#include "irplib_stdstar.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_photom_2mass_create(cpl_plugin *) ;
+static int hawki_step_photom_2mass_exec(cpl_plugin *) ;
+static int hawki_step_photom_2mass_destroy(cpl_plugin *) ;
+static int hawki_step_photom_2mass(cpl_parameterlist * parlist,
+ cpl_frameset * frameset);
+
+
+cpl_table ** hawki_step_photom_2mass_get_zpoints
+(cpl_frameset * cat_2mass,
+ cpl_frameset * obj_param,
+ cpl_frameset * obj_ima);
+
+static cpl_table * hawki_step_photom_2mass_retrieve_stars
+(cpl_frameset * cat_2mass,
+ cpl_propertylist * wcs_keywords);
+
+static cpl_array * hawki_step_photom_2mass_ppm
+(cpl_table * stars_2mass,
+ cpl_table * obj_det);
+
+static cpl_table * hawki_step_photom_2mass_fill_zpoint_table
+(cpl_table * stars_2mass,
+ cpl_table * obj_det_param,
+ cpl_array * matches,
+ cpl_propertylist * plist,
+ int idet);
+
+static cpl_propertylist ** hawki_step_photom_2mass_qc
+(cpl_table ** zpoint_table);
+
+static int hawki_step_photom_2mass_save
+(cpl_table ** zpoints,
+ cpl_parameterlist * parlist,
+ cpl_propertylist ** qclists,
+ cpl_frameset * set);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_photom_2mass_description[] =
+"hawki_step_photom_2mass -- HAWK-I photometric autocalibration using 2MASS.\n"
+"The input files must be tagged:\n"
+"obj_param.fits "HAWKI_CALPRO_OBJ_PARAM"\n"
+"image.fits "HAWKI_CALPRO_COMBINED"\n"
+"2mass_master_index.fits "HAWKI_UTIL_CAT_2MASS"\n"
+"The recipe creates as an output:\n"
+"hawki_cal_photom_2mass.fits ("HAWKI_CALPRO_ZPOINT_TAB"): \n"
+"The recipe does the following steps:\n"
+"-Search the 2MASS catalogue for stars in the FOV\n"
+"-Matches the input detected object catalogue and the 2MASS stars\n"
+"-Computes photometric characteristics for each matched star\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_photom_2mass",
+ "2MASS photometric calibration",
+ hawki_step_photom_2mass_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_photom_2mass_create,
+ hawki_step_photom_2mass_exec,
+ hawki_step_photom_2mass_destroy);
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_photom_2mass_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_photom_2mass_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_photom_2mass(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_photom_2mass_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_photom_2mass(cpl_parameterlist * parlist,
+ cpl_frameset * frameset)
+{
+ cpl_frameset * cat_2mass;
+ cpl_frameset * obj_param;
+ cpl_frameset * obj_ima;
+ cpl_table ** zpoint_table;
+ cpl_propertylist ** qclists;
+ int idet;
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(frameset)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve 2MASS catalogue */
+ if ((cat_2mass = hawki_extract_frameset(frameset,
+ HAWKI_UTIL_CAT_2MASS)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find 2MASS catalogue (%s)",
+ HAWKI_UTIL_CAT_2MASS);
+ return -1 ;
+ }
+
+ /* Retrieve obj param */
+ if ((obj_param = hawki_extract_frameset
+ (frameset, HAWKI_CALPRO_OBJ_PARAM)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find object parameters (%s)",
+ HAWKI_CALPRO_OBJ_PARAM);
+ return -1 ;
+ }
+
+ /* Retrieve reference image */
+ if ((obj_ima = hawki_extract_frameset
+ (frameset, HAWKI_CALPRO_COMBINED)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find combined image (%s) ",
+ HAWKI_CALPRO_COMBINED);
+ return -1 ;
+ }
+
+ /* Compute the zpoints */
+ zpoint_table = hawki_step_photom_2mass_get_zpoints
+ (cat_2mass, obj_param, obj_ima);
+ if(zpoint_table == NULL)
+ {
+ cpl_msg_error(__func__,"Could not get the zpoints");
+ cpl_frameset_delete(cat_2mass);
+ cpl_frameset_delete(obj_param);
+ cpl_frameset_delete(obj_ima);
+ return -1;
+ }
+
+ /* Get some QC */
+ qclists = hawki_step_photom_2mass_qc(zpoint_table);
+ if(zpoint_table == NULL)
+ {
+ cpl_msg_error(__func__,"Could not compute quality controls");
+ cpl_frameset_delete(cat_2mass);
+ cpl_frameset_delete(obj_param);
+ cpl_frameset_delete(obj_ima);
+ hawki_table_delete(zpoint_table);
+ return -1;
+ }
+
+ /* Save the products */
+ cpl_msg_info(__func__,"Saving products");
+ if(hawki_step_photom_2mass_save(zpoint_table, parlist, qclists, frameset) == -1)
+ {
+ cpl_msg_error(__func__,"Could not save products");
+ cpl_frameset_delete(cat_2mass);
+ cpl_frameset_delete(obj_param);
+ cpl_frameset_delete(obj_ima);
+ hawki_table_delete(zpoint_table);
+ return -1;
+ }
+
+ /* Free and return */
+ cpl_frameset_delete(cat_2mass);
+ cpl_frameset_delete(obj_param);
+ cpl_frameset_delete(obj_ima);
+ hawki_table_delete(zpoint_table);
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ cpl_propertylist_delete(qclists[idet]);
+ cpl_free(qclists);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+cpl_table ** hawki_step_photom_2mass_get_zpoints
+(cpl_frameset * cat_2mass,
+ cpl_frameset * obj_param,
+ cpl_frameset * obj_ima)
+{
+ cpl_table ** zpoint_table;
+ cpl_table ** obj_det_param;
+ cpl_propertylist * plist;
+ int idet;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Allocate zpoint_table */
+ zpoint_table = cpl_malloc(sizeof(cpl_table *) * HAWKI_NB_DETECTORS);
+
+ /* Load detected obj */
+ obj_det_param = hawki_load_tables(cpl_frameset_get_first(obj_param));
+
+ /* Read the main header */
+ plist = cpl_propertylist_load
+ (cpl_frame_get_filename(cpl_frameset_get_first(obj_ima)), 0);
+ /* Loop on detectors */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_propertylist * wcs_info;
+ cpl_table * stars_2mass;
+ cpl_array * matches;
+ int ext_nb;
+
+ cpl_msg_info(__func__,"Working on chip %d", idet + 1);
+ cpl_msg_indent_more();
+
+ /* Retrieve stars */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(cpl_frameset_get_first(obj_ima)),idet+1);
+ wcs_info = cpl_propertylist_load
+ (cpl_frame_get_filename(cpl_frameset_get_first(obj_ima)), ext_nb);
+ stars_2mass =
+ hawki_step_photom_2mass_retrieve_stars(cat_2mass, wcs_info);
+ if(stars_2mass == NULL)
+ {
+ int jdet;
+ cpl_msg_error(__func__, "Cannot retrieve stars");
+ cpl_propertylist_delete(plist);
+ cpl_propertylist_delete(wcs_info);
+ hawki_table_delete(obj_det_param);
+ for(jdet = 0; jdet <idet; ++jdet)
+ cpl_table_delete(zpoint_table[jdet]);
+ cpl_free(zpoint_table);
+ return NULL;
+ }
+
+ /* Pattern matching btw stars in 2MASS and detected ones */
+ cpl_msg_info(__func__,"Matching %"CPL_SIZE_FORMAT
+ " 2MASS stars and %"CPL_SIZE_FORMAT" detections",
+ cpl_table_get_nrow(stars_2mass),
+ cpl_table_get_nrow(obj_det_param[idet]));
+ matches = hawki_step_photom_2mass_ppm(stars_2mass, obj_det_param[idet]);
+
+ /* Fill the zpoint table */
+ cpl_msg_info(__func__,"Computing zero points");
+ zpoint_table[idet] = hawki_step_photom_2mass_fill_zpoint_table
+ (stars_2mass, obj_det_param[idet], matches, plist, idet);
+ if(zpoint_table[idet] == NULL)
+ {
+ int jdet;
+ cpl_msg_error(__func__, "Could not compute the zero points");
+ cpl_propertylist_delete(plist);
+ cpl_propertylist_delete(wcs_info);
+ hawki_table_delete(obj_det_param);
+ cpl_table_delete(stars_2mass);
+ for(jdet = 0; jdet <idet; ++jdet)
+ cpl_table_delete(zpoint_table[jdet]);
+ cpl_free(zpoint_table);
+ cpl_array_delete(matches);
+ return NULL;
+ }
+
+ /* Cleaning resources */
+ cpl_msg_indent_less();
+ cpl_propertylist_delete(wcs_info);
+ cpl_table_delete(stars_2mass);
+ cpl_array_delete(matches);
+ }
+
+ /* Free and return */
+ hawki_table_delete(obj_det_param);
+ cpl_propertylist_delete(plist);
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ int jdet;
+ for(jdet = 0; jdet <HAWKI_NB_DETECTORS; ++jdet)
+ cpl_table_delete(zpoint_table[jdet]);
+ cpl_free(zpoint_table);
+ cpl_msg_error(__func__, "A problem happened computing the zero point");
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return NULL;
+ }
+ return zpoint_table;
+}
+
+static cpl_table * hawki_step_photom_2mass_retrieve_stars
+(cpl_frameset * cat_2mass,
+ cpl_propertylist * wcs_keywords)
+{
+ char * catpath;
+ char * catname;
+ cpl_table * stars;
+ cpl_wcs * wcs;
+ int nstars;
+ int istar;
+ double ra1;
+ double ra2;
+ double dec1;
+ double dec2;
+ double extra_search = 0.;
+ cpl_matrix * from_coord;
+ cpl_matrix * to_coord;
+ cpl_array * status;
+
+
+ /* Extract the catalog path */
+ if (irplib_2mass_get_catpars(cpl_frameset_get_first(cat_2mass),
+ &catpath, &catname) != CPL_ERROR_NONE)
+ return NULL;
+
+ /* Get the WCS info */
+ wcs = cpl_wcs_new_from_propertylist(wcs_keywords);
+ if(cpl_error_get_code() == CPL_ERROR_NO_WCS)
+ {
+ cpl_msg_error(__func__,"Not compiled with WCS support.");
+ return NULL;
+ }
+
+ /* Get the limits to search */
+ if(irplib_cat_get_image_limits(wcs, extra_search,
+ &ra1, &ra2, &dec1, &dec2) ==
+ CPL_ERROR_DATA_NOT_FOUND)
+ {
+ cpl_msg_error(__func__,"No WCS information found");
+ cpl_free(catname);
+ cpl_free(catpath);
+ cpl_wcs_delete(wcs);
+ return NULL;
+ }
+ cpl_msg_info(__func__,"Searching stars in RA=[%f,%f] DEC=[%f,%f]",
+ ra1/15., ra2/15., dec1, dec2);
+
+
+ /* Search the stars */
+ stars = irplib_2mass_extract(catpath, ra1, ra2, dec1, dec2);
+ if(stars == NULL)
+ {
+ cpl_msg_error(__func__,"Error retrieving 2mass stars: %s ",
+ cpl_error_get_message());
+ cpl_free(catname);
+ cpl_free(catpath);
+ cpl_wcs_delete(wcs);
+ return NULL;
+ }
+ nstars = cpl_table_get_nrow(stars);
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__, "%d 2MASS stars found", nstars);
+
+ /* Convert Ra, Dec to X,Y using the WCS information from image */
+ from_coord = cpl_matrix_new(nstars, 2);
+ for (istar=0; istar<nstars; istar++)
+ {
+ cpl_matrix_set(from_coord, istar, 0, cpl_table_get_float
+ (stars, HAWKI_COL_2MASS_RA, istar, NULL));
+ cpl_matrix_set(from_coord, istar, 1, cpl_table_get_float
+ (stars, HAWKI_COL_2MASS_DEC, istar, NULL));
+ }
+
+ to_coord = NULL;
+ status = NULL;
+ if(cpl_wcs_convert(wcs, from_coord, &to_coord,
+ &status, CPL_WCS_WORLD2PHYS) != CPL_ERROR_NONE)
+ {
+ cpl_array_delete(status);
+ cpl_matrix_delete(from_coord);
+ cpl_matrix_delete(to_coord);
+ cpl_free(catname);
+ cpl_free(catpath);
+ cpl_wcs_delete(wcs);
+ cpl_msg_error(cpl_func,"Error in cpl_wcs conversion. %s",
+ cpl_error_get_message());
+ return NULL;
+ }
+
+ /* Add the predicted x,y coordinate columns to the 2MASS table */
+ cpl_table_new_column(stars, HAWKI_COL_2MASS_XPREDICT, CPL_TYPE_FLOAT);
+ cpl_table_set_column_unit(stars,HAWKI_COL_2MASS_XPREDICT, "pixels");
+ cpl_table_new_column(stars, HAWKI_COL_2MASS_YPREDICT, CPL_TYPE_FLOAT);
+ cpl_table_set_column_unit(stars, HAWKI_COL_2MASS_YPREDICT, "pixels");
+ for(istar=0; istar< nstars; istar++)
+ {
+ float xpredict = (float)cpl_matrix_get(to_coord, istar, 0);
+ float ypredict = (float)cpl_matrix_get(to_coord, istar, 1);
+ cpl_table_set_float(stars,"xpredict", istar, xpredict);
+ cpl_table_set_float(stars,"ypredict", istar, ypredict);
+ }
+
+ /* Free and return */
+ cpl_array_delete(status);
+ cpl_matrix_delete(from_coord);
+ cpl_matrix_delete(to_coord);
+ cpl_wcs_delete(wcs);
+ cpl_free(catname);
+ cpl_free(catpath);
+ cpl_msg_indent_less();
+ return stars;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Perform the point pattern matching between the 2MASS stars
+ and the detected objects
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_array * hawki_step_photom_2mass_ppm
+(cpl_table * stars_2mass,
+ cpl_table * obj_det)
+{
+ int istar;
+ int iobj;
+ int iter;
+ int nstars_2mass;
+ int nstars_2mass_used_match;
+ int nobj;
+ int nobj_used_match;
+ int nmatches;
+ int nmax_match_pattern = 30;
+ cpl_matrix * pattern;
+ cpl_array * matches;
+ double tol = 0.1;
+ double pradius = 30.0;
+ double mean_data_pos_err = 5.;
+ int ppm_max_iter = 5;
+ double scale = 1;
+ double angle;
+ cpl_matrix * obj_pos;
+ cpl_propertylist * sort_prop;
+
+
+ /* Sort the detected objects */
+ cpl_msg_indent_more();
+ sort_prop = cpl_propertylist_new();
+ cpl_propertylist_append_bool(sort_prop, HAWKI_COL_OBJ_FLUX, 1);
+ if (cpl_table_sort(obj_det, sort_prop) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot sort detected sources table");
+ cpl_propertylist_delete(sort_prop);
+ return NULL;
+ }
+
+ /* Create matrix of X,Y coordinates of detected objects*/
+ nobj = cpl_table_get_nrow(obj_det);
+ obj_pos = cpl_matrix_new(2, nobj);
+ for (iobj=0; iobj<nobj; iobj++)
+ {
+ float xim = cpl_table_get_double
+ (obj_det, HAWKI_COL_OBJ_POSX, iobj, NULL);
+ float yim = cpl_table_get_double
+ (obj_det, HAWKI_COL_OBJ_POSY, iobj, NULL);
+ cpl_matrix_set(obj_pos, 0, iobj, xim);
+ cpl_matrix_set(obj_pos, 1, iobj, yim);
+ }
+
+ /* Sort the 2MASS stars by magnitude */
+ cpl_propertylist_empty(sort_prop);
+ cpl_propertylist_append_bool(sort_prop, HAWKI_COL_2MASS_K_MAG, 0);
+ if (cpl_table_sort(stars_2mass, sort_prop) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot sort 2MASS stars table");
+ cpl_propertylist_delete(sort_prop);
+ return NULL;
+ }
+
+ /* Prepare the 2MASS matrix for the pattern matching */
+ nstars_2mass = cpl_table_get_nrow(stars_2mass);
+ pattern = cpl_matrix_new(2, nstars_2mass);
+ for(istar=0; istar<nstars_2mass ; istar++)
+ {
+ float x = cpl_table_get_float
+ (stars_2mass, HAWKI_COL_2MASS_XPREDICT, istar, NULL);
+ float y = cpl_table_get_float
+ (stars_2mass, HAWKI_COL_2MASS_YPREDICT, istar, NULL);
+ cpl_matrix_set(pattern, 0, istar, x);
+ cpl_matrix_set(pattern, 1, istar, y);
+ }
+
+ /* Do the ppm */
+ nstars_2mass_used_match = nmax_match_pattern;
+ if(nstars_2mass < nmax_match_pattern)
+ nstars_2mass_used_match = nstars_2mass;
+ nobj_used_match = (int)(1.7 * nstars_2mass_used_match);
+ if(nobj_used_match > nobj)
+ nobj_used_match = nobj;
+ if(nobj_used_match < nstars_2mass_used_match)
+ nobj_used_match = nstars_2mass_used_match;
+ cpl_msg_info(__func__,"The first step match will use %d stars "
+ "and %d objects", nstars_2mass_used_match,nobj_used_match);
+ for (iter = 0; iter < ppm_max_iter; iter++)
+ {
+ int nmatchsize;
+ nmatches = 0;
+ matches = cpl_ppm_match_points(obj_pos, nobj_used_match,
+ mean_data_pos_err,
+ pattern, nstars_2mass_used_match,
+ 1, tol, pradius,
+ NULL, NULL, &scale, &angle);
+ if(matches != NULL)
+ {
+ nmatchsize = cpl_array_get_size(matches);
+ nmatches = nmatchsize -
+ cpl_array_count_invalid(matches);
+ }
+ else
+ {
+ nmatchsize = 0;
+ nmatches = 0;
+ }
+
+ cpl_msg_info(cpl_func,"Total matches: %d. Valid matches: %d",
+ nmatchsize, nmatches);
+ cpl_msg_info(cpl_func,"Scale=%g angle=%g", scale, angle);
+ if((matches == NULL) || (nmatches < floor(nobj_used_match*0.1)))
+ {
+ nobj_used_match = nobj_used_match + 10;
+ cpl_msg_info(cpl_func,
+ "Increasing number of detections used in PPM to %d",
+ nobj_used_match);
+ continue;
+ }
+ else
+ break;
+ }
+
+ /* Output debug messages */
+ cpl_msg_indent_more();
+ cpl_msg_debug(__func__,"Matched stars:");
+ cpl_msg_indent_more();
+ cpl_msg_debug(__func__,"X_OBJ Y_OBJ X_STAR Y_STAR X_DIFF Y_DIFF:");
+ for(istar=0; istar < nstars_2mass; ++istar)
+ {
+ int null;
+ double x_obj, y_obj, x_star, y_star, x_diff, y_diff;
+ iobj = cpl_array_get_int(matches, istar, &null);
+
+ if(null != 0)
+ continue;
+ x_obj = cpl_matrix_get(obj_pos, 0, iobj);
+ y_obj = cpl_matrix_get(obj_pos, 1, iobj);
+ x_star = cpl_matrix_get(pattern, 0, istar);
+ y_star = cpl_matrix_get(pattern, 1, istar);
+ x_diff = x_obj - x_star;
+ y_diff = y_obj - y_star;
+ cpl_msg_debug(__func__,"%6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n",
+ x_obj, y_obj, x_star, y_star, x_diff, y_diff);
+ }
+ cpl_msg_indent_less();
+ cpl_msg_indent_less();
+
+ cpl_matrix_delete(pattern);
+ cpl_msg_info(cpl_func, "%d points matched", nmatches);
+
+ if(matches == NULL || nmatches == 0)
+ {
+ if(nmatches == 0)
+ cpl_array_delete(matches);
+ cpl_msg_error(cpl_func,"Error in PPM. %s",cpl_error_get_message());
+ cpl_matrix_delete(obj_pos);
+ cpl_propertylist_delete(sort_prop);
+ cpl_msg_indent_less();
+ return NULL;
+ }
+
+ if(nmatches < floor(nobj_used_match*0.1))
+ {
+ cpl_msg_warning(cpl_func,"PPM detected matched only %d objects."
+ " Results could be unreliable",nmatches);
+ }
+
+ /* Free and return */
+ cpl_matrix_delete(obj_pos);
+ cpl_propertylist_delete(sort_prop);
+ cpl_msg_indent_less();
+ return matches;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Create and fill the table with the zero points
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_table * hawki_step_photom_2mass_fill_zpoint_table
+(cpl_table * stars_2mass,
+ cpl_table * obj_det_param,
+ cpl_array * matches,
+ cpl_propertylist * plist,
+ int idet)
+{
+ cpl_table * zpoints;
+ int nmatches;
+ int nstars;
+ int imatch;
+ int istar;
+ const char * filter;
+ char magcol_2mass[100];
+ char magerrcol_2mass[100];
+ double dit;
+ double airmass;
+ double pixscale;
+ double extinction;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Read parameters from the propertylist */
+ airmass = (hawki_pfits_get_airmass_start(plist) +
+ hawki_pfits_get_airmass_end(plist)) / 2.;
+ filter = hawki_pfits_get_filter(plist);
+ dit = hawki_pfits_get_dit(plist);
+ pixscale = hawki_pfits_get_pixscale(plist);
+ switch (hawki_get_band(filter))
+ {
+ case HAWKI_BAND_J:
+ extinction = 0.098;
+ strcpy(magcol_2mass, HAWKI_COL_2MASS_J_MAG);
+ strcpy(magerrcol_2mass, HAWKI_COL_2MASS_J_MAGSIG);
+ break ;
+ case HAWKI_BAND_H:
+ extinction = 0.039;
+ strcpy(magcol_2mass, HAWKI_COL_2MASS_H_MAG);
+ strcpy(magerrcol_2mass, HAWKI_COL_2MASS_H_MAGSIG);
+ break ;
+ case HAWKI_BAND_K:
+ extinction = 0.065;
+ strcpy(magcol_2mass, HAWKI_COL_2MASS_K_MAG);
+ strcpy(magerrcol_2mass, HAWKI_COL_2MASS_K_MAGSIG);
+ break ;
+ default:
+ extinction = 0.00;
+ cpl_msg_warning(__func__,"The filter %s does not exist in 2MASS. "
+ "The 2MASS K band will be used instead. "
+ "Columns %s, %s, %s and %s in product will not "
+ "be accurate", filter,
+ HAWKI_COL_ZPOINT_MAG, HAWKI_COL_ZPOINT_ERRMAG,
+ HAWKI_COL_ZPOINT_ZPOINT, HAWKI_COL_ZPOINT_ATX0);
+ strcpy(magcol_2mass, HAWKI_COL_2MASS_K_MAG);
+ strcpy(magerrcol_2mass, HAWKI_COL_2MASS_K_MAGSIG);
+ break ;
+ }
+
+ /* Select only stars in 2MASS that have the given magnitude */
+ //irplib_stdstar_select_stars_mag(stars_2mass, magcol_2mass);
+ //cpl_msg_warning(__func__,"Paso irplib");
+
+ /* Create the table */
+ nstars = cpl_table_get_nrow(stars_2mass);
+ nmatches = cpl_array_get_size(matches) - cpl_array_count_invalid(matches);
+ zpoints = cpl_table_new(nmatches) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_CHIP, CPL_TYPE_INT) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_POSX, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_POSY, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_ZPOINT, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_ATX0, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_MAG, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_ERRMAG, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_AIRMASS, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FLUX, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FILTER, CPL_TYPE_STRING) ;
+// cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_PEAK, CPL_TYPE_DOUBLE) ;
+// cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_BGD, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMX, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMY, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHM, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMX_AS, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHMY_AS, CPL_TYPE_DOUBLE) ;
+ cpl_table_new_column(zpoints, HAWKI_COL_ZPOINT_FWHM_AS, CPL_TYPE_DOUBLE) ;
+ imatch = 0;
+
+ for (istar=0; istar<nstars; istar++)
+ {
+ int iobj;
+ int null;
+ double zpoint;
+ double atx0;
+ double flux;
+ double mag;
+ double errmag;
+ double fwhm_x;
+ double fwhm_y;
+ double fwhm;
+
+ iobj = cpl_array_get_int(matches, istar, &null);
+
+ if(null != 0)
+ continue;
+ if(!cpl_table_is_selected(stars_2mass, istar))
+ continue;
+
+ flux = cpl_table_get_double
+ (obj_det_param, HAWKI_COL_OBJ_FLUX, iobj, NULL);
+ mag = cpl_table_get_float
+ (stars_2mass, magcol_2mass, istar, NULL);
+ errmag = cpl_table_get_float
+ (stars_2mass, magerrcol_2mass, istar, NULL);
+ zpoint = mag + 2.5 * log10(flux) - 2.5 * log10(dit);
+ atx0 = zpoint + airmass * extinction;
+ fwhm_x = cpl_table_get_double
+ (obj_det_param, HAWKI_COL_OBJ_FWHM_MAJAX, iobj, NULL);
+ fwhm_y = cpl_table_get_double
+ (obj_det_param, HAWKI_COL_OBJ_FWHM_MINAX, iobj, NULL);
+ fwhm = sqrt(fwhm_x*fwhm_y);
+
+ cpl_table_set_int(zpoints, HAWKI_COL_ZPOINT_CHIP, imatch, idet + 1) ;
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_MAG, imatch, mag);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_ERRMAG, imatch, errmag);
+ cpl_table_set_string
+ (zpoints, HAWKI_COL_ZPOINT_FILTER, imatch, filter);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_AIRMASS, imatch, airmass);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_POSX, imatch, cpl_table_get_double
+ (obj_det_param, HAWKI_COL_OBJ_POSX, iobj, NULL));
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_POSY, imatch, cpl_table_get_double
+ (obj_det_param, HAWKI_COL_OBJ_POSY, iobj, NULL));
+ cpl_table_set_double(zpoints, HAWKI_COL_ZPOINT_ZPOINT, imatch, zpoint);
+ cpl_table_set_double(zpoints, HAWKI_COL_ZPOINT_ATX0, imatch, atx0);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FLUX, imatch, flux);
+// cpl_table_set_double(tab, HAWKI_COL_ZPOINT_PEAK, imatch,
+// hawki_img_zpoint_outputs.peak[labels[iframe]-1]) ;
+// cpl_table_set_double(tab, HAWKI_COL_ZPOINT_BGD, imatch,
+// hawki_img_zpoint_outputs.bgd[labels[iframe]-1]) ;
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FWHMX, imatch, fwhm_x);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FWHMY, imatch, fwhm_y);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FWHM, imatch, fwhm);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FWHMX_AS, imatch, fwhm_x * pixscale);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FWHMY_AS, imatch, fwhm_y * pixscale);
+ cpl_table_set_double
+ (zpoints, HAWKI_COL_ZPOINT_FWHM_AS, imatch, fwhm * pixscale);
+ ++imatch;
+ }
+
+ /* Check error and return */
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_error(__func__,"An error happened filling the zpoint table: %s",
+ cpl_error_get_message());
+ cpl_table_delete(zpoints);
+ return NULL;
+ }
+ return zpoints;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Compute some basic quality control
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_propertylist ** hawki_step_photom_2mass_qc
+(cpl_table ** zpoint_table)
+{
+ int idet;
+ cpl_propertylist ** qclists;
+
+ /* Allocate the qclists */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+
+ /* Loop on the detectors to get the mean zpoint */
+ for(idet = 0 ; idet < HAWKI_NB_DETECTORS ; ++idet)
+ {
+ double mean_zpoint;
+
+ /* Allocate this qclist */
+ qclists[idet] = cpl_propertylist_new() ;
+
+ /* Compute the mean zpoint */
+ mean_zpoint = cpl_table_get_column_mean(zpoint_table[idet],
+ HAWKI_COL_ZPOINT_ZPOINT);
+
+ cpl_propertylist_append_double
+ (qclists[idet], "ESO QC ZPOINT", mean_zpoint);
+ }
+
+ return qclists;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the recipe product on disk
+ @param tab the table to save
+ @param images the images where the photometry is computed
+ @param parlist the parameter list
+ @param qclists the QC lists for each detector
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_photom_2mass_save
+(cpl_table ** zpoints,
+ cpl_parameterlist * parlist,
+ cpl_propertylist ** qclists,
+ cpl_frameset * set)
+{
+ cpl_propertylist * protype;
+ cpl_frame * ref_frame ;
+ cpl_frameset * combinedframes;
+ int nframes ;
+ const char * recipe_name = "hawki_step_photom_2mass" ;
+
+ /* Initialise */
+ nframes = cpl_frameset_get_size(set) ;
+
+ /* Get the reference frame */
+ combinedframes = hawki_extract_frameset(set, HAWKI_CALPRO_COMBINED);
+ ref_frame = cpl_frameset_get_first(combinedframes);
+
+ /* Create the protype lists */
+ protype = cpl_propertylist_new();
+ cpl_propertylist_append_string(protype, "ESO PRO TYPE",
+ HAWKI_PROTYPE_ZPOINT_TAB);
+
+ /* Write the zpoint table */
+ hawki_tables_save(set,
+ parlist,
+ set,
+ (const cpl_table **)zpoints,
+ recipe_name,
+ HAWKI_CALPRO_ZPOINT_TAB,
+ HAWKI_PROTYPE_ZPOINT_TAB,
+ protype,
+ (const cpl_propertylist **)qclists,
+ "hawki_step_photom_2mass.fits") ;
+
+ /* Free and return */
+ cpl_propertylist_delete(protype);
+ cpl_frameset_delete(combinedframes);
+ return 0;
+}
diff --git a/recipes/hawki_step_refine_offsets.c b/recipes/hawki_step_refine_offsets.c
new file mode 100644
index 0000000..3d90b13
--- /dev/null
+++ b/recipes/hawki_step_refine_offsets.c
@@ -0,0 +1,813 @@
+/* $Id: hawki_step_refine_offsets.c,v 1.17 2011/10/24 10:42:12 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/10/24 10:42:12 $
+ * $Revision: 1.17 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+#include <string.h>
+
+#include "irplib_utils.h"
+#include "irplib_calib.h"
+
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_saa.h"
+#include "hawki_bkg.h"
+#include "hawki_distortion.h"
+#include "hawki_properties_tel.h"
+#include "hawki_image_stats.h"
+
+/*-----------------------------------------------------------------------------
+ Define
+ -----------------------------------------------------------------------------*/
+
+#define NEGLIG_OFF_DIFF 0.1
+#define SQR(x) ((x)*(x))
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_refine_offsets_create(cpl_plugin *) ;
+static int hawki_step_refine_offsets_exec(cpl_plugin *) ;
+static int hawki_step_refine_offsets_destroy(cpl_plugin *) ;
+static int hawki_step_refine_offsets(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_step_refine_offsets_retrieve_input_param
+(cpl_parameterlist * parlist);
+static int hawki_step_refine_offsets_fine
+(const cpl_frameset * science_objects_frames,
+ const cpl_frameset * reference_objects_frames,
+ cpl_bivector ** refined_offsets,
+ cpl_vector ** correl);
+
+static int hawki_step_refine_offsets_save
+(cpl_bivector ** refined_offsets,
+ cpl_vector ** correlations,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_frameset);
+
+static cpl_bivector ** hawki_step_refine_offsets_read_select_objects
+(const cpl_frameset * reference_obj_frames,
+ double first_image_off_x,
+ double first_image_off_y,
+ int nx,
+ int ny);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static struct
+{
+ /* Inputs */
+ int nbrightest;
+ int sx ;
+ int sy ;
+ int mx ;
+ int my ;
+} hawki_step_refine_offsets_config;
+
+static char hawki_step_refine_offsets_description[] =
+"hawki_step_refine_offsets -- utility to refine the nominal offsets.\n"
+"This utility will take the offsets in the header as a first approach\n"
+"and tries to refine them correlating the input images at the points\n"
+"given by the detected objects.\n"
+"The input of the recipe files listed in the Set Of Frames (sof-file)\n"
+"must be tagged as:\n"
+"images.fits "HAWKI_CALPRO_DIST_CORRECTED" or\n"
+"images.fits "HAWKI_CALPRO_BKG_SUBTRACTED" and\n"
+"det_obj_stats.fits "HAWKI_CALPRO_OBJ_PARAM"\n"
+"The recipe creates as an output:\n"
+"hawki_step_refine_offsets.fits ("HAWKI_CALPRO_OFFSETS"): Table with refined offsets\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_refine_offsets",
+ "Jitter recipe",
+ hawki_step_refine_offsets_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_refine_offsets_create,
+ hawki_step_refine_offsets_exec,
+ hawki_step_refine_offsets_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_refine_offsets_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --xcorr */
+ p = cpl_parameter_new_value("hawki.hawki_step_refine_offsets.xcorr",
+ CPL_TYPE_STRING,
+ "Cross correlation search and measure sizes",
+ "hawki.hawki_step_refine_offsets",
+ "20,20,25,25") ;
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xcorr") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* --nbrightest */
+ p = cpl_parameter_new_value("hawki.hawki_step_refine_offsets.nbrightest",
+ CPL_TYPE_INT,
+ "Number of brightest objects to use",
+ "hawki.hawki_step_refine_offsets",
+ 3);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nbrightest") ;
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV) ;
+ cpl_parameterlist_append(recipe->parameters, p) ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_refine_offsets_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_refine_offsets(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_refine_offsets_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_refine_offsets(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * science_obj_frames ;
+ cpl_frameset * reference_obj_frames ;
+ cpl_bivector ** refined_offsets;
+ cpl_vector ** correl;
+ int idet;
+
+ /* Retrieve input parameters */
+ if(hawki_step_refine_offsets_retrieve_input_param(parlist))
+ {
+ cpl_msg_error(__func__, "Wrong parameters");
+ return -1;
+ }
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Get the object images frames */
+ cpl_msg_info(__func__, "Identifying input frames");
+ science_obj_frames =
+ hawki_extract_frameset(framelist, HAWKI_CALPRO_DIST_CORRECTED);
+ if (science_obj_frames == NULL)
+ {
+ science_obj_frames =
+ hawki_extract_frameset(framelist, HAWKI_CALPRO_BKG_SUBTRACTED);
+ if (science_obj_frames == NULL)
+ {
+ cpl_msg_error(__func__, "No science object frames provided (%s)",
+ HAWKI_CALPRO_DIST_CORRECTED);
+ return -1 ;
+ }
+ }
+
+ /* Get the detected "objects" frame */
+ reference_obj_frames =
+ hawki_extract_frameset(framelist, HAWKI_CALPRO_OBJ_PARAM);
+ if(cpl_frameset_get_size(reference_obj_frames) != 1)
+ {
+ cpl_msg_error(__func__, "One object parameters frame must be provided (%s)",
+ HAWKI_CALPRO_OBJ_PARAM);
+ cpl_frameset_delete(science_obj_frames) ;
+ if(reference_obj_frames != NULL)
+ cpl_frameset_delete(reference_obj_frames);
+ return -1 ;
+ }
+
+ /* Get the offsets refinement */
+ refined_offsets = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_bivector *));
+ correl = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_vector *));
+ for(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ refined_offsets[idet] = cpl_bivector_new
+ (cpl_frameset_get_size(science_obj_frames));
+ correl[idet] = cpl_vector_new
+ (cpl_frameset_get_size(science_obj_frames));
+ }
+ if (hawki_step_refine_offsets_fine
+ (science_obj_frames, reference_obj_frames,
+ refined_offsets, correl) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot refine the objects") ;
+ cpl_frameset_delete(reference_obj_frames) ;
+ cpl_frameset_delete(science_obj_frames) ;
+ for(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(refined_offsets[idet]);
+ cpl_vector_delete(correl[idet]);
+ }
+ cpl_free(refined_offsets);
+ cpl_free(correl);
+ return -1 ;
+ }
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Save the products") ;
+ if (hawki_step_refine_offsets_save
+ (refined_offsets, correl, parlist, framelist) == -1)
+ {
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space");
+ cpl_frameset_delete(science_obj_frames);
+ cpl_frameset_delete(reference_obj_frames);
+ for(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(refined_offsets[idet]);
+ cpl_vector_delete(correl[idet]);
+ }
+ cpl_free(refined_offsets);
+ cpl_free(correl);
+ return -1 ;
+ }
+
+ /* Free and return */
+ cpl_frameset_delete(science_obj_frames);
+ cpl_frameset_delete(reference_obj_frames);
+ for(idet = 0 ; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ cpl_bivector_delete(refined_offsets[idet]);
+ cpl_vector_delete(correl[idet]);
+ }
+ cpl_free(refined_offsets);
+ cpl_free(correl);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+int hawki_step_refine_offsets_retrieve_input_param
+(cpl_parameterlist * parlist)
+{
+ cpl_parameter * par ;
+ const char * sval ;
+ par = NULL ;
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_refine_offsets.nbrightest");
+ hawki_step_refine_offsets_config.nbrightest =
+ cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find
+ (parlist, "hawki.hawki_step_refine_offsets.xcorr");
+ sval = cpl_parameter_get_string(par);
+ if (sscanf(sval, "%d,%d,%d,%d",
+ &hawki_step_refine_offsets_config.sx,
+ &hawki_step_refine_offsets_config.sy,
+ &hawki_step_refine_offsets_config.mx,
+ &hawki_step_refine_offsets_config.my)!=4)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The refinement of the offsets is implemented here
+ @return
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_refine_offsets_fine
+(const cpl_frameset * science_obj_frames,
+ const cpl_frameset * reference_obj_frames,
+ cpl_bivector ** refined_offsets,
+ cpl_vector ** correl)
+{
+ cpl_imagelist * in ;
+ cpl_bivector * nominal_offsets ;
+ cpl_bivector ** reference_objects;
+ double * offs_est_x ;
+ double * offs_est_y ;
+ double off_0_x;
+ double off_0_y;
+ double max_x, max_y ;
+ int idet;
+ int ioff;
+ cpl_propertylist * header;
+ int nx;
+ int ny;
+
+ /* Get the nominal offsets from the header */
+ cpl_msg_info(__func__,"Getting the nominal offsets");
+ nominal_offsets = hawki_get_header_tel_offsets(science_obj_frames);
+ if (nominal_offsets == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load the header offsets") ;
+ return -1;
+ }
+ offs_est_x = cpl_bivector_get_x_data(nominal_offsets);
+ offs_est_y = cpl_bivector_get_y_data(nominal_offsets);
+
+ /* Print the header offsets */
+ cpl_msg_indent_more();
+ for (ioff=0 ; ioff<cpl_bivector_get_size(nominal_offsets) ; ioff++)
+ {
+ cpl_msg_info(__func__, "Telescope offsets (Frame %d): %g %g", ioff+1,
+ offs_est_x[ioff], offs_est_y[ioff]) ;
+ }
+ cpl_msg_indent_less();
+
+ /* Get the size of the detectors of the first extension */
+ header = cpl_propertylist_load
+ (cpl_frame_get_filename
+ (cpl_frameset_get_first_const(science_obj_frames)), 1);
+ nx = hawki_pfits_get_naxis1(header);
+ ny = hawki_pfits_get_naxis2(header);
+ cpl_propertylist_delete(header);
+
+ /* Get the first offset to all offsets */
+ off_0_x = offs_est_x[0];
+ off_0_y = offs_est_y[0];
+
+ /* Get the objects (anchor points)*/
+ /* They are already in the "first image" reference system */
+ reference_objects =
+ hawki_step_refine_offsets_read_select_objects(reference_obj_frames,
+ off_0_x,
+ off_0_y,
+ nx,
+ ny);
+ if(reference_objects == NULL)
+ {
+ cpl_msg_error(__func__,"Error reading the reference objects");
+ cpl_bivector_delete(nominal_offsets);
+ return -1;
+ }
+
+ /* Subtract the first offset to all offsets */
+ max_x = max_y = 0.0 ;
+ for (ioff=1 ; ioff<cpl_bivector_get_size(nominal_offsets) ; ioff++)
+ {
+ offs_est_x[ioff] -= off_0_x;
+ offs_est_y[ioff] -= off_0_y;
+ if (fabs(offs_est_x[ioff]) > max_x) max_x = fabs(offs_est_x[ioff]) ;
+ if (fabs(offs_est_y[ioff]) > max_y) max_y = fabs(offs_est_y[ioff]) ;
+ }
+ offs_est_x[0] = offs_est_y[0] = 0.00 ;
+
+ /* Get the opposite offsets. This is to change from
+ * telescope convention to cpl convention */
+ cpl_vector_multiply_scalar(cpl_bivector_get_x(nominal_offsets), -1.0);
+ cpl_vector_multiply_scalar(cpl_bivector_get_y(nominal_offsets), -1.0);
+
+ /* Loop on the detectors */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_msg_info(__func__, "Working on detector number %d", idet+1) ;
+ cpl_msg_indent_more();
+
+ /* Load the input data */
+ cpl_msg_info(__func__, "Loading the input data") ;
+ cpl_msg_indent_more() ;
+ if ((in = hawki_load_detector(science_obj_frames,
+ idet+1, CPL_TYPE_FLOAT)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot load chip %d", idet+1) ;
+ cpl_bivector_delete(nominal_offsets) ;
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_bivector_delete(reference_objects[idet]);
+ }
+ cpl_free(reference_objects);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return -1;
+ }
+
+ /* Get the refinement */
+ cpl_msg_info(__func__, "Getting the refinement");
+ cpl_msg_indent_more() ;
+ if (hawki_geom_refine_images_offsets
+ (in,
+ nominal_offsets,
+ reference_objects[idet],
+ hawki_step_refine_offsets_config.sx,
+ hawki_step_refine_offsets_config.sy,
+ hawki_step_refine_offsets_config.mx,
+ hawki_step_refine_offsets_config.my,
+ refined_offsets[idet],
+ correl[idet]) == -1)
+ {
+ cpl_msg_error(__func__, "Cannot apply the shift and add") ;
+ cpl_imagelist_delete(in) ;
+ cpl_bivector_delete(nominal_offsets) ;
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ cpl_bivector_delete(reference_objects[idet]);
+ cpl_free(reference_objects);
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ return -1;
+ }
+
+ /* Convert to "telescope criteria" */
+ /* Also add the offset of the first image */
+ cpl_vector_multiply_scalar
+ (cpl_bivector_get_x(refined_offsets[idet]), -1.0);
+ cpl_vector_multiply_scalar
+ (cpl_bivector_get_y(refined_offsets[idet]), -1.0);
+ cpl_vector_add_scalar
+ (cpl_bivector_get_x(refined_offsets[idet]), off_0_x);
+ cpl_vector_add_scalar
+ (cpl_bivector_get_y(refined_offsets[idet]), off_0_y);
+
+ /* Print the new offsets */
+ for (ioff=0 ; ioff<cpl_bivector_get_size(refined_offsets[idet]); ioff++)
+ {
+ cpl_msg_info(__func__,"Refined telescope offsets (Frame %d): %g %g",
+ ioff+1,
+ cpl_vector_get(cpl_bivector_get_x
+ (refined_offsets[idet]), ioff),
+ cpl_vector_get(cpl_bivector_get_y
+ (refined_offsets[idet]), ioff));
+ }
+ cpl_imagelist_delete(in) ;
+ cpl_msg_indent_less() ;
+ cpl_msg_indent_less() ;
+ }
+
+ /* Freeing */
+ cpl_bivector_delete(nominal_offsets);
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ cpl_bivector_delete(reference_objects[idet]);
+ cpl_free(reference_objects);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function saves the refined objects as a FITS table
+ @param refined_offsets The compute refined offsets
+ @param recipe_parlist The parameters of the recipe
+ @param recipe_frameset The frameset the recipe was called with
+ @return 0 if sucess, -1 elsewhere.
+ */
+/*----------------------------------------------------------------------------*/
+
+static int hawki_step_refine_offsets_save
+(cpl_bivector ** refined_offsets,
+ cpl_vector ** correlations,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_frameset)
+{
+ cpl_table ** offset_tables;
+ int ioff;
+ int idet;
+ int noff;
+ const char * recipe_name = "hawki_step_refine_offsets";
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+ /* Convert the offsets to a table */
+ offset_tables = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ {
+ offset_tables[idet] = cpl_table_new
+ (cpl_bivector_get_size(refined_offsets[idet]));
+ cpl_table_new_column(offset_tables[idet],
+ HAWKI_COL_OFFSET_X, CPL_TYPE_FLOAT);
+ cpl_table_set_column_unit(offset_tables[idet],HAWKI_COL_OFFSET_X,"pix");
+ cpl_table_new_column(offset_tables[idet],
+ HAWKI_COL_OFFSET_Y, CPL_TYPE_FLOAT);
+ cpl_table_set_column_unit(offset_tables[idet],HAWKI_COL_OFFSET_Y,"pix");
+ cpl_table_new_column(offset_tables[idet],
+ HAWKI_COL_CORRELATION, CPL_TYPE_FLOAT);
+ noff = cpl_bivector_get_size(refined_offsets[idet]);
+ for(ioff = 0; ioff < noff; ++ioff)
+ {
+ double xoffset, yoffset, corr;
+ xoffset = cpl_vector_get
+ (cpl_bivector_get_x(refined_offsets[idet]), ioff);
+ yoffset = cpl_vector_get
+ (cpl_bivector_get_y(refined_offsets[idet]), ioff);
+ corr = cpl_vector_get(correlations[idet], ioff);
+ cpl_table_set
+ (offset_tables[idet], HAWKI_COL_OFFSET_X, ioff, xoffset);
+ cpl_table_set
+ (offset_tables[idet], HAWKI_COL_OFFSET_Y, ioff, yoffset);
+ cpl_table_set
+ (offset_tables[idet], HAWKI_COL_CORRELATION, ioff, corr);
+ }
+ }
+
+ /* Write the table with the statistics */
+ if (hawki_tables_save(recipe_frameset,
+ recipe_parlist,
+ recipe_frameset,
+ (const cpl_table **)offset_tables,
+ recipe_name,
+ HAWKI_CALPRO_OFFSETS,
+ HAWKI_PROTYPE_OFFSETS,
+ NULL,
+ NULL,
+ "hawki_step_refine_offsets.fits") != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__, "Cannot save the first extension table") ;
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_table_delete(offset_tables[idet]);
+ cpl_free(offset_tables);
+ return -1 ;
+ }
+
+ /* Free and return */
+ for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
+ cpl_table_delete(offset_tables[idet]);
+ cpl_free(offset_tables);
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function reads the objects that are going to be used as
+ anchor points
+ @param refined_offsets The compute refined offsets
+ @param recipe_parlist The parameters of the recipe
+ @param recipe_frameset The frameset the recipe was called with
+ @return 0 if sucess, -1 elsewhere.
+
+ The function returns the positions of the objects in the "first image"
+ reference system (using first_image_off_x, first_image_off_y). Note that
+ the objects are originally referred to the combined image offsets. The
+ function performs the necessary offset correction.
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_bivector ** hawki_step_refine_offsets_read_select_objects
+(const cpl_frameset * reference_obj_frames,
+ double first_image_off_x,
+ double first_image_off_y,
+ int nx,
+ int ny)
+{
+ const cpl_frame * reference_obj_frame;
+ cpl_table ** obj_param;
+ cpl_propertylist * sort_column;
+ cpl_bivector ** reference_objects;
+ int idet;
+
+ /* Get the objects */
+ cpl_msg_info(__func__,"Getting the reference object positions");
+ reference_obj_frame = cpl_frameset_get_first_const(reference_obj_frames);
+ obj_param = hawki_load_tables(reference_obj_frame);
+ if(obj_param == NULL)
+ {
+ cpl_msg_error(__func__,"Could not read the reference objects parameters");
+ return NULL;
+ }
+
+ /* Create the sorting criteria: by flux */
+ sort_column = cpl_propertylist_new();
+ cpl_propertylist_append_bool(sort_column, HAWKI_COL_OBJ_FLUX, CPL_TRUE);
+
+ /* Allocate partially the reference objects */
+ reference_objects = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_bivector *));
+
+ /* Loop on detectors */
+ cpl_msg_indent_more();
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_propertylist * objects_plist;
+ cpl_vector * obj_x;
+ cpl_vector * obj_y;
+ int nobj;
+ int nselect;
+ int iobj;
+ int ext_nb;
+ double reference_offset_x;
+ double reference_offset_y;
+
+ /* Get the global offset */
+ /* This allows to know which is the reference point of the detected
+ * objects positions (which are referred in general to the combined image */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(reference_obj_frame), idet + 1);
+ objects_plist = cpl_propertylist_load
+ (cpl_frame_get_filename(reference_obj_frame), ext_nb);
+ reference_offset_x =
+ hawki_pfits_get_comb_cumoffsetx(objects_plist);
+ reference_offset_y =
+ hawki_pfits_get_comb_cumoffsety(objects_plist);
+ if(cpl_error_get_code() != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(__func__,"Could not find keywords "
+ "ESO QC COMBINED CUMOFFSETX,Y in reference objects frame");
+ cpl_propertylist_delete(objects_plist);
+ cpl_propertylist_delete(sort_column);
+ return NULL;
+ }
+ cpl_msg_info(__func__,"Objects offsets wrt telescope: %f %f",
+ reference_offset_x, reference_offset_y);
+ cpl_propertylist_delete(objects_plist);
+
+ /* Sort the table by flux */
+ cpl_table_sort(obj_param[idet], sort_column);
+ nobj = cpl_table_get_nrow(obj_param[idet]);
+
+ /* Allocate objects vector */
+ reference_objects[idet] = cpl_bivector_new(nobj);
+ obj_x = cpl_bivector_get_x(reference_objects[idet]);
+ obj_y = cpl_bivector_get_y(reference_objects[idet]);
+ cpl_msg_info(__func__, "Number of objects in chip %d: %d", idet+1,nobj);
+
+ /* Keep only those objects within the first image */
+ cpl_table_unselect_all(obj_param[idet]);
+ for(iobj = 0 ; iobj < nobj; ++iobj)
+ {
+ double xpos_orig = cpl_table_get
+ (obj_param[idet], HAWKI_COL_OBJ_POSX, iobj, NULL);
+ double ypos_orig = cpl_table_get
+ (obj_param[idet], HAWKI_COL_OBJ_POSY, iobj, NULL);
+ double xpos_rel = xpos_orig - reference_offset_x + first_image_off_x;
+ double ypos_rel = ypos_orig - reference_offset_y + first_image_off_y;
+ if(xpos_rel < 0.0 || xpos_rel >= nx ||
+ ypos_rel < 0.0 || ypos_rel >= ny)
+ {
+ cpl_table_select_row(obj_param[idet], iobj);
+ }
+ }
+ cpl_table_erase_selected(obj_param[idet]);
+ nobj = cpl_table_get_nrow(obj_param[idet]);
+ cpl_msg_info(__func__, "Number of objects within limits of detector "
+ "in chip %d: %d", idet+1,nobj);
+
+ /* Apply the flux criteria */
+ nselect = hawki_step_refine_offsets_config.nbrightest;
+ if(nselect < 0 || nselect > nobj)
+ nselect = nobj;
+ cpl_msg_info(__func__, "Number of selected objects: %d", nselect);
+ for(iobj = 0 ; iobj < nselect; ++iobj)
+ {
+ double xpos_orig = cpl_table_get
+ (obj_param[idet], HAWKI_COL_OBJ_POSX, iobj, NULL);
+ double ypos_orig = cpl_table_get
+ (obj_param[idet], HAWKI_COL_OBJ_POSY, iobj, NULL);
+
+ cpl_vector_set
+ (obj_x, iobj, xpos_orig - reference_offset_x + first_image_off_x);
+ cpl_vector_set
+ (obj_y, iobj, ypos_orig - reference_offset_y + first_image_off_y);
+ cpl_msg_debug(__func__,"Using anchor point at %f,%f",
+ cpl_vector_get(obj_x,iobj),
+ cpl_vector_get(obj_y,iobj));
+
+ }
+ cpl_vector_set_size(obj_x, nselect);
+ cpl_vector_set_size(obj_y, nselect);
+
+ }
+ cpl_msg_indent_less();
+
+ /* Freeing */
+ for (idet=0 ; idet< HAWKI_NB_DETECTORS ; idet++)
+ cpl_table_delete(obj_param[idet]);
+ cpl_free(obj_param);
+ cpl_propertylist_delete(sort_column);
+
+ return reference_objects;
+}
diff --git a/recipes/hawki_step_stats.c b/recipes/hawki_step_stats.c
new file mode 100644
index 0000000..e2a4a16
--- /dev/null
+++ b/recipes/hawki_step_stats.c
@@ -0,0 +1,432 @@
+/* $Id: hawki_step_stats.c,v 1.12 2011/10/24 10:42:03 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/10/24 10:42:03 $
+ * $Revision: 1.12 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "hawki_dfs.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_image_stats.h"
+#include "hawki_utils.h"
+
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_stats_create(cpl_plugin *) ;
+static int hawki_step_stats_exec(cpl_plugin *) ;
+static int hawki_step_stats_destroy(cpl_plugin *) ;
+static int hawki_step_stats(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_step_stats_frameset_stats
+(cpl_table ** target_stats,
+ cpl_propertylist ** stats_stats,
+ cpl_frameset * target_frames);
+
+static int hawki_step_stats_save
+(cpl_table ** target_stats,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_frameset,
+ cpl_frameset * used_frameset,
+ cpl_propertylist ** stats_stats,
+ const char * calpro,
+ const char * protype);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_stats_description[] =
+"hawki_step_stats -- hawki statistics utility (mean, stdev, ...).\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"raw-jitter.fits "HAWKI_IMG_JITTER_RAW" or\n"
+"bkg.fits "HAWKI_CALPRO_BKGIMAGE" or\n"
+"raw-flat.fits "HAWKI_CAL_FLAT_RAW" or\n"
+"raw-dark.fits "HAWKI_CAL_DARK_RAW" or\n"
+"raw-zpoint.fits "HAWKI_CAL_ZPOINT_RAW" \n"
+"The recipe creates as an output:\n"
+"hawki_step_stats.fits ("HAWKI_CALPRO_JITTER_STATS"): Statistics of raw jitter images, or\n"
+"hawki_step_stats.fits ("HAWKI_CALPRO_JITTER_BKG_STATS"): Statistics of background images, or\n"
+"hawki_step_stats.fits ("HAWKI_CALPRO_FLAT_STATS"): Statistics of raw flats, or\n"
+"hawki_step_stats.fits ("HAWKI_CALPRO_DARK_STATS"): Statistics of raw darks, or\n"
+"hawki_step_stats.fits ("HAWKI_CALPRO_ZPOINT_STATS"): Statistics of raw standard star images.\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_stats",
+ "Standard statistics utility",
+ hawki_step_stats_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_stats_create,
+ hawki_step_stats_exec,
+ hawki_step_stats_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stats_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ /* cpl_parameter * p ; */
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* None.. */
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stats_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_stats(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stats_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stats(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * frames ;
+ cpl_table ** target_stats;
+ cpl_propertylist ** stats_stats;
+ int idet;
+ char calpro[1024];
+ char protype[1024];
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist))
+ {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1;
+ }
+
+ /* Retrieve raw frames */
+ cpl_msg_info(__func__, "Identifying input frames");
+ frames = hawki_extract_frameset(framelist, HAWKI_IMG_JITTER_RAW) ;
+ snprintf(calpro, 1024, HAWKI_CALPRO_JITTER_STATS);
+ snprintf(protype, 1024, HAWKI_PROTYPE_JITTER_STATS);
+ if (frames == NULL)
+ {
+ frames = hawki_extract_frameset(framelist, HAWKI_CALPRO_BKGIMAGE);
+ snprintf(calpro, 1024, HAWKI_CALPRO_JITTER_BKG_STATS);
+ snprintf(protype, 1024, HAWKI_PROTYPE_JITTER_BKG_STATS);
+ }
+ if (frames == NULL)
+ {
+ frames = hawki_extract_frameset(framelist, HAWKI_CAL_DARK_RAW);
+ snprintf(calpro, 1024, HAWKI_CALPRO_DARK_STATS);
+ snprintf(protype, 1024, HAWKI_PROTYPE_DARK_STATS);
+ }
+ if (frames == NULL)
+ {
+ frames = hawki_extract_frameset(framelist, HAWKI_CAL_FLAT_RAW);
+ snprintf(calpro, 1024, HAWKI_CALPRO_FLAT_STATS);
+ snprintf(protype, 1024, HAWKI_PROTYPE_FLAT_STATS);
+ }
+ if (frames == NULL)
+ {
+ frames = hawki_extract_frameset(framelist, HAWKI_CAL_ZPOINT_RAW);
+ snprintf(calpro, 1024, HAWKI_CALPRO_ZPOINT_STATS);
+ snprintf(protype, 1024, HAWKI_PROTYPE_ZPOINT_STATS);
+ }
+ if (frames == NULL)
+ {
+ cpl_msg_error(__func__,"Tag of input frames not supported");
+ cpl_msg_error(__func__,"Supported: %s %s %s %s %s",
+ HAWKI_IMG_JITTER_RAW, HAWKI_CALPRO_BKGIMAGE,
+ HAWKI_CAL_DARK_RAW, HAWKI_CAL_FLAT_RAW, HAWKI_CAL_ZPOINT_RAW);
+ return -1;
+ }
+
+ /* Create the statistics table and the "stats of the stats"*/
+ target_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ stats_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist *));
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ target_stats[idet] = cpl_table_new(cpl_frameset_get_size(frames));
+ stats_stats[idet] = cpl_propertylist_new();
+ }
+ hawki_image_stats_initialize(target_stats);
+
+ /* Compute actually the statistics */
+ hawki_step_stats_frameset_stats(target_stats, stats_stats, frames);
+
+ /* Saving the table product */
+ if(hawki_step_stats_save
+ (target_stats, parlist, framelist, frames, stats_stats, calpro, protype) !=0)
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space\n");
+
+ /* Free and return */
+ cpl_frameset_delete(frames);
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_table_delete(target_stats[idet]);
+ cpl_propertylist_delete(stats_stats[idet]);
+ }
+ cpl_free(target_stats);
+ cpl_free(stats_stats);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param obj the objects frames
+ @param obj the sky frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @param skybg the computed sky background values
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stats_frameset_stats
+(cpl_table ** target_stats,
+ cpl_propertylist ** stats_stats,
+ cpl_frameset * target_frames)
+{
+ int iframe;
+ int nframes;
+
+ /* Loop on the number of frames */
+ nframes = cpl_frameset_get_size(target_frames);
+ cpl_msg_info(__func__, "Looping the target frames: %d frames", nframes);
+ cpl_msg_indent_more();
+ for( iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ /* Local storage variables */
+ cpl_frame * this_target_frame;
+
+ /* Computing statistics for this frame */
+ cpl_msg_info(__func__, "Computing stats for frame: %d", iframe +1);
+ this_target_frame = cpl_frameset_get_frame(target_frames, iframe);
+ hawki_image_stats_fill_from_frame
+ (target_stats, this_target_frame, iframe);
+ }
+ cpl_msg_indent_less();
+
+ /* Compute stats of the stats */
+ hawki_image_stats_stats(target_stats, stats_stats);
+
+ /* Print info about the statistics */
+ hawki_image_stats_print(target_stats);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the jitter recipe products on disk
+ @param combined the combined imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param mean_sky_bg the vectors with the sky background values or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stats_save
+(cpl_table ** target_stats,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_frameset,
+ cpl_frameset * used_frameset,
+ cpl_propertylist ** stats_stats,
+ const char * calpro,
+ const char * protype)
+{
+ const cpl_frame * reference_frame;
+ cpl_propertylist * referencelist;
+ cpl_propertylist ** extlists;
+ int idet;
+ int ext_nb;
+ const char * recipe_name = "hawki_step_stats";
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+ /* Get the reference frame (the first one) */
+ reference_frame = cpl_frameset_get_first_const(used_frameset);
+
+ /* Create the prop lists */
+ cpl_msg_info(__func__, "Creating the keywords list") ;
+ referencelist = cpl_propertylist_load_regexp
+ (cpl_frame_get_filename(reference_frame), 0,HAWKI_HEADER_EXT_FORWARD,0);
+ extlists =
+ cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*));
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(reference_frame), idet+1);
+
+ /* Propagate the keywords from input frame extensions */
+ extlists[idet] = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(reference_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+
+ /* Add the stats of the stats */
+ cpl_propertylist_append(extlists[idet],stats_stats[idet]);
+ }
+
+ /* Write the table with the statistics */
+ hawki_tables_save(recipe_frameset,
+ recipe_parlist,
+ used_frameset,
+ (const cpl_table **)target_stats,
+ recipe_name,
+ calpro,
+ protype,
+ (const cpl_propertylist*)referencelist,
+ (const cpl_propertylist**)extlists,
+ "hawki_step_stats.fits");
+
+ /* Free and return */
+ cpl_propertylist_delete(referencelist) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_propertylist_delete(extlists[idet]) ;
+ }
+ cpl_free(extlists) ;
+
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
diff --git a/recipes/hawki_step_stitch.c b/recipes/hawki_step_stitch.c
new file mode 100644
index 0000000..69510dc
--- /dev/null
+++ b/recipes/hawki_step_stitch.c
@@ -0,0 +1,351 @@
+/* $Id: hawki_step_stitch.c,v 1.7 2011/10/24 10:41:54 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/10/24 10:41:54 $
+ * $Revision: 1.7 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_utils.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_load.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_stitch_create(cpl_plugin *) ;
+static int hawki_step_stitch_exec(cpl_plugin *) ;
+static int hawki_step_stitch_destroy(cpl_plugin *) ;
+static int hawki_step_stitch(cpl_parameterlist *, cpl_frameset *) ;
+static int hawki_step_stitch_save
+(cpl_image * in,
+ cpl_frame * combined,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_stitch_description[] =
+"hawki_step_stitch -- Stitching utility\n"
+"This recipe accepts 1 parameter:\n"
+"First parameter: the HAWKI image to stitch "
+" (PRO CATG = "HAWKI_CALPRO_COMBINED")\n"
+"\n"
+"This recipe produces 1 file:\n"
+"First product: the stitch image.\n"
+" (PRO CATG = "HAWKI_CALPRO_STITCHED")\n" ;
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok, -1 otherwise
+
+ Create the recipe instance and make it available to the application using the
+ interface. This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe ) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_stitch",
+ "Stitching utility",
+ hawki_step_stitch_description,
+ "Cesar Enrique Garcia",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_stitch_create,
+ hawki_step_stitch_exec,
+ hawki_step_stitch_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Defining the command-line/configuration parameters for the recipe.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stitch_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Check that the plugin is part of a valid recipe */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stitch_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_stitch(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stitch_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Interpret the command line options and execute the data processing
+ @param parlist the parameters list
+ @param frameset the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stitch(
+ cpl_parameterlist * parlist,
+ cpl_frameset * frameset)
+{
+ const char * comb_filename ;
+ cpl_frameset * combframes;
+ cpl_frame * combframe;
+ cpl_propertylist * plist ;
+ cpl_image * stitched ;
+ cpl_image * in[HAWKI_NB_DETECTORS] ;
+ double posx[HAWKI_NB_DETECTORS] ;
+ double posy[HAWKI_NB_DETECTORS] ;
+ int i, j ;
+ cpl_errorstate error_prevstate;
+
+
+ /* Retrieve input parameters */
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(frameset)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Identifying the combined frame */
+ cpl_msg_info(__func__, "Identifying the combined frame");
+ combframes = hawki_extract_frameset
+ (frameset, HAWKI_CALPRO_COMBINED);
+ if (combframes == NULL)
+ {
+ cpl_msg_error(__func__, "No combined images found (%s)",
+ HAWKI_CALPRO_COMBINED);
+ cpl_frameset_delete(combframes);
+ return -1 ;
+ }
+
+ /* Check that we have 1 files in input */
+ if (cpl_frameset_get_size(combframes) != 1) {
+ cpl_msg_error(__func__, "Expects one single combined images") ;
+ cpl_frameset_delete(combframes);
+ return -1 ;
+ }
+
+ /* Load the HAWKI images */
+ cpl_msg_info(__func__,"Loading combined frame");
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ if ((in[i] = hawki_load_image(combframes, 0, i+1,
+ CPL_TYPE_FLOAT)) == NULL) {
+ cpl_msg_error(__func__, "Cannot load chip nb %d", i+1) ;
+ for (j=0 ; j<i ; i++) cpl_image_delete(in[j]) ;
+ cpl_frameset_delete(combframes);
+ return -1 ;
+ }
+ }
+
+ /* Get the first input frame */
+ combframe = cpl_frameset_get_first(combframes);
+ comb_filename = cpl_frame_get_filename(combframe);
+
+ /* Get the POSX / POSY informations */
+ error_prevstate = cpl_errorstate_get();
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
+ plist = cpl_propertylist_load_regexp(comb_filename, i+1, "QC", 0) ;
+ posx[i] = hawki_pfits_get_comb_posx(plist);
+ posy[i] = hawki_pfits_get_comb_posy(plist);
+ cpl_propertylist_delete(plist) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_msg_error(__func__, "Cannot get POS infos for chip %d", i+1) ;
+ return -1 ;
+ }
+ }
+
+ /* Compute the stitched image */
+ cpl_msg_info(__func__, "Computing the stiched image") ;
+ if ((stitched = hawki_images_stitch(in, posx, posy)) == NULL) {
+ cpl_msg_error(__func__, "Cannot stitch the images") ;
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_image_delete(in[i]) ;
+ return -1 ;
+ }
+ for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) cpl_image_delete(in[i]) ;
+
+ /* Save the corrected image */
+ if (hawki_step_stitch_save(stitched, combframe, parlist, frameset) == -1)
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space");
+
+ /* Free and Return */
+ cpl_frameset_delete(combframes);
+ cpl_image_delete(stitched);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the products on disk
+ @param in the image to save
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_stitch_save
+(cpl_image * in,
+ cpl_frame * combined,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set)
+{
+ cpl_propertylist * plist;
+ cpl_propertylist * wcslist;
+ const char * recipe_name = "hawki_step_stitch" ;
+ int ext_chip_1;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ cpl_msg_indent_more();
+
+ /* Create a propertylist for PRO.x */
+ plist = cpl_propertylist_new();
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE,
+ HAWKI_PROTYPE_STITCHED) ;
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG,
+ HAWKI_CALPRO_STITCHED) ;
+
+ /* Handle WCS keys */
+ ext_chip_1 = 1;
+ wcslist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(combined), ext_chip_1, HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_append(plist, wcslist);
+
+ /* Save the image */
+ if(cpl_dfs_save_image(set,
+ NULL,
+ parlist,
+ set,
+ NULL,
+ in,
+ CPL_BPP_IEEE_FLOAT,
+ recipe_name,
+ plist,
+ NULL,
+ PACKAGE "/" PACKAGE_VERSION,
+ "hawki_step_stitch.fits") != CPL_ERROR_NONE)
+ cpl_msg_error(__func__,"Could not save stitched image");
+
+ cpl_propertylist_delete(plist) ;
+ cpl_propertylist_delete(wcslist) ;
+ cpl_msg_indent_less();
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
+
diff --git a/recipes/hawki_step_subtract_bkg.c b/recipes/hawki_step_subtract_bkg.c
new file mode 100644
index 0000000..7dff1c1
--- /dev/null
+++ b/recipes/hawki_step_subtract_bkg.c
@@ -0,0 +1,534 @@
+/* $Id: hawki_step_subtract_bkg.c,v 1.17 2011/10/24 10:41:43 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2008 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: cgarcia $
+ * $Date: 2011/10/24 10:41:43 $
+ * $Revision: 1.17 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+#include "hawki_utils.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_calib.h"
+
+/*-----------------------------------------------------------------------------
+ Structs
+ -----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_step_subtract_bkg_create(cpl_plugin *) ;
+static int hawki_step_subtract_bkg_exec(cpl_plugin *) ;
+static int hawki_step_subtract_bkg_destroy(cpl_plugin *) ;
+static int hawki_step_subtract_bkg(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_step_subtract_bkg_apply_one_to_one_save
+(cpl_frameset * objframes,
+ cpl_frameset * bkgframes,
+ cpl_parameterlist * parlist,
+ cpl_frameset * recipe_framelist);
+
+static int hawki_step_subtract_bkg_apply_one_to_all_save
+(cpl_frameset * objframes,
+ cpl_frameset * bkgframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+
+static int hawki_step_subtract_bkg_save
+(cpl_imagelist * obj_images,
+ int iserie,
+ cpl_frameset * used_frameset,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_step_subtract_bkg_description[] =
+"hawki_step_subtract_bkg -- hawki background subtraction utility.\n"
+"This recipe will subtract the given background to the science images.\n"
+"The background can be obtained from the sky or object images\n"
+"using the hawki_util_compute_bkg utility.\n"
+"There are two modes of operation:\n"
+"One single background image that it is subtracted to all object images.\n"
+"As many background images as objects. A one to one relationship is applied.\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"obj_basic_cal-file.fits "HAWKI_CALPRO_BASICCALIBRATED" or\n"
+"background-file.fits "HAWKI_CALPRO_BKGIMAGE" \n";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_step_subtract_bkg",
+ "Background subtraction utility",
+ hawki_step_subtract_bkg_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_step_subtract_bkg_create,
+ hawki_step_subtract_bkg_exec,
+ hawki_step_subtract_bkg_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ //cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* None.. */
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_step_subtract_bkg(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ int nobj;
+ int nbkg;
+ cpl_frameset * objframes;
+ cpl_frameset * bkgframes;
+
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist))
+ {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Identifying objects and bkg data frames */
+ cpl_msg_info(__func__, "Identifying objects and background data");
+ objframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_BASICCALIBRATED);
+ if (objframes == NULL)
+ {
+ cpl_msg_error(__func__, "No object frames provided (%s)",
+ HAWKI_CALPRO_BASICCALIBRATED);
+ return -1 ;
+ }
+ /* Retrieve bkg frames */
+ bkgframes = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_BKGIMAGE);
+ if (bkgframes == NULL)
+ {
+ cpl_msg_error(__func__, "No background frames provided (%s)",
+ HAWKI_CALPRO_BKGIMAGE);
+ cpl_frameset_delete(objframes);
+ return -1 ;
+ }
+
+ /* Subtract the background */
+ nobj = cpl_frameset_get_size(objframes);
+ nbkg = cpl_frameset_get_size(bkgframes);
+ if(nobj == nbkg)
+ hawki_step_subtract_bkg_apply_one_to_one_save
+ (objframes, bkgframes, parlist, framelist);
+ else if(nbkg == 1)
+ hawki_step_subtract_bkg_apply_one_to_all_save
+ (objframes, bkgframes, parlist, framelist);
+ else
+ {
+ cpl_msg_error(__func__,"Incompatible number of science and background"
+ " images.");
+ cpl_msg_error(__func__,"Supply only 1 bkg frame or as many as objects");
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(bkgframes);
+ return -1;
+ }
+
+ /* Free resources */
+ cpl_frameset_delete(objframes);
+ cpl_frameset_delete(bkgframes);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function will subtract each background frame to the
+ corresponding object frame and will save later the results.
+ @param obj the objects frames
+ @param bkg the background frames
+ @return 0 if everything is ok
+
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg_apply_one_to_one_save
+(cpl_frameset * objframes,
+ cpl_frameset * bkgframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ int iobj;
+ int nobjs;
+
+ /* Subtract the background to each object frame */
+ cpl_msg_info(__func__,"Using a one to one relation btw objects and bkgs");
+ nobjs = cpl_frameset_get_size(objframes);
+ for(iobj = 0; iobj < nobjs; ++iobj)
+ {
+ cpl_frame * obj_frame = NULL;
+ cpl_frame * bkg_frame = NULL;
+ cpl_imagelist * obj_images = NULL;
+ cpl_imagelist * bkg_images = NULL;
+ cpl_frameset * used_frameset;
+
+ /* Allocate resources */
+ used_frameset = cpl_frameset_new();
+
+ /* Read the object frame */
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__, "Applying correction to object %d", iobj+1) ;
+ obj_frame = cpl_frameset_get_frame(objframes, iobj);
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(obj_frame));
+ if(obj_frame != NULL)
+ obj_images = hawki_load_frame(obj_frame, CPL_TYPE_FLOAT);
+ if(obj_images == NULL)
+ {
+ cpl_msg_indent_less();
+ cpl_msg_error(__func__, "Error reading obj image") ;
+ cpl_frameset_delete(used_frameset);
+ return -1;
+ }
+
+ /* Read the bkg */
+ bkg_frame = cpl_frameset_get_frame(bkgframes, iobj);
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(bkg_frame));
+ if(bkg_frame != NULL)
+ bkg_images = hawki_load_frame(bkg_frame, CPL_TYPE_FLOAT);
+ if(bkg_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading background image") ;
+ cpl_msg_indent_less();
+ cpl_imagelist_delete(obj_images);
+ cpl_frameset_delete(used_frameset);
+ return -1;
+ }
+
+ /* Make the correction */
+ hawki_bkg_imglist_calib(obj_images, bkg_images);
+
+ /* Save the subtracted frame */
+ if(hawki_step_subtract_bkg_save(obj_images,
+ iobj,
+ used_frameset,
+ recipe_parlist,
+ recipe_framelist) != 0)
+ cpl_msg_warning(__func__,"Some data could not be saved. "
+ "Check permisions or disk space");
+
+ /* Free in loop */
+ cpl_msg_indent_less();
+ cpl_imagelist_delete(obj_images);
+ cpl_imagelist_delete(bkg_images);
+ cpl_frameset_delete(used_frameset);
+ }
+
+ /* Exit */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This function will subtract one background frame to all the
+ object frames and will save later the results.
+ @param obj the objects frames
+ @param bkg the background frames
+ @return 0 if everything is ok
+
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg_apply_one_to_all_save
+(cpl_frameset * objframes,
+ cpl_frameset * bkgframes,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ int iobj;
+ int nobjs;
+ cpl_frame * bkg_frame;
+ cpl_imagelist * bkg_images = NULL;
+
+ /* Read the bkg */
+ cpl_msg_info(__func__,"Using the same bkg for all the objects");
+ bkg_frame = cpl_frameset_get_first(bkgframes);
+ if(bkg_frame != NULL)
+ bkg_images = hawki_load_frame(bkg_frame, CPL_TYPE_FLOAT);
+ if(bkg_images == NULL)
+ {
+ cpl_msg_error(__func__, "Error reading background image");
+ return -1;
+ }
+
+ /* Subtract the background to each object frame */
+ nobjs = cpl_frameset_get_size(objframes);
+ for(iobj = 0; iobj < nobjs; ++iobj)
+ {
+ cpl_frame * obj_frame;
+ cpl_imagelist * obj_images = NULL;
+ cpl_frameset * used_frameset;
+
+ /* Allocate resources */
+ used_frameset = cpl_frameset_new();
+
+ /* Read the object frame */
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__, "Applying correction to object %d", iobj+1) ;
+ obj_frame = cpl_frameset_get_frame(objframes, iobj);
+ if(obj_frame != NULL)
+ obj_images = hawki_load_frame(obj_frame, CPL_TYPE_FLOAT);
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(obj_frame));
+ cpl_frameset_insert(used_frameset, cpl_frame_duplicate(bkg_frame));
+ if(obj_images == NULL)
+ {
+ cpl_msg_indent_less();
+ cpl_msg_error(__func__, "Error reading obj image") ;
+ cpl_frameset_delete(used_frameset);
+ return -1;
+ }
+
+ /* Make the correction */
+ hawki_bkg_imglist_calib(obj_images, bkg_images);
+
+ /* Save the subtracted frame */
+ hawki_step_subtract_bkg_save(obj_images,
+ iobj,
+ used_frameset,
+ recipe_parlist,
+ recipe_framelist);
+
+ /* Free in loop */
+ cpl_msg_indent_less();
+ cpl_imagelist_delete(obj_images);
+ cpl_frameset_delete(used_frameset);
+ }
+
+ /* Free and return */
+ cpl_imagelist_delete(bkg_images);
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the background subtracted products on disk
+ @param combined the combined imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param mean_sky_bg the vectors with the sky background values or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_step_subtract_bkg_save
+(cpl_imagelist * obj_images,
+ int iserie,
+ cpl_frameset * used_frameset,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_framelist)
+{
+ const cpl_frame * raw_reference;
+ cpl_propertylist ** extproplists;
+ char filename[256] ;
+ cpl_propertylist * inputlist ;
+ int ext_nb ;
+ const char * recipe_name = "hawki_step_subtract_bkg";
+ int idet;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+ /* Get the reference frame (the raw frame) */
+ raw_reference = irplib_frameset_get_first_from_group
+ (used_frameset, CPL_FRAME_GROUP_RAW);
+
+ /* Create the prop lists */
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__, "Creating the keywords list") ;
+ extproplists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*));
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(raw_reference), idet+1);
+
+ /* Allocate this property list */
+ extproplists[idet] = cpl_propertylist_new();
+
+ /* Propagate some keywords from input raw frame extensions */
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+ cpl_propertylist_append(extproplists[idet], inputlist);
+ cpl_propertylist_delete(inputlist);
+ inputlist = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(raw_reference), ext_nb,
+ HAWKI_HEADER_WCS, 0);
+ cpl_propertylist_append(extproplists[idet], inputlist);
+ cpl_propertylist_delete(inputlist);
+ }
+
+ /* Write the image */
+ snprintf(filename, 256, "hawki_step_subtract_bkg_%03d.fits", iserie+1);
+ hawki_imagelist_save(recipe_framelist,
+ recipe_parlist,
+ used_frameset,
+ obj_images,
+ recipe_name,
+ HAWKI_CALPRO_BKG_SUBTRACTED,
+ HAWKI_PROTYPE_BKG_SUBTRACTED,
+ NULL,
+ (const cpl_propertylist**)extproplists,
+ filename);
+
+ /* Free and return */
+ cpl_msg_indent_less();
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_propertylist_delete(extproplists[idet]) ;
+ }
+ cpl_free(extproplists) ;
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
diff --git a/recipes/hawki_tec_filtchk.c b/recipes/hawki_tec_filtchk.c
new file mode 100644
index 0000000..5a5de84
--- /dev/null
+++ b/recipes/hawki_tec_filtchk.c
@@ -0,0 +1,380 @@
+/* $Id: hawki_tec_filtchk.c,v 1.15 2011/10/24 10:41:32 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/10/24 10:41:32 $
+ * $Revision: 1.15 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include <hawki_dfs.h>
+#include <hawki_load.h>
+#include <hawki_save.h>
+#include <hawki_pfits.h>
+#include <hawki_image_stats.h>
+#include <hawki_utils.h>
+
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_tec_filtchk_create(cpl_plugin *) ;
+static int hawki_tec_filtchk_exec(cpl_plugin *) ;
+static int hawki_tec_filtchk_destroy(cpl_plugin *) ;
+static int hawki_tec_filtchk(cpl_parameterlist *, cpl_frameset *) ;
+
+static int hawki_tec_filtchk_frameset_stats
+(cpl_table ** target_stats,
+ cpl_propertylist ** stats_stats,
+ cpl_frameset * target_frames);
+
+static int hawki_tec_filtchk_save
+(cpl_table ** target_stats,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_frameset,
+ cpl_propertylist ** stats_stats,
+ const char * calpro,
+ const char * protype);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_tec_filtchk_description[] =
+"hawki_tec_filtchk -- Check pairs of flats taken with different filters.\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"raw-file.fits "HAWKI_TEC_FLAT_RAW"\n";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_tec_filtchk",
+ "Filter checking recipe",
+ hawki_tec_filtchk_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_tec_filtchk_create,
+ hawki_tec_filtchk_exec,
+ hawki_tec_filtchk_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_tec_filtchk_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ /* cpl_parameter * p ; */
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* None.. */
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_tec_filtchk_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_tec_filtchk(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_tec_filtchk_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Get the command line options and execute the data reduction
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_tec_filtchk(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * frames ;
+ cpl_table ** target_stats;
+ cpl_propertylist ** stats_stats;
+ int idet;
+ char calpro[1024];
+ char protype[1024];
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist))
+ {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1;
+ }
+
+ /* Retrieve raw frames */
+ cpl_msg_info(__func__, "Identifying input frames");
+ frames = hawki_extract_frameset(framelist, HAWKI_TEC_FLAT_RAW) ;
+ snprintf(calpro, 1024, HAWKI_CALPRO_FILTERPOSCHECK_STATS);
+ snprintf(protype, 1024, HAWKI_PROTYPE_FILTERPOSCHECK_STATS);
+ if (frames == NULL)
+ {
+ cpl_msg_error(__func__,"Input files should be tagged %s",
+ HAWKI_TEC_FLAT_RAW);
+ return -1;
+ }
+
+ /* Create the statistics table */
+ target_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table *));
+ stats_stats = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist *));
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ target_stats[idet] = cpl_table_new(cpl_frameset_get_size(frames));
+ stats_stats[idet] = cpl_propertylist_new();
+ }
+ hawki_image_stats_initialize(target_stats);
+
+ /* Compute actually the statistics */
+ hawki_tec_filtchk_frameset_stats(target_stats, stats_stats, frames);
+
+ /* Saving the table product */
+ hawki_tec_filtchk_save
+ (target_stats, parlist, framelist, stats_stats, calpro, protype);
+
+ /* Free and return */
+ cpl_frameset_delete(frames);
+ for( idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_table_delete(target_stats[idet]);
+ cpl_propertylist_delete(stats_stats[idet]);
+ }
+ cpl_free(target_stats);
+ cpl_free(stats_stats);
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param obj the objects frames
+ @param obj the sky frames
+ @param flat the flat field or NULL
+ @param bpm the bad pixels map or NULL
+ @param skybg the computed sky background values
+ @return the combined images of the chips or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_tec_filtchk_frameset_stats
+(cpl_table ** target_stats,
+ cpl_propertylist ** stats_stats,
+ cpl_frameset * target_frames)
+{
+ int iframe;
+ int nframes;
+
+ /* Loop on the number of frames */
+ nframes = cpl_frameset_get_size(target_frames);
+ cpl_msg_info(__func__, "Looping the target frames: %d frames", nframes);
+ cpl_msg_indent_more();
+ for( iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ /* Local storage variables */
+ cpl_frame * this_target_frame;
+
+ /* Computing statistics for this frame */
+ cpl_msg_info(__func__, "Computing stats for frame: %d", iframe +1);
+ this_target_frame = cpl_frameset_get_frame(target_frames, iframe);
+ hawki_image_stats_fill_from_frame
+ (target_stats, this_target_frame, iframe);
+ }
+ cpl_msg_indent_less();
+
+ /* Compute stats of the stats */
+ hawki_image_stats_stats(target_stats, stats_stats);
+
+ /* Print info about the statistics */
+ hawki_image_stats_print(target_stats);
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the jitter recipe products on disk
+ @param combined the combined imagelist produced
+ @param objs_stats the tables with the detected objects statistics or NULL
+ @param mean_sky_bg the vectors with the sky background values or NULL
+ @param parlist the input list of parameters
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_tec_filtchk_save
+(cpl_table ** target_stats,
+ cpl_parameterlist * recipe_parlist,
+ cpl_frameset * recipe_frameset,
+ cpl_propertylist ** stats_stats,
+ const char * calpro,
+ const char * protype)
+{
+ const cpl_frame * reference_frame;
+ cpl_propertylist * referencelist;
+ cpl_propertylist ** extlists;
+ int idet;
+ int ext_nb;
+ const char * recipe_name = "hawki_tec_filtchk";
+
+ /* Get the reference frame (the first one) */
+ reference_frame = cpl_frameset_get_first_const(recipe_frameset);
+
+ /* Create the prop lists */
+ cpl_msg_info(__func__, "Creating the keywords list") ;
+ referencelist = cpl_propertylist_load_regexp
+ (cpl_frame_get_filename(reference_frame), 0,HAWKI_HEADER_EXT_FORWARD,0);
+ extlists =
+ cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*));
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ /* Get the extension number */
+ ext_nb=hawki_get_ext_from_detector
+ (cpl_frame_get_filename(reference_frame), idet+1);
+
+ /* Propagate the keywords from input frame extensions */
+ extlists[idet] = cpl_propertylist_load_regexp(
+ cpl_frame_get_filename(reference_frame), ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0);
+
+ /* Add the stats of the stats */
+ cpl_propertylist_append(extlists[idet],stats_stats[idet]);
+ }
+
+ /* Write the table with the statistics */
+ hawki_tables_save(recipe_frameset,
+ recipe_parlist,
+ recipe_frameset,
+ (const cpl_table **)target_stats,
+ recipe_name,
+ calpro,
+ protype,
+ (const cpl_propertylist*)referencelist,
+ (const cpl_propertylist**)extlists,
+ "hawki_tec_filtchk_stats.fits");
+
+ /* Free and return */
+ cpl_propertylist_delete(referencelist) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ cpl_propertylist_delete(extlists[idet]) ;
+ }
+ cpl_free(extlists) ;
+ return 0;
+}
diff --git a/recipes/hawki_util_extinction.c b/recipes/hawki_util_extinction.c
new file mode 100644
index 0000000..e19240c
--- /dev/null
+++ b/recipes/hawki_util_extinction.c
@@ -0,0 +1,537 @@
+/* $Id: hawki_util_extinction.c,v 1.3 2011/12/22 14:28:43 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/12/22 14:28:43 $
+ * $Revision: 1.3 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+#include "irplib_strehl.h"
+#include "irplib_stdstar.h"
+#include "irplib_cat.h"
+
+#include "hawki_utils.h"
+#include "hawki_calib.h"
+#include "hawki_load.h"
+#include "hawki_save.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_alloc.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_util_extinction_create(cpl_plugin *) ;
+static int hawki_util_extinction_exec(cpl_plugin *) ;
+static int hawki_util_extinction_destroy(cpl_plugin *) ;
+static int hawki_util_extinction(cpl_parameterlist *, cpl_frameset *) ;
+
+static cpl_table ** hawki_util_extinction_reduce
+(cpl_frameset * set,
+ const char * stdstars,
+ const char * bpm,
+ const char * flat,
+ cpl_table ** raw_zpoint_stats,
+ int * star_labels,
+ int * det_labels,
+ cpl_imagelist ** images);
+static int hawki_util_extinction_save_photsol
+(cpl_table ** photsol_table,
+ cpl_frameset * zpoint_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set);
+static cpl_table ** hawki_util_extinction_photom
+(cpl_frameset * std_stars_photom);
+static cpl_table * hawki_util_extinction_get_photomsol
+(cpl_table * std_stars_photom);
+static int hawki_util_extinction_compute_keywords
+(cpl_frameset * set,
+ int * det_labels);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+
+static char hawki_util_extinction_description[] =
+"hawki_util_extinction -- Zero point recipe with extinction\n"
+"The input of the recipe files listed in the Set Of Frames (sof-file)\n"
+"must be tagged as:\n"
+"hawki_util_extinction.fits ("HAWKI_CALPRO_ZPOINT_TAB"): Zero point solution table\n"
+"The recipe creates as an output:\n"
+"hawki_cal_photom.fits ("HAWKI_CALPRO_PHOT_TAB"): Photometric solution\n"
+"Return code:\n"
+"esorex exits with an error code of 0 if the recipe completes successfully\n"
+"or 1 otherwise";
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_util_extinction",
+ "Zero point with extinction computation recipe",
+ hawki_util_extinction_description,
+ "Cesar Enrique Garcia Dabo",
+ "cgarcia at eso.org",
+ hawki_get_license(),
+ hawki_util_extinction_create,
+ hawki_util_extinction_exec,
+ hawki_util_extinction_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_extinction_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_extinction_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_util_extinction(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_extinction_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param parlist the parameters list
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_extinction(
+ cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * std_stars_photom ;
+ cpl_table ** zpoint_tables;
+
+ /* Initialise Output */
+ std_stars_photom = NULL ;
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve zpoint tables */
+ if ((std_stars_photom = hawki_extract_frameset
+ (framelist, HAWKI_CALPRO_ZPOINT_TAB)) == NULL)
+ {
+ cpl_msg_error(__func__, "Cannot find std stars info (%s)",
+ HAWKI_CALPRO_ZPOINT_TAB);
+ return -1 ;
+ }
+
+ /* Compute the zpoint values */
+ cpl_msg_info(__func__, "Reduce the data") ;
+ cpl_msg_indent_more() ;
+ if ((zpoint_tables = hawki_util_extinction_photom(std_stars_photom))==NULL)
+ {
+ cpl_msg_error(__func__, "Cannot compute photometric solution") ;
+ cpl_frameset_delete(std_stars_photom) ;
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Save the products */
+ cpl_msg_info(__func__, "Save the products");
+ cpl_msg_indent_more() ;
+ if (hawki_util_extinction_save_photsol
+ (zpoint_tables, std_stars_photom,
+ parlist, framelist) == -1)
+ {
+ cpl_msg_warning(__func__, "Data could not be saved. "
+ "Check permisions or disk space") ;
+ hawki_table_delete(zpoint_tables) ;
+ cpl_frameset_delete(std_stars_photom);
+ cpl_msg_indent_less() ;
+ return -1 ;
+ }
+ cpl_msg_indent_less() ;
+
+ /* Free and return */
+ cpl_frameset_delete(std_stars_photom);
+ hawki_table_delete(zpoint_tables);
+
+ /* Return */
+ if (cpl_error_get_code()) return -1 ;
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Reduce one image
+ @param ilist the input image list
+ @param pos the objects positions
+ @param labels the chip numbers
+ @return the newly allocated table with the following columns:
+ POSX POSY ZPOINT FLUX BGD PEAK FWHMX FWHMY
+ or NULL in error case
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_table ** hawki_util_extinction_photom
+(cpl_frameset * std_stars_photom)
+
+{
+ cpl_table ** photsol;
+ int nframes;
+ double extinction;
+ cpl_bivector * iqe_res ;
+ int iframe;
+ int idet;
+ int jdet;
+ int iext;
+ int ext_nb;
+ cpl_frame * ref_frame;
+
+ /* Test entries */
+ if (std_stars_photom == NULL) return NULL ;
+
+ /* Initialise */
+ photsol = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table*));
+ nframes = cpl_frameset_get_size(std_stars_photom) ;
+
+ /* Get reference */
+ ref_frame = cpl_frameset_get_first(std_stars_photom);
+ nframes = cpl_frameset_get_size(std_stars_photom);
+
+ /* Loop on detectors */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS; idet++)
+ {
+ cpl_table * merged_std_stars_photom;
+
+ cpl_msg_info(cpl_func, "Working on detector %d", idet +1);
+ cpl_msg_indent_more();
+ /* Get the extension */
+ ext_nb=hawki_get_ext_from_detector(cpl_frame_get_filename(ref_frame), idet+1);
+
+ /* Load all the tables and merge them */
+ for( iframe = 0 ; iframe < nframes ; ++iframe)
+ {
+ cpl_frame * this_frame;
+ cpl_table * this_table;
+ /* Get the current image */
+ this_frame = cpl_frameset_get_frame(std_stars_photom, iframe);
+ if(iframe == 0)
+ merged_std_stars_photom = cpl_table_load
+ (cpl_frame_get_filename(this_frame),ext_nb, 1);
+ else
+ {
+ cpl_table * this_table =
+ cpl_table_load(cpl_frame_get_filename(this_frame),ext_nb, 1);
+ cpl_table_insert(merged_std_stars_photom, this_table,
+ cpl_table_get_nrow(merged_std_stars_photom));
+ cpl_table_delete(this_table);
+ }
+ }
+
+ if(cpl_table_get_nrow(merged_std_stars_photom) < 2)
+ {
+ cpl_msg_error(__func__, "%d stars found. At least 2 stars must be present",
+ cpl_table_get_nrow(merged_std_stars_photom));
+ cpl_table_delete(merged_std_stars_photom);
+ return NULL;
+ }
+ cpl_msg_info(__func__,"Number of star measurements %d",
+ cpl_table_get_nrow(merged_std_stars_photom));
+
+ if((photsol[idet] = hawki_util_extinction_get_photomsol
+ (merged_std_stars_photom)) == NULL)
+ {
+ cpl_table_delete(merged_std_stars_photom);
+ for(jdet=0; jdet < idet; jdet++)
+ cpl_table_delete(photsol[jdet]);
+ cpl_free(photsol);
+ return NULL;
+ }
+
+ cpl_table_delete(merged_std_stars_photom);
+ cpl_msg_indent_less();
+ }
+ return photsol;
+}
+
+static cpl_table * hawki_util_extinction_get_photomsol
+(cpl_table * std_stars_photom)
+{
+ const double * instrmag;
+ const double * airmass;
+ const double * catmag;
+ cpl_table * photsol;
+ double zeropoint;
+ double extcoeff;
+ cpl_matrix * xpos;
+ cpl_vector * ypos;
+ cpl_polynomial * phot_coeff;
+ int nstars;
+ int istar;
+ const cpl_boolean sampsym = CPL_TRUE;
+ const cpl_size mindeg1d = 0;
+ const cpl_size maxdeg1d = 1;
+ cpl_size pows;
+
+
+ nstars = cpl_table_get_nrow(std_stars_photom);
+
+ photsol = cpl_table_new(1);
+ instrmag = cpl_table_get_data_double_const
+ (std_stars_photom, HAWKI_COL_ZPOINT_INSTRMAG);
+ airmass = cpl_table_get_data_double_const
+ (std_stars_photom, HAWKI_COL_ZPOINT_AIRMASS);
+ catmag = cpl_table_get_data_double_const
+ (std_stars_photom, HAWKI_COL_ZPOINT_STARMAG);
+
+ if(instrmag == NULL || airmass == NULL || catmag == NULL)
+ {
+ cpl_msg_error(cpl_func, "Some of the following columns not found "
+ "in table: %s, %s, %s", HAWKI_COL_ZPOINT_INSTRMAG,
+ HAWKI_COL_ZPOINT_AIRMASS, HAWKI_COL_ZPOINT_STARMAG);
+ cpl_table_delete(photsol);
+ return NULL;
+ }
+
+ cpl_table_new_column(photsol, HAWKI_COL_PHOT_FILTER, CPL_TYPE_STRING);
+ cpl_table_new_column(photsol, HAWKI_COL_PHOT_ZEROPOINT, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(photsol,HAWKI_COL_PHOT_ZEROPOINT,"mag");
+ cpl_table_new_column(photsol, HAWKI_COL_PHOT_EXTCOEFF, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(photsol,HAWKI_COL_PHOT_EXTCOEFF,"mag/airmass");
+
+ /* Make the fit to get the coefficients */
+ xpos = cpl_matrix_new(1, nstars);
+ ypos = cpl_vector_new(nstars);
+ for(istar = 0; istar < nstars; ++istar)
+ {
+ double y;
+ cpl_matrix_set(xpos, 0, istar, airmass[istar]);
+ y = catmag[istar] + instrmag[istar];
+ cpl_vector_set(ypos, istar, y);
+ }
+ /* phot_coeff[0] --> ZP
+ * phot_coeff[1] --> -extcoeff
+ */
+ phot_coeff = cpl_polynomial_new(1);
+ if(cpl_polynomial_fit(phot_coeff, xpos, NULL, ypos, NULL,
+ CPL_FALSE, &mindeg1d, &maxdeg1d) != CPL_ERROR_NONE)
+ {
+ cpl_msg_error(cpl_func,"Cannot get the photometric solution");
+ cpl_table_delete(photsol);
+ return NULL;
+ }
+ cpl_matrix_delete(xpos);
+ cpl_vector_delete(ypos);
+ pows = 0;
+ zeropoint = cpl_polynomial_get_coeff(phot_coeff, &pows);
+ pows = 1;
+ extcoeff = -cpl_polynomial_get_coeff(phot_coeff, &pows);
+ cpl_polynomial_delete(phot_coeff);
+
+ cpl_table_set_double(photsol, HAWKI_COL_PHOT_ZEROPOINT, 0,
+ zeropoint);
+ cpl_table_set_double(photsol, HAWKI_COL_PHOT_EXTCOEFF, 0,
+ extcoeff);
+
+ /* Output results */
+ cpl_msg_indent_more();
+ cpl_msg_info(__func__, "Zero point: %f", zeropoint);
+ cpl_msg_info(__func__, "Extinction coefficient: %f", extcoeff);
+ cpl_msg_indent_less();
+
+ return photsol;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Save the zpoint table on disk
+ @param tab the table to save
+ @param images the images where the photometry is computed
+ @param parlist the parameter list
+ @param set the input frame set
+ @return 0 if everything is ok, -1 otherwise
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_extinction_save_photsol
+(cpl_table ** photsol_table,
+ cpl_frameset * zpoint_frames,
+ cpl_parameterlist * parlist,
+ cpl_frameset * set)
+{
+ cpl_propertylist ** qclists ;
+ const char * ref_filename;
+ cpl_propertylist * inputlist ;
+ int ext_nb, nframes ;
+ const char * recipe_name = "hawki_util_extinction" ;
+ int idet;
+ int iframe;
+ cpl_errorstate error_prevstate = cpl_errorstate_get();
+
+
+ /* Initialise */
+ nframes = cpl_frameset_get_size(set) ;
+
+ /* Get the reference frame */
+ ref_filename = hawki_get_extref_file(set);
+
+ /* Create the QC lists for the extensions */
+ qclists = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_propertylist*)) ;
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
+ {
+ int this_iframe = -1;
+
+ qclists[idet] = cpl_propertylist_new() ;
+ /* These QC are common to all extensions */
+
+
+ /* Propagate some keywords from input raw frame extensions */
+ ext_nb=hawki_get_ext_from_detector(ref_filename, idet+1);
+ inputlist = cpl_propertylist_load_regexp(ref_filename, ext_nb,
+ HAWKI_HEADER_EXT_FORWARD, 0) ;
+ cpl_propertylist_append(qclists[idet], inputlist) ;
+ cpl_propertylist_delete(inputlist) ;
+
+ }
+
+ /* Write the photometric table */
+ hawki_tables_save(set,
+ parlist,
+ zpoint_frames,
+ (const cpl_table **)photsol_table,
+ recipe_name,
+ HAWKI_CALPRO_PHOT_TAB,
+ HAWKI_PROTYPE_PHOT_TAB,
+ NULL,
+ (const cpl_propertylist **)qclists,
+ "hawki_util_extinction.fits");
+
+ /* Free */
+ for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++) {
+ cpl_propertylist_delete(qclists[idet]) ;
+ }
+ cpl_free(qclists) ;
+
+ /* Free */
+ if(!cpl_errorstate_is_equal(error_prevstate))
+ {
+ cpl_errorstate_set(CPL_ERROR_NONE);
+ return -1;
+ }
+ return 0;
+}
diff --git a/recipes/hawki_util_gendist.c b/recipes/hawki_util_gendist.c
new file mode 100644
index 0000000..16d654d
--- /dev/null
+++ b/recipes/hawki_util_gendist.c
@@ -0,0 +1,602 @@
+/* $Id: hawki_util_gendist.c,v 1.22 2011/10/24 10:40:50 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/10/24 10:40:50 $
+ * $Revision: 1.22 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+
+#include "hawki_utils.h"
+#include "hawki_load.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+#include "hawki_distortion.h"
+#include "hawki_save.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_util_gendist_create(cpl_plugin *) ;
+static int hawki_util_gendist_exec(cpl_plugin *) ;
+static int hawki_util_gendist_destroy(cpl_plugin *) ;
+static int hawki_util_gendist(cpl_parameterlist *, cpl_frameset *) ;
+static cpl_table * hawki_util_gendist_convert(const char *) ;
+static hawki_distortion * hawki_util_gendist_convert_to_images
+(const cpl_table * dist_tab,
+ int detector_nx,
+ int detector_ny);
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_util_gendist_description[] =
+"hawki_util_gendist -- HAWK-I distortion calibration file creation.\n"
+"The 4 files (chip 1 2 3 4) listed in the Set Of Frames (sof-file) \n"
+"must be tagged:\n"
+"raw-file_chip1.txt "HAWKI_UTIL_DISTMAP_RAW"\n"
+"raw-file_chip2.txt "HAWKI_UTIL_DISTMAP_RAW"\n"
+"raw-file_chip3.txt "HAWKI_UTIL_DISTMAP_RAW"\n"
+"raw-file_chip4.txt "HAWKI_UTIL_DISTMAP_RAW"\n" ;
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_util_gendist",
+ "Distortion map creation",
+ hawki_util_gendist_description,
+ "Yves Jung",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_util_gendist_create,
+ hawki_util_gendist_exec,
+ hawki_util_gendist_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_gendist_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+ cpl_parameter * p ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+ if (recipe->parameters == NULL)
+ return 1;
+
+ /* Fill the parameters list */
+ /* --dim_x */
+ p = cpl_parameter_new_value("hawki.hawki_util_gendist.dim_x",
+ CPL_TYPE_INT, "Dimension of distortion image in X",
+ "hawki.hawki_util_gendist", HAWKI_DET_NPIX_X);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dim_x");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --dim_y */
+ p = cpl_parameter_new_value("hawki.hawki_util_gendist.dim_y",
+ CPL_TYPE_INT, "Dimension of distortion image in Y",
+ "hawki.hawki_util_gendist", HAWKI_DET_NPIX_Y);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dim_y");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_gendist_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_util_gendist(recipe->parameters, recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_gendist_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_gendist
+(cpl_parameterlist * parlist,
+ cpl_frameset * framelist)
+{
+ cpl_frameset * rawframes;
+ const cpl_frame * cur_frame;
+ const char * dist_name;
+ cpl_table ** distortion_table;
+ hawki_distortion ** distortion_im;
+ cpl_propertylist * plist;
+ cpl_propertylist * plist_ext;
+ char sval[64];
+ const char * recipe_name = "hawki_util_gendist";
+ int iext;
+ int ichip;
+ cpl_parameter * par;
+ int dim_x;
+ int dim_y;
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve raw frames */
+ if ((rawframes = hawki_extract_frameset(framelist,
+ HAWKI_UTIL_DISTMAP_RAW)) == NULL) {
+ cpl_msg_error(__func__, "Cannot find raw frames in the input list") ;
+ return -1 ;
+ }
+
+ /* There should be HAWKI_NB_DETECTORS input frames ordered */
+ if (cpl_frameset_get_size(rawframes) != HAWKI_NB_DETECTORS) {
+ cpl_msg_error(__func__, "%d frames expected", HAWKI_NB_DETECTORS) ;
+ cpl_frameset_delete(rawframes) ;
+ return -1 ;
+ }
+
+ /* Retrieve parameters */
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_util_gendist.dim_x") ;
+ dim_x = cpl_parameter_get_int(par);
+ par = cpl_parameterlist_find(parlist, "hawki.hawki_util_gendist.dim_y") ;
+ dim_y = cpl_parameter_get_int(par);
+
+ /* Allocate holder for the tables */
+ distortion_table = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(cpl_table*)) ;
+
+ /* Loop on the chips */
+ for (ichip=0 ; ichip<HAWKI_NB_DETECTORS ; ichip++) {
+
+ /* Get the file name */
+ cur_frame = cpl_frameset_get_frame_const(rawframes, ichip) ;
+ dist_name = cpl_frame_get_filename(cur_frame) ;
+
+ /* Create the output table */
+ cpl_msg_info(__func__, "Create the output table for chip %d", ichip+1) ;
+ if ((distortion_table[ichip] = hawki_util_gendist_convert(dist_name)) == NULL) {
+ int j;
+ cpl_msg_error(__func__, "Cannot create the output table") ;
+ cpl_frameset_delete(rawframes) ;
+ for (j=0 ; j<ichip ; j++) cpl_table_delete(distortion_table[j]) ;
+ cpl_free(distortion_table) ;
+ return -1 ;
+ }
+ }
+
+ /* Write the table */
+ plist = cpl_propertylist_new() ;
+ cpl_propertylist_append_string(plist, "INSTRUME", "HAWKI") ;
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_TYPE,
+ HAWKI_PROTYPE_DISTORTION) ;
+ cpl_propertylist_append_string(plist, CPL_DFS_PRO_CATG,
+ HAWKI_CALPRO_DISTORTION) ;
+
+ plist_ext = cpl_propertylist_new() ;
+ cpl_propertylist_prepend_string(plist_ext, "EXTNAME", "CHIP1.INT1") ;
+ if (cpl_dfs_save_table(framelist, NULL, parlist, rawframes, NULL,
+ distortion_table[0], plist_ext, recipe_name,
+ plist, NULL, PACKAGE "/" PACKAGE_VERSION,
+ "hawki_util_gendist.fits") != CPL_ERROR_NONE) {
+ cpl_msg_error(__func__, "Cannot save the first extension table") ;
+ cpl_propertylist_delete(plist_ext) ;
+ cpl_propertylist_delete(plist) ;
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++)
+ cpl_table_delete(distortion_table[iext]) ;
+ cpl_free(distortion_table) ;
+ cpl_frameset_delete(rawframes) ;
+ return -1 ;
+ }
+ cpl_propertylist_delete(plist) ;
+ cpl_propertylist_delete(plist_ext) ;
+
+ /* Save the extensions */
+ for (iext=1 ; iext<HAWKI_NB_DETECTORS; iext++)
+ {
+ ichip = iext;
+ //This is the actual layout of the chips in raw HAWK-I images.
+ if(iext == 2)
+ ichip = 3;
+ if(iext == 3)
+ ichip = 2;
+ plist_ext = cpl_propertylist_new() ;
+ sprintf(sval, "CHIP%d.INT1", ichip+1) ;
+ cpl_propertylist_prepend_string(plist_ext, "EXTNAME", sval) ;
+ cpl_table_save(distortion_table[ichip], NULL, plist_ext,
+ "hawki_util_gendist.fits", CPL_IO_EXTEND);
+ cpl_propertylist_delete(plist_ext) ;
+ }
+
+ /* Allocate holder for the distortion images */
+ distortion_im = cpl_malloc(HAWKI_NB_DETECTORS * sizeof(hawki_distortion*));
+
+ /* Loop on the chips */
+ for (ichip=0 ; ichip<HAWKI_NB_DETECTORS ; ichip++)
+ {
+ /* Get the file name */
+ cur_frame = cpl_frameset_get_frame_const(rawframes, ichip) ;
+ dist_name = cpl_frame_get_filename(cur_frame) ;
+
+ /* Create the output image */
+ cpl_msg_info(__func__, "Create the output images for extension %d", ichip+1) ;
+ if ((distortion_im[ichip] = hawki_util_gendist_convert_to_images
+ (distortion_table[ichip], dim_x, dim_y)) == NULL)
+ {
+ int j;
+ cpl_msg_error(__func__,"Cannot create the output distortion images");
+ cpl_frameset_delete(rawframes);
+ for (j=0 ;j < ichip; j++)
+ hawki_distortion_delete(distortion_im[j]);
+ cpl_free(distortion_im) ;
+ return -1 ;
+ }
+ }
+
+ /* Write the distortion images */
+ plist = cpl_propertylist_new() ;
+ cpl_propertylist_append_string(plist, "INSTRUME", "HAWKI");
+ //This two keywords are needed by QC. I do not why..
+ cpl_propertylist_append_string(plist, "MJD-OBS", "55128.5000000");
+ cpl_propertylist_append_string(plist, "FOR_QC", "dummy.fits");
+ cpl_propertylist_append_string(plist, "ORIGFILE",
+ "hawki_util_gendist_distx.fits") ;
+ hawki_main_header_save(framelist, parlist, rawframes,
+ "hawki_util_gendist",
+ HAWKI_CALPRO_DISTORTION_X,
+ HAWKI_PROTYPE_DISTORTION_X,
+ plist, "hawki_util_gendist_distx.fits");
+ cpl_propertylist_erase(plist, "ORIGFILE");
+ cpl_propertylist_append_string(plist, "ORIGFILE",
+ "hawki_util_gendist_distx.fits") ;
+ hawki_main_header_save(framelist, parlist, rawframes,
+ "hawki_util_gendist",
+ HAWKI_CALPRO_DISTORTION_Y,
+ HAWKI_PROTYPE_DISTORTION_Y,
+ plist, "hawki_util_gendist_disty.fits");
+ cpl_propertylist_delete(plist) ;
+
+ /* Save the extensions */
+ //There is kind of a hack here
+ //We use the distortion table as a reference to save the distortion images
+ //to have a proper layout of the detectors in the FITS file.
+ //For that hawki_get_extref_file has been modified.
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS; iext++) {
+ ichip = iext;
+ //This is the actual layout of the chips in raw HAWK-I images.
+ if(iext == 2)
+ ichip = 3;
+ if(iext == 3)
+ ichip = 2;
+ plist_ext = cpl_propertylist_new() ;
+ cpl_propertylist_append_double(plist_ext, "CRVAL1",
+ distortion_im[ichip]->x_crval);
+ cpl_propertylist_append_double(plist_ext, "CRVAL2",
+ distortion_im[ichip]->y_crval);
+ cpl_propertylist_append_double(plist_ext, "CDELT1",
+ distortion_im[ichip]->x_cdelt);
+ cpl_propertylist_append_double(plist_ext, "CDELT2",
+ distortion_im[ichip]->y_cdelt);
+ cpl_propertylist_append_double(plist_ext, "CRPIX1", 1);
+ cpl_propertylist_append_double(plist_ext, "CRPIX2", 1);
+ cpl_propertylist_append_string(plist_ext, "CTYPE1", "");
+ cpl_propertylist_append_string(plist_ext, "CTYPE2", "");
+ cpl_propertylist_append_string(plist_ext, "CUNIT1", "");
+ cpl_propertylist_append_string(plist_ext, "CUNIT2", "");
+ hawki_image_ext_save(framelist, distortion_im[ichip]->dist_x, iext + 1,
+ plist_ext, "hawki_util_gendist_distx.fits");
+ hawki_image_ext_save(framelist, distortion_im[ichip]->dist_y, iext + 1,
+ plist_ext, "hawki_util_gendist_disty.fits");
+ cpl_propertylist_delete(plist_ext);
+ }
+
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++)
+ cpl_table_delete(distortion_table[iext]);
+ cpl_free(distortion_table) ;
+
+ for (iext=0 ; iext<HAWKI_NB_DETECTORS ; iext++)
+ hawki_distortion_delete(distortion_im[iext]);
+ cpl_free(distortion_im) ;
+ cpl_frameset_delete(rawframes) ;
+
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert the ASCII catalog to the table
+ @param filename the ascii file
+ @return the newly allocated table or NULL in error case
+
+ The returned table must be deallocated with cpl_table_delete().
+
+ The input catalogs are ASCII files respecting this format:
+
+ DXGC DYGC I J
+
+ DXGC: x geometric correction to apply
+ DYGC: y geometric correction to apply
+ I: x position in pixel in the chip
+ J: y position in pixel in the chip
+
+ Example:
+0.68507 -0.37879 0 0
+1.49079 -0.60040 256 0
+1.43017 -0.01965 512 0
+1.30543 0.55538 768 0
+1.15870 1.18921 1024 0
+1.04449 1.91096 1280 0
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_table * hawki_util_gendist_convert(const char * filename)
+{
+ cpl_table * out ;
+ int nbentries ;
+ FILE * in ;
+ double dxgc, dygc ;
+ int i, j ;
+ char line[1024];
+
+ /* Check entries */
+ if (filename == NULL) return NULL ;
+
+ /* Get the number of lines */
+ nbentries = 0 ;
+ if ((in = fopen(filename, "r")) == NULL) {
+ return NULL ;
+ }
+ while (fgets(line, 1024, in) != NULL) {
+ if (line[0] != '#') nbentries ++ ;
+ }
+ fclose(in) ;
+
+ /* Create the table */
+ out = cpl_table_new(nbentries);
+ cpl_table_new_column(out, HAWKI_COL_DIST_DXGC, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(out, HAWKI_COL_DIST_DXGC, "pixels");
+ cpl_table_new_column(out, HAWKI_COL_DIST_DYGC, CPL_TYPE_DOUBLE);
+ cpl_table_set_column_unit(out, HAWKI_COL_DIST_DYGC, "pixels");
+ cpl_table_new_column(out, HAWKI_COL_DIST_I, CPL_TYPE_INT);
+ cpl_table_set_column_unit(out, HAWKI_COL_DIST_I, "pixels");
+ cpl_table_new_column(out, HAWKI_COL_DIST_J, CPL_TYPE_INT);
+ cpl_table_set_column_unit(out, HAWKI_COL_DIST_J, "pixels");
+
+ /* Parse the file */
+ if ((in = fopen(filename, "r")) == NULL) {
+ cpl_table_delete(out) ;
+ return NULL ;
+ }
+ nbentries = 0 ;
+ while (fgets(line, 1024, in) != NULL) {
+ if (line[0] != '#') {
+ if (sscanf(line, "%lg %lg %d %d",
+ &dxgc, &dygc, &i, &j) != 4) {
+ cpl_msg_error(__func__, "Bad line %d", nbentries+1) ;
+ cpl_table_delete(out) ;
+ return NULL ;
+ }
+ cpl_table_set_double(out, HAWKI_COL_DIST_DXGC, nbentries, dxgc);
+ cpl_table_set_double(out, HAWKI_COL_DIST_DYGC, nbentries, dygc);
+ cpl_table_set_int(out, HAWKI_COL_DIST_I, nbentries, i);
+ cpl_table_set_int(out, HAWKI_COL_DIST_J, nbentries, j);
+ nbentries ++ ;
+ }
+ }
+ fclose(in) ;
+
+ return out ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert the ASCII catalog to a pair of images
+ @param dist_tab the distortion file
+ @return the newly allocated distortion or NULL in error case
+
+ The returned struct must be deallocated with hawki_distortion_delete().
+
+ The input tables are FITS files with this columns:
+
+ DXGC DYGC I J
+
+ DXGC: x geometric correction to apply
+ DYGC: y geometric correction to apply
+ I: x position in pixel in the chip
+ J: y position in pixel in the chip
+
+ */
+/*----------------------------------------------------------------------------*/
+static hawki_distortion * hawki_util_gendist_convert_to_images
+(const cpl_table * dist_tab,
+ int detector_nx,
+ int detector_ny)
+{
+ hawki_distortion * out ;
+ int nbentries ;
+ int ngrid;
+ const int * i_ptr;
+ const int * j_ptr;
+ cpl_array * i_vec;
+ cpl_array * j_vec;
+ int irow;
+
+
+ /* Check entries */
+ if (dist_tab == NULL) return NULL ;
+
+ /* Create the table */
+ nbentries = cpl_table_get_nrow(dist_tab);
+ ngrid = sqrt(nbentries);
+ if(ngrid * ngrid != nbentries)
+ {
+ cpl_msg_error(__func__,"Only square grids are supported");
+ return NULL;
+ }
+ out = hawki_distortion_grid_new(detector_nx, detector_ny, ngrid);
+
+ /* Get the crval, cdelt */
+ i_ptr = cpl_table_get_data_int_const(dist_tab, HAWKI_COL_DIST_I);
+ i_vec = cpl_array_wrap_int((int *)i_ptr, nbentries);
+ out->x_crval = cpl_array_get_min(i_vec);
+ out->x_cdelt = (cpl_array_get_max(i_vec) - cpl_array_get_min(i_vec)) /
+ (ngrid - 1);
+ cpl_array_unwrap(i_vec);
+ j_ptr = cpl_table_get_data_int_const(dist_tab, HAWKI_COL_DIST_J);
+ j_vec = cpl_array_wrap_int((int *)j_ptr, nbentries);
+ out->y_crval = cpl_array_get_min(j_vec);
+ out->y_cdelt = (cpl_array_get_max(j_vec) - cpl_array_get_min(j_vec)) /
+ (ngrid - 1);
+ cpl_array_unwrap(j_vec);
+
+
+ /* Fill the image */
+ for(irow = 0; irow < nbentries; ++irow)
+ {
+ double i_ima;
+ double j_ima;
+ double dx;
+ double dy;
+ int null;
+
+ i_ima = (cpl_table_get_int(dist_tab, HAWKI_COL_DIST_I, irow, &null) -
+ out->x_crval) / out->x_cdelt;
+ if(floor(i_ima) != i_ima)
+ {
+ cpl_msg_error(__func__, " The distortion tables must be defined "
+ "in a regular grid");
+ hawki_distortion_delete(out);
+ return NULL;
+ }
+ j_ima = (cpl_table_get_int(dist_tab, HAWKI_COL_DIST_J, irow, &null) -
+ out->y_crval) / out->y_cdelt;
+ if(floor(j_ima) != j_ima)
+ {
+ cpl_msg_error(__func__, " The distortion tables must be defined "
+ "in a regular grid");
+ hawki_distortion_delete(out);
+ return NULL;
+ }
+ dx = cpl_table_get_double(dist_tab, HAWKI_COL_DIST_DXGC, irow, &null);
+ dy = cpl_table_get_double(dist_tab, HAWKI_COL_DIST_DYGC, irow, &null);
+
+ cpl_image_set(out->dist_x, (int)i_ima + 1, (int)j_ima + 1, dx);
+ cpl_image_set(out->dist_y, (int)i_ima + 1, (int)j_ima + 1, dy);
+ }
+
+ return out ;
+}
diff --git a/recipes/hawki_util_stdstars.c b/recipes/hawki_util_stdstars.c
new file mode 100644
index 0000000..d1b76c7
--- /dev/null
+++ b/recipes/hawki_util_stdstars.c
@@ -0,0 +1,315 @@
+/* $Id: hawki_util_stdstars.c,v 1.16 2011/07/06 08:21:36 cgarcia Exp $
+ *
+ * This file is part of the HAWKI Pipeline
+ * Copyright (C) 2002,2003 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: cgarcia $
+ * $Date: 2011/07/06 08:21:36 $
+ * $Revision: 1.16 $
+ * $Name: hawki-1_8_9 $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <math.h>
+#include <cpl.h>
+
+#include "irplib_utils.h"
+#include "irplib_stdstar.h"
+
+#include "hawki_utils.h"
+#include "hawki_load.h"
+#include "hawki_pfits.h"
+#include "hawki_dfs.h"
+
+/*-----------------------------------------------------------------------------
+ Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+static int hawki_util_stdstars_create(cpl_plugin *) ;
+static int hawki_util_stdstars_exec(cpl_plugin *) ;
+static int hawki_util_stdstars_destroy(cpl_plugin *) ;
+static int hawki_util_stdstars(cpl_frameset *) ;
+static cpl_table * hawki_util_stdstars_convert(const char *) ;
+
+/*-----------------------------------------------------------------------------
+ Static variables
+ -----------------------------------------------------------------------------*/
+
+static char hawki_util_stdstars_description[] =
+"hawki_util_stdstars -- HAWK-I standard stars catalog creation.\n"
+"The files listed in the Set Of Frames (sof-file) must be tagged:\n"
+"raw-file.txt "HAWKI_UTIL_STDSTARS_RAW"\n" ;
+
+/*-----------------------------------------------------------------------------
+ Functions code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Build the list of available plugins, for this module.
+ @param list the plugin list
+ @return 0 if everything is ok
+
+ This function is exported.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+ cpl_recipe * recipe = cpl_calloc(1, sizeof(*recipe)) ;
+ cpl_plugin * plugin = &recipe->interface ;
+
+ cpl_plugin_init(plugin,
+ CPL_PLUGIN_API,
+ HAWKI_BINARY_VERSION,
+ CPL_PLUGIN_TYPE_RECIPE,
+ "hawki_util_stdstars",
+ "Standard stars catalog creation",
+ hawki_util_stdstars_description,
+ "Cesar Enrique Garcia Dabo",
+ PACKAGE_BUGREPORT,
+ hawki_get_license(),
+ hawki_util_stdstars_create,
+ hawki_util_stdstars_exec,
+ hawki_util_stdstars_destroy) ;
+
+ cpl_pluginlist_append(list, plugin) ;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Setup the recipe options
+ @param plugin the plugin
+ @return 0 if everything is ok
+
+ Create the recipe instance and make it available to the application using the
+ interface.
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_stdstars_create(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Create the parameters list in the cpl_recipe object */
+ recipe->parameters = cpl_parameterlist_new() ;
+
+ /* Return */
+ return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Execute the plugin instance given by the interface
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_stdstars_exec(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ /* Issue a banner */
+ hawki_print_banner();
+
+ return hawki_util_stdstars(recipe->frames) ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Destroy what has been created by the 'create' function
+ @param plugin the plugin
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_stdstars_destroy(cpl_plugin * plugin)
+{
+ cpl_recipe * recipe ;
+
+ /* Get the recipe out of the plugin */
+ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+ recipe = (cpl_recipe *)plugin ;
+ else return -1 ;
+
+ cpl_parameterlist_delete(recipe->parameters) ;
+ return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief The recipe data reduction part is implemented here
+ @param framelist the frames list
+ @return 0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int hawki_util_stdstars(
+ cpl_frameset * framelist)
+{
+ cpl_frameset * rawframes ;
+ const char * recipe_name = "hawki_util_stdstars" ;
+
+
+ /* Identify the RAW and CALIB frames in the input frameset */
+ if (hawki_dfs_set_groups(framelist)) {
+ cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
+ return -1 ;
+ }
+
+ /* Retrieve raw frames */
+ if ((rawframes = hawki_extract_frameset(framelist,
+ HAWKI_UTIL_STDSTARS_RAW)) == NULL) {
+ cpl_msg_error(__func__, "Cannot find raw frames in the input list") ;
+ return -1 ;
+ }
+
+ /* Write the catalog */
+ if (irplib_stdstar_write_catalogs(framelist,
+ rawframes,
+ recipe_name,
+ HAWKI_CALPRO_STDSTARS,
+ HAWKI_PROTYPE_STDSTARS,
+ PACKAGE "/" PACKAGE_VERSION,
+ "HAWKI",
+ hawki_util_stdstars_convert) == -1) {
+ cpl_msg_error(__func__, "Cannot write the catalogs") ;
+ cpl_frameset_delete(rawframes) ;
+ return -1 ;
+ }
+ cpl_frameset_delete(rawframes) ;
+
+ /* Return */
+ if (cpl_error_get_code())
+ {
+ cpl_msg_error(__func__,
+ "HAWK-I pipeline could not recover from previous errors");
+ return -1 ;
+ }
+ else return 0 ;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Convert the ASCII catalog to the table
+ @param filename the ascii file
+ @return the newly allocated table or NULL in error case
+
+ The returned table must be deallocated with cpl_table_delete().
+
+ The inputcatalogs are ASCII files respecting this format:
+
+ Star_name RA DEC Spec_type MAG_FILT1 MAG_FILT2
+
+ Example:
+ AS01-0 13.7912 0.720278 -- 10.716 10.507
+ AS03-0 16.09 4.2275 -- 12.606 12.729
+ AS04-1 28.6808 0.733056 -- 12.371 12.033
+ ...
+
+ 99 is the value for unknown magnitudes.
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_table * hawki_util_stdstars_convert(const char * filename)
+{
+ cpl_table * out ;
+ int nfilters ;
+ const char * filters[4];
+ double mags[4] ;
+ int nbentries ;
+ FILE * in ;
+ char line[1024];
+ double ra, dec ;
+ char sname[512];
+ char stype[512];
+ int i ;
+
+ /* Check entries */
+ if (filename == NULL) return NULL ;
+
+ /* Initialise */
+ nfilters = 4 ;
+ filters[0] = hawki_std_band_name(HAWKI_BAND_J) ;
+ filters[1] = hawki_std_band_name(HAWKI_BAND_H) ;
+ filters[2] = hawki_std_band_name(HAWKI_BAND_K) ;
+ filters[3] = hawki_std_band_name(HAWKI_BAND_Y) ;
+
+ /* Get the number of lines */
+ nbentries = 0 ;
+ if ((in = fopen(filename, "r")) == NULL) {
+ return NULL ;
+ }
+ while (fgets(line, 1024, in) != NULL) {
+ if (line[0] != '#') nbentries ++ ;
+ }
+ fclose(in) ;
+
+ /* Create the table */
+ out = cpl_table_new(nbentries);
+ cpl_table_new_column(out, IRPLIB_STDSTAR_STAR_COL, CPL_TYPE_STRING);
+ cpl_table_new_column(out, IRPLIB_STDSTAR_TYPE_COL, CPL_TYPE_STRING);
+ cpl_table_new_column(out, IRPLIB_STDSTAR_RA_COL, CPL_TYPE_DOUBLE);
+ cpl_table_new_column(out, IRPLIB_STDSTAR_DEC_COL, CPL_TYPE_DOUBLE);
+ for (i=0 ; i<nfilters ; i++)
+ cpl_table_new_column(out, filters[i], CPL_TYPE_DOUBLE);
+
+ /* Parse the file */
+ if ((in = fopen(filename, "r")) == NULL) {
+ cpl_table_delete(out) ;
+ return NULL ;
+ }
+ nbentries = 0 ;
+ while (fgets(line, 1024, in) != NULL) {
+ if (line[0] != '#') {
+ if (sscanf(line, "%s %lg %lg %s %lg %lg %lg %lg",
+ sname, &ra, &dec, stype, &(mags[0]), &(mags[1]),
+ &(mags[2]), &(mags[3])) != 8) {
+ cpl_table_delete(out) ;
+ return NULL ;
+ }
+ cpl_table_set_string(out, IRPLIB_STDSTAR_STAR_COL,nbentries, sname);
+ cpl_table_set_string(out, IRPLIB_STDSTAR_TYPE_COL,nbentries, stype);
+ cpl_table_set_double(out, IRPLIB_STDSTAR_RA_COL, nbentries, ra);
+ cpl_table_set_double(out, IRPLIB_STDSTAR_DEC_COL, nbentries, dec);
+ for (i=0 ; i<nfilters ; i++)
+ cpl_table_set_double(out, filters[i], nbentries, mags[i]);
+ nbentries ++ ;
+ }
+ }
+ fclose(in) ;
+
+ return out ;
+}
+
diff --git a/reflex/Hawki_Calib_Science.xml.in b/reflex/Hawki_Calib_Science.xml.in
new file mode 100644
index 0000000..00f1a78
--- /dev/null
+++ b/reflex/Hawki_Calib_Science.xml.in
@@ -0,0 +1,3960 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
+ "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
+<entity name="Hawki_Calib_Science" class="ptolemy.actor.TypedCompositeActor">
+ <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.0.2">
+ </property>
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={214, 43, 1689, 1103}, maximized=false}">
+ </property>
+ <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1414, 974]">
+ </property>
+ <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="0.7851994921519">
+ </property>
+ <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{898.4081218423236, 525.2245478602708}">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
+
+<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
+</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[35.0, 345.0]">
+ </property>
+ <property name="SOP" class="ptolemy.data.expr.StringParameter" value="<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0_06" class="java.beans.XMLDecoder">
<object class="java.util.HashMap">
<void method="put">
<string>hawki_cal_flat</string>
<object class="java.util.ArrayList">
<void method="add">
[...]
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
+
+<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
+</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{65, 330}">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </property>
+ <property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="timeResolution" class="ptolemy.moml.SharedParameter" value="1E-10">
+ </property>
+ <property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="runUntilDeadlockInOneIteration" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
+ <p> The dynamic dataflow (DDF) domain is a superset of the synchronous
+ dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
+ an actor consumes and produces a fixed number of tokens per firing.
+ This static information makes possible compile-time scheduling. In the
+ DDF domain, there are few constraints on the production and consumption
+ behavior of actors, and the schedulers make no attempt to construct a
+ compile-time schedule. Instead, each actor has a set of firing rules
+ (patterns) and can be fired if one of them is satisfied, i.e., one
+ particular firing pattern forms a prefix of sequences of unconsumed
+ tokens at input ports. The canonical actors in the DDF domain include
+ Select and Switch, which consume or produce tokens on different channels
+ based on the token received from the control port. (In practice, use
+ DDFSelect and DDFBooleanSelect in the DDF-specific library instead of
+ Select and BooleanSelect in the regular FlowControl library; however,
+ Switch and BooleanSwitch in the regular FlowControl library can be
+ used in DDF domain.)</p>
+
+ <p> The dynamic scheduler implemented in this director fires all enabled
+ and non-deferrable actors once in a basic iteration. A deferrable
+ actor is one that will not help one of the downstream actors become
+ enabled because that downstream actor either already has enough tokens on
+ the channel connecting those two actors or is waiting for tokens on
+ another channel. If no actor fires so far, which means there is no
+ enabled and non-deferrable actor, then among all enabled and deferrable
+ actors, this director fires those which have the smallest maximum number
+ of tokens on their output channels which satisfy the demand of destination
+ actors. If still no actor fires, then there is no enabled actor. A user
+ can treat several such basic iterations as a single iteration by adding
+ a parameter with name <i>requiredFiringsPerIteration</i> to an actor
+ (which is often a sink actor or an actor directly connected to output port
+ of the composite actor) and specifying the number of times this actor must
+ be fired in a single iteration. If the value of the parameter
+ <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true,
+ one single iteration consists of repeating the basic iteration until
+ deadlock is reached (thus overriding the previous definition of one
+ iteration), which is the status of the model where all active
+ actors under the control of this director are unable to fire because
+ their firing rules are not satisfied. However, they may be able to fire
+ again during next iteration when tokens are transferred in from an outside
+ domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true
+ only when this director is not on the top level.</p>
+
+ <p> The algorithm implementing one basic iteration goes like this:
+ <pre>
+ E = set of enabled actors
+ D = set of deferrable enabled actors
+ </pre>
+ One basic(default) iteration consists of:
+ <pre>
+ if (E\D != empty set) {
+ fire (E\D)
+ } else if (D != empty set) {
+ fire minimax(D)
+ } else {
+ declare deadlock
+ }
+ </pre>
+ The function "minimax(D)" returns a subset of D with the smallest
+ maximum number of tokens on their output channels which satisfy the
+ demand of destination actors.</p>
+
+ <p> Note that any SDF model can be run with a DDF Director. However, the
+ notion of iteration is different. One could try to imitate the SDF
+ iteration in the DDF domain by controlling the number of firings in one
+ iteration for some actors, such as requiring a plotter to plot a fixed
+ number of points in each iteration.</p>
+
+ <p> In the DDF domain, the firing rule of any actor is specified by the token
+ consumption rates of its input ports. A general DDF actor could change
+ the consumption rates of its input ports after each firing of this actor.
+ For multiports, an array token could be used to specify different rates
+ for different channels connected to the same multiport. Note that in SDF,
+ all channels connected to the same multiport have the same rate.</p>
+
+ <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee.
+ See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic,
+ Vol. 1, Chapter 7, 1997.</p>
+
+ </configure></property>
+<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
+<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
+<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:director:5:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:5:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[25.0, -85.0]">
+ </property>
+ </property>
+ <property name="BOOKKEEPING_DIR" class="ptolemy.data.expr.FileParameter" value="$ROOT_DATA_DIR/reflex_book_keeping/Hawki">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[580.0, 185.0]">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ </property>
+ <property name="TMP_PRODUCTS_DIR" class="ptolemy.data.expr.FileParameter" value="$ROOT_DATA_DIR/reflex_tmp_products/Hawki">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[580.0, 235.0]">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ </property>
+ <property name="LOGS_DIR" class="ptolemy.data.expr.FileParameter" value="$ROOT_DATA_DIR/reflex_logs/Hawki">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[580.0, 210.0]">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ </property>
+ <property name="RAWDATA_DIR" class="ptolemy.data.expr.FileParameter" value="$ROOT_DATA_DIR/reflex_input/HAWK-I">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[580.0, 125.0]">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ </property>
+ <property name="END_PRODUCTS_DIR" class="ptolemy.data.expr.FileParameter" value="$ROOT_DATA_DIR/reflex_end_products/">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[580.0, 300.0]">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ </property>
+ <property name="FITS_VIEWER" class="ptolemy.data.expr.FileParameter" value="fv">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1040.0, 110.0]">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ </property>
+ <property name="ESORexArgs" class="ptolemy.data.expr.StringParameter" value="--suppress-prefix=TRUE">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
+
+<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
+</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1040.0, 170.0]">
+ </property>
+ </property>
+ <property name="EraseDirs" class="ptolemy.data.expr.StringParameter" value="false">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
+
+<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
+</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1040.0, 255.0]">
+ </property>
+ </property>
+ <property name="Annotation2" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="38">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4, 0.7, 0.3, 1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="HAWK-I Workflow For Jittered Imaging Data (v. @VERSION@)">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:2479:34:2">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[140.0, -95.0]">
+ </property>
+ </property>
+ <property name="ROOT_DATA_DIR" class="ptolemy.data.expr.FileParameter" value="HAWKI_DATA_PATH_TO_REPLACE/">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>yang zhao, edward lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>none</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
+
+<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the specified file using the $NAME syntax (e.g., $FileParameter or $SourceFile).</p>
+
+<p>File names can be specified in several ways:</p>
+
+<ol>
+<li>As a full path, which can be selected via the Browse option.</li>
+
+<li>As a path relative to a base, often the path of the parent workflow. Files specified relative to a base can be kept in the same directory as the parent workflow file, and should be moved together with the workflow. Note: workflows must be saved as MOML files before the workflow path can be used as a base. If the workflow has not been saved to a file, then the class path is used for identifying relative file names. </li>
+
+<li>A path that contains references to system-defined strings via the $NAME syntax (e.g., $CWD or $HOME). The following strings may be useful (to see the values of these strings, select "Check System Settings" from the Tools menu in the Toolbar):
+<table>
+<tr><td> $CWD</td><td>The current working directory </td></tr>
+<tr><td>$HOME</td><td>The user's home directory</td></tr>
+<tr><td> $TMPDIR</td><td>The temporary directory</td></tr>
+ </table>
+</li>
+<li>A special file name. The following file names are understood:
+<table>
+<tr><td> System.in </td><td> Standard input </td></tr>
+<tr><td>System.out</td><td>Standard output</td></tr>
+ </table>
+</li>
+</ol>
+</configure></property>
+<property name="prop:fileParameter" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The specified file or URL.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:422:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.FileParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1186:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 1.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:#00BB00" y="20">-F-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[580.0, 100.0]">
+ </property>
+ <property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.data.expr.StringParameter" value="<p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
<p>Change the name of the FileParameter to better identify the file it specifies (right-click the parameter and select &qu [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="yang zhao, edward lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="none">
+ </property>
+ <property name="fileParameter (parameter)" class="ptolemy.data.expr.StringParameter" value="The specified file or URL.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation3" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="
To run this workflow on the demo data:
- Turn on highlighting. Choose "Tools"-> "Animate at Runtime"
from top menu and set it to "1".
- Press the "Run" button OR cntrl-R to start the workflow.
To run on a different data set:
- Click on ROOT_DATA_DIR and set as appropriate.
All subdirectories of RAWDATA_DIR will be [...]
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{20.0, 55.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation4" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="18">
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Workflow Instructions
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{35.0, -10.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Rectangle" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{5.0, -30.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="520.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="66.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Rectangle2" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1015.0, -30.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="627.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="66.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Rectangle3" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{535.0, -30.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="469.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="66.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Annotation5" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="18">
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Setup Directories
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{555.0, -10.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation6" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="18">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Global Parameters
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1040.0, -10.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation7" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="16">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Input:
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{670.0, 60.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation8" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="16">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Working Directories:
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{625.0, 145.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation9" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="16">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Output:
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{670.0, 250.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="textSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.">
+ </property>
+ <property name="textColor (parameter)" class="ptolemy.data.expr.StringParameter" value="The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}">
+ </property>
+ <property name="fontFamily (parameter)" class="ptolemy.data.expr.StringParameter" value="The font face. Select a font from the drop-down menu. The default is "SansSerif".">
+ </property>
+ <property name="bold (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be bold. By default, type will not be bold.">
+ </property>
+ <property name="italic (parameter)" class="ptolemy.data.expr.StringParameter" value="Select to indicate that the type should be italics. By default, type will not be italicized.">
+ </property>
+ <property name="text (parameter)" class="ptolemy.data.expr.StringParameter" value="The text of the annotation.">
+ </property>
+ </property>
+ </property>
+ <property name="Annotation10" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="If END_PRODUCTS_DIR or ROOT_DATA_DIR is changed
using the Browse button, the leading 'file:' has to be removed
manually!">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{555.0, 315.0}">
+ </property>
+ </property>
+ <property name="Annotation11" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="fits viewer to use for the
inspection of input/output
products
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1205.0, 80.0}">
+ </property>
+ </property>
+ <property name="Annotation12" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="esorex arguments
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1335.0, 160.0}">
+ </property>
+ </property>
+ <property name="Annotation13" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Change "EraseDirs" to true to erase
BOOKKEEPING_DIR, TMP_PRODUCTS_DIR and LOGS_DIR
each time the workflow is run (Lazy Mode won't work anymore)">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1205.0, 225.0}">
+ </property>
+ </property>
+ <property name="Annotation14" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This is set automatically">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1475.0, 290.0}">
+ </property>
+ </property>
+ <property name="END_PRODUCT_SUBDIR" class="ptolemy.data.expr.StringParameter" value="2011-03-03T17:52:46/Science_DataSet_1">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
+
+<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
+</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1040.0, 305.0}">
+ </property>
+ </property>
+ <property name="GLOBAL_TIMESTAMP" class="ptolemy.data.expr.StringParameter" value="2011-03-03T17:52:46">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
+
+<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
+</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1040.0, 345.0}">
+ </property>
+ </property>
+ <property name="Annotation15" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This is set automatically">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1475.0, 330.0}">
+ </property>
+ </property>
+ <property name="Rectangle4" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1270.0, 395.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="157.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="130.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Rectangle5" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{45.0, 395.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="225.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="130.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="24">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value=" Step 5:
Output
Organisation
">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1450.0, 420.0}">
+ </property>
+ </property>
+ <property name="Annotation16" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="24">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value=" Step 3:
Sky
Subtraction">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{925.0, 420.0}">
+ </property>
+ </property>
+ <property name="Annotation17" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="24">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value=" Step 1:
Data Organisation
and Selection">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{50.0, 420.0}">
+ </property>
+ </property>
+ <property name="Annotation18" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="24">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value=" Step 4:
Jitter
Combination">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1285.0, 420.0}">
+ </property>
+ </property>
+ <property name="Rectangle6" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1435.0, 395.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="183.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="130.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Rectangle7" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{915.0, 395.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="345.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="130.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Rectangle8" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{280.0, 395.0}">
+ </property>
+ <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
+ </property>
+ <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="627.0">
+ </property>
+ <property name="height" class="ptolemy.data.expr.Parameter" value="130.0">
+ </property>
+ <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ </property>
+ <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
+<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:434:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ </property>
+ <property name="Annotation19" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="24">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value=" Step 2:
Creation of Master
Calibration Files">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{480.0, 420.0}">
+ </property>
+ </property>
+ <entity name="hawki_step_basic_calib_1" class="org.eso.RecipeExecuter">
+<display name="Basic Calibration"/> <property name="mode" class="ptolemy.data.expr.StringParameter" value="Run">
+ </property>
+ <property name="Input Files Tag" class="ptolemy.data.expr.StringParameter" value="JITTER_OBS,FLAT_IM,DARK_IM,BPM">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[645.0, 645.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_compute_bkg_1" class="org.eso.RecipeExecuter">
+<display name="compute_bkg_1"/> <property name="recipe_param_2" class="ptolemy.data.expr.Parameter" value="nhalf_window=9">
+ </property>
+ <property name="recipe_param_3" class="ptolemy.data.expr.Parameter" value="rejlow=2">
+ </property>
+ <property name="recipe_param_4" class="ptolemy.data.expr.Parameter" value="rejhigh=2">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[775.0, 685.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_cal_dark_1" class="org.eso.RecipeExecuter">
+<display name="Master Dark Creation"/> <property name="mode" class="ptolemy.data.expr.StringParameter" value="Run">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[340.0, 645.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_cal_flat_1" class="org.eso.RecipeExecuter">
+<display name="Master Flat Creation"/> <property name="Lazy Mode" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="Input Files Tag" class="ptolemy.data.expr.StringParameter" value="FLAT,DARK_IM,BPM_HOT">
+ </property>
+ <property name="recipe_param_3" class="ptolemy.data.expr.Parameter" value="second_pass=FALSE">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[395.0, 725.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_subtract_bkg_1" class="org.eso.RecipeExecuter">
+<display name="subtract_bkg_1"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[830.0, 760.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_combine_1" class="org.eso.RecipeExecuter">
+<display name="combine_1"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[920.0, 820.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_detect_obj_1" class="org.eso.RecipeExecuter">
+<display name="detect_obj_1"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[1000.0, 875.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_compute_bkg_2" class="org.eso.RecipeExecuter">
+<display name="compute_bkg_2"/> <property name="recipe_param_2" class="ptolemy.data.expr.Parameter" value="nhalf_window=8">
+ </property>
+ <property name="recipe_param_3" class="ptolemy.data.expr.Parameter" value="rejlow=1">
+ </property>
+ <property name="recipe_param_4" class="ptolemy.data.expr.Parameter" value="rejhigh=2">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[750.0, 875.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_subtract_bkg_2" class="org.eso.RecipeExecuter">
+<display name="subtract_bkg_2"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[835.0, 945.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_combine_2" class="org.eso.RecipeExecuter">
+<display name="combine_2"/> <property name="Lazy Mode" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="recipe_param_4" class="ptolemy.data.expr.Parameter" value="borders=8">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1305.0, 1065.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_apply_dist_1" class="org.eso.RecipeExecuter">
+<display name="apply_dist_1"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[1155.0, 1000.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_refine_offsets_1" class="org.eso.RecipeExecuter">
+<display name="refine_offsets_1"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[1305.0, 965.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="hawki_step_detect_obj_2" class="org.eso.RecipeExecuter">
+<display name="detect_obj_2"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[1495.0, 925.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="warnings" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="errors" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected inputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <port name="rejected outputs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ </entity>
+ <entity name="DataOrganizer" class="org.eso.DataOrganizer">
+ <property name="OCA File" class="ptolemy.data.expr.FileParameter" value="@prefix@/share/esopipes/hawki- at VERSION@/reflex/hawki_wkf.oca">
+ </property>
+ <property name="Keywords to be displayed" class="ptolemy.data.expr.StringParameter" value="OBJECT,DPR.CATG,DO.CATG,DO.CLASS">
+ </property>
+ <property name="Keywords File" class="ptolemy.data.expr.FileParameter" value="">
+ </property>
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:workflow:6:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.DataOrganizer">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ </property>
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.data.expr.StringParameter" value="The DataOrganizer organizes and classifies raw and reduced data: it takes as inputs all the files contained in a given directory, classifies them and organizes them in so called LoSOs (List of Science Observation). Each LoSO contains science frames, all the calibration needed to reduce them and custom parameters for the reduction recipes.">
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="ESO">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="1.0">
+ </property>
+ <property name="OCA File (parameter)" class="ptolemy.data.expr.StringParameter" value="The filename (full path) containing the OCA rules used for classification and organization. Look at the user manual for more info.">
+ </property>
+ <property name="class (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="semanticType41 (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="data dir (port)" class="ptolemy.kernel.util.StringAttribute" value="The directory containing the input data. It is scanned recursively.">
+ </property>
+ <property name="LoSOs (port)" class="ptolemy.kernel.util.StringAttribute" value="The produced LoSOs">
+ </property>
+ <property name="Keywords List (parameter)" class="ptolemy.data.expr.StringParameter" value="A comma separated list of FITS keywords which are extracted from all files in addition to the ones selected by the OCA rules">
+ </property>
+ <property name="entityId (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[125.0, 810.0]">
+ </property>
+ <port name="data dir" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="LoSOs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="DataSetChooser" class="org.eso.DataSetChooser">
+ <property name="Mode" class="ptolemy.data.expr.StringParameter" value="Select">
+ </property>
+ <property name="FITS Viewer" class="ptolemy.data.expr.StringParameter" value="$FITS_VIEWER">
+ </property>
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:workflow:5:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.DataSetChooser">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ </property>
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.data.expr.StringParameter" value="<p>The DataSetChooser allows you to view and select the group of files created by the DataOrganizer: it displays a list of LoSOs and gives the possibility of selecting, deselecting and analyze them.</p>
<p>It produces one token on the output port per selected LoSO</p>
">
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="ESO">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="1.0">
+ </property>
+ <property name="Mode (parameter)" class="ptolemy.data.expr.StringParameter" value="<p>Skip: automatically select all files and don't show any window;</p><p>Display: select all the files and allow the user only to view them;</p><p>Select: standard mode.</p>">
+ </property>
+ <property name="FITS Viewer (parameter)" class="ptolemy.data.expr.StringParameter" value="The application used to inspect FITS files">
+ </property>
+ <property name="class (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="semanticType41 (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="LoSOs (port)" class="ptolemy.kernel.util.StringAttribute" value="The input LoSOs">
+ </property>
+ <property name="sof (port)" class="ptolemy.kernel.util.StringAttribute" value="The SoF of the current LoSO">
+ </property>
+ <property name="sop (port)" class="ptolemy.kernel.util.StringAttribute" value="The SoP of the current LoSO">
+ </property>
+ <property name="entityId (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[125.0, 990.0]">
+ </property>
+ <port name="LoSOs" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ </port>
+ <port name="sop" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="FitsRouter" class="org.eso.FitsRouter">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:workflow:7:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.FitsRouter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ </property>
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.data.expr.StringParameter" value="<p>The FitsRouter routes files base on their category: by default, all the files are routed to the rejected directory, but the user can add additional port and configure the actor to route particular files there.</p>
<p>Basic Mode: create an output port named as a category (e.g.: FLAT), all files belonging to that category will be routed to that port.</p>
<p>Adv [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="ESO">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="1.0">
+ </property>
+ <property name="class (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="semanticType41 (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="sof (port)" class="ptolemy.kernel.util.StringAttribute" value="The input SoF">
+ </property>
+ <property name="rejected (port)" class="ptolemy.kernel.util.StringAttribute" value="The rejected SoF">
+ </property>
+ <property name="entityId (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[280.0, 990.0]">
+ </property>
+ <property name="DISTORTION_config" class="ptolemy.data.expr.StringParameter" value="DISTORTION_X,DISTORTION_Y">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="sof" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="rejected" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="DISTORTION" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="DARK" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="FLAT" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="JITTER_OBS" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="ProductRenamer" class="ptolemy.actor.lib.python.PythonScript">
+ <property name="script" class="ptolemy.kernel.util.StringAttribute" value="import os
import shutil
from ptolemy.data import StringToken, IntToken
from ptolemy.data.expr import Parameter
from org.eso.util import XMLTools
from nom.tam.fits import Fits
from java.beans import XMLEncoder
import java.io.BufferedOutputStream
from java.io import BufferedOutputStream
from java.io import ByteArrayOutputStream
from ptolemy.kernel.util import Il [...]
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Renames recipe products based on FITS keywords</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>reflex at eso.org</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure> This actor moves (or copies or links) its input sof to a final product directory based on some FITS keywords.
+ Usually, it should be connected to the output of the recipes that produce final products. If the recipe produces more products that are not relevant to rename, an output filter can be put in the recipe.</configure></property>
+<property name="port:in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="port:renamed_files" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The final list of files produced</configure></property>
+<property name="port:input_files" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The files to be copied/moved or linked</configure></property>
+<property name="prop:TimeStamp" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If it is not empty, a subdirectory will be created with this string. It will usually be WKF_TIME_STAMP, which should be created by the TimeStamp actor</configure></property>
+<property name="prop:script" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:FinalProductDirectory" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR</configure></property>
+<property name="prop:Rename_keywords" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The list of keywords used to create the new name</configure></property>
+<property name="prop:CopyMode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>There are several options: "copy", "move" or "link".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:workflow:19:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.python.PythonScript">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ </property>
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="script">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1570.0, 1015.0]">
+ </property>
+ <property name="Rename_keywords" class="ptolemy.data.expr.StringParameter" value="HIERARCH.ESO.OBS.NAME,HIERARCH.ESO.PRO.CATG">
+ </property>
+ <property name="FinalProductDirectory" class="ptolemy.data.expr.StringParameter" value="$END_PRODUCTS_DIR">
+ </property>
+ <property name="TimeStamp" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="CopyMode" class="ptolemy.data.expr.StringParameter" value="copy">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.data.expr.StringParameter" value=" This actor moves (or copies or links) its input sof to a final product directory based on some FITS keywords.
Usually, it should be connected to the output of the recipes that produce final products. If the recipe produces more products that are not relevant to rename, an output filter can be put in the recipe.">
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="reflex at eso.org">
+ </property>
+ <property name="Rename_keywords (parameter)" class="ptolemy.data.expr.StringParameter" value="The list of keywords used to create the new name">
+ </property>
+ <property name="FinalProductDirectory (parameter)" class="ptolemy.data.expr.StringParameter" value="The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR">
+ </property>
+ <property name="TimeStamp (parameter)" class="ptolemy.data.expr.StringParameter" value="If it is not empty, a subdirectory will be created with this string. It will usually be WKF_TIME_STAMP, which should be created by the TimeStamp actor">
+ </property>
+ <property name="CopyMode (parameter)" class="ptolemy.data.expr.StringParameter" value="There are several options: "copy", "move" or "link".">
+ </property>
+ <property name="script (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="in (port)" class="ptolemy.kernel.util.StringAttribute">
+ </property>
+ <property name="renamed_files (port)" class="ptolemy.kernel.util.StringAttribute" value="The final list of files produced">
+ </property>
+ <property name="input_files (port)" class="ptolemy.kernel.util.StringAttribute" value="The files to be copied/moved or linked">
+ </property>
+ </property>
+ <property name="OutputExistsMode" class="ptolemy.data.expr.StringParameter" value="append_version">
+ </property>
+ <port name="input_files" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
+ <port name="renamed_files" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ </port>
+ </entity>
+ <entity name="hawki_step_stitch_1" class="org.eso.RecipeExecuter">
+<display name="stitch_1"/> <property name="_location" class="ptolemy.kernel.util.Location" value="[1485.0, 825.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="Initialize" class="ptolemy.actor.TypedCompositeActor">
+<display name="Initialise"/> <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.0.2">
+ </property>
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:449:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Actor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
+ </property>
+ <property name="semanticType22" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Workflow">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</p>
+
+<p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p></configure></property>
+</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[120.0, 560.0]">
+ </property>
+ <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This subworkflow is in charge of two things:
-Deleting the workflow directories if requested.
-Providing the value of the raw data directory">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{365.0, 535.0}">
+ </property>
+ </property>
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={-257, 62, 1932, 1138}, maximized=false}">
+ </property>
+ <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1657, 1009]">
+ </property>
+ <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="0.6681514476615">
+ </property>
+ <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{740.9883333333332, 743.9433333333333}">
+ </property>
+ <port name="raw_data_dir" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1345.0, 370.0}">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
+ <entity name="String Constant" class="ptolemy.actor.lib.StringConst">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="value" class="ptolemy.data.expr.Parameter" value="if [ "x$EraseDirs" = "xtrue" ]; then echo "Deleting files"; rm -rf $BOOKKEEPING_DIR/*; rm -rf $LOGS_DIR/*; rm -rf $TMP_PRODUCTS_DIR/* ; else echo "Will not delete files"; fi">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
+
+<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p>
+
+<p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p>
+
+<p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p>
+
+</configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{-320.0, 380.0}">
+ </property>
+ </entity>
+ <entity name="Variable Setter" class="ptolemy.actor.lib.SetVariable">
+ <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="END_PRODUCT_SUBDIR">
+ </property>
+ <property name="delayed" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee, Steve Neuendorffer, Jerome Blanc</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
+Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
+If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes to the value deterministically (independent of the schedule of execution of the actors).
+If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables.
+Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor.
+The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value.
+The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:10:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.SetVariable">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:886:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Variable">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{870.0, 350.0}">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="output" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ </port>
+ </entity>
+ <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$RAWDATA_DIR">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
+
+<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p>
+
+<p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p>
+
+<p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p>
+
+</configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1145.0, 370.0}">
+ </property>
+ </entity>
+ <entity name="String Accumulator" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/Science_DataSet_"">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
+The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:292:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{705.0, 350.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Wibke Sudholt">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="Substring separator (parameter)" class="ptolemy.data.expr.StringParameter" value="The characters used to separate the elements in the output string. By default, the value is "".">
+ </property>
+ <property name="parts (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that accepts substrings.">
+ </property>
+ <property name="whole (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the full string.">
+ </property>
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </entity>
+ <entity name="Time Stamp" class="org.sdm.spa.Timestamp">
+ <property name="format" class="ptolemy.data.expr.StringParameter" value="yyyy-MM-dd'T'HH:mm:ss">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Ilkay Altintas</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The TimeStamp actor outputs the current date and time.</p>
+
+<p>Dates and times can be formatted in a variety of ways. Select a format from the drop-down menu beside the format parameter, or enter a pattern directly into the format field. For more information about date format patterns, see http://java.sun.com/docs/books/tutorial/i18n/format/datepattern.html.</p></configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the current time stamp as a string.</configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time.</configure></property>
+<property name="prop:format" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The date format. Select a format string from the drop-down menu or type in a custom format string directly into the field. For more information about date formatting patterns, see http://java.sun.com/docs/books/tutorial/i18n/format/datepattern.html</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:370:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.sdm.spa.Timestamp">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1136:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#ClockActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{405.0, 280.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Ilkay Altintas">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="format (parameter)" class="ptolemy.data.expr.StringParameter" value="The date format. Select a format string from the drop-down menu or type in a custom format string directly into the field. For more information about date formatting patterns, see http://java.sun.com/docs/books/tutorial/i18n/format/datepattern.html">
+ </property>
+ <property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the current time stamp as a string.">
+ </property>
+ <property name="trigger (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time.">
+ </property>
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </entity>
+ <entity name="Variable Setter2" class="ptolemy.actor.lib.SetVariable">
+ <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="GLOBAL_TIMESTAMP">
+ </property>
+ <property name="delayed" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee, Steve Neuendorffer, Jerome Blanc</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
+Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
+If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes to the value deterministically (independent of the schedule of execution of the actors).
+If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables.
+Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor.
+The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value.
+The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:10:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.SetVariable">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:886:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Variable">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{530.0, 280.0}">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="output" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_expertMode" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ </port>
+ </entity>
+ <entity name="DirectoryEraser" class="ptolemy.actor.lib.Exec">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="command" class="ptolemy.actor.parameters.PortParameter" value="sh">
+ </property>
+ <property name="directory" class="ptolemy.data.expr.FileParameter" value="$CWD">
+ </property>
+ <property name="environment" class="ptolemy.data.expr.Parameter" value="{{name = "", value = ""}}">
+ </property>
+ <property name="prependPlatformDependentShellCommand" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="throwExceptionOnNonZeroReturn" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="waitForProcess" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Xiaojun Liu, Edward A. Lee, Steve Neuendorffer</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
+<p>The External Execution actor executes a system command from a workflow. The actor accepts a command, a directory and environment in which to execute the command, and a command input string. Once the command has finished executing, the actor will output the execution results along with any errors. If no results are generated, the actor will output an empty string.</p>
+
+<p>The External Execution actor depends on system-specific executables and is operating-system specific.</p>
+
+<p>To mimic the effect of executing a command in a shell interpreter, set the command parameter to "cmd" (Windows) or "sh" (Windows with Cygwin or Linux), and then provide commands, as a string, via the input port. Note that each passed command must be terminated with a newline. For example, to open a workflow in vergil and run it, set command to "sh" and use a StringConstant actor to pass the input port the string:
+ "vergil -run model.xml\n exit\n"</p>
+</configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts data generated by the executed command, output as a string after the command has finished executing. If the command generates no data on standard out, then the empty string (a string of length zero) is generated. </configure></property>
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that accepts strings to pass to the standard input of the subprocess. Note that a newline is not appended to the string. If you require a newline, add one using the AddSubtract actor. This port is an input port of type String.</configure></property>
+<property name="port:error" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts any errors generated by the command execution. Errors are output as a string after the command has finished executing. If the execution generates no errors, an empty string is output. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If connected, a token must be available on this port before actor will execute.</configure></property>
+<property name="port:exitCode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the command's exit code. A non-zero value signifies an error.</configure></property>
+<property name="prop:environment" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An array of records that name an environment variable and a value:
+
+ {{name = "NAME1", value = "value1"}...}
+
+Where NAME1 is the name of the environment variable, and value1 is the value.
+For example, {{name = "PTII", value = "c:/ptII"}} would set the value of the PTII to c:/ptII.
+If the parameter is set to {{name="", value = ""}}, then the environment from the parent process is used. If environmental variables are set with the parameter, the parent values may not be passed to the process. To view the current environment, use the "env" command.
+</configure></property>
+<property name="prop:directory" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The directory in which to execute the command. The default value of this parameter $CWD, which represents the user's current working or home directory. </configure></property>
+<property name="prop:throwExceptionOnNonZeroReturn" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If true, then throw an exception if the subprocess returns non-zero.</configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If a positive integer, then it is the maximum number of times to execute the actor.</configure></property>
+<property name="prop:prependPlatformDependentShellCommand" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
+If true, then prepend the platform dependent shell command to the
+parsed value of the command parameter. By setting this argument
+to true, it is possible to invoke commands in a platform neutral
+method.
+<p>Under Windows NT or XP, the arguments "cmd.exe" and "/C" are
+prepended. Under Windows 95, the arguments "command.com" and "/C"
+are prepended. Under all other platforms, the arguments "/bin/sh"
+and "-c" are prepended. </p>
+<p>The default value of this parameter is a boolean of value false,
+which allows the user to arbitrarily invoke /bin/sh scripts on all
+platforms. </p>
+<p><b>NOTE:</b> This must be true if file redirection is used in <i>command</i>.</p>
+<p><b>NOTE:</b> Under Cygwin, if true, the path environment of the subprocess is not
+identical to the path of the calling process. In this case the full path to the program
+must be specified.</p>
+</configure></property>
+<property name="prop:waitForProcess" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If true, then actor will wait until subprocess completes.</configure></property>
+<property name="prop:command" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The command to be executed (e.g., echo "Hello, world."). The command can be specified via either the command port or parameter.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:102:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.Exec">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:976:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#ExternalExecutionEnvironmentActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#UnixCommand">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{95.0, 350.0}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Xiaojun Liu, Edward A. Lee, Steve Neuendorffer">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="firingCountLimit (parameter)" class="ptolemy.data.expr.StringParameter" value="If a positive integer, then it is the maximum number of times to execute the actor.">
+ </property>
+ <property name="directory (parameter)" class="ptolemy.data.expr.StringParameter" value="The directory in which to execute the command. The default value of this parameter $CWD, which represents the user's current working or home directory. ">
+ </property>
+ <property name="environment (parameter)" class="ptolemy.data.expr.StringParameter" value="An array of records that name an environment variable and a value:
{{name = "NAME1", value = "value1"}...}
Where NAME1 is the name of the environment variable, and value1 is the value.
For example, {{name = "PTII", value = "c:/ptII"}} would set the value of the PTII to c:/ptII.
If the parameter is set to {{name= [...]
+ </property>
+ <property name="prependPlatformDependentShellCommand (parameter)" class="ptolemy.data.expr.StringParameter" value="
If true, then prepend the platform dependent shell command to the
parsed value of the command parameter. By setting this argument
to true, it is possible to invoke commands in a platform neutral
method.
<p>Under Windows NT or XP, the arguments "cmd.exe" and "/C" are
prepended. Under Windows 95, the argument [...]
+ </property>
+ <property name="throwExceptionOnNonZeroReturn (parameter)" class="ptolemy.data.expr.StringParameter" value="If true, then throw an exception if the subprocess returns non-zero.">
+ </property>
+ <property name="waitForProcess (parameter)" class="ptolemy.data.expr.StringParameter" value="If true, then actor will wait until subprocess completes.">
+ </property>
+ <property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts data generated by the executed command, output as a string after the command has finished executing. If the command generates no data on standard out, then the empty string (a string of length zero) is generated. ">
+ </property>
+ <property name="trigger (port)" class="ptolemy.kernel.util.StringAttribute" value="If connected, a token must be available on this port before actor will execute.">
+ </property>
+ <property name="error (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts any errors generated by the command execution. Errors are output as a string after the command has finished executing. If the execution generates no errors, an empty string is output. ">
+ </property>
+ <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port that accepts strings to pass to the standard input of the subprocess. Note that a newline is not appended to the string. If you require a newline, add one using the AddSubtract actor. This port is an input port of type String.">
+ </property>
+ <property name="exitCode (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the command's exit code. A non-zero value signifies an error.">
+ </property>
+ <property name="command (parameter)" class="ptolemy.data.expr.StringParameter" value="The command to be executed (e.g., echo "Hello, world."). The command can be specified via either the command port or parameter.">
+ </property>
+ </property>
+ <port name="output" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="command" class="ptolemy.actor.parameters.ParameterPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="error" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="input" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="exitCode" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="String Constant3" class="ptolemy.actor.lib.StringConst">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="value" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
+
+<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p>
+
+<p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p>
+
+<p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p>
+
+</configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{510.0, 445.0}">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </entity>
+ <relation name="relation" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation2" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation4" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation5" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation6" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <vertex name="vertex1" value="[345.0, 355.0]">
+ </vertex>
+ </relation>
+ <relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation8" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <link port="raw_data_dir" relation="relation8"/>
+ <link port="String Constant.output" relation="relation3"/>
+ <link port="Variable Setter.input" relation="relation4"/>
+ <link port="Variable Setter.output" relation="relation"/>
+ <link port="String Constant2.output" relation="relation8"/>
+ <link port="String Constant2.trigger" relation="relation"/>
+ <link port="String Accumulator.parts" relation="relation5"/>
+ <link port="String Accumulator.parts" relation="relation7"/>
+ <link port="String Accumulator.whole" relation="relation4"/>
+ <link port="Time Stamp.output" relation="relation2"/>
+ <link port="Time Stamp.trigger" relation="relation6"/>
+ <link port="Variable Setter2.input" relation="relation2"/>
+ <link port="Variable Setter2.output" relation="relation5"/>
+ <link port="DirectoryEraser.output" relation="relation6"/>
+ <link port="DirectoryEraser.input" relation="relation3"/>
+ <link port="String Constant3.output" relation="relation7"/>
+ <link port="String Constant3.trigger" relation="relation6"/>
+ </entity>
+ <relation name="relation6" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation12" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation15" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation17" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <vertex name="vertex1" value="[725.0, 660.0]">
+ </vertex>
+ </relation>
+ <relation name="relation5" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation4" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation26" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation25" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation20" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <vertex name="vertex1" value="[720.0, 1055.0]">
+ </vertex>
+ </relation>
+ <relation name="relation28" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <vertex name="vertex1" value="[585.0, 1015.0]">
+ </vertex>
+ </relation>
+ <relation name="relation11" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation19" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation21" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation9" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation16" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation13" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation23" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation2" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation8" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation18" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation29" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <link port="hawki_step_basic_calib_1.sof in" relation="relation11"/>
+ <link port="hawki_step_basic_calib_1.sof in" relation="relation19"/>
+ <link port="hawki_step_basic_calib_1.sof in" relation="relation28"/>
+ <link port="hawki_step_basic_calib_1.sof out" relation="relation7"/>
+ <link port="hawki_step_compute_bkg_1.sof in" relation="relation7"/>
+ <link port="hawki_step_compute_bkg_1.sof out" relation="relation5"/>
+ <link port="hawki_cal_dark_1.sof in" relation="relation23"/>
+ <link port="hawki_cal_dark_1.sof out" relation="relation11"/>
+ <link port="hawki_cal_dark_1.sof out" relation="relation21"/>
+ <link port="hawki_cal_flat_1.sof in" relation="relation21"/>
+ <link port="hawki_cal_flat_1.sof in" relation="relation2"/>
+ <link port="hawki_cal_flat_1.sof out" relation="relation19"/>
+ <link port="hawki_step_subtract_bkg_1.sof in" relation="relation5"/>
+ <link port="hawki_step_subtract_bkg_1.sof in" relation="relation7"/>
+ <link port="hawki_step_subtract_bkg_1.sof out" relation="relation6"/>
+ <link port="hawki_step_combine_1.sof in" relation="relation6"/>
+ <link port="hawki_step_combine_1.sof out" relation="relation12"/>
+ <link port="hawki_step_detect_obj_1.sof in" relation="relation12"/>
+ <link port="hawki_step_detect_obj_1.sof out" relation="relation4"/>
+ <link port="hawki_step_detect_obj_1.sof out" relation="relation16"/>
+ <link port="hawki_step_compute_bkg_2.sof in" relation="relation7"/>
+ <link port="hawki_step_compute_bkg_2.sof in" relation="relation4"/>
+ <link port="hawki_step_compute_bkg_2.sof out" relation="relation15"/>
+ <link port="hawki_step_subtract_bkg_2.sof in" relation="relation15"/>
+ <link port="hawki_step_subtract_bkg_2.sof in" relation="relation7"/>
+ <link port="hawki_step_subtract_bkg_2.sof out" relation="relation17"/>
+ <link port="hawki_step_combine_2.sof in" relation="relation25"/>
+ <link port="hawki_step_combine_2.sof in" relation="relation3"/>
+ <link port="hawki_step_combine_2.sof out" relation="relation8"/>
+ <link port="hawki_step_combine_2.sof out" relation="relation18"/>
+ <link port="hawki_step_combine_2.sof out" relation="relation29"/>
+ <link port="hawki_step_apply_dist_1.sof in" relation="relation17"/>
+ <link port="hawki_step_apply_dist_1.sof in" relation="relation20"/>
+ <link port="hawki_step_apply_dist_1.sof out" relation="relation26"/>
+ <link port="hawki_step_apply_dist_1.sof out" relation="relation25"/>
+ <link port="hawki_step_refine_offsets_1.sof in" relation="relation26"/>
+ <link port="hawki_step_refine_offsets_1.sof in" relation="relation16"/>
+ <link port="hawki_step_refine_offsets_1.sof out" relation="relation3"/>
+ <link port="hawki_step_detect_obj_2.sof in" relation="relation18"/>
+ <link port="DataOrganizer.data dir" relation="relation"/>
+ <link port="DataOrganizer.LoSOs" relation="relation9"/>
+ <link port="DataSetChooser.LoSOs" relation="relation9"/>
+ <link port="DataSetChooser.sof" relation="relation13"/>
+ <link port="FitsRouter.sof" relation="relation13"/>
+ <link port="FitsRouter.DISTORTION" relation="relation20"/>
+ <link port="FitsRouter.DARK" relation="relation23"/>
+ <link port="FitsRouter.FLAT" relation="relation2"/>
+ <link port="FitsRouter.JITTER_OBS" relation="relation28"/>
+ <link port="ProductRenamer.input_files" relation="relation29"/>
+ <link port="hawki_step_stitch_1.sof in" relation="relation8"/>
+ <link port="Initialize.raw_data_dir" relation="relation"/>
+</entity>
diff --git a/reflex/Makefile.am b/reflex/Makefile.am
new file mode 100644
index 0000000..9609143
--- /dev/null
+++ b/reflex/Makefile.am
@@ -0,0 +1,33 @@
+
+AUTOMAKE_OPTIONS = foreign
+
+#Put here all the workflows. They must end with extension .in. They should
+#be like a normal workflow but with the string "oca_path_to_substitute"
+#as the path of the OCA rules (grep for OCA in the xml file)
+WORKFLOWS = Hawki_Calib_Science.xml
+#Put here the OCA rules used by the workflow
+OCAWKF = hawki_wkf.oca
+
+
+#This installs the workflow and the OCA rules in wkfdir
+wkfextra_DATA = $(WORKFLOWS) $(OCAWKF)
+
+
+#Pack in the distribution the original workflow
+EXTRA_DIST = $(WORKFLOWS).in $(OCAWKF)
+
+#This also installs the workflow in the common reflex directory
+wkfcopy_DATA = $(WORKFLOWS)
+
+#This is the same, but with a link. Unfortunately it does not work when
+#using the make distcheck option
+#install-data-hook:
+# mkdir -p $(wkflinkdir) && \
+# cd $(wkfdir) && \
+# for wkf in $(WORKFLOWS) ; do \
+# $(LN_S) -f $(wkfdir)/$$wkf $(wkflinkdir)/$$wkf ; done
+#
+#uninstall-hook:
+# cd $(wkflinkdir) && \
+# $(RM) -f $(WORKFLOWS)
+
diff --git a/reflex/Makefile.in b/reflex/Makefile.in
new file mode 100644
index 0000000..d06c3e0
--- /dev/null
+++ b/reflex/Makefile.in
@@ -0,0 +1,507 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = reflex
+DIST_COMMON = $(srcdir)/Hawki_Calib_Science.xml.in \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = Hawki_Calib_Science.xml
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(wkfcopydir)" "$(DESTDIR)$(wkfextradir)"
+DATA = $(wkfcopy_DATA) $(wkfextra_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = foreign
+
+#Put here all the workflows. They must end with extension .in. They should
+#be like a normal workflow but with the string "oca_path_to_substitute"
+#as the path of the OCA rules (grep for OCA in the xml file)
+WORKFLOWS = Hawki_Calib_Science.xml
+#Put here the OCA rules used by the workflow
+OCAWKF = hawki_wkf.oca
+
+#This installs the workflow and the OCA rules in wkfdir
+wkfextra_DATA = $(WORKFLOWS) $(OCAWKF)
+
+#Pack in the distribution the original workflow
+EXTRA_DIST = $(WORKFLOWS).in $(OCAWKF)
+
+#This also installs the workflow in the common reflex directory
+wkfcopy_DATA = $(WORKFLOWS)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign reflex/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign reflex/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+Hawki_Calib_Science.xml: $(top_builddir)/config.status $(srcdir)/Hawki_Calib_Science.xml.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-wkfcopyDATA: $(wkfcopy_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(wkfcopydir)" || $(MKDIR_P) "$(DESTDIR)$(wkfcopydir)"
+ @list='$(wkfcopy_DATA)'; test -n "$(wkfcopydir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(wkfcopydir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(wkfcopydir)" || exit $$?; \
+ done
+
+uninstall-wkfcopyDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(wkfcopy_DATA)'; test -n "$(wkfcopydir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(wkfcopydir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(wkfcopydir)" && rm -f $$files
+install-wkfextraDATA: $(wkfextra_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(wkfextradir)" || $(MKDIR_P) "$(DESTDIR)$(wkfextradir)"
+ @list='$(wkfextra_DATA)'; test -n "$(wkfextradir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(wkfextradir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(wkfextradir)" || exit $$?; \
+ done
+
+uninstall-wkfextraDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(wkfextra_DATA)'; test -n "$(wkfextradir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(wkfextradir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(wkfextradir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(wkfcopydir)" "$(DESTDIR)$(wkfextradir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-wkfcopyDATA install-wkfextraDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-wkfcopyDATA uninstall-wkfextraDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ install-wkfcopyDATA install-wkfextraDATA installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-wkfcopyDATA uninstall-wkfextraDATA
+
+
+#This is the same, but with a link. Unfortunately it does not work when
+#using the make distcheck option
+#install-data-hook:
+# mkdir -p $(wkflinkdir) && \
+# cd $(wkfdir) && \
+# for wkf in $(WORKFLOWS) ; do \
+# $(LN_S) -f $(wkfdir)/$$wkf $(wkflinkdir)/$$wkf ; done
+#
+#uninstall-hook:
+# cd $(wkflinkdir) && \
+# $(RM) -f $(WORKFLOWS)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/reflex/hawki_wkf.oca b/reflex/hawki_wkf.oca
new file mode 100644
index 0000000..7582391
--- /dev/null
+++ b/reflex/hawki_wkf.oca
@@ -0,0 +1,282 @@
+
+
+//CLASSIFICATION
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "DARK"
+ and TPL.NEXP > 2 then
+{
+ RAW.TYPE = "DARK";
+ DO.CATG = "DARK";
+ PACK.DIR = "DARK";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "FLAT"
+ and TPL.ID != "HAWKI_img_tec_DetTest" and TPL.ID != "HAWKI_img_tec_DetLin"
+ and TPL.NEXP > 2 then
+{
+ RAW.TYPE = "FLAT";
+ DO.CATG = "FLAT";
+ PACK.DIR = "FLAT";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "STD"
+ and TPL.NEXP == 4
+ and (
+ INS.FILT1.NAME == "J" or
+ INS.FILT1.NAME == "H" or
+ INS.FILT1.NAME == "Ks" or
+ INS.FILT1.NAME == "Y"
+ ) and
+ INS.FILT2.NAME =="OPEN"
+ then
+{
+ RAW.TYPE = "STD";
+ DO.CATG = "ZPOINT";
+ PACK.DIR = "STD";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "TECHNICAL" and DPR.TECH == "IMAGE" and DPR.TYPE == "FLAT"
+ and TPL.NEXP > 1 then
+{
+ RAW.TYPE = "FILTCHK";
+ DO.CATG = "TEC_FLAT";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "ACQUISITION" then
+{
+ RAW.TYPE = "ACQUISITION";
+ DO.CATG = "ACQ_IMAGE";
+ PACK.DIR = "NONE";
+ CATG = "SCIENCE";
+}
+
+if DPR.CATG == "SCIENCE" and DPR.TECH == "IMAGE" and DPR.TYPE == "OBJECT" then
+{
+ RAW.TYPE = "SCIENCE_IMG";
+ DO.CATG = "JITTER_OBS";
+ PACK.DIR = "NONE";
+ CATG = "SCIENCE";
+}
+
+if DPR.CATG == "SCIENCE" and DPR.TECH == "IMAGE" and DPR.TYPE == "SKY" then
+{
+ RAW.TYPE = "SCIENCE_IMG";
+ DO.CATG = "JITTER_SKY";
+ PACK.DIR = "NONE";
+ CATG = "SCIENCE";
+}
+
+if DPR.CATG == "CALIB" and DPR.TYPE == "LINEARITY,DARK,DETCHAR" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_DARK";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TYPE == "LINEARITY,FLAT,DETCHAR" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_LAMP";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "BIAS,DETCHECK" and TPL.ID == "HAWKI_img_tec_DetLin" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_DARK";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+if DPR.CATG == "CALIB" and DPR.TECH == "IMAGE" and DPR.TYPE == "FLAT" and TPL.ID == "HAWKI_img_tec_DetLin" then
+{
+ RAW.TYPE = "DETLIN";
+ DO.CATG = "DETLIN_LAMP";
+ PACK.DIR = "NONE";
+ CATG = "CALIB";
+}
+if DPR.CATG == "TECHNICAL" and DPR.TECH == "IMAGE" and DPR.TYPE == "STD" then
+{
+ RAW.TYPE = "TEC_STD";
+ DO.CATG = "TEC_STD";
+ PACK.DIR = "NONE";
+ CATG = "TECH";
+}
+if PRO.CATG == "DISTORTION_X" then
+{
+ DO.CATG = "DISTORTION_X";
+ DO.CLASS = "DISTORTION_X";
+}
+if PRO.CATG == "DISTORTION_Y" then
+{
+ DO.CATG = "DISTORTION_Y";
+ DO.CLASS = "DISTORTION_Y";
+}
+if CATNAME == "2mass" then
+{
+ DO.CATG = "CAT_2MASS";
+ DO.CLASS = "CAT_2MASS";
+}
+
+
+
+//ORGANIZATION
+
+select execute(ACTION_DARK) from inputFiles where RAW.TYPE=="DARK"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_FLAT) from inputFiles where RAW.TYPE=="FLAT"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,INS.FILT1.NAME,INS.FILT2.NAME,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_STD) from inputFiles where RAW.TYPE=="STD"
+ group by DET.NCORRS.NAME,DET.DIT,DET.NDIT,INS.FILT1.NAME,INS.FILT2.NAME,OBS.TARG.NAME,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_FILTCHK) from inputFiles where RAW.TYPE=="FILTCHK"
+ group by DET.NCORRS.NAME,DET.DIT,INS.FILT1.NAME,INS.FILT2.NAME,TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_DETLIN) from inputFiles where RAW.TYPE=="DETLIN"
+ group by TPL.START as (TPL_A,tpl);
+
+select execute(ACTION_SCIENCE_IMG) from inputFiles where RAW.TYPE=="SCIENCE_IMG"
+ group by DET.NCORRS.NAME,DET.DIT,INS.FILT1.NAME,INS.FILT2.NAME,TPL.START as (TPL_A,tpl);
+
+
+
+
+action ACTION_DARK
+{
+ recipe hawki_cal_dark {
+ "--sigma=10.0";
+}
+ product DARK_IM { PRO.CATG="DARK_IM"; PRO.EXT="tpl_0001.fits";}
+ product BPM_HOT { PRO.CATG="BPM_HOT"; PRO.EXT="tpl_0002.fits";}
+}
+
+
+action ACTION_FLAT
+{
+ minRet = 0; maxRet = 1;
+ select file as DARK_IM from calibFiles where
+ PRO.CATG=="DARK_IM"
+ and inputFile.DET.DIT==DET.DIT
+ ;
+ minRet = 1; maxRet = 1;
+ select file as BPM_HOT from calibFiles where
+ PRO.CATG=="BPM_HOT"
+ // and inputFile.DET.DIT==DET.DIT
+ ;
+ recipe hawki_cal_flat{
+ "--normalise";
+ "--select_min_level=-1.0";
+ "--select_max_level=25000.0";
+ "--select_max_rms=4000.0";
+ "--select_auto=TRUE";
+ "--select_auto_max_bins=10";
+ "--select_min_nframes=3";
+ "--extra_stats=TRUE";
+ "--lowval_bpm=0.6" ;
+ "--highval_bpm=1.3" ;
+ }
+ product FLAT_IM { PRO.CATG="FLAT_IM"; PRO.EXT="tpl_0001.fits";}
+ product BPM_COLD { PRO.CATG="BPM_COLD"; PRO.EXT="tpl_0002.fits";}
+ product BPM_HOTCOLD { PRO.CATG="BPM"; PRO.EXT="tpl_0003.fits";}
+}
+
+action ACTION_DETLIN
+{
+ recipe hawki_cal_lingain {
+ "--filter=25000" ;
+ " --kappa=5" ;
+ " --exts=-1" ;
+ "--method=PTC" ;
+ "--rescale=TRUE" ;
+ }
+ product LINGAIN_BPM { PRO.CATG="LINGAIN_BPM"; PRO.EXT="tpl_0000.fits";}
+ product LINGAIN_LIN { PRO.CATG="LINGAIN_LIN"; PRO.EXT="tpl_0001.fits";}
+ product LINGAIN_GAIN { PRO.CATG="LINGAIN_GAIN"; PRO.EXT="tpl_0002.fits";}
+ product LINGAIN_COEFFS { PRO.CATG="LINGAIN_COEFFS"; PRO.EXT="tpl_0003.fits";}
+}
+
+action ACTION_STD
+{
+ minRet = 1; maxRet = 1;
+ select file as STDSTARS_CATS from calibFiles where
+ PRO.CATG=="STDSTARS_CATS"
+ ;
+ minRet = 1; maxRet = 1;
+ select file as FLAT_IM from calibFiles where
+ PRO.CATG=="FLAT_IM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME
+ ;
+ minRet = 1; maxRet = 1;
+ select file as BPM_HOTCOLD from calibFiles where
+ PRO.CATG=="BPM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME
+ ;
+ minRet = 0; maxRet = 1;
+ select file as DISTORTION_MASSOC from calibFiles where
+ PRO.CATG=="DISTORTION"
+ ;
+ minRet = 0; maxRet = 1;
+ select file as DARK_IM_MASSOC from calibFiles where
+ PRO.CATG=="DARK_IM"
+ and inputFile.DET.DIT==DET.DIT
+ ;
+ select file as BPM_HOT_MASSOC from calibFiles where
+ PRO.CATG=="BPM_HOT"
+ and inputFile.DET.DIT==DET.DIT
+ ;
+ minRet = 1; maxRet = 1;
+ select file as BPM_COLD_MASSOC from calibFiles where
+ PRO.CATG=="BPM_COLD"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME
+ ;
+ recipe hawki_cal_zpoint;
+ product ZPOINT_IMA { PRO.CATG="ZPOINT_IMA"; PRO.EXT="tpl_0001.fits";}
+ product ZPOINT_RES { PRO.CATG="ZPOINT_RES"; PRO.EXT="tpl_0002.fits";}
+}
+
+action ACTION_SCIENCE_IMG
+{
+ minRet = 0; maxRet = 1;
+ select file as DISTORTION_X from calibFiles where
+ PRO.CATG=="DISTORTION_X";
+ select file as DISTORTION_Y from calibFiles where
+ PRO.CATG=="DISTORTION_Y";
+ minRet = 1; maxRet = 1;
+ select file as FLAT_IM from calibFiles where
+ PRO.CATG=="FLAT_IM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME;
+ minRet = 1; maxRet = 1;
+ select file as BPM_HOTCOLD from calibFiles where
+ PRO.CATG=="BPM"
+ and inputFile.DET.NCORRS.NAME==DET.NCORRS.NAME
+ and inputFile.INS.FILT1.NAME==INS.FILT1.NAME and inputFile.INS.FILT2.NAME==INS.FILT2.NAME;
+ minRet = 0; maxRet = 1;
+ select file as DARK_IM from calibFiles where
+ PRO.CATG=="DARK_IM"
+ and inputFile.DET.DIT==DET.DIT;
+ minRet = 0; maxRet = 1;
+ select file as CAT_2MASS from inputFiles where
+ DO.CATG =="CAT_2MASS";
+
+ recipe hawki_sci_jitter
+ {
+ "--refine";
+ }
+}
+
+action ACTION_FILTCHK
+{
+ recipe hawki_tec_filtchk;
+}
diff --git a/regtests/Makefile.am b/regtests/Makefile.am
new file mode 100644
index 0000000..c19c6fa
--- /dev/null
+++ b/regtests/Makefile.am
@@ -0,0 +1,30 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the VISIR Pipeline
+## Copyright (C) 2002-2004 European Southern Observatory
+
+## This library 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
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+
+endif
+SUBDIRS = . tests
diff --git a/regtests/Makefile.in b/regtests/Makefile.in
new file mode 100644
index 0000000..b9b7960
--- /dev/null
+++ b/regtests/Makefile.in
@@ -0,0 +1,614 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = regtests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+DISTCLEANFILES = *~
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+SUBDIRS = . tests
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign regtests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign regtests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/regtests/tests/Makefile.am b/regtests/tests/Makefile.am
new file mode 100644
index 0000000..290494d
--- /dev/null
+++ b/regtests/tests/Makefile.am
@@ -0,0 +1,61 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the AMBER Pipeline
+## Copyright (C) 2002-2004 European Southern Observatory
+
+## This library 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
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+
+
+endif
+
+reg0:
+ esoreg.pl -force -id 0 ../../${PACKAGE}_reg/sof
+
+reg1:
+ esoreg.pl -force -id 1 ../../${PACKAGE}_reg/sof
+
+valgrind:
+ esoreg.pl -valgrind -preload ../../${PACKAGE}_reg/sof
+
+check:
+ mkdir -p .purifydir
+ @if test -d ../../${PACKAGE}_reg/sof/; then esorex --version ; fi
+ @if test -d ../../${PACKAGE}_reg/sof/; then mkdir -p ../../${PACKAGE}_reg/sof/.purifydir ; fi
+ @if test -d ../../${PACKAGE}_reg/sof/.purifydir; then touch ../../${PACKAGE}_reg/sof/.purifydir/_dummy ; fi
+# if test -d ../../${PACKAGE}_reg; then esoreg.pl -force -id 0 ../../${PACKAGE}_reg/sof; fi
+# link to the Reference data under ${SOF_DATA}/${PACKAGE}/ReferenceData/
+ if test -d ../../${PACKAGE}_reg; then for i in ${SOF_DATA}/${PACKAGE}/ReferenceData/*.0; do ln -f -s $$i ../../${PACKAGE}_reg/sof/ ; done ; fi
+ if test -d ../../${PACKAGE}_reg; then esoreg.pl -force -id 1 ../../${PACKAGE}_reg/sof; fi
+ @if test "$$?x" = "0x"; then echo PASS: regtests; fi
+ @if test "$$?x" != "0x"; then echo FAILED: regtests; fi
+ @if test -d ../../${PACKAGE}_reg/sof/.purifydir; then cp ../../${PACKAGE}_reg/sof/.purifydir/* .purifydir; fi
+
+if PURIFY
+include $(top_builddir)/Makefile.purify
+endif
+
+
+
+
+
diff --git a/regtests/tests/Makefile.in b/regtests/tests/Makefile.in
new file mode 100644
index 0000000..f589e8d
--- /dev/null
+++ b/regtests/tests/Makefile.in
@@ -0,0 +1,435 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = regtests/tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = @LIBHAWKI@
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.8 foreign
+DISTCLEANFILES = *~
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign regtests/tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign regtests/tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+reg0:
+ esoreg.pl -force -id 0 ../../${PACKAGE}_reg/sof
+
+reg1:
+ esoreg.pl -force -id 1 ../../${PACKAGE}_reg/sof
+
+valgrind:
+ esoreg.pl -valgrind -preload ../../${PACKAGE}_reg/sof
+
+check:
+ mkdir -p .purifydir
+ @if test -d ../../${PACKAGE}_reg/sof/; then esorex --version ; fi
+ @if test -d ../../${PACKAGE}_reg/sof/; then mkdir -p ../../${PACKAGE}_reg/sof/.purifydir ; fi
+ @if test -d ../../${PACKAGE}_reg/sof/.purifydir; then touch ../../${PACKAGE}_reg/sof/.purifydir/_dummy ; fi
+# if test -d ../../${PACKAGE}_reg; then esoreg.pl -force -id 0 ../../${PACKAGE}_reg/sof; fi
+# link to the Reference data under ${SOF_DATA}/${PACKAGE}/ReferenceData/
+ if test -d ../../${PACKAGE}_reg; then for i in ${SOF_DATA}/${PACKAGE}/ReferenceData/*.0; do ln -f -s $$i ../../${PACKAGE}_reg/sof/ ; done ; fi
+ if test -d ../../${PACKAGE}_reg; then esoreg.pl -force -id 1 ../../${PACKAGE}_reg/sof; fi
+ @if test "$$?x" = "0x"; then echo PASS: regtests; fi
+ @if test "$$?x" != "0x"; then echo FAILED: regtests; fi
+ @if test -d ../../${PACKAGE}_reg/sof/.purifydir; then cp ../../${PACKAGE}_reg/sof/.purifydir/* .purifydir; fi
+
+ at PURIFY_TRUE@include $(top_builddir)/Makefile.purify
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/setup b/setup
new file mode 100755
index 0000000..0c1c500
--- /dev/null
+++ b/setup
@@ -0,0 +1,77 @@
+#! /bin/sh
+# This file is part of the HAWKI Pipeline
+# Copyright (C) 2002,2003 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: cgarcia $
+# $Date: 2012/01/09 14:15:47 $
+# $Revision: 1.2 $
+# $Name: hawki-1_8_9 $
+
+
+# This script is the autoinstaller for the VLT instrument pipeline
+# packages used by the Instrument Pipeline Installation Procedure
+# (IPIP) to ease the pipeline installation for ESO System Engineering
+# staff.
+
+
+error () {
+ echo "Error: $cmd: $1"
+ exit 1
+}
+
+
+#
+# Main
+#
+
+cmd=`basename $0`
+usage="Usage: $cmd installation-path"
+
+setup_configure="./configure --prefix=$1"
+setup_make="make"
+
+# The destination directory for the installation is mandatory
+if test $# != 1; then
+ echo "$usage"
+ exit 1
+fi
+
+# Configure the package
+echo "Setting up pipeline package... "
+if eval $setup_configure; then
+ :
+else
+ error "Package setup failed! See logfile for details."
+fi
+
+# Compile the pipeline
+echo "Building pipeline package... "
+if eval $setup_make; then
+ :
+else
+ error "Package build failed! See logfile for details."
+fi
+
+# Install the pipeline
+echo "Installing pipeline package... "
+if eval $setup_make install install-html; then
+ :
+else
+ error "Package installation failed! See logfile for details."
+fi
+
+exit 0
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..e845b90
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,48 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the HAWKI Pipeline Library
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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
+
+AUTOMAKE_OPTIONS = 1.6 foreign
+
+DISTCLEANFILES = *~
+
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+
+LIBHAWKI = $(top_builddir)/hawki/libhawki.la
+
+INCLUDES = -I$(top_builddir)hawki/
+LDADD = $(LIBHAWKI)
+
+check_PROGRAMS =
+
+# Be sure to reexport important environment variables.
+TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
+ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
+
+TESTS =
+
+# We need to remove any files that the above tests created.
+clean-local:
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..b16a8d1
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,532 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+check_PROGRAMS =
+TESTS =
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
+ $(top_srcdir)/m4macros/eso.m4 $(top_srcdir)/m4macros/gsl.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/m4macros/openmp.m4 \
+ $(top_srcdir)/m4macros/purify.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPL_INCLUDES = @CPL_INCLUDES@
+CPL_LDFLAGS = @CPL_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CX_INCLUDES = @CX_INCLUDES@
+CX_LDFLAGS = @CX_LDFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+HAWKI_BINARY_AGE = @HAWKI_BINARY_AGE@
+HAWKI_BINARY_VERSION = @HAWKI_BINARY_VERSION@
+HAWKI_INCLUDES = @HAWKI_INCLUDES@
+HAWKI_INTERFACE_AGE = @HAWKI_INTERFACE_AGE@
+HAWKI_LDFLAGS = @HAWKI_LDFLAGS@
+HAWKI_MAJOR_VERSION = @HAWKI_MAJOR_VERSION@
+HAWKI_MICRO_VERSION = @HAWKI_MICRO_VERSION@
+HAWKI_MINOR_VERSION = @HAWKI_MINOR_VERSION@
+HAWKI_VERSION = @HAWKI_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LATEX = @LATEX@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCEXT = @LIBCEXT@
+LIBCPLCORE = @LIBCPLCORE@
+LIBCPLDFS = @LIBCPLDFS@
+LIBCPLDRS = @LIBCPLDRS@
+LIBCPLUI = @LIBCPLUI@
+LIBHAWKI = $(top_builddir)/hawki/libhawki.la
+LIBIRPLIB = @LIBIRPLIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PURIFY_CMD = @PURIFY_CMD@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_ldflags = @all_ldflags@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pipedocsdir = @pipedocsdir@
+plugindir = @plugindir@
+prefix = @prefix@
+privatelibdir = @privatelibdir@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wkfcopydir = @wkfcopydir@
+wkfextradir = @wkfextradir@
+AUTOMAKE_OPTIONS = 1.6 foreign
+DISTCLEANFILES = *~
+ at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
+INCLUDES = -I$(top_builddir)hawki/
+LDADD = $(LIBHAWKI)
+
+# Be sure to reexport important environment variables.
+TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
+ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes$$std"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# We need to remove any files that the above tests created.
+clean-local:
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cpl-plugin-hawki.git
More information about the debian-science-commits
mailing list